Cleanup pubkey.(pem/txt)

This commit is contained in:
Retro_Guy 2022-12-15 06:19:27 +00:00
parent 5d3febd4bb
commit 0617c7cef2
2 changed files with 17 additions and 8 deletions

View File

@ -1,12 +1,13 @@
<?php
echo '<center>';
echo '<font size="1em">';
$pubkeyfile = getcwd().'/../tmp/pubkey.pem';
if(is_file($pubkeyfile)) {
echo 'sitename: '.$CONFIG[site_shortname].'&nbsp;&nbsp;';
echo '<a href="/tmp/pubkey.pem" target=_blank>public key</a>';
$pubkeyfile = getcwd().'/../tmp/pubkey.txt';
if(is_file($pubkeyfile) && (isset($CONFIG['site_shortname']) && $CONFIG['site_shortname'] != '')) {
echo '<font size="1.5em">';
echo '<a href="/tmp/pubkey.txt" target=_blank>'.$CONFIG[site_shortname].'</a>';
echo '<br />';
echo '</font>';
}
echo '<font size="1em">';
echo '<i>rocksolid light</i> '.$rslight_version;
echo '<br />';
echo '<a href="https://github.com/novabbs/rocksolid-light" target=_blank>clearnet</a>';

View File

@ -1,6 +1,7 @@
<?php
// This file runs maintenance scripts and should be executed by cron regularly
include "config.inc.php";
include $config_dir."/scripts/rslight-lib.php";
$menulist = file($config_dir."menu.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
@ -36,7 +37,8 @@
$uinfo=posix_getpwnam($CONFIG['webserver_user']);
$cwd = getcwd();
$webtmp = preg_replace('/spoolnews/','tmp',$cwd);
$webtmp = preg_replace('/spoolnews/','tmp/',$cwd);
@mkdir($webtmp,0755,'recursive');
@chown($webtmp, $uinfo["uid"]);
@chgrp($webtmp, $uinfo["gid"]);
@ -57,8 +59,14 @@
@mkdir($logdir,0755,'recursive');
@mkdir($lockdir,0755,'recursive');
if(!is_file($webtmp.'/pubkey.pem') && is_file($config_dir.'/ssl/pubkey.pem')) {
copy($config_dir.'/ssl/pubkey.pem', $webtmp.'/pubkey.pem');
$pemfile = $ssldir.'/server.pem';
$pubkeyfile = $ssldir.'/pubkey.pem';
if((!is_file($pemfile)) || (!is_file($pubkeyfile))) {
create_certificate($pemfile, $pubkeyfile);
}
if(!is_file($webtmp.'/pubkey.txt') && is_file($config_dir.'/ssl/pubkey.pem')) {
echo 'Writing pubkey.txt to: '.$webtmp."/pubkey.txt\n";
copy($config_dir.'/ssl/pubkey.pem', $webtmp.'/pubkey.txt');
}
if(isset($CONFIG['enable_nocem']) && $CONFIG['enable_nocem'] == true) {