but it’s got breaks!
Tom Hayward
Check me out:
Facebook
Flickr
Last.fm
Del.icio.us
Twitter @thayward
Comments:
I just added LineBuzz for comments. Just highlight the phrase you want to comment on, and click "Post an inline comment". You will need be registered with LineBuzz, but luckily this is simple and quick.Local Links:
Friend's Blogs:
Sold out to Lincoln…whatever pays the bills I guess. Can’t blame them for needing money. I only paid $10 for their show years ago.
Get APRS status via SMS/email
I wrote an email system that will email you a APRS station’s info (last heard time, position, and APRS status).
To use the system, just send an email or SMS (text message) to aprs@tomh.us with the station’s callsign at the start of the message. Emails must be in plain text format, not multipart/HTML.
You should receive a response in about a minute. It will look something like this:
WA7RVV-12 6min ago:
Saltese, Mt 59867, USA
/W2,MTN,LOOKOUT PASS
47.454167,-115.658333
I made you a 1234567890 countdown timer
Unix time will reach 1234567890 on 2009-02-13 15:31:30. I made a countdown timer in bash.
#!/bin/sh printf "\tUNIX TIME\t TO GO:\tDAYS\tHOURS\tMINUTES\tSECONDS\n" while true; DATE=`date +%s` SECONDS=$[1234567890-$DATE] MINUTES=$[$SECONDS/60] HOURS=$[$MINUTES/60] DAYS=$[$HOURS/24] printf "\t%s\t\t%4s\t%5s\t%7s\t%7s\r" "$DATE" "$DAYS" "$[$HOURS%$DAYS]" "$[$MINUTES%$HOURS]" "$[$SECONDS%$MINUTES]" sleep 1 done
Send a file to a process by writing to /proc
I’d like a way to “write” to a Linux filesystem, but rather than write the file, have the file sent to a process (so that it can be sent to another server over the network). I think this is possible with a kernel module by writing to /proc/mykernelmodule/filetosend, but I don’t know of any good resources that teach this. Any ideas?
Edit: This seems like a pretty good resource (haven’t started hacking on it yet): http://tldp.org/LDP/lkmpg/2.6/html/x810.html.
Blocking Recursive Root DNS Queries with iptables
Around Jan 18th,
Several folks are reporting odd queries hitting their DNS servers at a steady rate of about two per second. The queries invariably ask for the name server of the domain “.” (NS query for a single dot). Since “.” is a query for the root name servers, it has a very short query packet but a pretty long answer. Our current theory therefore is that this is a denial of service (DoS) attack in progress, where the DNS servers are used as “amplifiers” and unwittingly flood the (spoofed) source by providing a long answer to a system which never asked.
http://isc.sans.org/diary.html?storyid=5713
I noticed one of the servers I am responsible was getting hit with this query about four times a second. The server was already configured to reject the query, but with each one it logged a warning. named (bind DNS server) and syslogd were now the second and third largest resource users on the server.
I’m sure there are other system administrators dealing with the same problem, so I’m going to outline the process I went through to eventually drop them with iptables (the server is not protected by a hardware firewall, so I had to use the linux firewall iptables). Note, the system is Ubuntu Server 7.10, so the paths used here should be accurate for related systems.
First of all, to survey the damage:
thayward@sea1:~$ tail /var/log/syslog Jan 24 11:52:28 sea1 named[23890]: client 206.71.158.30#43845: query (cache) './NS/IN' denied Jan 24 11:52:29 sea1 named[23890]: client 206.71.158.30#43332: query (cache) './NS/IN' denied Jan 24 11:52:29 sea1 named[23890]: client 206.71.158.30#23849: query (cache) './NS/IN' denied Jan 24 11:52:29 sea1 named[23890]: client 206.71.158.30#65188: query (cache) './NS/IN' denied Jan 24 11:52:29 sea1 named[23890]: client 206.71.158.30#45150: query (cache) './NS/IN' denied Jan 24 11:52:30 sea1 named[23890]: client 206.71.158.30#1362: query (cache) './NS/IN' denied Jan 24 11:52:31 sea1 named[23890]: client 206.71.158.30#39496: query (cache) './NS/IN' denied Jan 24 11:52:31 sea1 named[23890]: client 206.71.158.30#27892: query (cache) './NS/IN' denied Jan 24 11:52:31 sea1 named[23890]: client 206.71.158.30#52019: query (cache) './NS/IN' denied Jan 24 11:52:32 sea1 named[23890]: client 206.71.158.30#36766: query (cache) './NS/IN' denied
You can see named goes to a lot of effort to get these denials logged. While I figure out how to drop the packets, let’s set bind’s log level to something that won’t log this attack. The system’s bind configuration file is located at /etc/bind/named.conf. I added these lines:
logging{
channel default_syslog {
syslog daemon;
severity notice;
};
};
This changes the default syslog behavior of bind from info to notice. This stops logging of the denial messages.
Okay, now that we’ve avoided the problem, let’s try to actually block it. The simple solution is to block the source IP address. In this case, that is spoofed as it is the IP address of the victim. Blocking this will keep me out of the attack for now, but when they choose a new victim I could begin sending more refusals.
To block the source IP, I issued this command for each of the offending IPs:
sudo iptables -I INPUT -s 206.71.158.30 -j DROP
This calmed things down a bit, but still wouldn’t protect me against future attacks. For this I would need to do some investigation and learn how to block the packets more specifically.
I started a packet capture on the server with tcpdump.
thayward@sea1:~$ sudo tcpdump -i eth0 -s 1500 -w dump4
eth0 specifies the network adapter to capture from; size of 1500 tells tcpdump to cature the full packet (by default, tcpdump only captures the first 68 bytes); and dump4 is the file I saved the capture to.
I downloaded dump4 and loaded it into Wireshark. A filter expression of “dns” filters out what I need.
I knew these packets would be port 53 because they are DNS queries. I also knew they would be UDP because it is a short DNS query. What I wanted to know was the length of the packet (the tiny packet length is what makes this attack work). I experimented with some of the values I found in Wireshark, I found one that matches iptables’ length rule:

