Hello,
Thank you so much for responding. I find your commentary and feedback on my questions incredibly helpful. I was also just about to re-configure Nginx so thanks for those tips also.
As far as your comments and questions on my server set go:
" ..If you can figure out how to install and configure them you shouldn't need denyhosts or fail2ban.."
I used vpsbible.com to set up the server 2 years ago and have slowly been learning the ropes as you might have guessed. I just discovered today that the vpsbible site was just refreshed and includes new tutorials on getting snort and other security measures set up so I'm looking forward to that.
"Good. I also like to add google-authentication to PAM to try and add another layer of defense for someone trying to login as root via LISH."
Google/2 Factor Authentication to PAM sounds cool. I didn't know anyone else except the linode user could access lish for my server like that. I have 2-factor enabled on my linode account and thought that took care of everything, so I will look into that.
"Shouldn't you have port 443 open as well?"
I guess port 443 is working, as I haven't had any problems with it. An nmap scan from hackertarget.com says its "443/tcp closed https" and is the only other port mentioned other than 80 and my SSH port. All others HT says are either closed or filtered.
"Behind https right?"
None of my wordpress sites are https. So wouldn't configuring wp-admin as a https make the whole wordpress site resolve to https? As it stands now if you tried to visit wp-admin on my wordpress sites, the browser would ask you for the server htpassword username/password before you could even try to logging into wordpress.
By coincidence, I tried to uncomment out the htpassword protection for wp-admin yesterday since so many people/bots are trying to log into or bruteforce some of my sites. It would make me feel a lot better if my wordpress plugin (Wordfence) could catch them and put them on the 2 month login timeout I have set up rather than OSSEC catching them first and putting them on a measly 600s time out. My sites still ask for the htpasswd however, not sure why. Here is my "global restrictions" file for NGINX in case you are wondering. It is used as an include on all the vHost files. I got some of these tips from
https://calomel.org and others.
Code:
########################################
###Global Restrictions Configuration File ###
############################################
# Designed to be included in any server {} block.</p>
location = /favicon.ico {
log_not_found off;
access_log off;
}
#Turn off logging of robots.txt
#HOLD OF ON UNCOMMENTING, DO I WANT THIS?
#location = /robots.txt {
#allow all;
#log_not_found off;
#access_log off;
#}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# Deny access to any files with a .php extension in the uploads directory
location ~* ^/wp-content/uploads/.*.php$ {
deny all;
access_log off;
log_not_found off;
}
# Deny access to any files with a .php extension in the uploads directory for multisite
location ~* /files/(.*).php$ {
deny all;
access_log off;
log_not_found off;
}
####################################################
###### DIRECTIVES ABOVE FROM NGINX WORDPRESS CODEX ##########
## OTHER DIRECTIVES BELOW I FOUND ELSEWHERE ON THE INTERNETS##
####################################################
#Forbid Access to All Subversion Files and Folders
location ~ /\.svn/* {
deny all;
}
#Password Protect The WordPress Admin Folder
#location ^~ /wp-admin{
# auth_basic "Restricted Access";
# auth_basic_user_file /usr/local/nginx/.htpasswd;
#}
#Password Protect The Ossec Wui Folder
location ^~ /ossec-wui{
auth_basic "Restricted Access";
auth_basic_user_file /usr/local/nginx/.htpasswd;
}
#Prevent access to any files starting with a $ (usually temp files)
location ~ ~$ { access_log off; log_not_found off; deny all; }
#Common deny or internal locations, to help prevent access to areas of
#the site that should not be public
location ~* wp-includes/theme-compat/ { deny all; }
location ~* wp-includes/js/tinymce/langs/.*\.php { deny all; }
###DO NOT UNCOMMENT - WORKING ON
###THE TWO DIRECTIVES BELOW BLOCK NORMAL IMAGES SHOWING IN BROWSER
## location /wp-content/ { internal; }
##location /wp-includes/ { internal; }
#Redirect server error pages to my customized static page
error_page 403 /error403.html;
location = /error403.html {
root html;
}
"My understanding is if you are running PHP behind Nginx that php5-fpm is preferred over fastcgi."
You are right, I am running php5-fpm. I was getting PHP5 and FastCGI confused. I had to look at the php info tab on one my wordpress sites to be sure. I haven't messed with PHP really or tried learning more about it yet. I was recently getting a ton of errors regarding "fast cgi sent in stderr," so not sure why it references fast-cgi. Regardless, after some research I found it may have been related to an APC bug so I uninstalled it and the errors disappeared. I haven't replaced or tried installing another caching system since. I figure once I get to the point of having major traffic on one my wordpress sites I might be earning enough to just go managed and not have to deal with any of this stuff again. It's been an adventure running my own server for sure but only to save money on having decently performing wordpress sites.
"I presume this is just for small amounts of admin type mail like those coming from OSSEC?" "As for the "iptables denied" reports you should be able to fix that with your firewall rules, i.e. don't LOG denied packets ... just go right to DROP."
Yes, postfix is set up for the few programs that need to send me mail which includes any live wordpress site contact form submissions, logwatch, logrotate, and OSSECs 200+ emails daily.. not small amounts by any means haha. So thanks for the tip on turning off logging for IPtables denied errors. Not sure why the vpsbible guide had them set to on. Installing OSSEC was my idea so turning iptables denied errors off is a simple solution that I will definitely be taking advantage of.
Thanks again!