rem

.co

Iptables: Creating persistent bans from Fail2Ban

 |  700 words — 3 minutes  |  fail2ban firewall iptables linux php

On my servers I use the nifty program Fail2Ban to perform logbased automatic firewalling of ‘bad’ ip’s.

The idea behind this is easy: Some IP performs an action I don’t approve of. This can be any number of things, e.g. requesting pages in Apache that are commonly accessed by bots and/or scanners, or trying to log in to SSH with accounts that do not exist on the system. This bad behavior gets logged, and Fail2Ban keeps tabs on those logs, and using a number of rules it determines if a host is ‘bad’ enough to temporarily or permanently ban all access to the server. It does so by adding a few chains to Iptables (one for each thing it checks for), and dynamically adding/removing IP’s to/from these chains.

This all works perfectly. However, there’s one issue; When Iptables gets reloaded, it restores its default rules, removing the Fail2Ban chains and all the rules they contain, even if the ip’s in the chain were marked as permanent.

CSS: Overlapping Flash content with CSS

 |  300 words — 2 minutes  |  CSS

By default, flash movies are always shown on the top-level of a display tree.

However, it can be very useful to be able to move the flash content to the background, and having it overlapped by other content; e.g. You have a flash movie in the header of your website, but there’s a sidebar menu which should be displayed over the header.

PHP: Testing the Pseudo Random Number Generator

 |  400 words — 2 minutes  |  PHP

Every programmer uses them.. PRNG’s, better known as Pseudo-Random Number Generators; in PHP represented by the rand(min,max) function.

Unlike True Random Number Generators (TRNG’s) that use true random data like atmospheric noise to create their numbers, PRNG’s rely on software algorithms to come up with seemingly random numbers.. but are they?

And is there a difference between Linux and Windows PRNG results?

MySQL: The complete FULLTEXT checklist

 |  600 words — 3 minutes  |  MySQL

In an effort to help a colleague with FULLTEXT search troubles today, I tried to find out everything that could go wrong with setting up this search method on a table. My short research resulted in this checklist. Failure to comply with these checks will result in catastrophic failure :P

MySQL: Boolean substitution

 |  500 words — 3 minutes  |  MySQL PHP

Today I faced a quite interesting problem, that originated from pure laziness. I’m developing a backend system for a quite complex database structure. Within this backend, an almost limitless amount of table views have to be created for the end user. Because I’m extremely lazy, and didn’t want to develop the html view code for each table view, I created a PHP html-table-generator-class, which takes a mysql_result_set as parameter, and outputs the html table in string format.

This method works great, unless for some cases, where a value in the query has to be substituted by a user readable value. A boolean is a good example of such a value.