Remove individual cert files

This commit is contained in:
Bob Mottram 2016-10-20 22:02:16 +01:00
parent 591c3d7d8a
commit 1d5edecce3
10 changed files with 33 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -170,7 +170,7 @@ function restore_remote_mediagoblin {
}
function remove_mediagoblin {
echo -n ''
remove_certs ${MEDIAGOBLIN_DOMAIN_NAME}
}
function install_mediagoblin {

View File

@ -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

View File

@ -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 {

View File

@ -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 {

View File

@ -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