Skip to content

Commit fbe2d6b

Browse files
committed
Added XMPP to updater
1 parent 6886b5f commit fbe2d6b

File tree

2 files changed

+41
-25
lines changed

2 files changed

+41
-25
lines changed

install/lib/installer_base.lib.php

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -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__);

install/update.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,11 @@
392392
$inst->configure_apps_vhost();
393393
}
394394

395+
if($conf['services']['xmpp']) {
396+
//** Configure Metronome XMPP
397+
$inst->configure_xmpp('dont-create-certs');
398+
}
399+
395400

396401
//* Configure DBServer
397402
swriteln('Configuring Database');
@@ -494,6 +499,10 @@
494499
if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') system($inst->getinitcommand($conf['bind']['init_script'], 'restart').' &> /dev/null');
495500
}
496501

502+
if($conf['services']['xmpp']) {
503+
if($conf['xmpp']['installed'] == true && $conf['xmpp']['init_script'] != '') system($inst->getinitcommand($conf['xmpp']['init_script'], 'restart').' &> /dev/null');
504+
}
505+
497506
if($conf['services']['proxy']) {
498507
// if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['squid']['init_script'])) system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
499508
if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null');

0 commit comments

Comments
 (0)