Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Need to ban IP address with hosts file

Need to ban IP address with hosts file
Thread Tools
Mac Elite
Join Date: Feb 2002
Location: Hilton Head, SC
Status: Offline
Reply With Quote
Mar 30, 2005, 09:59 PM
 
Where are the hosts allow and hosts deny files? I need to ban an IP address...
     
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
Mar 31, 2005, 09:33 AM
 
man ipfw
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
Mar 31, 2005, 09:38 AM
 
It's a simple as

ipfw add deny all from xxx.xxx.xxx.xxx to any

to not allow inbound xxx.xxx.xxx.xxx

ipfw add deny all from any to xxx.xxx.xxx.xxx

to not allow outbound to xxx.xxx.xxx.xxx
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
Junior Member
Join Date: May 2004
Status: Offline
Reply With Quote
Mar 31, 2005, 10:28 AM
 
http://www.hmug.org/HowTos/tcpwrappers.html
see also 'man 5 hosts_access' & 'man 5 hosts_options'
     
Mac Elite
Join Date: Feb 2002
Location: Hilton Head, SC
Status: Offline
Reply With Quote
Apr 1, 2005, 08:42 PM
 
I found somebody trying to use an ssh brute forcer on my ssh session in my snort logs

Thanks for the help!
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Apr 5, 2005, 10:14 AM
 
Just for future reference's sake: /etc/hosts.allow and /etc/hosts.deny, if they're not there you, can create them.
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
ink
Mac Elite
Join Date: May 2001
Location: Utah
Status: Offline
Reply With Quote
Apr 10, 2005, 04:31 PM
 
Originally posted by Tyler McAdams:
I found somebody trying to use an ssh brute forcer on my ssh session in my snort logs.
I see that ALL the time nowadays. They're automated bots looking for low-hanging fruit. Just make sure you have good passwords and no 'guest' accounts.

EDIT: Also, be careful with tcpwrappwers, not all services honor it. ipfw is a better choice.
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Apr 11, 2005, 04:22 PM
 
Yeah, I have seen that a lot. Disabled sshd myself recently - I don't use it enough to warrant the security risk. Another hint, btw: use non-obvious usernames. Don't ever enable root, www, guest, etc for login.
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Apr 11, 2005, 06:21 PM
 
Originally posted by ink:
EDIT: Also, be careful with tcpwrappwers, not all services honor it. ipfw is a better choice.
I use a combination of both. Well, portsentry does, but I've got a script cronned up to text message/e-mail me when it detects failed passwords or illegal login attempts via ssh. I try to at least go check it out at my next convenience.
Originally posted by P:
Yeah, I have seen that a lot. Disabled sshd myself recently - I don't use it enough to warrant the security risk. Another hint, btw: use non-obvious usernames. Don't ever enable root, www, guest, etc for login
I use ssh too often (and scp, which piggybacks on ssh) to disable it, so I just lock it down. There are some simple things that you can do to your /etc/sshd_config file to tighten security, here's one:
Code:
DenyUsers nobody,root,daemon,unknown,smmsp,lp,postfix,www,eppc,mysql,qtss,cyrus,mailman,appserver
My god it's annoying how it breaks that line. But you get the point. If you explicitly deny access to those system users then you'll be just fine. Note: There's also an "AllowUsers" directive as well, which is somewhat more of a pain in the butt depending on your setup. You'd have to remember to add new users to your config whenever you handed out a new shell account (and DenyUsers is more liberal, but works nice for locking out users that you KNOW shouldn't have access).

"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Apr 12, 2005, 03:40 PM
 
Good hint. Thanks, I'll remember that whenever I get around to enabling sshd again. Right now it's not urgent - I can't use SSH from work at the moment because of the firewall settings. One of these days I'll set something up with sshd listing on port 80 - that gets through - but I don't need to right now.
     
Mac Elite
Join Date: Feb 2002
Location: Hilton Head, SC
Status: Offline
Reply With Quote
Apr 15, 2005, 02:11 AM
 
That is good... does it matter where I put AllowUsers ?
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Apr 15, 2005, 03:01 AM
 
Nope, as long as it's in sshd's config (/etc/sshd_config on Mac OS X). You don't have to restart the daemon either, changes "take place" immediately.
(Last edited by [APi]TheMan; Apr 15, 2005 at 03:09 AM. )
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Mac Elite
Join Date: Feb 2002
Location: Hilton Head, SC
Status: Offline
Reply With Quote
Apr 15, 2005, 03:37 AM
 
Thanks! One mo question...Does any modified line in that config file need the # subtracted out? Is that perl?
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Apr 15, 2005, 08:11 PM
 
Yeah, you need to take that "#" out. In most config files those signify a comment.
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Senior User
Join Date: Sep 2002
Location: Canastota, New York
Status: Offline
Reply With Quote
Apr 16, 2005, 12:50 PM
 
I run an OpenBSD server that used to be constantly hammered by these SSH-bots.

Once I changed to port from 22 to something else, the attacks stopped.
     
Mac Elite
Join Date: Feb 2002
Location: Hilton Head, SC
Status: Offline
Reply With Quote
Apr 16, 2005, 01:59 PM
 
Originally Posted by [APi]TheMan
Yeah, you need to take that "#" out. In most config files those signify a comment.
That's what I thought.. thanks for all the help!!! the attacks have subsided.
     
   
Thread Tools
Forum Links
Forum 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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 05:01 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2