From 1d5edecce3b56979cc31d8b8f7d41bc8a741f2e3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 20 Oct 2016 22:02:16 +0100 Subject: [PATCH] Remove individual cert files --- src/freedombone-app-dokuwiki | 1 + src/freedombone-app-gnusocial | 1 + src/freedombone-app-gogs | 1 + src/freedombone-app-htmly | 1 + src/freedombone-app-hubzilla | 1 + src/freedombone-app-mediagoblin | 2 +- src/freedombone-app-mumble | 1 + src/freedombone-app-pelican | 1 + src/freedombone-app-xmpp | 1 + src/freedombone-utils-web | 24 ++++++++++++++++++++++++ 10 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/freedombone-app-dokuwiki b/src/freedombone-app-dokuwiki index ebefaff7..82552d9e 100755 --- a/src/freedombone-app-dokuwiki +++ b/src/freedombone-app-dokuwiki @@ -173,6 +173,7 @@ function remove_dokuwiki { function_check remove_onion_service remove_onion_service dokuwiki ${DOKUWIKI_ONION_PORT} nginx_dissite $DOKUWIKI_DOMAIN_NAME + remove_certs $DOKUWIKI_DOMAIN_NAME if [ -f /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME ]; then rm /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME fi diff --git a/src/freedombone-app-gnusocial b/src/freedombone-app-gnusocial index ee861408..5dff24a9 100755 --- a/src/freedombone-app-gnusocial +++ b/src/freedombone-app-gnusocial @@ -469,6 +469,7 @@ function remove_gnusocial { read_config_param "MY_USERNAME" echo "Removing $GNUSOCIAL_DOMAIN_NAME" nginx_dissite $GNUSOCIAL_DOMAIN_NAME + remove_certs $GNUSOCIAL_DOMAIN_NAME if [ -d /var/www/$GNUSOCIAL_DOMAIN_NAME ]; then rm -rf /var/www/$GNUSOCIAL_DOMAIN_NAME fi diff --git a/src/freedombone-app-gogs b/src/freedombone-app-gogs index 19004323..02334c4b 100755 --- a/src/freedombone-app-gogs +++ b/src/freedombone-app-gogs @@ -337,6 +337,7 @@ function remove_gogs { systemctl stop gogs systemctl disable gogs nginx_dissite ${GIT_DOMAIN_NAME} + remove_certs ${GIT_DOMAIN_NAME} if [ -d /var/www/${GIT_DOMAIN_NAME} ]; then rm -rf /var/www/${GIT_DOMAIN_NAME} fi diff --git a/src/freedombone-app-htmly b/src/freedombone-app-htmly index 0a372084..d792cccc 100755 --- a/src/freedombone-app-htmly +++ b/src/freedombone-app-htmly @@ -322,6 +322,7 @@ function remove_htmly { read_config_param "HTMLY_DOMAIN_NAME" nginx_dissite $HTMLY_DOMAIN_NAME + remove_certs ${HTMLY_DOMAIN_NAME} if [ -f /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME ]; then rm -f /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME fi diff --git a/src/freedombone-app-hubzilla b/src/freedombone-app-hubzilla index 34468d93..2b9ef47f 100755 --- a/src/freedombone-app-hubzilla +++ b/src/freedombone-app-hubzilla @@ -279,6 +279,7 @@ function remove_hubzilla { return fi nginx_dissite $HUBZILLA_DOMAIN_NAME + remove_certs ${HUBZILLA_DOMAIN_NAME} if [ -d /var/www/$HUBZILLA_DOMAIN_NAME ]; then rm -rf /var/www/$HUBZILLA_DOMAIN_NAME fi diff --git a/src/freedombone-app-mediagoblin b/src/freedombone-app-mediagoblin index aaf5a86d..1342dad3 100755 --- a/src/freedombone-app-mediagoblin +++ b/src/freedombone-app-mediagoblin @@ -170,7 +170,7 @@ function restore_remote_mediagoblin { } function remove_mediagoblin { - echo -n '' + remove_certs ${MEDIAGOBLIN_DOMAIN_NAME} } function install_mediagoblin { diff --git a/src/freedombone-app-mumble b/src/freedombone-app-mumble index ad7020d5..500905a1 100755 --- a/src/freedombone-app-mumble +++ b/src/freedombone-app-mumble @@ -166,6 +166,7 @@ function remove_mumble { if [ -f /etc/mumble-server.ini ]; then rm /etc/mumble-server.ini fi + remove_certs mumble function_check remove_onion_service remove_onion_service mumble ${MUMBLE_PORT} sed -i '/mumble/d' $COMPLETION_FILE diff --git a/src/freedombone-app-pelican b/src/freedombone-app-pelican index 444d2e4a..789b0307 100755 --- a/src/freedombone-app-pelican +++ b/src/freedombone-app-pelican @@ -82,6 +82,7 @@ function remove_pelican { rm -rf /var/www/$STATIC_BLOG_DOMAIN/htdocs fi pip uninstall pelican + remove_certs $STATIC_BLOG_DOMAIN } function create_pelican_conf { diff --git a/src/freedombone-app-xmpp b/src/freedombone-app-xmpp index 175301bc..156f6ed0 100755 --- a/src/freedombone-app-xmpp +++ b/src/freedombone-app-xmpp @@ -266,6 +266,7 @@ function configure_firewall_for_xmpp { function remove_xmpp_client { apt-get -y remove --purge profanity remove_completion_param install_xmpp_client + remove_certs xmpp } function remove_xmpp { diff --git a/src/freedombone-utils-web b/src/freedombone-utils-web index bf41f22e..11b5c72c 100755 --- a/src/freedombone-utils-web +++ b/src/freedombone-utils-web @@ -567,4 +567,28 @@ function install_web_server { mark_completed $FUNCNAME } +function remove_certs { + domain_name=$1 + + if [ ! $domain_name ]; then + return + fi + + if [ -f /etc/ssl/certs/${domain_name}.dhparam ]; then + rm /etc/ssl/certs/${domain_name}.dhparam + fi + + if [ -f /etc/ssl/certs/${domain_name}.pem ]; then + rm /etc/ssl/certs/${domain_name}.pem + fi + + if [ -f /etc/ssl/certs/${domain_name}.crt ]; then + rm /etc/ssl/certs/${domain_name}.crt + fi + + if [ -f /etc/ssl/private/${domain_name}.key ]; then + rm /etc/ssl/private/${domain_name}.key + fi +} + # NOTE: deliberately no exit 0