Fix from address (root@localhost.localdomain) in sendmail

Posted 319 days ago by Alex in Randomness, Software, Technology

I’m usually a postfix guy. That’s what I run on my servers and it’s the configuration I understand. So when someone asked me to take a look at an issue on a server running sendmail, I was a bit befuddled.

The problem was that any messages sent from the command line, were arriving with a from address of root@localhost.localdomain. This was a bit of a problem. To test and confirm I ran the following:

echo "Who will this message be addressed from?  The world may never know." | mail -s "Testing sendmail" alex

And sure enough, I get an email address from root@localhost.localdomain. I end up Googling combinations of ‘root@localhost.localdomain’, ‘localhost.localdomain’ and ‘sendmail’. The options were pretty much useless. Too much noise about changing the sendmail configuration options.

In the end, I stumbled upon the real way to fix it…. Open /etc/hosts and change add the host’s name before the localhost.localdomain entry on the first line.

127.0.0.1     host.foobar.com host localhost.localdomain localhost
::1           localhost6.localdomain6 localhost6

Turns out, sendmail looks for the first hostname in the hosts file for the loopback address and uses that in the from field when a from address isn’t specified by the mail client.

Installing FreeNAS to a flash drive on a Mac

Posted 344 days ago by Alex in Hardware, Interesting Links, Software, Technology

I’m building a NAS and decided to use FreeNAS to deploy it (rather than buy a hardware solution). The installation instructions were easy enough though they didn’t include instructions on how to install FreeNAS onto a flash drive while running a Mac. I found a 512MB flash drive that was perfectly suitable for the install.
Note: The instructions below include terminal commands. The command is presented with an example of expected output.

  1. Download the latest release of FreeNAS from the downloads page. The version I downloaded was titled ‘FreeNAS-amd64-embedded-0.7.2.5543.img’. Make sure you get the .img file, not the .iso.
  2. Plug your flash drive into your computer and open a new terminal window.
  3. Using diskutil, find the device node for your flash drive:
    mac:~ alex$ diskutil list
    /dev/disk0
       #:                  TYPE NAME                    SIZE       IDENTIFIER
       0: GUID_partition_scheme                        *500.1 GB   disk0
       1:                   EFI                         209.7 MB   disk0s1
       2:             Apple_HFS Macintosh HD            499.8 GB   disk0s2
    /dev/disk1
       #:                  TYPE NAME                    SIZE       IDENTIFIER
       0:                       CDROM                  *512.5 MB   disk1
  4. The flash drive’s device node in the above output is /dev/disk1. Now, unmount the drive:
    mac:~ alex$ diskutil unmountDisk /dev/disk1
    Unmount of all volumes on disk1 was successful
  5. Next, we’ll extract the image’s contents onto the flash drive. Warning: This will delete all of the data off of the drive.
    mac:~ alex$ sudo dd if=~/Downloads/FreeNAS-amd64-embedded-0.7.2.5543.img of=/dev/disk1
    203632+0 records in
    203632+0 records out
    104259584 bytes transferred in 66.608632 secs (1565256 bytes/sec)
  6. Lastly, eject the drive.
    $ diskutil eject /dev/disk1
    Disk /dev/disk1 ejected

Now you can use the flash drive to boot off of and run your FreeNAS instance from. Good times!

MAMP? More like LAMP.

Posted 348 days ago by Alex in Interesting Links, Internet, Software, Technology

So I was looking for web servers to run on my MBP. I came across MAMP which looks like a pretty good piece of software. While downloading I became curious if the MAMP team actually used MAMP servers.

Checking the HTTP headers revealed the following:

Server: Apache/2.2.4 (Linux/SUSE)

I’ll take that as a No.

For the record, I use the LAMP stack for my sites. I am messing around with offline development and needed an environment.

L4D2 Solo Developer Commentary

Posted 357 days ago by Alex in Gaming

Over the holidays I took advantage of the Steam Holiday Sale and bought Left 4 Dead 2. While I usually don’t like games that involve things jumping out at the player, I do love a good co-op game — and L4D2 is probably one of the best.

After having played about 30 hours of a combination of co-op campaigns, versus and survival I finally got around to playing through with the Developer Commentary turned on. This is a feature of all of Valve games after Half-Life 2; you can play through parts of the game and listen to the game’s developers talk about their experiences making the game.

While playing through L4D2 with commentary enabled, the zombies will ignore you unless you provoke them. This means you can wander through the level listening to the commentary without having to constantly fight off the hoards. The AI controlled survivors on the other hand still shoot anything without a pulse. It can get quite annoying.

Because of this, I figured out how a way to play through The Parish level without the computer controlled players so I could listen to the commentary in peace. Here’s how:

  1. Enable the developer console under Options > Keyboard/Mouse > Allow Developer Console.
  2. Press ~ to open the console and type the following:
    map_commentary c5m1_waterfront
  3. You’ll be loaded into The Parish map with commentary enabled. Now to get rid of your teammates.
  4. Press ~ to open the console and type the following:
    kill Coach
    kill Ellis
    kill Rochelle
  5. You can now play through the level without interruption.
  6. Note #1: Don’t open closets the survivors are in or they’ll just join you again and start shooting everything.
  7. Note #2: You’ll have to type in the kill commands after each new chapter before you leave the safe house.
  8. Note #3: Be prepared for a few fights. There are some sections where hoards are scripted to attack you, but the difficulty is easy so they’re trivial to kill. Just keep a melee weapon handy.

List last modified file in all subdirectories

Posted 438 days ago by Alex in Code, Randomness, Software

I don’t know when someone would use this little snippet, but I think it’s useful.

It will open every directory in /home and retrieve the last modified file in all subdirectories under that directory. Then it will print out the file’s modification time and path. This might be useful for a system administrator who wants to see when the last time a user modified a file in their home directory.

for i in `find /home -maxdepth 1 -mindepth 1 -type d`; do
  cd $i
  find `pwd` -type f -printf "%TY-%Tm-%Td %TT %p\n" | sort | tail -n 1
done

To run it, save the code as ‘directory-age-check.sh’ and run:

 sudo ./directory-age-check.sh | sort 

MineDraft.net

Posted 464 days ago by Alex in Interesting Links, Internet, Software

MineDraft

I, like many other Minecrafters, have lots of wonderful ideas to share with the Minecraft community. Frequently, we share our ideas by starting Minecraft, building our idea and taking screenshots and videos. These images and videos are uploaded to imgur or youtube and the links are shared. I found this to be a bit of a hassle.

Thus, MineDraft was born. With MineDraft, you can create your ideas in a simple to use interface, create a link to the design and share it with your friends. No more video editing or image cropping. No need to upload anything. Just draft and share.

MineDraft.net

Check it out on Reddit too!