Geek Projects – Linux, Apache, MySQL, PHP, DNS A Linux Sysadmin

July 9, 2008

sha1sum in Mac OS X

Filed under: Mac OS X — Matt @ 5:44 pm

Mac OS X doesn’t come with a sha1sum utility. Neither does fink. So what’s the quickest way to check a sha1sum on a Mac? Use openssl:

openssl sha1 filename

If you’d like to roll this sha1sum check into a simple bash script, create the following sha1sum script:

#!/bin/bash
/usr/bin/openssl sha1 $1

Then make the sha1sum script executable, and run it:

chmod 755 sha1sum
./sha1sum filename

May 6, 2008

SMTP relay with FreeBSD and sendmail

Filed under: Systems Administration — Matt @ 10:42 pm

Here’s a guide to setting up a FreeBSD server to relay emails for a set of IP addresses and/or hostnames. Be very careful to only enable relaying for trusted machines. Ideally, you’d setup your FreeBSD sendmail server to require authentication.

  1. Enable sendmail on your FreeBSD server by adding the following line to the /etc/rc.conf file:
  2. sendmail_enable="YES"

  3. Start sendmail using FreeBSD’s rc.d system.
  4. /etc/rc.d/sendmail start

  5. Add the IP address or IP addresses that you’d like sendmail to relay mail for to the /etc/mail/access file. For example, the following lines enable relaying for all emails coming from 10.0.2.1, and any IP address starting with 192.168.0.
  6. 10.0.2.1 RELAY
    192.168.0 RELAY

  7. cd to your FreeBSD server’s /etc/mail directory, and run make to apply your changes to sendmail.
  8. cd /etc/mail
    make

April 29, 2008

Installing djbdns dnscache on FreeBSD 6

Filed under: DNS — Matt @ 3:52 pm

djbdns is a DNS server package that was created in response to BIND’s history of security holes. Whenever I setup a Linux or FreeBSD DNS server, I try to use djbdns rather than BIND. Here’s how to setup a DNS caching server using FreeBSD 6.x and djbdns’s dnscache mode. The following commands should be run with root, su or sudo:

  1. Install the djbdns port, and its dependencies.
  2. cd /usr/ports/dns/djbdns
    make install clean
    rehash

  3. Enable the supervise service, which is used to start djbdns.
  4. echo 'svscan_enable="YES"' >> /etc/rc.conf
    mkdir /var/service
    usr/local/etc/rc.d/svscan.sh start

  5. Create djbdns’s cache and log accounts.
  6. pw useradd Gdnscache -d /nonexistent -s /sbin/nologin
    pw useradd Gdnslog -d /nonexistent -s /sbin/nologin

  7. Configure djbdns as a DNS caching server. In the examples below, 192.168.0.1 is the IP address of the interface that the djbdns DNS caching server will run on, and 192.168.0/24 is the network that I want to allow to access the server. Subsitute in the appropriate IPs and range(s) for your network.
  8. dnscache-conf Gdnscache Gdnslog /usr/local/etc/dnscache 192.168.0.1
    ln -s /usr/local/etc/dnscache /var/service
    touch /var/service/dnscache/root/ip/192.168.0
    /usr/local/etc/rc.d/svscan.sh restart

Sources:

April 28, 2008

How to disable EVDO on a Motorola e815 with Verizon Wireless / Page Plus

Filed under: Wireless — Matt @ 11:56 am

EVDO can shorten your Motorola e815’s battery life. Since Page Plus, my cell provider doesn’t support EVDO, I disabled it on my unlocked e815 with the following procedure:

Enable Test Mode

  1. Quickly press the Menu (top-center) key, then 073887*.
  2. Enter your security code when prompted. By default, this will be 000000. If you aren’t prompted for your security code, go back to step 1. You probably didn’t type the sequence in fast enough.
  3. Scroll down to “Test Mode”, and press Select, then Enable.
  4. Press Exit to go back to the main screen.

