Results 1 to 12 of 12

Thread: sshd_config

  1. #1
    Senior Member
    Join Date
    Feb 2004
    Location
    Maryland, USA
    Posts
    771

    sshd_config

    When out on the road I want to ssh into my home net. I've setup a dyn dns name, and I directed my router to fwd ssh traffic to my linux box. I altered sshd_config to have
    PermitRootLogin no
    AllowUsers myusername

    All of which enabled me to ssh in and feel somewhat secure.

    But reviewing my /var/log/auth.log Im getting lots of unwelcome and unsuccessfull breakin attempts. With enough tries (currently occurring every 2 seconds) I'm concerned those bad boys might eventually crack my uname and pwd.

    Should I somehow shutoff pwd authentication and just make sure I carry around my id_rsa private key and use it on the inbound pc? How do you road warriers practice safe ssh?

  2. #2
    Administrator Bok's Avatar
    Join Date
    Oct 2003
    Location
    Wake Forest, North Carolina, United States
    Posts
    24,471
    Blog Entries
    13
    I've been doing it for years and have probably had multiple millions of attempts to get in without success...

    Anyway, what I tend to do is port forward some other port like 8456 or so to 22 on a machine and make sure it has a password which is not easily crackable. 8 digits with numbers and upper/lowercase virtually guarantees that any password generator won't get in...

    BOk

  3. #3
    =>Team Joker<= LAURENU2's Avatar
    Join Date
    Dec 2004
    Location
    Chicago IL USA
    Posts
    5,478
    Blog Entries
    1
    Use the best password Team_Free-DC It is almost unbeatable

  4. #4
    Keeper of the Fridge PY 222's Avatar
    Join Date
    Jul 2002
    Location
    San Jose, CA
    Posts
    2,706
    Quote Originally Posted by LAURENU2
    Use the best password Team_Free-DC It is almost unbeatable
    I don't know about that Lauren.

    MerePeer, I get hit from this bruteforce attacks all the time and when it gets bad, I got logs worth MBs on a daily basis from my Logwatch.

    Just change the default port to something else like what Bok recommended and you should eliminate alot of the bruteforce. Also, a strong password is very important.

  5. #5
    Big Fat Gorilla guru's Avatar
    Join Date
    Dec 2001
    Location
    Warren, OR
    Posts
    501
    Yea, I had the same issue so I just changed the port on my firewall to 223 and had it forward the the standart port 22 on my internal server. SSH login attempts went away after that.
    I'm having fun!!! I'm just not sure if it's net fun or gross fun.

  6. #6
    Target Butt IronBits's Avatar
    Join Date
    Dec 2001
    Location
    Morrisville, NC
    Posts
    8,619
    You guys are sneaky and sharp!

  7. #7
    Administrator PCZ's Avatar
    Join Date
    Jun 2003
    Location
    Chertsey Surrey UK
    Posts
    2,428
    I do the same thing with Terminal Services.
    Let the router translate a high port number on the outside to 3389 on the inside.

  8. #8
    Stats God in Training Darkness Productions's Avatar
    Join Date
    Dec 2001
    Location
    The land of dp!
    Posts
    4,164
    Another thing you can do, if you only log in from certain IPs (this doesn't work so well if you need to log in from all over) is set up an iptables rule to block requests to port 22 unless they come from a specific IP...

    It looks like this:
    Code:
    $IPTABLES -A INPUT -p tcp -i $WAN -d $SOURCE_IP --dport 22 -j ACCEPT -m state --state NEW,ESTABLISHED,RELATED
    There's also a ssh bruteforce killer in iptables:
    Code:
    $IPTABLES -A INPUT -p tcp -i $WAN --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP
    Which basically says that if there are 4 attempts in under 60 seconds to port 22, then start dropping requests from that IP.

  9. #9
    Good suggestions everyone. I have my firewall set to block the SSH port, with exceptions from the IP's I usually use. But that won't work if I'm travelling so I also have port-knocking setup so I can access the server when I need to from any IP if I know the correct "knock".

  10. #10
    Senior Member
    Join Date
    Feb 2004
    Location
    Maryland, USA
    Posts
    771
    I picked a new port and told the router to forward it instead of 22, then I setup a second ssh daemon with its own config file with a new "Port", "PidFile", and a new "AllowUsers" with 1 new user which has a complex password. After I ssh in I can just su.
    I left the original daemon on port 22 (lan access only) to make it easier when working inhouse.
    Thanks for the advice!

  11. #11
    has been eaten by a grue.
    Join Date
    Jun 2003
    Location
    Detroit, MI
    Posts
    384
    Just don't do what I did earlier this week, MeerPeer, and spend 2 days madly editing /etc/ssh/ssh_config, and wondering why it wasn't working...

  12. #12
    Free-DC Semi-retire gopher_yarrowzoo's Avatar
    Join Date
    Mar 2002
    Location
    Knoxville, TN
    Posts
    3,985
    yeah much like me with apache httpd files not got it 100% and Im thinking of upgrading im using a package (see other thread which right now I can't be bothered linking too it's been a long day)
    Semi-retired from Free-DC...
    I have some time to help.....
    I need a new laptop,but who needs a laptop when you have a phone...
    Now to remember my old computer specs..


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •