Older blog entries for mchirico (starting at number 58)

Recommended Reading

"Higher Order Perl: transforming Programs with Programs", by Mark Jason Dominus.

Mark put a lot of time into this book, and it shows. It was 5 years in the making, with free versions passed out for review. Examples can be found here (scroll down the page) .

Mark plans to take the book public, in Wiki form.

I would agree that "writing functions that modify other functions" is a very powerful programming technique found in Lisp, Mathematica, Java, and C++ to name a few languages, but it's not generally associated with Perl. Well, Mark will open your eyes here. The book is fun to read. It has depth; however, it is not written like a text book. Compare it to hacking with friends rather than sitting in a CS class.

Leap Second Log Entries

That's it. The leap second was added. You'll see it in your logs.

Dec 31 18:59:59 squeezel kernel: Clock: inserting leap second 23:59:60 UTC
Dec 31 18:59:59 livingroom kernel: Clock: inserting leap second 23:59:60 UTC
Leap Second of 2005

The last time we had a leap second was 1998. This is exciting! We're going to have another one.

For me this will occur Dec 31, 7:00pm EST. Unlike the New Year, the whole planet experiences this transition at once, when the UTC clock ticks 23:59:60.

Below, is what the last leap second looked like in 1998

        Date        Time       TAI  NTP Leap        NTP Seconds
 1.  Dec 31 98    23:59:59     31    01           3,124,137,599
 2.  Dec 31 98    23:59:60     31    01           3,124,137,600
 3.  Jan 01 98    00:00:00     32    00           3,124,137,600
 4.  Jan 01 99    00:00:01     33    00           3,124,137,601

By the way, this is the 23rd leap second. Yes, I know what you're thinking. The number 23 is interesting because it's the first intersection of Pi and e.

   Pi = 3.141592653589793-23-84
   e  = 2.718281828459045-23-53

Also, the earth is tilted at 23.5 degrees...hmm there's that number again. Ramsey Theory? Maybe, probably.

C++ Network Programming: boost asio

Wouldn't it be nice to have all the network interfaces, in modern C++, for Linux, Windows, OS X and Solaris?

asio is under review for Boost inclusion, with SSL support and the future possibility for rawsockets.

It is a good C++ learning execise reviewing this library. There is active discussion now on the developers mailing list.

9 Dec 2005 (updated 9 Dec 2005 at 03:20 UTC) »
Highly Recommended Reading

Below are two highly recommended C++ books.

Effective C++ Third Edition: 55 Specific Ways in Improve Your Programs and Designs, by Scott Meyers

C++ Common Knowledge: Essential Intermediate Programming, by Stephen C. Dewhurst.

I've repeatedly gone through all examples. My copies are less then a year old; yet, with repeated daily readings and dog eared pages, my books are beginning to show some wear. In my opinion, you won't go wrong with these two books. One of the books requred a few minor, technical corrections; but, these corrections can be found on the author's errata page.

Postfix 2nd Instance for Sender-based Routing: Multiple Gmail and Comcast Accounts

Sender-based routing allows delivery actions on email to be made based on the sending address. This makes it possible for each Gmail and or Comcast account to have separate authentication rules. In summary, your home Postfix system can support Gmail and Comcast accounts for all of your family and friends. This tutorial walks you through an example using Gmail and Comcast, but the setup is similar for any ISP specific emails.

14 Aug 2005 (updated 14 Aug 2005 at 16:55 UTC) »
2 Linux Boxes - One Monitor

I have 2 Linux boxes. One runs Fedora 4 [closet.squeezel.com] and the other Fedora 3 [squeezel.squeezel.com]. The monitor is physically attached to FC3.

It's convienent to run both, yes both, gnome and kde on the same monitor, in the same window. The menu bar for the FC3 is at the top, and FC4 is at the bottom of the screen. Here's how I set this up. This setup is run from [squeezel.squeezel.com] , the computer with FC3, in a gnome-terminal:

        $ ssh -Y closet.squeezel.com

By default FC3 and FC4 are configured for X11 forwarding. The ``-Y'' option is for trust forwarding. After running the command above, I'm connected to closet.squeezel.com. Next, I just load the KDE session.

        $ startkde
    Or, if you want gnome instead.
         $ gnome-session

You may get a few errors above on sound cards. On my configuration, I had to setup the monitor for the correct resolution. But, that was pretty straight forward. Also, you'll want to set the menu bar for each computer for different parts of the screen. That was it. You can do this through firewalls as well - reference ``Breaking Firewalls with OpenSSH''

Ctl-Alt-F12 (What if you wanted FC4 on vt12?)

Well, of course you can have your cake and eat it too. Even with the above configuration, it's possible to run a complete session on vt12. Above, I chose startkde for the second session, but sometimes I like the gnome-session on a complete terminal, so I put that (the gnome-session) on virtual terminal 12.

