Tuesday, August 26, 2008

Capture packets on a Mac

Mac OS X 10.5.4

For some reason, Wireshark keeps crashing X11 on my machine, so it isn't an option. If you have the same problem, here is how to capture and decode HTTP traffic from the command line, using tcpdump:

tcpdump -n -i en1 -s 0 -A port 80 and host www.yahoo.com

Options:







-nDon't convert addresses to hostnames
-i en1Interface to listen on. en0 is the wired interface and en1 is the wireless on a MacBook Pro
-s 0Snarf the required length to catch whole packets
-APrint each packet (minus its link level header) in ASCII
<expr>Packet match expression. My example of port 80 and host www.yahoo.com says to only print packets that have a source or destination port of 80 and a source or destination host of www.yahoo.com. There are many other qualifiers, such as portrange, net, src, dst, inbound, outbound, ether, fddi, ip, ip6, arp, tcp, udp. See the manual page for more info.


For more info, at the terminal, type man tcpdump

Wednesday, August 13, 2008

Setting Up Gmail To Work With Blackberry (BIS)

Tested with: Gmail (or Google Apps), Blackberry 8830, Blackberry Internet Service (BIS)

This does not apply to Blackberry Enterprise Server (BES). If your company has given you a Blackberry and it works with Exchange, Lotus Notes, or Groupwise, then you are operating in BES mode. You'll need to make sure your cell company has set up BES and BIS on your Blackberry for this to work.

I've used my Blackberry in many different scenarios: with Lotus Notes (BES), Microsoft Exchange (BES), and now I've moved to Google Apps, which allows me to receive mail for free at my address nospam@heatery.com. This tip walks you through the steps I went through to make sure that all my email shows up on the Blackberry and all replies from the Blackberry show up in Gmail. Also, new messages appear on your Blackberry as soon as they appear in your Google inbox (push email).

Step 1: Blackberry Setup

  1. Sign into your provider's Blackberry site (or create a new account):

    AT&T: http://www.att.blackberry.com

    Alltel: http://www.alltel.blackberry.com

    T-Mobile: http://bis.na.blackberry.com/html?brand=tmobile

    Verizon: http://bis.na.blackberry.com/html?brand=vzw

  2. On the email accounts screen, you'll see your blackberry email address (for example, johndoe@att.blackberry.com). To the right, click Edit
  3. Change "Reply to:" to whatever your Gmail or Google Apps email is. For me, this is johndoe@heatery.com. This causes any mail you send from your Blackberry to look like it came from your Gmail or Google Apps account. If you skip this step, email will appear to have come from johndoe@att.blackberry.com
  4. Change "Your name:" if you want to
  5. Change "Auto BCC:" to your Gmail or Google Apps email address. Your "Reply-to:" and "Auto BCC:" fields should have the same address. Auto BCC causes a copy of any messages you send from your Blackberry to be sent to your Gmail or Google Apps email.
  6. Click Save


Step 2: Gmail Setup

  1. Sign into Gmail
  2. Click Settings (in the top right hand corner of the screen)
  3. Click the Forwarding and POP/IMAP tab
  4. Select "Forward a copy of incoming mail to"
  5. Enter your Blackberry email address (like johndoe@att.blackberry.com)
  6. Make sure the option "keep ____ Mail's copy in the inbox" is selected




Interested in syncing your Google Calendar with your Blackberry?

How about syncing your Google Calendar with iCal on your Apple computer?

You could also sync your Google Calendar with Mozilla Sunbird

Syncing your Blackberry's calendar with your Google Calendar

Tested with: Gmail (or Google Apps), Blackberry 8830

Tired of maintaining two or more calendars? Maybe you only keep your calendar on your Blackberry. If so, this tip will backup your calendar to a Gmail (or Google Apps) account. If you use Outlook 2003 or 2007 on your Windows desktop, you could then install Google Sync for Outlook. With both Google Sync for Outlook and Google Sync for Blackberry installed, you can enter something in your Outlook calendar and it will get pushed to your Blackberry in a few minutes. Changing or adding calendar items on the Blackberry also gets pushed back to Outlook.

