|
|
| บรรทัดที่ 21: |
บรรทัดที่ 21: |
|
| |
|
| === [[ตั้งค่า firewall]] === | | === [[ตั้งค่า firewall]] === |
| 1. ตรวจสอบสถานะ firewalld service บน mail server
| |
| *ต้องมีสถานะ active (running)
| |
|
| |
| '''# systemctl status firewalld'''
| |
|
| |
| ''ตัวอย่าง''
| |
|
| |
| '''Active: <span style='color:red'>active (running)</span> since Mon 2019-11-18 14:12:03 +07; 1h 13min ago'''
| |
|
| |
| 2. ตรวจสอบ firewall zone และ network interface ที่เปิดอยู่
| |
| '''# firewall-cmd --get-active-zones'''
| |
| ''ตัวอย่าง''
| |
| '''public
| |
| '''interfaces: ens32
| |
|
| |
| 3. ตรวจสอบรายการ services ของ firewall ที่เปิดอยู่ที่ zone public
| |
| '''# firewall-cmd --zone=public --list-services'''
| |
|
| |
| ''ตัวอย่าง''
| |
| ''' cockpit dhcpv6-client ssh '''
| |
|
| |
| 4. เปิด firewall services ที่ zone public ของ mail server (สามารถเปิดเท่าต้องการได้)
| |
| '''# firewall-cmd --permanent --zone=public --add-service=http
| |
| '''# firewall-cmd --permanent --zone=public --add-service=https
| |
| '''# firewall-cmd --permanent --zone=public --add-service=mysql
| |
| '''# firewall-cmd --permanent --zone=public --add-service=smtp
| |
| '''# firewall-cmd --permanent --zone=public --add-service=smtps
| |
| '''# firewall-cmd --permanent --zone=public --add-service=imap
| |
| '''# firewall-cmd --permanent --zone=public --add-service=imaps
| |
| '''# firewall-cmd --reload
| |
|
| |
| 5. ตรวจสอบรายการ services ของ firewall ที่เปิดอยู่ที่ zone public อีกครั้ง จะพบ services เปิดเพิ่มขึ้นมา
| |
|
| |
| ''*ref: configure firewall services for mail server (https://spalinux.com/2015/06/centos-7-basic-configure-firewall-by-firewall-cmd)''
| |
| '''# firewall-cmd --zone=public --list-services'''
| |
|
| |
| ''ตัวอย่าง''
| |
| ''' cockpit dhcpv6-client <span style='color:red'>http https imap imaps mysql smtp smtps</span> ssh '''
| |
|
| |
| 6. ในตัวอย่างนี้เราแนะนำให้ปิดการทำงานของ SELinux เพื่อความสะดวกในการตั้งค่า (ไม่แนะนำให้ทำกับเครื่อง production)
| |
| *เปลี่ยน SELinux=enforcing เป็น SELinux=disabled
| |
| '''# vi /etc/selinux/config'''
| |
|
| |
| ''ตัวอย่าง''
| |
|
| |
| '''# This file controls the state of SELinux on the system.
| |
| '''# SELINUX= can take one of these three values:
| |
| '''# enforcing - SELinux security policy is enforced.
| |
| '''# permissive - SELinux prints warnings instead of enforcing.
| |
| '''# disabled - No SELinux policy is loaded.
| |
| '''SELINUX=<span style='color:red'>disabled</span>
| |
| '''# SELINUXTYPE= can take one of these two values:
| |
| '''# targeted - Targeted processes are protected,
| |
| '''# mls - Multi Level Security protection.
| |
| '''SELINUXTYPE=targeted
| |
|
| |
| 7. ตรวจสอบสถานะ SELinux อีกครั้ง
| |
| * สั่ง restart server และทำการตรวจสอบ
| |
| '''# reboot'''
| |
| '''# sestatus'''
| |
|
| |
| ''ตัวอย่าง''
| |
|
| |
| ''' disabled '''
| |
|
| |
|
| === [[3. สร้าง SSL ของ EAI Email Server บน CentOS 8]] === | | === [[3. สร้าง SSL ของ EAI Email Server บน CentOS 8]] === |