Blogs

Rejecting routes - One way to stop abusers.

Rejecting a route, or null routing is a quick and easy way to stop a DOS or prevent someone from accessing your server. Now I should warn you, this is not a great solution, but it works. There are better ways of doing this with firewall rules.

Mounting ISO Images using the loopback device.

Mounting an ISO image via the loopback device, so that you can view/edit the files before burning a CD/DVD.

I found this text on a download page at http://www.linuxhelp.net/linux_downloads/

Once you've downloaded an ISO Image you can mount it as a loopback device. This will give you access to the files in the ISO without you having to burn it to a CDROM first. In order to do this you must have loopback compiled into your Linux Kernel. (Most newer distributions will have this enabled by default).

SSH and NAT Disconnects.

Have you ever noticed that your ssh sessions will disconnect if idle to long, no matter what you set the idle time out and keep alive settings at? This can be quite annoying when you are trying to administer a few boxes and you are working between different ssh sessions in different windows..

This is usually the result of a packet filter or NAT device timing out your TCP connection due to inactivity. You can enable ClientAliveInterval in the server's sshd_config, or enable ServerAliveInterval in the client's ssh_config (the latter is available in OpenSSH 3.8 and newer).

Enabling either option and setting the interval for less than the time it takes to time out your session will ensure that the connection is kept "fresh" in the device's connection table.

Limit visit count with cookies and PHP.

I had a need to limit how many times a page could be refreshed in a set amount of time. This was to prevent abuse of a whois web application I had written.

Here is a proof of concept that I wrote, and then based my real code on this.

Make Gmail labels act like folders.

Here are some directions on how to make the gmail system work more like folders instead of labels. I have had a couple users on my gmail for domains complain that everything is in their INBOX, and they want to be able to move things into other folders. Here is how I told them to do it.

HOWTO Create and Install a self signed SSL key

Creating a self signed SSL key in RedHat Linux.

Step 1: Create a key

/usr/bin/openssl genrsa 1024 > /etc/httpd/conf/ssl.key/server.key

Step 2: Install the key

cd /usr/share/ssl/certs

make testcert

You will be prompted for server information, fill it all out, and once the key is installed re-start the web service.

/sbin/service httpd restart

Bulk adduser script

In 2007 Our Exchange server at work crashed, and we needed a way to still let our users have e-mail, so one of the admins asked me if they created a list from the active directory server, if I could write a script that would bulk add all the users and set a temporary password for them. etc..etc..etc.

I said sure thing.. so here is what I did..

NOTE: This works on RedHat Enterprise Linux.. you may need to adjust the adduser parts to make it work with your flavor of linux.

First off, this is what the data from the AD server looked like.

Simple java script agree/not agree form

This was actually one of my more popular wiki entries..

I wrote this little form that will only let you submit it if the agree box is checked.. It was used when I had to show an EULA and needed the user to agree to it before he continued.

Perl - Dos2Unix

When dealing with text files that are sent to you from a Windows machine, you sometimes run into issues where the end of line is a ASCII code sequence CarriageReturn,LineFeed. Where the UNIX (Linux) world is expecting a just a line feed. This can cause strange formatting issues when trying to parse out files with perl (and even PHP).

PHP Code Form Confirmation

Here is some code I use to confirm the data from a form. I uses an array called fieldname, if there is not a matching array entry in fieldname and $_POST, then it will not display that field.

The fieldname array stores the display text for the field.. So the key is the field name, the data is the display text.


<?php
$fieldname = array (
"firstname" => "Your First Name",
"lastname" => "Your Last Name",
"email" => "Your E-Mail Address"
);
// I use the name action for my submit button, and if the value is "Submit Form" I think call the confirmform code.

Powered by Drupal - Design by artinet