Archive | February 21, 2011

Notes from NH Ruby/Rails, 21-Feb-2011

Eight attendees made it to the February meeting of the New Hampshire Ruby Rails group at the New Hampshire Innovation Commercialization Center. A round of introductions included the usual suspects and several new people with interesting backgrounds and interests.

Brian Turnbull talked about Ruby debugging. He had a sample he created on Github Ruby comes with it’s own debugging library, but you can add a good one with a gem: ruby-debug.
Commands:
list – lists the code currently load
next – steps through the code listed, but skips over subroutines.
step – steps into the code
where – dumps the stack
finish – finishes the current subroutine call
display – dumps a value
(commonly use display value.inspect to make a cleaner display)
pp – pretty print, evaluates any Ruby code you want
edit – launches the EDITOR variable in our shell
catch – catch exceptions
cont – continue
break – set a breakpoint

,,, and so forth. Use the help, it is your friend.

The second example is far more complex, with a Sinatra app using OmniAuth and an LDAP provider. Following the supplied documentation, the app crashes on startup. (That’s what you get for reading the docs!) Debug and another tool – rbtrace to the rescue! Excellent demo of the problem and how the tools can debug them.

Fail2Ban more skript kiddies poking 404 files

I review my web server logs pretty regularly, and there’s a pattern of 404’s I’ve seen recently that I haven’t been blocking up until now: searching each directory for ‘contact.php’ or ‘setup.php’ — the latter often searching for every variety of phpMyAdmin. I don’t have PMA on my machine, but I’d sure make sure I read all the instructions and removed setup.php if I had! (And you should, too!) I found this link that adds a simple test and rules using Fail2Ban to temporarily banning sites that hit too many 404’s too fast. I’ll have to see if this bonks too many search engines.

http://www.barbarycodes.com/2010/10/06/automated-banning-of-script-kiddies-with-fail2ban/

Powered by WordPress. Designed by Woo Themes

This work by Ted Roche is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States.