@@ -1349,14 +1349,55 @@ 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 ' );
13521376
13531377 // Copy init script
13541378 caselog ('cp -f apps/metronome-init /etc/init.d/metronome ' , __FILE__ , __LINE__ );
13551379 caselog ('chmod u+x /etc/init.d/metronome ' , __FILE__ , __LINE__ );
13561380
13571381 exec ($ this ->getinitcommand ('xmpp ' , 'restart ' ));
13581382
1359-
1383+ /*
1384+ writing new private key to 'smtpd.key'
1385+ -----
1386+ You are about to be asked to enter information that will be incorporated
1387+ into your certificate request.
1388+ What you are about to enter is what is called a Distinguished Name or a DN.
1389+ There are quite a few fields but you can leave some blank
1390+ For some fields there will be a default value,
1391+ If you enter '.', the field will be left blank.
1392+ -----
1393+ Country Name (2 letter code) [AU]:
1394+ State or Province Name (full name) [Some-State]:
1395+ Locality Name (eg, city) []:
1396+ Organization Name (eg, company) [Internet Widgits Pty Ltd]:
1397+ Organizational Unit Name (eg, section) []:
1398+ Common Name (e.g. server FQDN or YOUR name) []:
1399+ Email Address []:
1400+ * */
13601401
13611402 /*// Dont just copy over the virtualhost template but add some custom settings
13621403 $tpl = new tpl('apache_apps.vhost.master');
0 commit comments