Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music
All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => all application on unix knowledges by golfreeze => Topic started by: golfreeze on พฤศจิกายน 15, 2018, 07:52:32 AM
-
เปลี่ยน ssh port ใน Centos 7.x ทำยังไงบ้าง
ถ้าทำการเปลี่ยนที่ configure /etc/ssh/sshd_config เฉยๆ จะไม่สามารถ start ssh ได้ครับ
sshd[4713]: error: Bind to port 2299 on 11.222.1.99 failed: Permission denied.
ใน centos 7.x และ RHES 7.x ต้องทำการปรับ configure ของ selinux + policy ด้วย
โดยลงตัว command
#yum install policycoreutils-python
ทำการเพิ่ม policy โดย
#semanage port -a -t ssh_port_t -p tcp 2299
แล้วทำการ restart ssh daemon 1 ครั้ง
#service sshd restart
#netstat -na | grep 2299
แต่ถ้ามีการใช้งาน firewall-cmd ด้วยก็
#firewall-cmd --add-port 2299/tcp --permanent
เท่านี้ก็เรียบร้อยแล้วครับผม : ) ;)
Support [at] Packetlove.com Team.
-
#### ปิด port บน centos 7.x
firewall-cmd --zone=public --remove-port=61616/tcp
firewall-cmd --zone=public --remove-port=9200/tcp
firewall-cmd --zone=public --remove-port=9300/tcp
firewall-cmd --zone=public --remove-port=5601/tcp
firewall-cmd --reload
-
====centos 8
yum install policycoreutils-python-utils.noarch
หรือ
yum install policycoreutils-python.x86_64
-
ถ้าเครื่องไหนใช้งาน csf (configServer and Firewall) ที่ลงมากับ redhat 8 / Debian 8.x
สามารถเข้าไปปรับ TCP_IN ให้ allow port ที่ต้องการได้ครับ
TCP_IN="sshxxx"
#systemctl restart csf
แล้วทำการเปลี่ยน port ssh ใน /etc/ssh/sshd_config
แล้วทำการ reload ssh 1 รอบ
#systemctl reload sshd
เท่านี้ก็หนีการโจมตี แบบ bruteforce ได้ละครับผม ;)