I am almost there; moving my first website from shared-hosting to self-hosting on Ubuntu LEMP. Think I will leave email handling to Google apps for the time being.
I have some questions left:
SSH:
I use ssh with keys, no root login. Will add an AllowUsers entry. Is there anything else I can do or is there anything to gain by choosing a different port? If yes, how to choose a free port?
ISPConfig:
Is this worth the time and trouble for a server with a couple of sites? I think it is overkill.
http://www.howtoforge.com/perfect-server-ubuntu-11.10-with-nginx-ispconfig-3
Nginx:
Think my knowledge of Nginx is good enough. PHPMyAdmin, Munin, and stats are in password protected directories and the passwords are very strong. I guess this is safe enough.
How to limit the number of requests per IP in case of a DOS?
For a wordpress site I have enabled both http and https (with a self created certificate). The idea was that visitors access the site via http, but that I can login via https, but sooner rather then later it switches back to http by itself. From the server block in the config file:
Code:
listen 80;
listen 443 default_server ssl;
ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;
SecurityI use Fail2Ban and LogWatch
iptables looks difficult. As far as I can guess I only need ports 22, 80 and 443 for incoming. The output of iptables -L is:
Code:
Chain INPUT (policy ACCEPT)
target prot opt source destination
fail2ban-ssh tcp -- anywhere anywhere multiport dports ssh
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain fail2ban-ssh (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere
Output of nmap (from desktop to server):
Code:
Starting Nmap 5.21 ( http://nmap.org ) at 2011-11-11 10:22 CET
Nmap scan report for www.example.com (66.66.66.66)
Host is up (0.037s latency).
Not shown: 996 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp filtered smtp
80/tcp open http
443/tcp open https
Nmap done: 1 IP address (1 host up) scanned in 7.07 seconds
I think this looks good. It is more the output of netstat that has me worried (part of active internet connections):
Code:
udp 0 0 server1.myserver:33367 ntp1.exa-networks.c:ntp ESTABLISHED
udp 0 0 server1.myserver:40586 ntp3.0x00.lv:ntp ESTABLISHED
udp 0 0 server1.myserver:56097 www.clipsure.com:ntp ESTABLISHED
udp 0 0 server1.myserver:42466 ns1.blazing.de:ntp ESTABLISHED
Why are there connections to those sites? I understand that ntp stands for network time protocol, but clipsure is an adtracker. All I have are a couple of dummy wordpress installations on my server.
Postfix:I only use postfix for LogWatch and sending message in case someone comments on one of the blogs. So only outgoing. Is there a way to block incoming mail connections. Occasionally I get messages like the following in LogWatch:
Code:
****** Detail (1) ******************************************************************************** **
1 Connections lost (inbound) --------------------------------------------------------------
1 After CONNECT
144 Delivered -------------------------------------------------------------------------------
144 myserver.example.com
3 Sent via SMTP ---------------------------------------------------------------------------
3 mysite.net
1 Hostname verification errors ------------------------------------------------------------
1 Address not listed for hostname
1 178.79.187.64 nbi.guv.ph
=== Delivery Delays Percentiles ============================================================
0% 25% 50% 75% 90% 95% 98% 100%
The myserver.example.com and mysite.net are mine, but nbi.guv.ph has no business on my server.
Still lots to learn, but I would like to start self-hosting this month. I have resources to further study Nginx, Bash, ... but can you recommend books/sites for iptables and security (keeping hackers out and what to do if they got in, and how to detect that).
Thanx,
pannix