The following commands are executed from the computer with the physical monitor in an xterm, which is squeezel.squeezel.com. Do it in an xterm, so you can lock the display should you walk away from it.

     $ xinit -- :1 vt12

Note above that's ``xinit [space] -- [space] :1 [space] vt12''. If you want to add even more virtual terminals, execute the command above with :2 and the desired vt[number]. Now, the screen get's a little funky, but you want to type in the following comand: ``ssh -Y [remote server]''. This is the command I use.

     $ ssh -Y closet.squeezle.com
 After it logs in.
      $ gnome-session

The above will take a few second to load. Now you just switch to the correct virtaul terminal. In my case it was as follows:

    Switch to the new virtual terminal
       Ctl-Alt-F12
    To get back
       Ctl-Alt-F7

If I've missed anything, I'll update it in Linux Tips (TIP 195 - Trusted X11 Forwarding).

I do this with computers across the Internet as well. If you're doing the same you may want to reference (TIP 13 - Securing sshd), which shows you how to limit only certain accounts access to ssh. Also, block IP address with iptables for locations that you will never connect from..

Why do this?

The biggest advantage of this setup - you save money. No expensive KVM switches, no additional monitors. Save your money for faster hardware. The boxes can mount NFS over OpenVPN so that files are accessible from both computers.

Want more ideas?

If you comb through the more than 100 pages of Linux Tips, you'll see tips for setting up OpenVPN, NFS, securing ssh and a lot of other stuff...free of course.

Hope this helps...

Mike Chirico

Postfix - IMAP (sasldb)

My home computers use Postfix/Fetchmail for sending and getting email from Comcast and Gmail (Reference: Gmail on Linux Box).

I recently added IMAP to this configuration. This greatly improves things, since I can easily preserve my mail on the server, when reading/storing it from a laptop. One thing: I hate using the Linux account passwords for email. It can be a problem if ssl isn't setup correctly on the client. Passwords, Linux account passwords, would go across the Internet unencrypted. So, IMAP is configure to use sasldb for authentication. Not PAM. That way if my kids screw the client up, Linux passwords are separate and safe.

Mutt works well with IMAP(S) by storing certificates. If you have multiple servers, you can easily configure your .muttrc file to authenticate and grab mail automatically.

I've informally documented the setup in "Linux Tips" (TIP 188 and TIP 190), which includes necessary entries in "/etc/imapd.conf", creating users with saslpasswd2, changes to "/etc/postfix/main.cf" and "/etc/postfix/master.cf", and needed RPMS to install with Fedora Core.

I hope this helps.

oprofile - a system-wide profiler

This is a powerful tool with a lot of options. It comes installed with the Fedora distributions, but to take full advantage of this tool the kernel should be recompiled from source, to reference the uncompressed kernel image with the ``--vmlinux'' option.

This article ``Performance Monitoring on Linux'' walks you through the necessary steps for compiling the source kernel on Fedora installs. Also included is a quick look at iozone, and smartmontools.

The article isn't finished. cfengine has interesting system monitoring features as well (cfenvd components), but that article is taking its time.

Advanced Programming in the UNIX Environment: Second Edition

I picked up a copy of ``Advanced Programming in the UNIX Environment: Second Edition'', by W. Richard Stevens, Stephen A. Rago. Pub Date: June 17, 2005, 960 pages. Stevens passed on in 1999 - boating accident I think. Rago is carrying on the tradition.

cfengine

This package will intelligently push and pull updates to multiple servers, with built in locking to prevent system overloading. In addition, there are tripwire features (md5sum in a BerkeleyDB database), for system monitoring.

That's not all. There is an intrusion detection component, well, let's call it "sophisticated environment monitoring" where deviations from "normal" and "abnormal" behavior can be detected, with flexibility to customize...

Some of the articles written about cfengine seem to gloss over the full functionality. I saw one popular article mention rsync, which isn't needed. Cfengine will perform its own updates ... look for traffic on port 5308. Setting up keys and admit rights can be a bit tricky, especially since error messages can be misleading. Anyway, I'm making cfengine my next article. It could be 40+ pages.

tcpdump

A document that goes beyond methodically listing tcpdump options and engages the reader with short programs using raw sockets (for sending with flag manipulation) and libpcap (for receiving), may be worth writing. Perhaps it maybe worth reading if it is given a bit of a security spin, since I got a lot of comments on the Breaking Firewalls with OpenSSH and PuTTY article.

Personally, I think tcpdump is indispensable for system administration.

Fedora Core 4

So far I like it. Bind 9 is setup securely, or specifically more secure than FC3. I did have compiler errors with cyrus-sasl-2.1.21.tar.gz; but, for setting up postfix to interact with gmail, the installed package work fine, unlike FC3.

49 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!