diff --git a/roles/postfix/files/stunnel-smtps.service b/roles/postfix/files/stunnel-smtps.service deleted file mode 100644 index c03b281..0000000 --- a/roles/postfix/files/stunnel-smtps.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Stunnel for SMTPs connections -After=network.target -After=syslog.target - -[Service] -Type=simple -PrivateTmp=true -User=smtps -Group=smtps -ExecStart=/usr/bin/stunnel /etc/stunnel/smtps.conf - -[Install] -WantedBy=multi-user.target diff --git a/roles/postfix/handlers/main.yml b/roles/postfix/handlers/main.yml index 13405c4..0b0f8e9 100644 --- a/roles/postfix/handlers/main.yml +++ b/roles/postfix/handlers/main.yml @@ -3,8 +3,3 @@ ansible.builtin.service: name: postfix state: restarted - -- name: Restart stunnel-smtps - ansible.builtin.service: - name: stunnel-smtps - state: restarted diff --git a/roles/postfix/tasks/main.yml b/roles/postfix/tasks/main.yml index 6993d5c..559d32e 100644 --- a/roles/postfix/tasks/main.yml +++ b/roles/postfix/tasks/main.yml @@ -37,79 +37,6 @@ - mail_domain is defined - mail_server is defined -- name: Install stunnel - ansible.builtin.package: - name: stunnel - state: installed - when: - - ansible_distribution_major_version|int <= 7 - - mail_server is defined - -- name: Create group smtps - ansible.builtin.group: - name: smtps - system: true - when: - - ansible_distribution_major_version|int <= 7 - - mail_server is defined - -- name: Create user smtps - ansible.builtin.user: - name: smtps - comment: Service Stunnel-SMTPS - createhome: false - group: smtps - home: /var/empty - shell: /sbin/nologin - system: true - when: - - ansible_distribution_major_version|int <= 7 - - mail_server is defined - -- name: Create stunnel config - ansible.builtin.template: - src: stunnel.conf.j2 - dest: /etc/stunnel/smtps.conf - mode: 0644 - owner: root - group: "{{ ansible_wheel }}" - notify: Restart stunnel-smtps - when: - - ansible_distribution_major_version|int <= 7 - - mail_server is defined - -- name: Create stunnel systemd service - ansible.builtin.copy: - src: stunnel-smtps.service - dest: /etc/systemd/system/stunnel-smtps.service - mode: 0644 - owner: root - group: "{{ ansible_wheel }}" - notify: Restart stunnel-smtps - when: - - ansible_distribution_major_version|int <= 7 - - mail_server is defined - -- name: Enable stunnel service - ansible.builtin.service: - name: stunnel-smtps - state: started - enabled: true - when: - - ansible_distribution_major_version|int <= 7 - - mail_server is defined - -- name: Configure relayhost - ansible.builtin.lineinfile: - path: /etc/postfix/main.cf - regexp: '^relayhost\s*=' - insertafter: '^#relayhost\s*=' - line: "relayhost = [localhost]:2525" - notify: Restart postfix - when: - - ansible_distribution_major_version|int <= 7 - - mail_server is defined - - name: Configure relayhost ansible.builtin.lineinfile: path: /etc/postfix/main.cf @@ -118,7 +45,6 @@ line: "relayhost = [{{ mail_server }}]:465" notify: Restart postfix when: - - ansible_distribution_major_version|int >= 8 - mail_server is defined - name: Configure smtp_tls_security_level @@ -129,7 +55,6 @@ line: "smtp_tls_security_level = encrypt" notify: Restart postfix when: - - ansible_distribution_major_version|int >= 8 - mail_server is defined - name: Configure smtp_tls_wrappermode @@ -140,7 +65,6 @@ line: "smtp_tls_wrappermode = yes" notify: Restart postfix when: - - ansible_distribution_major_version|int >= 8 - mail_server is defined - name: Enable postfix service diff --git a/roles/postfix/templates/stunnel.conf.j2 b/roles/postfix/templates/stunnel.conf.j2 deleted file mode 100644 index 59fee92..0000000 --- a/roles/postfix/templates/stunnel.conf.j2 +++ /dev/null @@ -1,10 +0,0 @@ -foreground = yes -pid = - -[smtps-wrapper] -accept = localhost:2525 -client = yes -connect = {{ mail_server }}:465 -CAfile = {{ tls_bundle }} -verify = 2 -sslVersion = TLSv1.2