Disable EVDO

  1. Press the Menu key followed quickly by the Left Soft Key (top left key).
  2. Press the Left Soft Key until you see “HDR Pref” and “HDR Hybr” (around 5 times).
  3. Scroll up to “HDR Hybr”, and change its value to CDMA by pressing the Right Soft Key.
  4. Scroll up to “HDR Pref”, and change its value to Off by pressing the Right Soft Key.
  5. Press the Left Soft Key to select Exit.
  6. Press the End button to go back to the main screen.

Disable Test Mode

  1. Quickly press the Menu (top-center) key, then 073887*.
  2. Enter your security code when prompted. By default, this will be 000000. If you aren’t prompted for your security code, go back to step 1. You probably didn’t type the sequence in fast enough.
  3. Scroll down to “Test Mode”, and press Select, then Disable.
  4. Press Exit to go back to the main screen.

April 24, 2008

Printing to a Cannon ImageRunner 5075 from Microsoft Word 97

Filed under: Systems Administration — Matt @ 1:34 pm

One of my customers recently had a Canon ImageRunner 5075 coper/printer/fax unit installed in their office. Everything seemed to be working until someone tried to print a document in Microsoft Word 97. It seems that Microsoft Word 97 didn’t like the new printer. It would crash every time someone went to File -> Print, and selected the Canon printer, but strangely enough, it printed just fine if the Canon IR 5075 was set as the default, and they just clicked on the Print icon.

None of the other printers caused Microsoft Word 97, or any of the other Microsoft Office 97 apps to crash. As a workaround while I tracked down the problem, I asked them to print their word documents as PDFs, then print the PDFs to the Canon ImageRunner 5075.

Needless to say, that kludge wasn’t a good long term solution for the printing problems.What I found was that Microsoft Word 97, and the rest of Microsoft Office 97 for that matter didn’t like Canon’s UFR (Ultra Fast Rendering) drivers. I found a PCL 6 driver for the ImageRunner 5075 on Canon’s website, switched to it, and the crashes ceased.

February 23, 2008

Using dd to write disk images to CompactFlash disks and floppies under Mac OS X

Filed under: Mac OS X — Matt @ 10:56 am

Here’s how to use the dd utility to write a disk image to media under Mac OS X. I tested this with 10.5.2 with both a USB to CompactFlash adaptor, and a USB Imation USB SuperDisk.

  1. Plug the media into your Mac.
  2. If you get a message saying that the media cannot be read, click Ignore.
  3. Open Disk Utility (Applications -> Utilities -> Disk Utility).
  4. On the left-hand column, find that disk that you plan to write to. Select any partitions on that disk that are mounted, and click the Unmount button (not the Eject button). Once unmounted, the partitions should grey out.
  5. On the left-hand column, find that disk that you plan to write to, click it, then click on the Info button.
  6. In the window that pops up, note the Disk Identifier. It should be something like disk2 or disk3.
  7. Open up Terminal (Applications -> Utilities -> Terminal).
  8. Type in the following command, replacing diskx with the Disk Identifier found earlier, and image.img with the name of the image file that you wish to read from.

sudo dd if=image.img of=/dev/diskx

January 17, 2008

Configuring the Cisco VPN Client in Ubuntu Linux 7.10 (Gutsy)

Filed under: Linux — Matt @ 1:15 am

I do some work for an organization which requires me to authenticate to a Cisco VPN. Getting the VPN client setup under Mac OS X is a simple matter, but doing the same under Linux required some research. Here’s what worked for me. I’m using the 64-bit x86 version of Ubuntu, which didn’t seem to cause any hiccups:

Step 1 – Install the Cisco VPN Client:

  1. Check what kernel you’re running by issuing the uname -a command. You should get something like:
  2. Linux matt-media 2.6.22-14-generic #1 SMP Tue Dec 18 05:28:27 UTC 2007 x86_64 GNU/Linux

  3. Download a copy of Cisco’s VPN client for Linux. If you’re using a 2.6.x kernel, it’s important to use a 4.8.x client.
  4. Confirm that you have kernel sources installed for your kernel version. Check the /lib/modules/ directory.
  5. Download a patch matching your kernel version from http://tuxx-home.at/. I’m running 2.6.22, so I ran:
  6. wget http://tuxx-home.at/projects/cisco-vpnclient/vpnclient-linux-2.6.22.diff

  7. Extract Cisco’s VPN client tarball:
  8. tar -xzf vpnclient-linux-x86_64-4.8.00.0490-k9.tar.gz

  9. Apply the patch:
  10. cd vpnclient
    patch -i ../vpnclient-linux-2.6.22.diff

  11. Install the VPN client:
  12. sudo ./vpn_install