Under Internet Protocol, I found Total Length to be 45, and used this in the iptables rule:
sudo iptables -I INPUT -p udp --dport 53 -m length --length 45 -j DROP
This will drop all root DNS queries.
To test it out:
dig . NS @yourserver.com
If dig just hangs without returning a result, the request was dropped and it’s working.
My beef with exams
I have final exams this week and have been cramming the last few days. But it all seems pointless.
As I understand it, the goal of an exam is to re-familiarize oneself with all the little facts forgotten over the period of the semester, hopefully to the point that the memory will be retained forever. As a member of the “Google generation” I find this paradigm worthless. I remember basic concepts, and from there if I ever need to know the answer to a trivial question, it’s ten seconds away on my iPod or computer via the Internet. I can leave that brain capacity for something less trivial.
I’ve grown accustomed to the presence of the Internet and organize my knowledge with various tools available on the Internet. For example, I use Delicious to manage my bookmarks. Every time I learn something on the Internet, I save the link to Delicious and tag it with all the categories I think I’ll need to find the information again. I remember the concept, forget the details, and go on with my life. I’ve been using this for a few years now, and it’s definitely a more efficient information repository than my brain.
I wonder how long it will take acedamia to catch up. I want a computer available during exams, just like I have during the rest of my life. If I’m being judged on my ability to recall information, I should get all the normal tools. Otherwise, the grade is not an accurate representation of my ability. I’d be happy to hear a defense of the traditional exam system—I just don’t get it.
Christmas 2009
I suppose I should compile a list of Chistmas Birthday ideas for those of you trying to shop for me…
-
OEM shift knob for my 2000 Impreza 2.5RS (it came with an aftermarket knob that falls off when I shift)Works great! Garmin nuvi 350 GPS (this specific model is recently discontinued, but the only model that works with a Tracker2 for APRS)- Rally Armor Mud Flaps
- Kavinsky T-Shirt (Medium)
Rubber floor mats for 2000 Subaru Impreza- Web Database Applications with PHP and MySQL, Second Edition
High Performance MySQL, Second EditionElectric razor (mine completely died yesterday—won’t charge or operate from AC)- Bash Scripting Cookbook
- Hopefully I will think of more soon.
