Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Secure configuration?
PostPosted: Wed Nov 04, 2009 4:13 pm 
Offline
Junior Member

Joined: Wed Nov 04, 2009 5:22 am
Posts: 27
I am setting up my first Linode and I am wondering if I have a secure configuration.

* I am using Gentoo, currently running sshd and qmail, but anticipate adding Apache, MySQL, and PHP in the future.

* I have sshd (w/ tcpwrappers) set up with AllowUsers <myID>, PermitRootLogin No, and only public key auth.

* qmail is configured with xinetd (w/ tcpwrappers) instead of tcpserver and utilities.

* My hosts.allow allows only my home IP and work subnet access to sshd. It allows everyone access to SMTP. (I have DenyHosts installed, but it is rather pointless right now because I have sshd locked to IP addresses in hosts.allow.)

* I am running Shorewall as a firewall. It is configured to accept Web, SMTP, and SSH traffic. (from anywhere)

* I am not using grsecurity or PaX.

Questions:
1) Is this a secure configuration/am I missing anything? I am a little nervous since I haven't done all of this before and I really don't want my box to get hacked.

2) When I add Apache, I think I can not chroot it if I use the package manager to install. Is it worth hassling with this (conducting a manual install)? Assuming I follow basic security configuration instructions setting up Apache, MySQL, and PHP, and also install mod_security, how much additional risk is there in running these too?


Top
   
 Post subject:
PostPosted: Wed Nov 04, 2009 9:32 pm 
Offline
Senior Member

Joined: Sun Aug 02, 2009 1:32 pm
Posts: 222
Website: https://www.barkerjr.net
Location: Connecticut, USA
Something I like to do is install Logwatch. Logwatch is a Perl script that runs in a daily cron job that scrapes the system logs and emails root a report about what's happened in the past day.

Another thing, make regular backups. Assume that after compromise, you'll want to quickly delete the server and restore from backups. Beta backups (see the forum) are OK, but keep all your data backed up as well.

The stuff you're describing is much more than what I do on my servers. Don't worry about it, and have fun.


Top
   
 Post subject:
PostPosted: Mon Nov 16, 2009 4:08 am 
Offline
Junior Member

Joined: Wed Nov 04, 2009 5:22 am
Posts: 27
OK, thanks. I will check into logwatch. Right now I am using logcheck, but I don't really like it. One thing is that it prints the same warning in multiple categories.

I have also heard of OSSEC so I am looking into that as well.

I guess I really just needed a little confirmation someone else that I wasn't missing something glaringly obvious. :)

So far my Linode is running qmail and I changed my mail server DNS to point to it instead of my old shared hosting account. I also installed Apache, MySQL and PHP but am not running them publicly yet. Pretty soon I will be able to turn off that other account entirely. :)


Top
   
 Post subject:
PostPosted: Mon Nov 16, 2009 3:26 pm 
Offline
Junior Member

Joined: Sat Oct 24, 2009 2:16 pm
Posts: 21
Did you change the ssh port to be something random?


Top
   
 Post subject:
PostPosted: Mon Nov 16, 2009 6:53 pm 
Offline
Senior Member

Joined: Thu Apr 08, 2004 3:24 pm
Posts: 92
ICQ: 3765104
Website: http://www.unixfool.com
Yahoo Messenger: wigglit2001@yahoo.com
Location: VA
mosdl wrote:
Did you change the ssh port to be something random?


IMO, I don't think changing the sshd listening port is going to make him any more secure than him already using key authentication. It may cut down on the 'dumb' scans (and having to log those 'dumb' scans), but any cracker worth his salt will scan for listening ports and learn the listening port regardless of what port is listening.

Fail2ban or denyhosts is a good option.

I also monitor with Snort and Modsecurity (those may be overboard for some, but I've a professional interest in such tools and I love the challenge of learning to set up and administer such tools).


Top
   
 Post subject:
PostPosted: Tue Nov 17, 2009 2:14 am 
Offline
Junior Member

Joined: Wed Nov 04, 2009 5:22 am
Posts: 27
mosdl wrote:
Did you change the ssh port to be something random?


Actually, I did at first but found it irritating and went back to the standard port. I had to configure my PuTTY configurations to all connect to the other port, and the protocol would not be displayed by name in netstat -l, etc...

I also didn't think it was getting me any extra security because an attacker could just nmap the machine and discover the port anyway. Since I am using public key auth, I think using a non standard port was only providing me a reduction in log reports and I didn't find it worth it.

If I configure denyhosts/fail2ban or some other active blocker I think I can safely just filter those reports out of the log files anyway...


Top
   
 Post subject:
PostPosted: Tue Nov 17, 2009 2:16 am 
Offline
Junior Member

Joined: Wed Nov 04, 2009 5:22 am
Posts: 27
unixfool wrote:
I also monitor with Snort and Modsecurity (those may be overboard for some, but I've a professional interest in such tools and I love the challenge of learning to set up and administer such tools).


Actually, I was running Snort on my home Linux firewall running IPCop until I installed a wireless router that included a firewall. I never really understood what the logs were telling me, though.

The tough part of all these log files and monitoring programs is knowing what is "important" and what is just background noise that is safely being blocked by your security programs. I haven't seen a good tutorial on this yet, though...


Top
   
 Post subject:
PostPosted: Tue Nov 17, 2009 10:46 am 
Offline
Senior Member

Joined: Sat Feb 14, 2009 1:32 am
Posts: 123
AtomicDog wrote:
mosdl wrote:
Did you change the ssh port to be something random?


I also didn't think it was getting me any extra security because an attacker could just nmap the machine and discover the port anyway. Since I am using public key auth, I think using a non standard port was only providing me a reduction in log reports and I didn't find it worth it.


Technically, you aren't getting any additional security, but security through obscurity can help. I ALWAYS change my SSH port because the problem isn't just those people who are trying to guess passwords that are problems.

What happens if there is a vulnerability that allows an attacker to bypass all authentication? Having SSH on port 22 would probably cause your system to be compromised almost immediately. You wouldn't have that same worry if it was on another port.

Also, it helps you prioritize. If I am running SSH on a different port then I have fewer attacks against SSH. It is those who find SSH on another port that I would worry about more. I would take information obtained from SSH and start blocking them at the firewall immediately. SSH attacks on ports other than 22 rank much higher on my "oh crap" list than standard port 22 attacks. If you don't run SSH on another port you are going to have a lot of noise.

AtomicDog wrote:
I had to configure my PuTTY configurations to all connect to the other port, and the protocol would not be displayed by name in netstat -l, etc...


You can save your connection information in PuTTY. I run SSH on a different port and I don't have to type it in every time. Just once.

Don't rely on the service information in netstat. Doing so can cause you to assume things that aren't true. I might see SSH listening in netstat when I am really running a web server on port 22. If you really want the service names to work, edit the /etc/services file and netstat will show the correct name.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group