mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 02:20:17 +00:00
Clean up some more of the server/bridge.
- Turn off some debugging in the server. - Add a "bridge_export_key" CLI flag to the server to export the contents of the public certificate used for bridge connections. - Fix up the bridge rc.d script so it actually works. - Ensure that the bridge SSL key/cert is created when starting the server. - Add the bridge to the overall project build.
This commit is contained in:
@@ -22,7 +22,7 @@ int BlackList_AuthFailsToBlock = 5;
|
||||
int BlackList_AuthFailResetMinutes = 10;*/
|
||||
|
||||
//Create the default logfile
|
||||
QFile logfile;
|
||||
/*QFile logfile;
|
||||
void MessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg){
|
||||
QString txt;
|
||||
switch(type){
|
||||
@@ -46,7 +46,7 @@ void MessageOutput(QtMsgType type, const QMessageLogContext &context, const QStr
|
||||
QTextStream out(&logfile);
|
||||
out << txt;
|
||||
if(!txt.endsWith("\n")){ out << "\n"; }
|
||||
}
|
||||
} */
|
||||
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
@@ -71,7 +71,7 @@ int main( int argc, char ** argv )
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
//Setup the log file
|
||||
logfile.setFileName("/var/log/sysadm-bridge.log");
|
||||
/*logfile.setFileName("/var/log/sysadm-bridge.log");
|
||||
if(DEBUG){ qDebug() << "Log File:" << logfile.fileName(); }
|
||||
if(QFile::exists(logfile.fileName()+".old")){ QFile::remove(logfile.fileName()+".old"); }
|
||||
if(logfile.exists()){ QFile::rename(logfile.fileName(), logfile.fileName()+".old"); }
|
||||
@@ -82,8 +82,8 @@ int main( int argc, char ** argv )
|
||||
}
|
||||
logfile.open(QIODevice::WriteOnly | QIODevice::Append);
|
||||
qInstallMessageHandler(MessageOutput);
|
||||
|
||||
//Create the two servers and connect them
|
||||
*/
|
||||
//Create the server
|
||||
qDebug() << "Starting the PC-BSD sysadm bridge....";
|
||||
BridgeServer server;
|
||||
|
||||
@@ -99,7 +99,7 @@ int main( int argc, char ** argv )
|
||||
|
||||
//Cleanup any globals
|
||||
delete CONFIG;
|
||||
logfile.close();
|
||||
//logfile.close();
|
||||
|
||||
//Return
|
||||
return ret;
|
||||
|
||||
@@ -33,10 +33,10 @@ sysadm_bridge_stop()
|
||||
fi
|
||||
}
|
||||
|
||||
sysadm_start()
|
||||
sysadm_bridge_start()
|
||||
{
|
||||
export PATH="${PATH}:/usr/local/bin:/usr/local/sbin"
|
||||
sysadm_stop
|
||||
sysadm_bridge_stop
|
||||
echo "Starting sysadm bridge..."
|
||||
command="/usr/local/bin/sysadm-bridge-start"
|
||||
daemon -r -P /var/run/sysadm-bridge-daemon.pid -p /var/run/sysadm-bridge.pid $command $flags
|
||||
|
||||
@@ -175,7 +175,7 @@ void WebSocket::EvaluateREST(QString msg){
|
||||
}
|
||||
|
||||
void WebSocket::EvaluateRequest(const RestInputStruct &REQ){
|
||||
qDebug() << "Evaluate Request:" << REQ.namesp << REQ.name << REQ.args;
|
||||
//qDebug() << "Evaluate Request:" << REQ.namesp << REQ.name << REQ.args;
|
||||
RestOutputStruct out;
|
||||
out.in_struct = REQ;
|
||||
QHostAddress host;
|
||||
|
||||
@@ -80,7 +80,7 @@ inline QString openDB(QString repo){
|
||||
DB.setHostName("localhost");
|
||||
QString path = getRepoFile(repo);
|
||||
DB.setDatabaseName(path); //path to the database file
|
||||
qDebug() << "New DB:" << repo << DB.connectionName();
|
||||
//qDebug() << "New DB:" << repo << DB.connectionName();
|
||||
return DB.connectionName();
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,10 @@ int main( int argc, char ** argv )
|
||||
CONFIG->remove("bridge_connections/"+name);
|
||||
qDebug() << "Bridge Removed:" << name;
|
||||
i=i+1;
|
||||
}else if(opt=="export_key"){
|
||||
//Export the public SSL cert used for establishing a connection with a bridge
|
||||
QString crt = ReadFile("/usr/local/etc/sysadm/ws_bridge.crt");
|
||||
qDebug() << crt.toLocal8Bit();
|
||||
}else{
|
||||
qDebug() << "Unknown option:" << argv[i];
|
||||
return 1;
|
||||
|
||||
@@ -17,7 +17,7 @@ ssl_keygen()
|
||||
-keyout /usr/local/etc/sysadm/wsserver.key \
|
||||
-out /usr/local/etc/sysadm/wsserver.crt -days 1024 \
|
||||
-subj "/C=US/ST=MY/L=NULL/O=SysAdm/OU=SysAdm/CN=SysAdm/emailAddress=none@example.org" 2>/dev/null
|
||||
if [ -ne "/usr/local/etc/sysadm/ws_bridge.key" ]; then
|
||||
if [ ! -e "/usr/local/etc/sysadm/ws_bridge.key" ] ; then
|
||||
openssl req -x509 -nodes -newkey rsa:2048 \
|
||||
-keyout /usr/local/etc/sysadm/ws_bridge.key \
|
||||
-out /usr/local/etc/sysadm/ws_bridge.crt -days 102400 \
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
TEMPLATE = subdirs
|
||||
CONFIG += recursive
|
||||
|
||||
SUBDIRS+= server
|
||||
|
||||
#Make sure to list the library as a requirement for the others (for parallellized builds)
|
||||
#binary.depends = library
|
||||
#server.depends = library
|
||||
SUBDIRS+= server bridge
|
||||
|
||||
rcd.path = /usr/local/etc/rc.d/
|
||||
rcd.extra = cp rc.d/* $(INSTALL_ROOT)/usr/local/etc/rc.d/
|
||||
|
||||
Reference in New Issue
Block a user