image
image

|


Go Back   macosx.com > Mac Help Forums > Unix & X11

Reply
 
Thread Tools
  #1  
Old March 8th, 2006, 05:47 PM
Registered User
 
Join Date: Sep 2000
Location: San Francisco
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
ericmurphy is on a distinguished road
Attacks via SSH

I have ssh enabled on my machine for remote access. Hey, it's better than telnet, right? Anyway, I was perusing the /var/log/secure.log file, and noted a lot of failed authentication attempts against what appears to be guesses of accounts on the machine (e.g., "test," "root," "user," "admin," etc.). This is worrying, obviously.

I really do need to keep ssh access enabled on my machine. But I really only need that access from one IP address. Granted, IPs can be spoofed, but it can't hurt to restrict access via SSH to certain IP addresses. Is there a relatively straightforward way to do this? I'm planning on purchasing a hardware firewall (mainly to close ports that I need open for LAN access that should be closed for WAN access) which should be able to do it, but in the meantime, it would be nice to do it via ipfw. Can I just edit the ipfw rules file?
Reply With Quote
  #2  
Old March 9th, 2006, 12:33 AM
tomdkat's Avatar
Registered User
 
Join Date: Aug 2005
Posts: 197
Thanks: 6
Thanked 0 Times in 0 Posts
tomdkat is on a distinguished road
You should be able to block incoming ssh connections from everywhere except for a single IP. I can't give you the ipfw rules, but I've done this kind of thing on Linux using iptables so I imagine OS X would be able to do this using ipfw.

Maybe this site might be of help.

Peace...
Reply With Quote
  #3  
Old March 10th, 2006, 03:48 PM
ksv's Avatar
ksv ksv is offline
liberal socialist
 
Join Date: Nov 2000
Location: Trondheim, Norway
Posts: 3,000
Thanks: 0
Thanked 0 Times in 0 Posts
ksv is on a distinguished road
You can also configure sshd to use private key authentication, which will make sshd impossible to break into with such automated «brute force» attacks. And/or block hosts after e.g. three failed attempts.
__________________
leo at code.coop

Co-operatives are private corporations based on the values of self-help, self-responsibility, democracy, equality, equity and solidarity.
Reply With Quote
  #4  
Old March 12th, 2006, 01:51 PM
Registered User
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
jmarcus is on a distinguished road
This problem is consistant accross the board. On my Linux machines I get about 1000 failed attempts a week. Recently I found www.denyhosts.com which checks your log files for failed logins and adds them to hosts.deny. Oh and KSV impossible is a big statement.

Take a look.
Good luck,
James
Reply With Quote
  #5  
Old March 12th, 2006, 06:04 PM
ksv's Avatar
ksv ksv is offline
liberal socialist
 
Join Date: Nov 2000
Location: Trondheim, Norway
Posts: 3,000
Thanks: 0
Thanked 0 Times in 0 Posts
ksv is on a distinguished road
Quote:
Originally Posted by jmarcus
This problem is consistant accross the board. On my Linux machines I get about 1000 failed attempts a week. Recently I found www.denyhosts.com which checks your log files for failed logins and adds them to hosts.deny. Oh and KSV impossible is a big statement.

Take a look.
Good luck,
James
I did not write impossible to break into, but impossible to break into with such automated «brute force» attacks.

Or should we say «everything is relative?»

Using a 2048 bit RSA encryption without public key negotiation, there are
2^2048 options. If every attempt takes a second, the process of breaking into the system will take up to 512382770029664626152886806961408421493596249836940069002573969868161072090117498940848576 413034523460310723632069666722065568860199310646484781715919081099705588491998049785828104 352967872464909881685032725576615245944613182073759542080389689183321768481193747404633480 586883110430393972088286388951204742546840648618536631479657768686018669058475647439851630 804125533665192576622089997370469599709287435260114529485642786931722449758249328480219490 385800882915259181977497317672021263906356654796478146856649236692953054382249942177172726 654064662440343346391459529319343046761137725218038879273780023006398 years.
__________________
leo at code.coop

