@@ -1309,7 +1309,7 @@ public function configure_bind() {
13091309 }
13101310
13111311
1312- public function configure_xmpp () {
1312+ public function configure_xmpp ($ options = '' ) {
13131313 global $ conf ;
13141314
13151315 if ($ conf ['xmpp ' ]['installed ' ] == false ) return ;
@@ -1349,30 +1349,37 @@ public function configure_xmpp() {
13491349 $ content = str_replace ('{server_id} ' , $ conf ['server_id ' ], $ content );
13501350 wf ($ full_file_name , $ content );
13511351
1352- // Create SSL Certificate for localhost
1353- echo "writing new private key to 'localhost.key' \n----- \n" ;
1354- $ ssl_country = $ this ->free_query ('Country Name (2 letter code) ' , 'AU ' );
1355- $ ssl_locality = $ this ->free_query ('Locality Name (eg, city) ' , '' );
1356- $ ssl_organisation = $ this ->free_query ('Organization Name (eg, company) ' , 'Internet Widgits Pty Ltd ' );
1357- $ ssl_organisation_unit = $ this ->free_query ('Organizational Unit Name (eg, section) ' , '' );
1358- $ ssl_domain = $ this ->free_query ('Common Name (e.g. server FQDN or YOUR name) ' , $ conf ['hostname ' ]);
1359- $ ssl_email = $ this ->free_query ('Email Address ' , '' );
1360-
1361- $ tpl = new tpl ('metronome_conf_ssl.master ' );
1362- $ tpl ->setVar ('ssl_country ' ,$ ssl_country );
1363- $ tpl ->setVar ('ssl_locality ' ,$ ssl_locality );
1364- $ tpl ->setVar ('ssl_organisation ' ,$ ssl_organisation );
1365- $ tpl ->setVar ('ssl_organisation_unit ' ,$ ssl_organisation_unit );
1366- $ tpl ->setVar ('domain ' ,$ ssl_domain );
1367- $ tpl ->setVar ('ssl_email ' ,$ ssl_email );
1368- wf ('/etc/metronome/certs/localhost.cnf ' , $ tpl ->grab ());
1369- unset($ tpl );
1370- // Generate new key, csr and cert
1371- exec ("(cd /etc/metronome/certs && make localhost.key) " );
1372- exec ("(cd /etc/metronome/certs && make localhost.csr) " );
1373- exec ("(cd /etc/metronome/certs && make localhost.cert) " );
1374- exec ('chmod 0400 /etc/metronome/certs/localhost.key ' );
1375- exec ('chown metronome /etc/metronome/certs/localhost.key ' );
1352+ if (!stristr ($ options , 'dont-create-certs ' )){
1353+ // Create SSL Certificate for localhost
1354+ echo "writing new private key to 'localhost.key' \n----- \n" ;
1355+ $ ssl_country = $ this ->free_query ('Country Name (2 letter code) ' , 'AU ' );
1356+ $ ssl_locality = $ this ->free_query ('Locality Name (eg, city) ' , '' );
1357+ $ ssl_organisation = $ this ->free_query ('Organization Name (eg, company) ' , 'Internet Widgits Pty Ltd ' );
1358+ $ ssl_organisation_unit = $ this ->free_query ('Organizational Unit Name (eg, section) ' , '' );
1359+ $ ssl_domain = $ this ->free_query ('Common Name (e.g. server FQDN or YOUR name) ' , $ conf ['hostname ' ]);
1360+ $ ssl_email = $ this ->free_query ('Email Address ' , '' );
1361+
1362+ $ tpl = new tpl ('metronome_conf_ssl.master ' );
1363+ $ tpl ->setVar ('ssl_country ' ,$ ssl_country );
1364+ $ tpl ->setVar ('ssl_locality ' ,$ ssl_locality );
1365+ $ tpl ->setVar ('ssl_organisation ' ,$ ssl_organisation );
1366+ $ tpl ->setVar ('ssl_organisation_unit ' ,$ ssl_organisation_unit );
1367+ $ tpl ->setVar ('domain ' ,$ ssl_domain );
1368+ $ tpl ->setVar ('ssl_email ' ,$ ssl_email );
1369+ wf ('/etc/metronome/certs/localhost.cnf ' , $ tpl ->grab ());
1370+ unset($ tpl );
1371+ // Generate new key, csr and cert
1372+ exec ("(cd /etc/metronome/certs && make localhost.key) " );
1373+ exec ("(cd /etc/metronome/certs && make localhost.csr) " );
1374+ exec ("(cd /etc/metronome/certs && make localhost.cert) " );
1375+ exec ('chmod 0400 /etc/metronome/certs/localhost.key ' );
1376+ exec ('chown metronome /etc/metronome/certs/localhost.key ' );
1377+ }else {
1378+ echo "----- \n" ;
1379+ echo "Metronome XMPP SSL server certificate is not renewed. Run the following command manual as root to recreate it: \n" ;
1380+ echo "# (cd /etc/metronome/certs && make localhost.key && make localhost.csr && make localhost.cert && chmod 0400 localhost.key && chown metronome localhost.key) \n" ;
1381+ echo "----- \n" ;
1382+ }
13761383
13771384 // Copy init script
13781385 caselog ('cp -f apps/metronome-init /etc/init.d/metronome ' , __FILE__ , __LINE__ );
0 commit comments