Some random tips you would like to know about AWS EC2
I have been writing posts about AWS. And after so long again I am writing yet another post which is a compilation of tips and tricks you would love to do to secure your EC2 instance. Securing and EC2 instance is much more similar like any other operating systems. Here I am writing about some tips I recently did on one of a Linux EC2 instance.
Here are gist snippet tips that you can use to secure your Linux Server.
Install mod security module
SSH configuration to enable keys for some users and passwords for some users
Disable mysql history
Installing mod_evasive for DOS attack prevention
Here are gist snippet tips that you can use to secure your Linux Server.
Install mod security module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum install mod_security | |
service httpd restart |
SSH configuration to enable keys for some users and passwords for some users
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/ssh/sshd_config | |
#ec2-user and root uses key file for login | |
Match User ec2-user,root | |
PasswordAuthentication no | |
#testuser uses password for login | |
Match User testuser | |
PasswordAuthentication yes |
Disable mysql history
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm $HOME/.mysql_history | |
ln -s /dev/null $HOME/.mysql_history |
Installing mod_evasive for DOS attack prevention
yum install httpd-devel wget wget http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz tar -xzf mod_evasive_1.10.1.tar.gz cd mod_evasive apxs -cia mod_evasive20.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/httpd/conf.d/mod_evavsive.conf | |
LoadModule evasive20_module /usr/lib64/httpd/modules/mod_evasive20.so | |
<IfModule mod_evasive20.c> | |
DOSHashTableSize 3097 | |
DOSPageCount 3 | |
DOSSiteCount 100 | |
DOSPageInterval 3 | |
DOSSiteInterval 5 | |
DOSBlockingPeriod 300 | |
DOSLogDir "/var/log/httpd/modevasive/" | |
DOSEmailNotify someone@somewhere.com | |
</IfModule> |
Comments
Post a Comment