Monitor SSL changes to keep up to date

This commit is contained in:
Retro_Guy 2023-03-18 22:07:34 +00:00
parent 87d441f7e8
commit 832316a13e
3 changed files with 18 additions and 5 deletions

View File

@ -12,12 +12,13 @@ echo '<br />';
echo '<b>novaBBS:</b><br /><a href="https://www.novabbs.com">www.novabbs.com</a><br />'; echo '<b>novaBBS:</b><br /><a href="https://www.novabbs.com">www.novabbs.com</a><br />';
echo '<br />'; echo '<br />';
echo 'Newsreader Access:<br />'; echo "Newsreader Access (most text newsgroups available, use 'list'):<br />";
echo 'v77lu6t26velvaddm4gibyzd5sogskuczp7vwoc4vxmukvvaucva.b32.i2p<br />'; echo 'v77lu6t26velvaddm4gibyzd5sogskuczp7vwoc4vxmukvvaucva.b32.i2p<br />';
echo 'zkcvkb5xprurx5dvpanhyivneuzah6k6xayxgxd4h2ekklxgoi2x5aad.onion:119<br />'; echo 'zkcvkb5xprurx5dvpanhyivneuzah6k6xayxgxd4h2ekklxgoi2x5aad.onion:119<br />';
echo 'news.novabbs.org:119 or 563<br />'; echo 'news.novabbs.org:119 or 563<br />';
echo '<br />'; echo '<br />';
echo 'Create NNTP Account: Use one of the <i>Rocksolid Light</i> links above to create account.<br />'; echo 'Create NNTP Account: Use one of the <i>Rocksolid Light</i> links above to create account.<br />';
echo 'Log into NNTP server with your username/password to post<br />';
echo 'NNTP Peering also available in i2p/tor/clearnet<br />'; echo 'NNTP Peering also available in i2p/tor/clearnet<br />';
echo '<br />'; echo '<br />';
echo 'Rocksolid is also available from any usenet news provider carrying the rocksolid.* hierarchy<br />'; echo 'Rocksolid is also available from any usenet news provider carrying the rocksolid.* hierarchy<br />';

View File

@ -1,12 +1,14 @@
<?php <?php
/* Set paths for fullchain.pem abnd privkey.pem */ /* Set paths for fullchain.pem and privkey.pem */
$letsencrypt['fullchain'] = file_get_contents("/etc/letsencrypt/live/<domain>/fullchain.pem"); $letsencrypt['path'] = "/etc/letsencrypt/live/<domain>/";
$letsencrypt['privkey'] = file_get_contents("/etc/letsencrypt/live/<domain>/privkey.pem");
$letsencrypt['fullchain'] = file_get_contents($letsencrypt['path']."fullchain.pem");
$letsencrypt['privkey'] = file_get_contents($letsencrypt['path']."/privkey.pem");
/* Please do not change anything below */ /* Please do not change anything below */
$letsencrypt['pem_private_key'] = openssl_pkey_get_private($letsencrypt['privkey']); $letsencrypt['pem_private_key'] = openssl_pkey_get_private($letsencrypt['privkey']);
$pem_public_key = openssl_pkey_get_details($letsencrypt['pem_private_key'])['key']; $pem_public_key = openssl_pkey_get_details($letsencrypt['pem_private_key'])['key'];
$letsencrypt['server.pem'] = $letsencrypt['fullchain']; $letsencrypt['server.pem'] = $letsencrypt['fullchain'];
$letsencrypt['pubkey.pem'] = $pem_public_key; $letsencrypt['pubkey.pem'] = $pem_public_key;

View File

@ -1218,6 +1218,13 @@ function create_node_ssl_cert($pemfile) {
$uinfo=posix_getpwnam($CONFIG['webserver_user']); $uinfo=posix_getpwnam($CONFIG['webserver_user']);
$pubkeyfile = $ssldir.'/pubkey.pem'; $pubkeyfile = $ssldir.'/pubkey.pem';
$pubkeytxtfile = $webtmp.'/pubkey.txt'; $pubkeytxtfile = $webtmp.'/pubkey.txt';
$ssltime = filectime($letsencrypt['path'])."fullchain.pem";
if(isset($letsencrypt['path'])) {
if($ssltime > filectime($pemfile)) {
touch($config_dir.'/ssl.reload');
}
}
if(!file_exists($config_dir.'/ssl.reload')) { if(!file_exists($config_dir.'/ssl.reload')) {
if((is_file($pemfile)) && (is_file($pubkeyfile)) && (is_file($pubkeytxtfile))) { if((is_file($pemfile)) && (is_file($pubkeyfile)) && (is_file($pubkeytxtfile))) {
if(md5_file($pubkeyfile) == md5_file($pubkeytxtfile)) { if(md5_file($pubkeyfile) == md5_file($pubkeytxtfile)) {
@ -1234,6 +1241,9 @@ function create_node_ssl_cert($pemfile) {
file_put_contents($pemfile, $letsencrypt['server.pem'].$letsencrypt['privkey']); file_put_contents($pemfile, $letsencrypt['server.pem'].$letsencrypt['privkey']);
file_put_contents($pubkeyfile, $letsencrypt['pubkey.pem']); file_put_contents($pubkeyfile, $letsencrypt['pubkey.pem']);
file_put_contents($pubkeytxtfile, $letsencrypt['pubkey.pem']); file_put_contents($pubkeytxtfile, $letsencrypt['pubkey.pem']);
touch($pemfile, $ssltime);
touch($pubkeyfile, $ssltime);
touch($pubkeytxtfile, $ssltime);
} else { } else {
/* Create self signed cert */ /* Create self signed cert */
$certificateData = array( $certificateData = array(