Bo's Oracle Station

查看: 2859|回复: 0

ansible6(邮件服务器)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2020-12-12 17:09:27 | 显示全部楼层 |阅读模式
mail_arch.png

v5-1_srvgroup.yml:
  1. ---
  2. - name: Runing Mail Server
  3.   hosts: serverb
  4.   vars:
  5.     v_mail_servers:
  6.       - postfix
  7.       - dovecot
  8.   tasks:
  9.   - name: Install Postfix
  10.     yum:
  11.       name: "{{ item }}"
  12.       state: latest
  13.     loop:
  14.        "{{ v_mail_servers }}"

  15.   - name: myorigin
  16.     lineinfile:
  17.       path: /etc/postfix/main.cf
  18.       regexp: '^#myorigin = $mydomain'
  19.       line: myorigin = $mydomain

  20.   - name: inet_interfaces
  21.     lineinfile:
  22.       path: /etc/postfix/main.cf
  23.       regexp: '^inet_interfaces = localhost'
  24.       line: inet_interfaces = all

  25.   - name: mydestination
  26.     lineinfile:
  27.       path: /etc/postfix/main.cf
  28.       regexp: '^mydestination ='
  29.       line: mydestination = $myhostname, localhost.$mydomain, localhost, lab.example.com

  30.   - name: mynetwork
  31.     lineinfile:
  32.       path: /etc/postfix/main.cf
  33.       line: mynetworks = 172.25.250.0/24, 127.0.0.0/8

  34.   - name: login_trusted_networks
  35.     lineinfile:
  36.       path: /etc/dovecot/dovecot.conf
  37.       regexp: '^#login_trusted_networks ='
  38.       line: login_trusted_networks = 172.25.250.0/24

  39.   - name: Mbox
  40.     file:
  41.       path: /home/student/mail/.imap/INBOX
  42.       state: directory
  43.       recurse: yes
  44.       owner: student
  45.       group: student
  46.       setype: user_home_t

  47.   - name: 10conf
  48.     lineinfile:
  49.       path: /etc/dovecot/conf.d/10-mail.conf
  50.       line: mail_location = mbox:~/mail:INBOX=/var/mail/%u

  51.   - name: Running Servers
  52.     service:
  53.       name: "{{ item }}"
  54.       state: restarted
  55.       enabled: yes
  56.     loop:
  57.       - postfix
  58.       - dovecot

  59.   - name: firewalld
  60.     firewalld:
  61.       service: smtp
  62.       state: enabled
  63.       permanent: yes
  64.       immediate: yes

  65.   - name: firewalld-dovecot
  66.     firewalld:
  67.       service: pop3
  68.       state: enabled
  69.       permanent: yes
  70.       immediate: yes
复制代码

2020-12-12 20-51-36屏幕截图.png


  1. Dec 12 21:05:20 serverb postfix/qmgr[17733]: 9D67920CE759: from=<student@lab.example.com>, size=334519, nrcpt=1 (queue active)
  2. Dec 12 21:05:20 serverb postfix/smtpd[18342]: disconnect from classroom.lab.example.com[172.25.250.254] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
  3. Dec 12 21:05:24 serverb postfix/smtp[18346]: 9D67920CE759: to=<18950350376@189.cn>, relay=mta-189.21cn.com[183.61.185.69]:25, delay=3.8, delays=0.2/0.04/2.1/1.4, dsn=5.0.0, status=bounced (host mta-189.21cn.com[183.61.185.69] said: 543 suspected spams or account(IP) exception (in reply to end of DATA command))
  4. Dec 12 21:05:24 serverb postfix/cleanup[18345]: 6B25820CE804: message-id=<20201212130524.6B25820CE804@serverb.lab.example.com>
  5. Dec 12 21:05:24 serverb postfix/bounce[18347]: 9D67920CE759: sender non-delivery notification: 6B25820CE804
  6. Dec 12 21:05:24 serverb postfix/qmgr[17733]: 6B25820CE804: from=<>, size=2762, nrcpt=1 (queue active)
  7. Dec 12 21:05:24 serverb postfix/qmgr[17733]: 9D67920CE759: removed
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-11-21 14:29 , Processed in 0.045296 second(s), 27 queries .

快速回复 返回顶部 返回列表