From 20c0c0b47efb2dac8de9b06334e47de5b1bb8e7c Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 17 May 2016 10:31:02 -0400 Subject: [PATCH] Add another CLI option to sysadm-bridge: - "-list_ssl": This will output all the known public keys which may be authenticated with the server and any information about them. --- src/bridge/main.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/bridge/main.cpp b/src/bridge/main.cpp index 76f359a..07cfdd6 100644 --- a/src/bridge/main.cpp +++ b/src/bridge/main.cpp @@ -17,11 +17,6 @@ QSettings *CONFIG = new QSettings(SETTINGSFILE, QSettings::IniFormat); AuthorizationManager *AUTHSYSTEM = new AuthorizationManager(); -//Set the defail values for the global config variables -/*int BlackList_BlockMinutes = 60; -int BlackList_AuthFailsToBlock = 5; -int BlackList_AuthFailResetMinutes = 10;*/ - //Create the default logfile QFile logfile; void MessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg){ @@ -81,15 +76,26 @@ int main( int argc, char ** argv ) } } settingchange=true; + }else if( QString(argv[i])=="-import_ssl_pubkey" && i+1setValue("RegisteredCerts/cli-import/"+enc_key, "Date Registered: "+QDateTime::currentDateTime().toString(Qt::ISODate) ); qDebug() << "Registered Key:" << enc_key << "(base64)"; settingchange=true; + + }else if( QString(argv[i])=="-list_ssl" ){ + qDebug() << "Known SSL Keys (base64)"; + settingchange = true; + QStringList keys = QStringList(CONFIG->allKeys());//.filter("RegisteredCerts/"); + for(int i=0; ivalue(keys[i]).toString(); + } + }else{ + qDebug() << "Unknown Option:" << argv[i]; } } //end loop over argc - if(settingchange){ return 0; } + if(settingchange){ CONFIG->sync(); return 0; } QCoreApplication a(argc, argv);