Is it normal to get hundreds of break-in attempts per day?
serverfault.com
serverfault.com
The data is quite interesting.
Here's a snapshot of where most "attacks" to my honeypot originate from (the more, the brighter): http://darkpan.com/files/latlong255.png
# accept traffic to the normal ssh port
iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT
# accept traffic on the port kippo is listening on
iptables -A INPUT -i eth0 -p tcp --dport 2222 -j ACCEPT
# direct traffic inbound on port 22 to port 2222
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 22 -j REDIRECT --to-port 2222
Make sure also to add an ACCEPT rule for traffic to whatever port sshd is actually bound to.Damn little arrows and imprecise HTC touchscreens... downvoted you by mistake
Crashing the ssh daemon isn't always easy, but, making the job easier for an attacker because 'obscurity' is considered a good protection scheme in this case opens up other potential vulnerabilities.
Just use Single Packet Authorization, people.
On my on personal servers? Single-packet or port knocking or whatever, it's fun to play around - that's how you learn. At the enterprise? The internet can't ssh to anything - you need VPN access, and not just any but the correct VPN access, and the right credentials on audited machines. There's nothing for outsiders to knock on (except maybe the VPN - but that has auto-lockout and password rotation tied into the enterprise auth system)
If someone wanted to do port knocking or similar for enterprise stuff I think that'd be a staunch "Umm, no"
Same goes to port-knocking.
Just throw in denyhosts/fail2ban, and follow simple rules (no root login, no password/keyboard-interactive logins, possibly, except for special emergency "oh-shit-i've-lost-my-keyfile" account with secure passphrase and non-dictionary username), and you'll be perfectly safe.
On the other hand, most drive-by attackers won't bother going for the other ports. Perhaps you can make some argument involving the probability/entropy/information of the attacks vs your defenses.
RewriteRule \.(asp|aspx|php|jsp)$ - [F,L,NC]
RewriteRule (w00tw00t) - [F,L,NC]
RewriteRule (phpmyadmin) - [F,L,NC]
RewriteRule (php-my-admin) - [F,L,NC]
That cuts off those requests before they hit a Rails process and suck up any additional resources.
url.redirect = (
"^(.*)php(.*)$" => "http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.37.3.tar.bz2",
# other stuff
)
I do not use php on the server.. I don't know if these kits end up downloading the kernel or not, though.Just throw the request away or return a 404 at the load balancer level.
If you're on Apache use mod_security, if you're not put Varnish in front and configure it to return simple 404 errors on such pages.
But don't mod_rewrite, redirect or otherwise throw traffic onto someone else's server, let alone one that will result in a traffic cost for them.
Yeah, point them at microsoft.com instead! Should be easy to find a hefty service pack or DirectX install for the bots to hit...
Am I missing something here, or is this actually a decent idea?
Edit: I just tried this in IE on my Win box; the connection even stayed open for a good long time! Firefox blocked it, though, which is probably good.
But, I do wonder if there is some other way to do the same thing. Perhaps we could setup some kind of tarpit like server that sends out a file very slowly... like .1K / sec (~1 packet every 10 secs). Just enough to keep their connection alive, but slow enough to not use too much bandwidth.
But, I'm not sure if this would be any better than just sending a 404 quickly.
I also put in an output line so I can see what passwords they're guessing.
I prefer port knocking or two factor auth as a solution to brute force attacks. http://code.google.com/p/google-authenticator/
http://configserver.com/cp/csf.html
It's fantastic. Among a million other things, monitors logs for several kinds failed login attempts and can automagically ban them via iptables (with timeouts if you so desire).
Be sure to donate to keep this fantastic software alive if you use it.
sudo apt-get install denyhosts
Job done.It requires maybe 7-10 lines of configuration to have a fairly well-insulated system:
# config/moonshine.yml
:ssh:
:port: 9024
:allow_users:
- rails
# app/manifests/application_manifest.rb
configure({
:denyhosts => { :admin_email => 'admin@example.com' }
})
recipe :ssh
recipe :iptables
recipe :denyhostsSSH is easy. Get a static ip or figure out the ip range for your ISP. Drop any connection not in that IP range using iptables on that port. Done.
HTTP requires more creativity. It really depends on how you have things set up. I have a honeypot default vhost on Apache. If you enter just the IP address for the server, you get the honeypot. That's what most of these bots will hit. The 404 errors caused are very annoying and mess up the logs. On the honeypot, I have a RewriteRule that rewrites anything that would cause a 404 to index.html which is a blank page.
I got an automated email every time somebody failed to log in, so my iPhone was plinging every few seconds for 30 minutes before I added a filter in GMail to mark those mails as read. I've since installed fail2ban.
Try this in Nginx server config: if ($request ~* "^[^ ]+[ ]+[^:]+://" ) { return 444; }
444 is nonstandard Nginx code that closes the connection without sending any headers.
Link: http://ossec.net
Well - actually, no. Mere hundreds are kind of abnormally low.
Use ssh-keygen to generate a key and copy the contents of the .pub to your ~/.ssh/authorized_keys and disable PasswordAuthentication in /etc/ssh/sshd_config and /etc/init.d/ssh reload