copytruncate: Truncate the original log file in place after creating a copy.
An example: /etc/logrotate.d/mds
/var/log/mds/mds-app-*.log { daily copytruncate rotate 30 dateext missingok notifempty sharedscripts }
/var/log/mds/mds-app-*.log { daily copytruncate rotate 30 dateext missingok notifempty sharedscripts }
iptablesby
iptables -A chain-Russian-Block
iptables -N chain-Russian-Block ... iptables -A chain-Russian-Block -s 2.56.24.0/23 -j DROP iptables -A chain-Russian-Block -s 2.56.26.0/23 -j DROP iptables -A chain-Russian-Block -s 2.56.88.0/22 -j DROP ... iptables -A INPUT -j chain-Russian-Block
# iptables -S chain-Russian-Block | wc -l 24,445
service netfilter-persistent save
su - mysite cd etc ls -l htpasswd OMD[mysite]:~/etc$ ls -l htpasswdExample: check_mk version 1.4:
lambert:!$1$042926$lmAEb.P5TAi0sZfiGyWHX. omdadmin:M29dfyFjgy5iAcheck_mk version 1.5:
automation:$1$857531$PzhNz/zMdQv8xGu68EZhD. cmkadmin:$1$386620$Xe5mZKwrPRlzx0BvZCJM8.
htpasswd htpasswd omdadmin # set password for user *omdadmin* New password: Re-type new password:You should be good! Have a nice day!
vi /etc/ssh/sshd_config
PermitRootLogin no
vi /etc/ssh/sshd_config
Port 44022
semanage port -a -t ssh_port_t -p tcp 44022
vi /usr/lib/firewalld/services/ssh.xml
SSH
Secure Shell (SSH) is a protocol for logging into and executing commands on remote machines. It provides secure encrypted communications. If you plan on accessing your machine remotely via SSH over a firewalled interface, enable this option. You need the openssh-server package installed for this option to be useful.
# systemctl restart sshd.service
# firewall-cmd --reload
# Fist Cleaning all rules
iptables -F
iptables -X
# By default I drop all traffic
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
# Only allow ssh and web
iptables -A INPUT -m tcp -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -m tcp -p tcp --dport 80 -j ACCEPT
iptables -A OUTPUT -m tcp -p tcp --sport 22 -j ACCEPT
iptables -A OUTPUT -m tcp -p tcp --sport 80 -j ACCEPT
# Allow lo
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Save the config for reboot and restart the service see how it works.
service iptables save
service iptables restart
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -s [My Static IP]/32 -d [Server IP]/32 -p tcp -m tcp --dport 22 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 80 -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -s [Server IP]/32 -d [My Static IP]/32 -p tcp -m tcp --sport 22 -j ACCEPT
-A INPUT -s [Another Server]/32 -p tcp -m tcp --sport 80 -j ACCEPT
-A OUTPUT -d [Another Server]/32 -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -s 192.168.244.0/24 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT
-A OUTPUT -d 192.168.244.0/24 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT
iptables -A INPUT -i eth0 -p udp -m udp --sport 53 -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp -m udp --dport 53 -j ACCEPT
iptables -A OUTPUT -m tcp -p tcp -m state --state NEW -m multiport --dports 80,443 -j ACCEPT