Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Title continuation would be “while having limited knowledge of Internet security”.

I have recently set up a small server with a low end computer running debian with the aim to use it as a personal git repository. I have enabled ssh and was quite surprised at the promptness at which it suffered from brute force attacks and the like. Then I read that this is quite common and learned about basic security measures to ward off these attacks (lots of questions and duplicates on serverfault deal with it, see for instance this one or this one).

But now I am wondering if all this is worth the effort. I decided to set up my own server mostly for fun : I could just rely on third party solutions such as those offered by gitbucket.org, bettercodes.org, etc. While part of the fun is about learning about Internet security, I have not enough time to dedicate to it to become an expert and be almost certain that I took the correct prevention measures.

In order to decide if I will continue to play with this toy project, I would like to know what I really risk in doing so. For instance, in what extent are the other computers connected to my network threaten as well? Some of these computer are used by people with even lesser knowledge than mine running Windows.

What is the probability that I get into real trouble if I follow basic guidelines such as strong password, disabled root access for ssh, non standard port for ssh and possibly disabling password login and using one of fail2ban, denyhosts or iptables rules?

Put another way, is there some big bad wolves I should fear or is it all mostly about shooing away script kiddies?

share|improve this question

migrated from serverfault.com Aug 26 '13 at 14:10

This question came from our site for system and network administrators.

    
I think you hit the nail on the head when you mentioned that you don't have the time or inclination to become an expert in $TECHNOLOGY security; this is the primary reason to use a hosted solution. The only other common argument in evaluating in-house vs hosting is the cost. Since github and the like are free, you're essentially giving up your personal time just to gain the knowledge of how to run a git repo. We can't tell you what you should be doing with your personal time, but in a professional situation this would make no sense. (caveat emptor: complicated situations have more variables). –  Chris S Aug 26 '13 at 14:09
1  
If you decide to run your own server, also add to your todo list regular checking for updates and security vulnerabilities for every service you run. Just setting it up is not enough. –  week Aug 26 '13 at 14:18
    
Two words: public keys, as @Stephane put it. Disable keyboard-interactive authentication and use only pubkey authentication. –  kostix Aug 26 '13 at 16:20

5 Answers 5

up vote 11 down vote accepted

IMO SSH is one of the safest things to have listen on the open internet. If you're really concerned have it listen on a non-standard high end port. I'd still have a (device level) firewall between your box and the actual Internet and just use port forwarding for SSH but that's a precaution against other services. SSH itself is pretty damn solid.

I have had people hit my home SSH server occasionally (open to Time Warner Cable). Never had an actual impact.

share|improve this answer
    
My Internet service provider provides a firewall whose parameters I saw when opening a port for ssh. Is it what you refer to? –  Alfred M. Aug 26 '13 at 13:05
2  
Could be, some ISPs give you a dumb device, some a router with a built in firewall. I'm just saying that it's NEVER a good idea to put a general purpose OS directly on the Internet no matter what precautions you take. You want some sort of hardware device (or something like DD-WRT) between you and the nasty. –  TheFiddlerWins Aug 26 '13 at 13:20
1  
Set up public key authentication as mentioned in another answer, and TURN OFF ChallengeResponseAuthentication and PasswordAuthentication in /etc/ssh/sshd_config. –  Randy Orrison Aug 27 '13 at 8:05

Setting up a public key authentication system with SSH is really trivial and takes about 5 minutes to setup.

If you force all SSH connection to use it, then it'll make your system pretty much as resilient as you can hope to without investing a LOT into security infrastructure. Frankly, it's so simple and effective (as long as you don't have 200 accounts - then it gets messy) that not using it should be a public offense.

share|improve this answer
1  
To force SSH connections to use public key authentication after you've set it up, make sure you TURN OFF ChallengeResponseAuthentication and PasswordAuthentication in /etc/ssh/sshd_config. I forgot this once, much to my regret (only once, and never again). –  Randy Orrison Aug 27 '13 at 8:07

I also run a personal git server that's open to the world on SSH, and I also have the same brute-force issues as you, so I can sympathise with your situation.

TheFiddlerWins has already addresses the main security implications of having SSH open on a publicly-accessible IP, but best tool IMO in response to brute-force attempts is Fail2Ban - software that monitors your authentication log files, detects intrusion attempts and adds firewall rules to the machine's local iptables firewall. You can configure both how many attempts before a ban and also the length of the ban (my default is 10 days).

share|improve this answer
    
As my comment on previous post stated, that's what my NAS uses at home, and after a couple of month, the amount of attemps has been significally lowered. –  Kwaio Aug 26 '13 at 14:33

The answers are very good, I would only recommend two things:

  • Consider access only by key authentication system
  • Use Denyhosts: It will ban hosts attempting to access your server with invalid auth
share|improve this answer

Another way to handle this is to set up a VPN. Rather than connecting directly to SSH ports on your home server, you connect to the VPN first, then run all your traffic over the encrypted, secure connection.

The ideal way to handle this is with a firewall that incorporates a VPN Endpoint, but you can also set up a Windows computer to act as a VPN server.

Here's an example:

http://www.howtogeek.com/135996/

Now keep in mind that a proper security configuration would involve a public (or semi-public) computer that's isolated from your internal network. A web server, or any computer hosting publicly available services, should be outside of your home or office's secure network. You would use 2 routers to create a safe zone, or a DMZ, between you and the Internet.

This way, if your server is hacked, it can't be used as a vector to attack your other computers.

So the setup would look like this:

DMZ Configuration

share|improve this answer
    
Sorry about the small image... I can't figure out how to edit my post. –  TomXP411 Dec 5 '13 at 22:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.