Rate Limit SSH Brute Force on port 22

iptables -A INPUT -p tcp –dport 22 -i eth0 -m state –state NEW -m recent –set iptables -A INPUT -p tcp –dport 22 -i eth0 -m state –state NEW -m recent  –update –seconds 60 –hitcount 3 -j DROP

Read more

RDS Encrypted individual mysql connection for PCI compliance

download certs from aws cd /etc/ssl/mysql wget https://rds.amazonaws.com/doc/mysql-ssl-ca-cert.pem create user in RDS GRANT ALL PRIVILEGES ON abcdb.* TO ‘anuj’@’%’ IDENTIFIED BY ‘efghij’ REQUIRE SSL; flush privileges; Verify the connection mysql -h host.rds.amazonaws.com -u anuj -pefghij -P 3306 –ssl_ca=/etc/ssl/mysql/mysql-ssl-ca-cert.pem

Read more

Minimal postfix/dovecot installation

yum install postfix chkconfig postfix on chkconfig sendmail off /etc/init.d/sendmail stop /etc/init.d/postfix start Put these 5 lines in /etc/postfix/main.cf inet_interfaces = 127.0.0.1, 88.155.666.111    :Listen on loopback and public interface myorigin = mail.anuj.com         :visible hostname in email mydestination = mail.anuj.com        :accept email for any@mail.anuj.com relay_domains = anuj.com        :To relay domain as required […]

Read more

Basic Selinux Policy

#To see context ls -Z #To see selinux status sestatus #To switch Selinux into Permissive mode on the fly to debug setenforce 0 #To switch Selinux into Enforcing mode on the fly to debug setenforce 1 #To see selinux log tail -f /var/log/audit/audit.log #SELinux security context of the httpd process codero1:/var/www/html# ps axZ |grep httpd […]

Read more

Reset mySQL replication

cd /home/anuj/dump mysql -p FLUSH TABLES WITH READ LOCK; SHOW MASTER STATUS; +—————+———–+————–+——————+ | File          | Position  | Binlog_Do_DB | Binlog_Ignore_DB | +—————+———–+————–+——————+ | binlog.000662 | 166715532 |              |                  | +—————+———–+————–+——————+ 1 row in set (0.00 sec) mysqldump  –opt  lory –lock-all-tables –add-drop-table > lory.sql mysqldump  –opt  rons –lock-all-tables –add-drop-table > rons.sql UNLOCK TABLES; quit; scp […]

Read more
Random Pages By Best Accounting Services