- Set bash history with time stamp for root and other users
Add this to .bashrc
HISTSIZE=500000HISTFILESIZE=200000HISTTIMEFORMAT="(%m/%d/%y) %T "export HISTFILESIZEexport HISTSIZEexport HISTTIMEFORMATexport PROMPT_COMMAND='history -a'
- Kernel Parameter setup
Add this to "/etc/sysctl.conf"
net.ipv4.conf.all.rp_filter=1net.ipv4.conf.all.accept_source_route=0net.ipv4.conf.default.accept_source_route = 0net.ipv4.icmp_echo_ignore_broadcasts=1kernel.exec-shield=1kernel.randomize_va_space=1net.core.somaxconn=4096net.core.rmem_max=16777216net.core.wmem_max=16777216net.ipv4.ip_local_port_range=1024 65535net.ipv4.tcp_tw_recycle=1net.ipv4.tcp_max_syn_backlog=8192net.core.netdev_max_backlog=16384net.core.rmem_max=16777216net.core.wmem_max=16777216net.ipv4.tcp_rmem=4096 87380 16777216net.ipv4.tcp_wmem=4096 16384 16777216net.ipv4.tcp_syncookies = 1net.core.netdev_max_backlog=300000net.ipv4.conf.all.rp_filter = 1net.ipv4.conf.default.rp_filter = 1net.ipv4.tcp_timestamps=0
- Set Limit security for normal users where application are running.
Add below lines to this file. /etc/security/limits.confroot - nofile 40000User1 - nofile 40000User2 - nofile 40000
- User Account lock after 3 failed logging attempt
Add this configuration to this configuration. /etc/pam.d/common-auth
auth required pam_tally2.so deny=3 unlock_time=60
- Set ulimit
Add these lines to .bashrc under required userulimit -n 40000TMOUT=1800ulimit -c unlimited
- Secure SSH
Stop ssh login for root user. Add ssh allow users to AllowUsers list
Change these configuration in sshd_conf file. /etc/ssh/sshd_config
PermitRootLogin no
Port 3222
AllowUsers User1 User2

No comments:
Post a Comment