ผลต่างระหว่างรุ่นของ "2. ตั้งค่า firewall CentOS 8"

จาก Wiki_EAI
ไปยังการนำทาง ไปยังการค้นหา
Created page with "4. ทำการตั้งค่าเปิด firewall *ตรวจสอบสถานะของ firewall โดยต้องได้สถานะ Active (runn..."
 
ลไม่มีความย่อการแก้ไข
 
(ไม่แสดง 2 รุ่นระหว่างกลางโดยผู้ใช้คนเดียวกัน)
บรรทัดที่ 1: บรรทัดที่ 1:
4. ทำการตั้งค่าเปิด firewall
1. ตรวจสอบสถานะ firewalld service บน mail server โดยต้องได้สถานะ active (running)
*ตรวจสอบสถานะของ firewall โดยต้องได้สถานะ Active (running)
 
  '''# systemctl status firewalld'''
  '''# systemctl status firewalld'''


*ตรวจสอบ Zone และ Interface ของ Network ที่ใช้อยู่ปัจจุบัน
''ตัวอย่าง''
 
'''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'''
  '''# firewall-cmd --get-active-zones'''
 
''ตัวอย่าง''
'''
  public
  public
  interfaces: ens32
  interfaces: ens32
'''


*ตรวจสอบ service ที่ firewall เปิดให้ใช้งาน
3. ตรวจสอบรายการ services ของ firewall ที่ zone public
  '''# firewall-cmd --zone=public --list-services'''
  '''# firewall-cmd --zone=public --list-services'''


  cockpit dhcpv6-client ssh
''ตัวอย่าง''
  ''' cockpit dhcpv6-client ssh '''


*เพิ่ม service ของ mail server ที่เราจะต้องใช้
4. เปิด firewall services ที่ zone public ของ mail server (สามารถเปิดเท่าต้องการได้)
  '''# firewall-cmd --permanent --zone=public --add-service=http
  '''# firewall-cmd --permanent --zone=public --add-service=http
  '''# firewall-cmd --permanent --zone=public --add-service=https
  '''# firewall-cmd --permanent --zone=public --add-service=https
บรรทัดที่ 24: บรรทัดที่ 31:
  '''# firewall-cmd --reload
  '''# firewall-cmd --reload


*ตรวจสอบ service ของ firewall ที่เปิดเพิ่ม
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'''
  '''# firewall-cmd --zone=public --list-services'''


  cockpit dhcpv6-client http https imap imaps mysql smtp smtps ssh
''ตัวอย่าง''
''*add firewall service for mail server (https://spalinux.com/2015/06/centos-7-basic-configure-firewall-by-firewall-cmd)''
  ''' cockpit dhcpv6-client http https imap imaps mysql smtp smtps ssh '''  


 
6. ปิด selinux (เพื่อสะดวกต่อการ configure แต่ความปลอดภัยจะลดลง)
5. ปิด selinux (เพื่อสะดวกต่อการ configure แต่ความปลอดภัยจะลดลง)
*เปลี่ยน SELinux=enforcing เป็น SELinux=disabled
*เปลี่ยน SELinux=enforcing เป็น SELinux=disabled
  '''# vi /etc/selinux/config'''
  '''# vi /etc/selinux/config'''
บรรทัดที่ 54: บรรทัดที่ 62:
  disabled
  disabled


 
7. ติดตั้ง wget เพื่อใช้ download service ที่จำเป็นต้องใช้งานเพิ่ม
6. ติดตั้ง wget เพื่อใช้ download service ที่จำเป็นต้องใช้งานเพิ่ม
  '''# yum install wget'''
  '''# yum install wget'''

รุ่นแก้ไขปัจจุบันเมื่อ 16:15, 26 ตุลาคม 2563

1. ตรวจสอบสถานะ firewalld service บน mail server โดยต้องได้สถานะ active (running)

# systemctl status firewalld

ตัวอย่าง

Active: active (running) 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 http https imap imaps mysql smtp smtps ssh  

6. ปิด selinux (เพื่อสะดวกต่อการ configure แต่ความปลอดภัยจะลดลง)

  • เปลี่ยน 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=disabled
# SELINUXTYPE= can take one of these two values:
#       targeted - Targeted processes are protected,
#       mls - Multi Level Security protection.
SELINUXTYPE=targeted
  • Restart ระบบ และทำการตรวจสอบ
# reboot
  • ตรวจสอบสถานะของ SELinux
# sestatus
disabled

7. ติดตั้ง wget เพื่อใช้ download service ที่จำเป็นต้องใช้งานเพิ่ม

# yum install wget