If you use a Mac (which I recommend), you'll need to use iCal or Mozilla Sunbird. There may be others that support CalDAV, I just haven't tested them yet.

Installing Google Sync for Blackberry

  1. On your Blackberry's browser, visit m.google.com/sync
  2. Click Install NOW
  3. Click Download. The Blackberry will say "Downloading Google Sync"
  4. Once installation is complete, a dialog box will appear.
  5. Click Run to start Google Sync
  6. Enter your Google email address and password
  7. Click "Sync Now" to start syncing
  8. When the sync is complete, click Dismiss. You should still be in the Google Sync for Mobile program. If not, go into your Blackberry Calendar, press the Menu button, then select "Google Sync"
  9. In the Google Sync program, press the Menu button, then select Options
  10. Here you can change options related to syncing. Don't change "When to Sync" (should always by Automatic). You change change the conflict resolution option. For "Sync Events for next" I recommend 24 weeks.
  11. When done, press the Menu button and select Save


Note that calendar syncing occurs on a schedule (every 10 minutes) and is not a push solution. If you need true push, look into Blackberry Enterprise Server.

Enabling Google CalDAV for Mozilla Sunbird

Tested with: Gmail (or Google Apps), Mac OS X 10.5.4, Mozilla Sunbird 0.8

Google recently enabled CalDAV access to Google Calendars. It works with Sunbird, but the documentation on doing this is hard to find. So here is how to do it, step by step.


  1. Download and install Sunbird on your Mac.
  2. Open Sunbird
  3. Click File, then "Subscribe to Remote Calendar..."
  4. When the "Create a new calendar" dialog box appears, select "On the Network" and click Continue
  5. For Format, select "CalDAV" and for Location, enter "https://www.google.com/calendar/dav/YOUR_GOOGLE_EMAIL/events" (without the quotes)
    For example, assume your Gmail address is johndoe@gmail.com, then your Location would be https://www.google.com/calendar/dav/johndoe@gmail.com/events
    Let's assume you have Google Apps and your email is bill.jones@jonescorp.com, then your Location would be:
    https://www.google.com/calendar/dav/bill.jones@jonescorp.com/events
  6. Click Continue
  7. Next, your are asked to name your calendar. For mine, I just typed my first name. You can choose a color for calendar entries here and choose if your want alarms to go off in Sunbird. Click Continue.
  8. Click Done.



That's it. By default, Sunbird will refresh remote calendars every 30 minutes. If you want to change this, go into the Preferences (Command ,)

Since Google CalDAV syncing is in beta, you should direct all your questions to Google Groups - Calendar Help Dataapi

Thursday, May 15, 2008

Mounting a Linux NFS point on a Mac client

Mac OS X 10.5.2, Linux (Debian) kernel 2.6.21.5

Quick tip for anyone trying to connect to a Linux server's NFS share from a Mac. The Finder provides a way to do this (from the menu bar, Go->Connect to server, then nfs://<server_name>/<mount_point>). Turns out this may not work if your distribution of Linux requires NFS connections to come from a trusted port. The solution requires you to open a terminal and type:

sudo /sbin/mount_nfs -o resvport <server_name>:<mount_point>

In this example, the Mac has an IP address of 192.168.1.1 and the Linux server's is 192.168.1.34.
So on my linux box, my /etc/exports file looks like:



# /etc/exports: the access control list for filesystems which may be exported

# to NFS clients. See exports(5).

/home/music 192.168.1.0/255.255.255.0(ro,sync)




On the Mac, I type:

