Difference between revisions of "SELinux,Fail2ban,Security Configurations"

From Rhomicom Wiki
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 13: Line 13:
 
   nano /etc/firewalld/firewalld.conf
 
   nano /etc/firewalld/firewalld.conf
 
   <nowiki>#</nowiki> AllowZoneDrifting=no
 
   <nowiki>#</nowiki> AllowZoneDrifting=no
 +
 +
  Follow this link for [[Additional Firewall-Cmd Commands]]
 
== SELinux Permissions ==
 
== SELinux Permissions ==
 
   setsebool -P httpd_can_network_connect 1
 
   setsebool -P httpd_can_network_connect 1
Line 28: Line 30:
 
   sudo yum -y install epel-release
 
   sudo yum -y install epel-release
 
   sudo yum -y install fail2ban
 
   sudo yum -y install fail2ban
−
   sudo systemctl enable fail2ban
+
   sudo systemctl enable fail2ban && sudo systemctl start fail2ban
  
 +
nano /etc/fail2ban/jail.conf
 
   [DEFAULT]
 
   [DEFAULT]
 
   # Ban hosts for one hour:
 
   # Ban hosts for one hour:
Line 38: Line 41:
 
   # Override /etc/fail2ban/jail.d/00-firewalld.conf:
 
   # Override /etc/fail2ban/jail.d/00-firewalld.conf:
 
   banaction = iptables-multiport
 
   banaction = iptables-multiport
−
   ignoreip = 127.0.0.1/8 154.160.2.127/8
+
   ignoreip = 127.0.0.1/8 154.160.2.127/16
  
 
   [sshd]
 
   [sshd]
 
   enabled = true
 
   enabled = true
  
−
   phpinfo,
+
   systemctl start fail2ban
 +
  sudo systemctl status fail2ban
 
   sudo systemctl restart fail2ban
 
   sudo systemctl restart fail2ban
 +
 
   sudo fail2ban-client status
 
   sudo fail2ban-client status
 
   sudo fail2ban-client status sshd
 
   sudo fail2ban-client status sshd
Line 51: Line 56:
 
   sudo fail2ban-client status wordpress3
 
   sudo fail2ban-client status wordpress3
 
   sudo fail2ban-client status http-get-post-dos
 
   sudo fail2ban-client status http-get-post-dos
 +
 
== Install Letsencrypt ==
 
== Install Letsencrypt ==
 
   dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
 
   dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Line 60: Line 66:
 
   certbot --nginx
 
   certbot --nginx
 
   OR certbot --apache
 
   OR certbot --apache
 +
  certbot --apache -d wiki.rhomicom.com
 +
  certbot --nginx -d wiki.rhomicom.com
  
 
   certbot renew
 
   certbot renew
Line 65: Line 73:
 
   certbot certonly --apache
 
   certbot certonly --apache
 
   certbot certonly --nginx
 
   certbot certonly --nginx
 +
  sudo certbot certonly --standalone --debug -d api.example.net