six demon bag

Wind, fire, all that kind of thing!

2020-03-23

FRITZ!Box Firewall is Broken

AVM's FRITZ!Box routers have builtin packet filtering capabilities that are configured via the parental controls. However, for some unknown reason the vendor deemed it a good idea to hard-link MAC addresses to IPs (hint: it's not) with no option to override it (hint #2: that's an even worse idea).

See more ...

Posted 16:06 [permalink]

Shell Patterns (3) - Structured Output

This is a short series describing some Bash constructs that I frequently use in my scripts.

On Linux (and many other operating systems) it's common to have regular and error output written to stdout and stderr respectively. In shell scripts you'd use the echo or printf commands for displaying messages, and redirect stdout to stderr for having the message displayed on stderr.

echo 'foo'       # output goes to stdout
echo 'bar' 1>&2  # output goes to stderr

There may be different levels of information that you want to separate from each other, though, like having additional debug output that you don't want to pollute stdout or stderr. For that you can use the file descriptors 3 through 9.

See more ...

Posted 15:22 [permalink]

2020-03-06

Shell Patterns (2) - Error Handling

This is a short series describing some Bash constructs that I frequently use in my scripts.

When writing scripts for automation purposes you normally want the scripts to terminate when something goes wrong. Because terminating in a controlled way is usually better than blindly continuing execution when the assumptions subsequent commands are based on aren't valid anymore.

Bash provides several options for controlling error handling, the most commonly used ones being

  • -e (or -o errexit): Exit immediately when a command terminates with a non-zero exit code.
  • -u (or -o nounset): Treat unset variables and parameters (except for $@ and $*) as errors when expanding them. This prevents problems due to misspelled variables.

There are some issues with using just these two options, though:

See more ...

Posted 17:25 [permalink]