Archive | LAMP

Linux Apache MySQL Python Perl PostgreSQL

Adding Fail2Ban to the web site

I swapped out web servers two weekends ago, when the old machine started showing some unacceptable behavior. Part of that swap involved switching from a CentOS-based Linux distribution to an Ubuntu-based distribution. There were some great learning moments involved in that. I also wanted to swap out a few programs that hadn’t worked as well as I had hoped.

One of the new packages I’m trying out is Fail2Ban, an Python-based application to review the logs and temporarily bans IP addresses based on the patterns of abuse. Similar applications like DenyHosts are well-rated, but DenyHosts specializes in ssh, which hadn’t been too much of a problem for me, and didn’t have a straight-forward configuration for ftp, which unfortunately I must offer. I had used a similar Perl-based application before, but it hadn’t supported a couple of a my applications, and appeared to introduce some instability in the system. Fail2Ban came with configurations for Apache 2 and vsftpd. In their wiki, there was a HOWTO for banning PHP-based file upload attacks, something which had begun to fill the logs with nonsense.

So, 48 hours in and things seem to be running well. The log files clearly show some applications being blocked, other applications seems to be running well, and performance and responsiveness of the site seems to be okay.

Notes from Python Special Interest Group, 27-August-2009

Twelve folks attended the August meeting of the Python Special Interest Group, one of the most active chapters of the Greater New Hampshire Linux User Group. The meeting was held on the regular night, the fourth Thursday of the month at the Amoskeag Business Incubator in Manchester, gathering at 6:30 with the formal meeting starting at 7 PM.

I gave the usual pitch about the GNHLUG, checking the calendars for upcoming meetings, joining the announcement mailing lists for low-traffic meeting announcments, or the GNHLUG and PySIG discussion list for slightly-higher traffic but high-quality technical discussions, and mentioned some of the upcoming meetings. I also reminded members that user group discounts are available from many of the book publishers, and that if they are interested in reviewing a recently released book, I can request one through the user group program.

Software Freedom Day is coming up September 19th, and Arc will be running an event in Manchester. Keep an eye on the mailing list for further details.

Mark talked about his monthly Tech Talk presentations in at the Lawrence Library in Pepperell, MA (next meeting, September 30th), and his Tech Talk newsletter. Mark is doing a great job getting the word out there and spreading the message about Free/Open Source to non-technical folks. He’s also tried to get a hearing about Open Source in his local schools, but without much luck. Mark also pointed out the new Full Circle magazine Issue 27, which starts a tutorial series on Python.

Arc Riley gave a quick demo of Crunchy, a python-based local web server for serving Python tutorials. Looks neat.

