diff --git a/roles/mailserver/certificates/files/update-smtp-certificates.sh b/roles/mailserver/certificates/files/update-smtp-certificates.sh deleted file mode 100755 --- a/roles/mailserver/certificates/files/update-smtp-certificates.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# ------------------------------------------------------------- -# Deploy mail certificate to SMTP server -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Project: Nasqueron -# Created: 2016-11-03 -# License: Trivial work, not eligible to copyright -# Source file: roles/mailserver/certificates/files/update-smtp-certificates.sh -# ------------------------------------------------------------- -# -# <auto-generated> -# This file is managed by our rOPS SaltStack repository. -# -# Changes to this file may cause incorrect behavior -# and will be lost if the state is redeployed. -# </auto-generated> - -: ${CONTAINER_NAME='mailserver'} -: ${CERT_DIR='/srv/data/letsencrypt/etc/live/mail.nasqueron.org-0001'} -: ${CONTAINER_DIR="/var/lib/lxc/$CONTAINER_NAME/rootfs"} - -cp $CERT_DIR/fullchain.pem $CONTAINER_DIR/etc/ssl/certs/mailserver.crt -cp $CERT_DIR/privkey.pem $CONTAINER_DIR/etc/ssl/private/mailserver.key - -# Mail servers can read the certificate as root before dropping privileges -chown 0:0 $CONTAINER_DIR/etc/ssl/private/mailserver.key -chmod 400 $CONTAINER_DIR/etc/ssl/private/mailserver.key - -lxc-attach -n $CONTAINER_NAME -- service postfix restart -lxc-attach -n $CONTAINER_NAME -- service dovecot restart diff --git a/roles/mailserver/certificates/init.sls b/roles/mailserver/certificates/init.sls deleted file mode 100644 --- a/roles/mailserver/certificates/init.sls +++ /dev/null @@ -1,12 +0,0 @@ -# ------------------------------------------------------------- -# Salt — Deploy SSL certificate for SMTP server -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Project: Nasqueron -# Created: 2016-11-03 -# License: Trivial work, not eligible to copyright -# ------------------------------------------------------------- - -smtp_certificates_update_script: - file.managed: - - name: /usr/local/bin/update-smtp-certificates - - source: salt://roles/mailserver/certificates/files/update-smtp-certificates.sh diff --git a/roles/mailserver/systemd-unit/files/lxc-container-mailserver-start.sh b/roles/mailserver/systemd-unit/files/lxc-container-mailserver-start.sh deleted file mode 100755 --- a/roles/mailserver/systemd-unit/files/lxc-container-mailserver-start.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -# ------------------------------------------------------------- -# Nasqueron mail services -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Project: Nasqueron -# Created: 2015-12-16 -# License: Trivial work, not eligible to copyright -# Source file: roles/mailserver/systemd-unit/files/lxc-container-mailserver-start.sh -# ------------------------------------------------------------- -# -# <auto-generated> -# This file is managed by our rOPS SaltStack repository. -# -# Changes to this file may cause incorrect behavior -# and will be lost if the state is redeployed. -# </auto-generated> - -#Let systemd launch a lxc mail container through -#/usr/lib/systemd/system/lxc-container-mailserver.service -# -#Start a lxc container, and create iptable rules - -IPTABLES="/usr/sbin/iptables" -LXC_START="/usr/bin/lxc-start" -CONTAINER_NAME="mailserver" -HOST_INTERFACE="ens192" -DOCKER_INTERFACE="docker0" -HOST_IP="212.129.32.223" -CONTAINER_IP="10.0.3.8" -PORTS="25 110 143 465 587" -DOCKER_PORTS="25 143 465 587" -NGINX_PORT="21080" - -$LXC_START -n $CONTAINER_NAME -d - -#Web rules -for PORT in $PORTS -do - $IPTABLES -t nat -I PREROUTING -i $HOST_INTERFACE -p TCP -d $HOST_IP/32 --dport $PORT -j DNAT --to-destination $CONTAINER_IP:$PORT -done - -#Need 80 port for main nginx -$IPTABLES -t nat -I PREROUTING -i $HOST_INTERFACE -p TCP -d $HOST_IP/32 --dport $NGINX_PORT -j DNAT --to-destination $CONTAINER_IP:80 - -#Docker rules -for PORT in $DOCKER_PORTS -do - $IPTABLES -t nat -I PREROUTING -i $DOCKER_INTERFACE -p TCP -d $HOST_IP/32 --dport $PORT -j DNAT --to-destination $CONTAINER_IP:$PORT -done diff --git a/roles/mailserver/systemd-unit/files/lxc-container-mailserver-stop.sh b/roles/mailserver/systemd-unit/files/lxc-container-mailserver-stop.sh deleted file mode 100755 --- a/roles/mailserver/systemd-unit/files/lxc-container-mailserver-stop.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -# ------------------------------------------------------------- -# Nasqueron mail services -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Project: Nasqueron -# Created: 2015-12-16 -# License: Trivial work, not eligible to copyright -# Source file: roles/mailserver/systemd-unit/files/lxc-container-mailserver-stop.sh -# ------------------------------------------------------------- -# -# <auto-generated> -# This file is managed by our rOPS SaltStack repository. -# -# Changes to this file may cause incorrect behavior -# and will be lost if the state is redeployed. -# </auto-generated> - -#Let systemd stop the lxc mail container through /usr/lib/systemd/system/lxc-container-mailserver.service -#Stop the lxc container, and create iptable rules - -IPTABLES="/usr/sbin/iptables" -LXC_STOP="/usr/bin/lxc-stop" -CONTAINER_NAME="mailserver" -HOST_INTERFACE="ens192" -DOCKER_INTERFACE="docker0" -HOST_IP="212.129.32.223" -CONTAINER_IP="10.0.3.8" -PORTS="25 110 143 465 587" -DOCKER_PORTS="25 143 465 587" -NGINX_PORT="21080" - -#Web rules -for PORT in $PORTS -do - $IPTABLES -t nat -D PREROUTING -i $HOST_INTERFACE -p TCP -d $HOST_IP/32 --dport $PORT -j DNAT --to-destination $CONTAINER_IP:$PORT -done - -#Need 80 port for main nginx -$IPTABLES -t nat -D PREROUTING -i $HOST_INTERFACE -p TCP -d $HOST_IP/32 --dport $NGINX_PORT -j DNAT --to-destination $CONTAINER_IP:80 - - -#Docker rules -for PORT in $DOCKER_PORTS -do - $IPTABLES -t nat -D PREROUTING -i $DOCKER_INTERFACE -p TCP -d $HOST_IP/32 --dport $PORT -j DNAT --to-destination $CONTAINER_IP:$PORT -done - -$LXC_STOP -n $CONTAINER_NAME diff --git a/roles/mailserver/systemd-unit/files/lxc-container-mailserver.service b/roles/mailserver/systemd-unit/files/lxc-container-mailserver.service deleted file mode 100644 --- a/roles/mailserver/systemd-unit/files/lxc-container-mailserver.service +++ /dev/null @@ -1,27 +0,0 @@ -# ------------------------------------------------------------- -# Nasqueron mail services -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Project: Nasqueron -# Created: 2015-12-16 -# License: Trivial work, not eligible to copyright -# Source file: roles/mailserver/systemd-unit/files/lxc-container-mailserver.service -# ------------------------------------------------------------- -# -# <auto-generated> -# This file is managed by our rOPS SaltStack repository. -# -# Changes to this file may cause incorrect behavior -# and will be lost if the state is redeployed. -# </auto-generated> - -[Unit] -Description=LXC mail server container - -[Service] -Type=simple -RemainAfterExit=yes -ExecStart=/usr/lib/systemd/system/lxc-container-mailserver-start -ExecStop=/usr/lib/systemd/system/lxc-container-mailserver-stop - -[Install] -WantedBy=multi-user.target