mkdir /tmp/mnt (make a directory where I want to mount the remote directory

sudo /sbin/mount_nfs -o resvport 192.168.1.34:/home/music /tmp/mnt



You should now be able to cd /tmp/mnt and see the contents of the remote directory.



Troubleshooting Notes:
If you are having trouble, look in the logs on the Linux/Mac boxes. On Linux, they are usually in /var/log. For the Mac, use the Console application in the Utilities folder. After you add an entry to /etc/exports on the Linux box, you may have to tell mountd(8) and nfsd(8) to re-read the file. Some systems allow you to do this with the command exportfs -a. If that command does not work, then send HUP signals to the two server processes:

sudo killall -HUP rpc.mountd

sudo killall -HUP rpc.nfsd

Thursday, April 17, 2008

Replace the Dock Icon Created by a VMware Fusion Application

Mac OS X 10.5.2, VMware Fusion Version 1.1 (62573)

Update: According to the official VMware blog, changing the permissions is not necessary, so you may be able to skip steps 7-12.










Does the above grainy low-resolution icon of a Windows application (Bridge) running in VMware Fusion look familiar? I use VMware Fusion on my Mac to run a few Windows applications I'm still holding on to. It turns out the icons from Windows are smaller than on a Mac, so when you zoom in on them on the Dock, they look pixelated. I went in search of how to fix this situation and found that it is pretty easy, once you figure out how VMware Fusion stores icons. In this example, I'm using Adobe CS3 Bridge, mainly because native icons (.icns) are available on the Mac as well as Windows.

When you open an application in Fusion, it will create an application bundle in

/Users/<your_user_name>/Documents/Virtual Machines.localized/<virtual_machine_name>.vmwarevm/Applications

so in my example, Bridge is located in:

/Users/joe/Documents/Virtual Machines.localized/Windows XP Professional.vmwarevm/Applications/Adobe Bridge - Windows XP Professional.app



To replace the icon you see for a Windows application:

  1. Use the Finder (or terminal) and navigate to:


    /Users/joe/Documents/Virtual Machines.localized/Windows XP Professional.vmwarevm/Applications/



  2. Command-click (or right click) on Windows XP Professional.vmwarevm and click Show Package Contents



  3. Double-click the Applications folder. You should see a list of all Windows applications you have ever used in Fusion.



  4. Command-click (or right click) on the application you want to change the icon for. For this example, right-click  Adobe Bridge -- Windows XP Professional.app and click Show Package Contents



  5. Continue to navigate to Contents/Resources



  6. You should see a file called docker.icns which you should replace with your new icon. In this example, I've pulled the Bridge.icns from the Mac trial of Adobe CS3. I simply copy Bridge.icns to docker.icns



  7. You must now change the permissions on docker.icns to 0755 (rwxr-xr-x) owned by root, or the next time you open the Windows application Fusion will replace docker.icns. Open up the Terminal application, located in /Applications/Utilities



  8. Change to the Resources folder by typing cd then the path to your application bundle (you could drag and drop the folder icon in the Finder to the terminal). In this example, the command is:

    cd /Users/joe/Documents/Virtual\ Machines.localized/Windows\ XP\ Professional.vmwarevm/Applications/Adobe\ Bridge\ -\ Windows\ XP\ Professional.app



  9. Change to the Resources directory by typing:

    cd Contents/Resources



  10. Change the owner to root by typing: sudo chown root docker.icns



  11. Change the permissions to (rwxr-xr-x) by typing:

    sudo chmod 0755 docker.icns



  12. Finally, you have to restart your Dock to see the results (or reboot):

    In the Terminal application, type

    killall Dock



Look at the difference:



BEFORE (zoomed):




AFTER (zoomed):





BEFORE (unzoomed):




AFTER (unzoomed):





Much sharper. The only problem here is you have to find the Mac icon yourself. There may be a way to convert Windows .ico files into Mac .icns files, but I'm not sure. Drop me a note in the comments if you figure out a way to do it.

Wednesday, March 19, 2008

FileMon replacement for Mac

Mac OS X 10.5.2

Since switching to a Mac in January of 2008, I've been looking for a replacement of the Sysinternals tools, especially FileMon. For those who don't know, FileMon is a program which shows file activity in real-time (file accesses, changes). I found a utility on the Mac that is almost the same: fseventer. The only thing fseventer lacks is the ability to print file accesses--it only prints file/directory changes. If you need to be able to see file accesses, it seems the only solution on the Mac is to use Instruments, which is a program included with the free Developer Tools (XCode, Interface Builder, Shark, etc.) If you have Leopard and have some experience with dtrace(1), then you can use that utility from the command line. For 10.4, you can look at ktrace(1), but that utility shows system calls, not file accesses/modifications.



Download fseventer