diff --git a/rootfs/standard/etc/systemd/system/https.service b/rootfs/standard/etc/systemd/system/https.service index 7e2fa21d..90f77754 100644 --- a/rootfs/standard/etc/systemd/system/https.service +++ b/rootfs/standard/etc/systemd/system/https.service @@ -13,7 +13,7 @@ KillMode=process TimeoutSec=30 Restart=always RestartSec=10 -ExecStartPre=/usr/bin/mynode_gen_cert.sh https +ExecStartPre=/usr/bin/mynode_gen_cert.sh https 825 ExecStart=/usr/sbin/hitch -u bitcoin -g bitcoin --tls --backend=[127.0.0.1]:80 --frontend=[0.0.0.0]:443 /home/bitcoin/.mynode/https/myNode.local.pem User=root Group=root diff --git a/rootfs/standard/usr/bin/mynode_gen_cert.sh b/rootfs/standard/usr/bin/mynode_gen_cert.sh index 3137d6ba..6817ee65 100755 --- a/rootfs/standard/usr/bin/mynode_gen_cert.sh +++ b/rootfs/standard/usr/bin/mynode_gen_cert.sh @@ -12,6 +12,10 @@ if [ ! -z "$1" ]; then OUTPUT_DIR="${OUTPUT_DIR_BASE}/$1" HDD_DIR="${HDD_DIR_BASE}/$1" fi +DAYS=99999 +if [ ! -z "$1" ]; then + DAYS=$2 +fi mkdir -p $OUTPUT_DIR mkdir -p $HDD_DIR @@ -54,7 +58,7 @@ openssl req -new -key $OUTPUT_DIR/$domain.key -out $OUTPUT_DIR/$domain.csr -pass # Create Certificate echo "Creating Certificate" -openssl x509 -req -days 99999 -in $OUTPUT_DIR/$domain.csr -signkey $OUTPUT_DIR/$domain.key -out $OUTPUT_DIR/$domain.crt +openssl x509 -req -days $DAYS -in $OUTPUT_DIR/$domain.csr -signkey $OUTPUT_DIR/$domain.key -out $OUTPUT_DIR/$domain.crt echo "Creating PEM" cat $OUTPUT_DIR/$domain.key > $OUTPUT_DIR/$domain.pem diff --git a/rootfs/standard/var/www/mynode/settings.py b/rootfs/standard/var/www/mynode/settings.py index edd237c7..35ea4460 100644 --- a/rootfs/standard/var/www/mynode/settings.py +++ b/rootfs/standard/var/www/mynode/settings.py @@ -375,6 +375,17 @@ def repair_drive_page(): } return render_template('reboot.html', **templateData) +@mynode_settings.route("/settings/regen-https-certs") +def regen_https_certs_page(): + # Touch files to trigger re-checking drive + os.system("rm -rf /home/bitcoin/.mynode/https") + os.system("rm -rf /mnt/hdd/mynode/settings/https") + os.system("sync") + os.system("systemctl restart https") + + flash("HTTPS Service Restarted", category="message") + return redirect(url_for(".page_settings")) + @mynode_settings.route("/settings/toggle-uploader") def toggle_uploader_page(): # Toggle uploader diff --git a/rootfs/standard/var/www/mynode/templates/settings.html b/rootfs/standard/var/www/mynode/templates/settings.html index 98049aef..ef2fa1c1 100644 --- a/rootfs/standard/var/www/mynode/templates/settings.html +++ b/rootfs/standard/var/www/mynode/templates/settings.html @@ -402,6 +402,13 @@
+
Reset HTTP Certificates
+ This will regenerate yur HTTPS certificates. +
+ Regenerate + +
+
Re-scan Blockchain
Advanced: If you are having issues parsing the Bitcoin blockchain or blocks cannot be found, please try rescanning.