Co-operatives are private corporations based on the values of self-help, self-responsibility, democracy, equality, equity and solidarity.

Last edited by ksv; March 12th, 2006 at 06:29 PM.
Reply With Quote
  #6  
Old March 12th, 2006, 06:19 PM
fryke's Avatar
Super Moderator
 
Join Date: Sep 2000
Location: macosx.com
Posts: 13,040
Thanks: 2
Thanked 0 Times in 0 Posts
fryke has a spectacular aura aboutfryke has a spectacular aura about
Only if it's the _last_ option, right. ... But really: The problem more often than not is not a brute-force attack but that OpenSSH has a known (and exploited) bug* which lets you somehow circumvent the security measures. Hence you have to turn SSH off if you don't need it and if you have to turn it on keep it updated well and, if you can, only let known IPs/hosts connect at all.

*Not talking about a specific bug here, of course.
__________________
MacBook Air 13" 1.6 GHz, 2 GB RAM, 80 GB HD. Mac OS X 10.5.4
MacBook 13" 1.83 GHz, 2 GB RAM, 160 GB HD. Mac OS X 10.5.4
Hackintosh Core2Duo 2.4 GHz, 2 GB RAM, 160 GB HD. Mac OS X 10.5.4
iPhone 3G 16 GB (v2), AppleTV 1G 40 GB (v2)

Mac user since 1987, Apple Product Professional 2007, 2008.
Reply With Quote
  #7  
Old March 13th, 2006, 12:03 AM
tomdkat's Avatar
Registered User
 
Join Date: Aug 2005
Posts: 197
Thanks: 6
Thanked 0 Times in 0 Posts
tomdkat is on a distinguished road
Quote:
Originally Posted by jmarcus
This problem is consistant accross the board. On my Linux machines I get about 1000 failed attempts a week. Recently I found www.denyhosts.com which checks your log files for failed logins and adds them to hosts.deny. Oh and KSV impossible is a big statement.
Do you mean DenyHosts?

Quote:
Originally Posted by fryke
But really: The problem more often than not is not a brute-force attack but that OpenSSH has a known (and exploited) bug* which lets you somehow circumvent the security measures. Hence you have to turn SSH off if you don't need it and if you have to turn it on keep it updated well and, if you can, only let known IPs/hosts connect at all.
I think this is a very important point to keep in mind. You do not have to have the ssh daemon running to make outbound ssh connections. You need to have it running only if you want to accept ssh connections to your machine from remote. If you always use ssh to connect to other machines, don't run sshd.

If you tunnel X over ssh, I'm not sure if you need ssh running or not.

Peace...
Reply With Quote
  #8  
Old March 13th, 2006, 09:32 AM
ElDiabloConCaca's Avatar
U.S.D.A. Prime
 
Join Date: Aug 2001
Location: San Antonio, Texas
Posts: 9,731
Thanks: 2
Thanked 36 Times in 34 Posts
ElDiabloConCaca will become famous soon enough
Quote:
Originally Posted by tomdkat
If you tunnel X over ssh, I'm not sure if you need ssh running or not.

Peace...
Just to confirm -- that's a negative. You do not need the sshd daemon running in order to tunnel X over ssh.
__________________
Power Macintosh G4/500MHz "Yikes!" 10.4.11 Server • 1024MB • 3 x 120GB + 320GB • DVR-111D • 2 x Radeon 7000 PCI • 2 x 17" CRT
MacBook 2.0GHz Core 2 Duo - White 10.5.4 • 2048MB • 80GB • CD-RW/DVD-ROM
iPod Photo 60GB • iPod nano 1GB • AT&T DSL 6Mb/768k
http://www.jeffhoppe.com
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Virgin France attacks Apple for monopoly chevy Apple News, Rumors & Discussion 12 July 11th, 2004 06:48 PM
Nimda attacks? Daeyin Apple News, Rumors & Discussion 2 February 1st, 2002 01:27 AM
Response to the attacks on the US? Matrix Agent Bob's Place 32 September 15th, 2001 01:53 AM


All times are GMT -5. The time now is 09:03 AM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.