19 Jul 2005 16:03

bashlib

If the idea of writing CGI in bash scares you, you obviously have either written not enough CGI, not enough bash, or too much of either (or both). bashlib is the beautiful little script you source to give you parameter and cookie goodness with no effort whatsoever. Behold:

#!/bin/bash
. /usr/local/lib/bashlib

echo "Content-type: text/html"
echo

p=`param addr`
if [ "x$p" = "x" ]; then
    p="192.168.0.1/24"
fi

cat <<EOF
<html><body>
<h1>IP Calculator</h1>
<p>
<form action="ipcalc.cgi">
<input type="text" name="addr" value="$p" />
<input type="submit" />
</form>
</p>

<pre>
`ipcalc $p`
</pre>

</body></html>
EOF

Yes, I know that is terribly insecure, (You don't see me giving you a link to try it out, do you?) but those problems are not unique to CGI with bash.

19 Jul 2005 10:32

Password Recovery on 3COM SuperStack Switches

Google has some answers, some of which are bogus and some of which don't apply to all switches. It's a lot easier than Google would make it seem, though, if you have one switch with a known password and a management module. Just stack up the other switches, log into the management one, and do system initialize. That will initialize the whole stack (reset to factory defaults, including password but not including IP addresses). If initializing isn't your cup of tea, I system password will reset the passwords on the whole stack as well. (Hint: verify the stack is what you think it is with system inventory)

15 Jul 2005 14:56

Implications of BIND Forwarders

I've got forwarders set on the nameserver at work. Last week, I tried to delegate a subdomain to another nameserver and had a devil of a time. The problem was the forwarders; here is the solution:

zone "subdomain.example.com" in {
    // ...
    forwarders { };
};

Otherwise, the nameserver will ask the forwarders and not the delegate. Having learned this tidbit, my subconscious realized a few days later (i.e. today) that I could use this to my advantage in another seemingly unrelated situation.

My LAN at home is connected to work's LAN. At work, as well as at home, I have split views for internal and external. You can use per-zone forwarders clauses in situations like these to access work's internal view (without becoming a slave) even though your normal forwarders are third parties such as your ISP's name servers. Here is the config on my home box, in the internal view:

zone "example.com" in {
    type forward;
    forwarders { 172.16.5.3; 172.16.59.7; };
    forward only;
};

15 Jul 2005 14:39

Bewitched

Erin and I saw Bewitched the other night, and we liked it. My critical review of the movie can be boiled down to one statement:

Nicole Kidman is not Meg Ryan.

Not exactly rocket science, I know, but this observation takes on more depth when you realize that Norma Ephron also wrote, directed, and/or produced You've Got Mail and Sleepless in Seattle.