Step 2 – Configure the VPN Client:

  1. Take a backup of a working Cisco VPN client’s configuration. The location below is where these files were located on my Mac OS X system. They’re no doubt located somewhere other than the /private folder in other OSes.
  2. tar -czf cisco-vpnclient.tgz /private/etc/opt/cisco-vpnclient

  3. Copy the cisco-vpnclient.tgz tarball that you just created into the /etc/opt/ directory of your Linux system, and unpack it.
  4. sudo tar -xzf cisco-vpnclient.tgz

  5. Start the vpnclient service.
  6. sudo /etc/init.d/vpnclient_init start

  7. Check the name of your VPN’s profile by listing the contents of the Profiles directory. Your profile’s name will be the name of the the .pcf file, minus the .pcf extension.
  8. ls /etc/opt/cisco-vpnclient/Profiles/

  9. Connect to the VPN, using the profile name found above as the last argument.
  10. sudo vpnclient connect "University of South Florida"

That’s it! You should now be prompted to enter your password, and find yourself connected!

January 11, 2008

VNC in Mac OS X 10.3.9

Filed under: Mac OS X — Matt @ 10:07 pm

The latest version of Vine Server (3.0) only officially works with Mac OS X 10.4 or later, but there’s a way to make it work with Mac OS X 10.3 (Panther). After installing Vine normally, just delete the following directory. It contains the offending OS X 10.5 (Leopard) specific files:

/Applications/Vine Server.app/Content/Resources/TigerBundle.bundle

That’s it! You should now be able to launch Vine’s VNC Server from the Applications Folder, configure it, and remotely control to your Mac OS X 10.3 system over the network.

January 10, 2008

Kismac r62 download for Mac OS X 10.3 (Panther)

Filed under: Mac OS X,Wireless — Matt @ 11:58 pm

I was able to download a copy of the elusive Kismac r62 – the last version of Kismac to run on Mac OS X 10.3 (Panther). Kismac r62 is now running happily on my G4 iBook with OS X 10.3.9. I’ve mirrored Kismac r62 here in case anyone wants to download it:

Prevening an iBook G4 from going to sleep when closed

Filed under: Mac OS X — Matt @ 5:34 pm

Here’s how I prevented my iBook G4 notebook from going to sleep when the lid is closed. This worked with Mac OS X 10.3.9 (Panther). YMMV. If you’re running a OS X 10.4 (Tiger) or newer, you might want to check out InsomniaX instead. InsomniaX should work with Mac OS X 10.4 and later.

  1. Download and decompress Insomnia.kext.tbz. I wasn’t able to retrieve a copy of from the Insomnia project’s home page, but I did grab a working copy off of the Internet Archive, which I mirrored here. I also mirrored a copy of the source code in the Insomnia.src.tbz file.
  2. Open a command prompt, switch to the directory that you decompressed Insomnia.kext.tbz to, and execute the following commands:
    1. sudo chown root:wheel Insomnia.kext # set the module to be owned by root
    2. mv Insomnia.kext /System/Library/Extensions # move the module to the kernel extensions directory
    3. cd /System/Library/Extensions # change to the kernel extensions directory
    4. sudo kextload Insomnia.kext # load the module
  3. Test the module by closing your notebook’s lid. If your Mac doesn’t go to sleep, you’re in business.

You can unload the Insomnia.kext module at any time by executing the following commands:

  1. cd /System/Library/Extensions # change to the kernel extensions directory
  2. sudo kextunload Insomnia.kext # unload the module
« Newer PostsOlder Posts »

Powered by WordPress