Arc talked about the Python Software Foundation and the Google Summer of Code and also here. The project Arc mentored helped to develop the 3to2 program for rolling back code written for Python 3 to run in Python 2.x. While the code is still in an alpha state, it successfully performs a lot of the conversion needed, and will continue as a framework for the final product. Arc managed the GSOC for the PSF. The Python Software Foundation had the second largest number of sponsored GSOC projects (Apache was #1) and most were completed successfully. Thanks to Arc for a lot of hard work this summer!

Kent S. Johnson talked about itertools. Itertools provides a simple way to represent and manipulate large sequences of numbers without the necessity to consume large memory and CPU resources with creating the entire sequence before iterating over the sequences. Starting with some simple examples of arrays and lists, sequences and generators, Kent built up examples (with some contributions from Bill Freeman) into a more complex problem that illustrated why itertools is so handy. Well done!

Bruce Labitt is almost single-handedly responsible for keeping the pysig mailing list going this summer. Bruce talked about the work he’s doing with intensive calculations and huge arrays. Bruce is building some complex simulations of radio waveforms and calculating various aspects of the radio waves for regulatory compliance. He’s using Python and NumPy and other libraries to generate test data and simulations, and interfacing common PCs with some supercomputing facilities for the heavy number-crunching. Very interesting talk.

Thanks to Bill Sconce for organizing the meeting, to Mark, Arc and Bruce for presenting, to Janet for the awesome cookies, to the Amoskeag  Business Incubator for the great facilities, and to all for attending and participating.

More links from NHRuby.org’s August dinner meeting

I was finally able to decode some of the scrawling notes I took at the NHRuby.org August dinner meeting, and found a couple more resources worth looking at. With our theme of “Where’d you learn that?” I’d recommend you check out these resources:

Dave Thomas, co-author of the original Pragmatic Programmer and proprietor of the same-named shop, has a series of videos called “The Ruby Object Model and Metaprogramming” that one attendee thought was well worth watching.

Another recommendation was to check out Topher Cyll’s book, “Practical Ruby Projects: Ideas for the Eclectic Programmer” for some interesting insights into Ruby.

Notes from NH Ruby group, 20-Aug-2009, “Where’d you learn that?”

Eight folks enjoyed an excellent dinner at The Rosa Restaurant. We had a private room upstairs where we could woot and yell over each other and tell geek jokes without inhibitions, not that that has ever stopped us before.

Nick Plante mentioned Rails Rumble coming up this weekend. Watch for some incredible apps coming from the Rumble. Can’t wait to see the winners.

Adam Bair brought along two books, Kent Beck’s “Smalltalk Best Practice Patterns” (ISBN 978-0134769042) and Martin Fowler’s “Refactoring” (978-0201485677). Adam credit both books as being very helpful for his practice in the past several years where he has had to refactor a lot of code in rescuing lower-quality Rails projects.

Adam also mentioned an inspirational presentation by Marcel Molina, Jr. at Ruby Hoedown 2007 called “Beautiful Code” (http://rubyhoedown2007.confreaks.com/session09.html) – Adam recommends the higher quality videos as they include video/slides side by side – and also browsing much of the confreaks.com site for some great videos.

Russ talked about Peepcode videos (http://peepcode.com), which he really appreciates. In particular, he mentioned the most recent, Advanced Command Line, helped him debug an unusual problem he was having with one remote client whose shell behaved incorrectly. He’s used inspiration from that video to reconfigure the way he uses his shell. Russ also mentioned Ryan Bates “RailsCasts” (http://railscasts.com/) as very useful, and in particular, thought that the three part series on forms (link updated; thanks, Russ!) changed the way he developed Ruby apps.

I talked a little bit about “The Well Grounded Rubyist” (ISBN 979-1933988658) by David Black, which has helped me fill in some of the background of how and why Ruby behaves the way it does. I also passed around Jason Clinton’s “Ruby Phrasebook” which is a handy book of recipes on how an experienced Rubyist is likely to solve common problems like parsing config files or processing XML.

Nick mentioned that he’s using the unix screen command to do screen-sharing for remote pair-programming and you could see the lightbulbs go off over people’s heads (“That’s my payoff for tonight!” one attendee exclaimed.) He’s also working with EC2 instances and is fired up over how simple and powerful they are. Nick promised a followup, perhaps a demo at a future NHRuby meeting, and Casey mentioned that there’s someone local who’s been doing demos on the Amazon Web Services offerings – we hope to come up with some contact info and see if we can schedule a presentation.

The group also talked about how, as a group, we might contribute to one particular open source project. A couple of ideas were batted around. I look forward to hearing more about this idea.

The night’s theme was “How do you know that?” and I asked about how people are keeping up on all the news about what’s happening. We didn’t really come up with a list of links or blogs or news sites, so if you think of any now (or have your bookmarks handy for sharing), I’d appreciate you passing them on and I’ll include them in the meeting notes.

Thanks all, for a fun dinner amongst friends and some inspiring ideas!

NHRuby, August 20th, The Rosa Restaurant

Some of the best user group meetings I have attended have been those with the most relaxed format, where the group pretty much steers the conversation to whatever is most interesting to them.While the formal presentations by experts are great for getting some deep and rich information across, the wide-ranging discussions of an informal meeting can stretch the breadth of your knowledge.

So it is that the August 20th meeting of the New Hampshire Ruby group will take place at 7PM at The Rosa Restaurant on State Street, Portsmouth, NH. We’ll have a good meal and swap ideas about where to learn more about Ruby. The announcement. more details and directions can be found on the NHRuby.org web site. Hope to see you there!

Pro Git

Congratulations to author Scott Chacon and publisher Apress for the newly-released book, “Pro Git,” a book about the professional use of Git, the version control system. Git is the engine beneath the popular GitHub.com site where much of the Ruby on Rails community does their development. Git is also the core of the version control system for the Linux kernel. Kudos to both author and publisher, for releasing the book under a Creative Commons Attribution-Non Commercial-Share Alike 3.0 license. This is a valuable service to the community so that search engines will find authoritative information on Git, and also serves as great advertising for the book. Apress will be providing a review copy for the GNHLUG members to review; keep an eye out for a review soon! And if you’re using Git as part of your professional work, consider purchasing the book to thank Scott for his efforts and APress for their wisdom in releasing the book on the web.

Notes from MonadLUG, 9-July-2009, Charlie Farinella and OpenBSD

Seven people made it to the July meeting of the Monadnock Linux User Group, MonadLUG, held as usual on the second Thursday of the month at the SAU #1 offices in Peterborough. (Note that there will be no August meeting.) MonadLUG is one of the many chapters of the Greater New Hampshire Linux User Group; keep an eye on that web site (and the mailing lists linked off that page) for announcements and upcoming meetings.

Charlie talked about his job and the many uses they have for some legacy machines (older PowerPC Macs, Pentium-150 boxes) that could be useful as single-task machines running mail server, router, firewall or other similar tasks. CentOS or other modern distros are too complex and demand too many resources, especially for older machines or VMs within a machine. OpenBSD has low resource requirements, a strong reputation for security and ‘correctness,’ ease of use and configuration. He showed a couple of virtual machines (VMs) running inside of VirtualBox on his ArchLinux ThinkPad. Charlie walked us through a basic installation, using an .iso of OpenBSD that appears as a CD to a new VM. He talked about network configuration, package management, ports, pf configuration, runlevels, service configuration and more. There were slides; I’ll post a URL if Charlie’s willing to send them along. OpenBSD looks like an ideal, minimal OS for a dedicated-function machine.

Finishing a little early, Charlie talked about his company’s move to Zimbra and the kinds of collaboration they plan to do with it. Audience participation about other competing packages like eGroupware and LifeRay was quite interesting. A replacement for Exchange and/or Sharepoint is needed in a lot of companies, and this seems to be a popular FAQ.

Note there is no August meeting, as MonadLUG takes a summer break.

September 10th will have the MondaLUG host a presentation by Patrick Galbraith. Pat blew us away with his first presentation on MySQL. This is a not-to-be-missed meeting for anyone using MySQL.

Thanks to Charlie for the great presentation and to Ken and the SAU for the fine facilities.

Fedora display switching rocks!

Just a note of praise to the Fedora distribution and the recent updates to Linux, X.org et al for getting display switching to work, at least on my laptop.
For years, it’s been a running joke that the first 10 minutes of every LUG presentation is spent watching the speaker (and too many helpful volunteers) struggling to get their laptop to properly display on the projector. (I’ve noted the equivalent at Rails meetings is everyone digging around in the bottom of their bag for the properly-matching MacBook-to-VGA adaptor.)
At the most recent CentraLUG meeting, I just plugged my running Thinkpad T61 laptop (running Fedora 10) into our ancient projector and had it immediately recognized! xrandr listed the VGA adaptor as 1024×768 and 800×600 (the higher format is interpolated — did I mention the projector was ancient?). The GNOME desktop menu options of System | Preferences | Hardware | Screen Resolution detected the display, also, and let me lower the screen resolution and mirror the two displays or align them side-by-side or top-to-bottom.
While I know other OSes have been doing this forever, this is a great milestone for Linux.

Notes from CentraLUG, 6-July-2009, Philip Sbrogna and WINE

Eight people made it to the July meeting of the Central New Hampshire Linux User Group, held at its July location of the Hopkinton Town Library.

Philip Sbrogna spoke and demonstrated Wine, the Microsoft Windows ™ API emulator for Linux. Phil showed us how the install and configuration occurs, using a first-person shooter installed from CD. We talked about the structure of the files installed (in the home directory, under .wine), how to reset the Windows configuration (delete everything under .wine and run wine again to rebuild the default structure), where the registry files are stored (in the directory above the drive_c directory), add-on tools that can help get specific applications running (Winetools, Wine-doors, Winetricks). Members had lots of questions, on- and off-topic, and discussion was vigorous and educational.

Tentative August meeting: a cookout, somewhere off I-93 exit 23. Stay tuned for details.

Thanks to Philip for making the trip and making a great presentation (despite projector difficulties) and to the Hopkinton Town Library for the facilities.

LESS, HAML, HTML Structure

A quick follow-up on the weekend posting about the Ruby group: there was mention of another package, LESS, that generates CSS as well. This might be worth checking out as well. I appreciate the feature that the CSS is static on the server and only generated when the plugin notes that the source file (with .less extension, of course) has changed. This speeds up serving the file, and speeds the responsiveness on the client, since nothing needs to be parsed, interpreted and applied.

In “It’s the Headings, Stupid!” Jon Udell points out that pretty visually-structured HTML still shouldn’t lose the structural power built into HTML: seven levels of headings, paragraphs, ordered and unordered list, definition lists, anchor tags, captions, titles and alt attributes. A sober reminder that not all the readers of our web sites are “ooh!” and “aah!” over our choice of colors or silly javascript animations, but are searching for content!

In a follow-up on Twitter, Pat Allen points to a SlideShare presentation with excellent audio of the Melbourne Ruby User Group and a presentation by Ben Schwarz “Why HAML Sucks or Why You Should Think Before Choosing HAML for Your Next Project” The long-winded title, Ben explains, is from an initially controversial title that got the conversation going, but was a bit too extreme. He makes some very good points in the presentation. I like the idea of audio synched with the slideshow; that works well. Obviously, hards-on presentations would have other challenges, but for a slide-heavy presentation, this works well.

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.