You Batter-y Beware

no comments

Seriously?

Malware stuffed into a USB battery charger?

This is just as bad as a trojan on a key fob and… smart phone? . Actually, this is worse because people don’t expect utility to run.

Is nothing sacred?

I’d just like to point out, being a big Mac-fan, that it would have been trivial to write an exploit Macs with this as well. Though it can be frustrated by enabling the Firewall. But face it, nobody (translate to not many) does but me.

Lessons lessons

What’s the lesson here? Don’t trust a battery company software? Don’t use autorun? I’m sure Microsoft thought that it sounded like a great idea way back in the day.

You auto-be-running

Apparently, autorun has been renamed to autoplay (<sarcasm>Where the heck have I been, what a change!</sarcasm>).

According to KB967715 they had it disabled in XP prior to SP2. Now it’s enabled for XP SP2+, Vista, and 7. However, for Vista and 7 users, it asks you if you want to auto-run it first.

Trust

Again, it’s about trust. Do you trust Energizer to make you software? Apparently not any more. Even if you have auto-run disabled, it appears as though you can still be compromised because you trusted the application to run. So, a Mac is just as vulnerable in this respect.

So the next time a peripheral decides to offer you friendly software: just say no!

Left unsaid

I’m sure there’s tons of room for comments such as: “It’s the manufacturers overseas!” and, while that MIGHT be true, it would be much better if we didn’t trust all these random devices and gadgets we have.

OSX Library ACLs

no comments

Background

I have a couple of Mac workstations at the office. One is used extensively for photo editing (CS4). At any rate, I’m trying to set up a new e-mail account.

The Symptoms

Even though I entered the new password correctly SEVERAL times, it never worked when “Remember password in keychain” was selected. I thought it was a fluke.

I tried setting it up again today. However, I spent almost an hour tracking this one down. I noticed that, after editing the account settings that a dialog window would appear and claim that it was not possible to save the settings. It claimed that the permissions on ~/Library/Preferences were not correct. I heeded it’s warning well.

The Investigation

I popped open my swiss army knife: AppleKey + Space “Terminal” [return]. There, I looked at the file permissions for

ls lah
Everything looked fine. The owner was the user, the group was the domain administrator. No anomalies-or so I thought.

The seemingly coincidental success with not using the “Remember my password in keychain” got me thinking; I tried to add a new item to the keychain. The login keychain. I was dumbfounded when greeted with the following message: “An error has occured. Unable to add an item to the current keychain… [Unix Permissions]”. What the heck was wrong? The owner is right, group is irrelevant, and the permissions mask was 600.

The Discovery

On a hunch, I did: “ls -leh” on a suspect directory. And there it was:

drwx------+

The + at the end of the permissions mask isn’t just for show. It’s not a sticky bit either. It’s the extended attribute for ACLs. Yes. Macs use ACLs. There’s almost no information about this online. You can get more information by using the man pages:

man chmod

And I saw it:

  0 group:everyone deny delete

There was one other ACL for domain administrators. But this one was it. Macs, Unix, and Linux machines in particular typically use the write to temporary and copy-back method of writing files. It helps reduce corruption and in this case, probably enabled the system to run as long as it did without major incident. Sadly, with this technique, the final copy, which is actually a move, never completes successfully. The result is that preferences for “well behaved” applications fail to save. Keychain wouldn’t update either due to the same principle.

The Solution

You have to eliminate that one particular ACL in the ~/Library folder. Doing so enables you to write again. Denies always over-rule the allows.

chmod -R -a "everyone deny delete" ~/Library

Remember, I’m not responsible for what happens if you use that. Do your research and be sure yourself.

The Aftermath

Keychain now accepts new items. Mail now accepts new passwords. Preferences save without incident.

This entire episode was the result of ACL’s being improperly applied. I’m not sure how it happened but I do have a guess.

The Possible Reason

About a month back, we tried a tablet. It was a WaCom Bamboo tablet. The software was designed for CS3. We tried it with CS4. That was a mistake. To be fair, it never said it worked with CS4. It said CS3 and then stopped at that platform. I goofed.

CS4 became extremely unstable. Photoshop crashed many more times each day than normal. InDesign refused to open at all. Uninstalling the suite using the uninstaller and Adobe’s secret clean-up script (which told me that it took no action) did not fix it. I had to remove all the preferences that bore the mark of Adobe (anything with “adobe” in the name of the .plist file or folder). I reinstalled it and it worked as though it were brand new again (after updates).

However, this was not before I performed a “Disk Permissions Repair” as suggested by forums. This utility is located in your Applications > Utilities > Disk Utility under your Mac drive. I believe that doing this action resulted in the mis-placed ACL’s.

I hope this helps someone who is or has suffered this problem before.

Mac Latex-mk

no comments

I really like the LaTeX typesetting system. It makes nice looking documents. It’s a bit of a pain to use, however. On FreeBSD, there is a LIFE-SAVING port called “latex-mk,” which is a set of maintained make files that will do all the heavy-lifting for you. It’s only released for FreeBSD and NetBSD, but I’ll walk you through how to install it on Darwin (Mac). I make no warrantees here. You accept all responsibility for following these instructions or deviating from these instructions. I am not responsible for lost data or damaged property, etc.

Installation

Getting LaTeX and latex-mk

First, you need the latex package for Mac: MacTex. Install that the usual way (or read their instructions if you get lost, no sense me repeating them). Once you have that installed, grab the latex-mk file. You’ll have to dig around a big, look under “Obtaining” if that link still exists. You’ll see a SourceForge download. Download this file: latex-mk-1.9.1.tar.gz. I’m sure these instructions will work for future versions too, though I make no guarantees.

Uncompressing/Unarchiving

Go ahead and unzip the latex-mk. Crack open a terminal (Finder > Applications > Utilities > Terminal.app). Change to the latex-mk directory:

cd ~/Downloads/latex-mk-1.9.1

If the version has changed, cd to that. Remember, you must unzip it first. Apple’s archiver should handle it. But you can always do a “tar -xzf latex-mk-1.9.1.tar.gz” if you’re old fashioned like me.

Configuration

Like most packages, you need to run the configuration program. Do this from the latex-mk-1.9.1 directory (you should still be there).

sh ./configure

You will see lots of text fly by. If you get errors, sorry, this tutorial is over. Drop me a line, maybe I’ll be able to help or point you in the right direction. If you see it create lots of little files, then you’re golden.

Compile

Type:

make

And, after a very short time, it will complete.

Install

Type

sudo make install

Sudo will ask for an administrator’s password. Enter it. If you don’t trust this package, you can always install by hand… But I’m not going over that. Once this is done, latex-mk is now installed and ready for use.

Cleaning up

Type:

make clean distclean

That will remove any installation files. You may also simply delete the latex-mk-1.9.1 folder. You should delete the zip file from which you got the latex-mk-1.9.1 folder; you no longer need it.

Testing

Let’s take it for a spin. Assuming you have MacTex installed already:

  • Create a new folder somewhere, I’ll call it: “Test”
  • cd to “Test”
  • Create a new latex document, say, “test.tex” and type or copy in the following:
%test.tex:
\documentclass[]{article}
\begin{document}
\LaTeX
\end{document}
  • Now create a new file called “Makefile” and put the following into it:
#Makefile
NAME = test
TEXSRCS = test.tex
BIBTEXSRCS = 
TGIFDIRS = tgif_figs

include /usr/local/share/latex-mk/latex.gmk
  • At the command prompt, type: “make pdf”
  • You’ll see it build the file. When it finishes, open finder and go to your “Test” folder. You’ll see a shiny new “Test.pdf” so go ahead, click it! You’ll see the strangely formatted LaTeX logo.

Congratulations. You just “ported” a FreeBSD application to Mac. Aren’t command line applications grand?

Why Latex-mk?

Latex-mk takes care of lots of details when creating LaTeX documents. It keeps your bibliography up to date automatically and will re-run the latex processor to ensure all your citations and cross references are up to date and shiny. Otherwise, you have to run latex 2-3 time every change to ensure your references will be linked. Your new friend is “make pdf” as it enables one-stop generation shopping.

More Information

The make file can do much more. You should see what it can do by going to the latex-mk site for instructions.

Mac Applications Not (Force) Quitting

no comments

I’ve just recently (a few hours ago) run into applications not loading or quitting (even with Forced quits) on Mac OSX10.5 Leopard on a brand-new machine. Here’s the grueling story:

I tried to read a .doc and I declined to try Office 2004 for Mac. Nothing appears wrong at this point. I then tried to launch iTunes, it had the launched icon (blue circle) under it, leading me to believe it was running, but there was no window. I could not interact with iTunes at this point. I attempted repeatedly to launch iTunes to no avail. So, I did what any self-respecting GUI user did: Quit. After ignoring the problem report, I attempted the last straw, the Force Quit. After trying that several times, also to no avail, I turned to the Internet for help. Most forums suggested unplugging your iPod when this happens. I do not have an iPod attached to the computer. So I tried a little Unix magic. But “kill -9” from the command line was ineffective. Trevor suggested “killall Dock,” (the Dock is the application “Task Bar” for you Windows users) but that was also ineffective. iTunes appeared thusly in ps xau:

% ps xau | grep iTunes
6432   0.0  0.0        0      0   ??   E    6:45PM   0:00.00 (iTunes)

I’ve never seen an “E” state before, nor a process enclosed in parenthesis. According to the man pages for ps, the “E” means “the process is trying to exit.” The man pages, however, are silent as to what (PROCESS NAME) means.

Can’t Quit, Can’t Delete

Time Machine is running and was backing files up at that time to an external USB disk. It also refused to load or force quit (like iTunes) after stopping the back up. I could also not view the trash as it claimed that items were “being deleted.” The system was still responsive (I could browse the Internet to look for forums with this problem, but found nothing completely applicable). I attempted to restart: APPLE MENU > Restart. All windows quit, but the system would not complete the restart. After trying to restart AGAIN (the dock was still visible, so I opened up a Terminal and the menu reappeared), iTunes, System Preferences (Time Machine) and trash were still inaccessible. I then forced a restart by holding down the power button.

Office 2004 for Mac not the problem

Now, convinced Office was the problem, to avoid this problem again I attempted to deinstall the Office 2000 Test Drive application(s). That began to run, it claimed to have progressed 1/10th of the way through (as seen by the progress bar) at which point, the application was hung. Force quit was ineffective. I submitted a problem report about Remove Office crashing. But the application persists! Force quitting that does not shut it down either. Things are getting serious.

Time machine

Time Machine was not actively backing up at this time. I decided to unmount the back up drive “Time Machine Backups” (what Time Machine calls its backup drive). This did nothing as well. The drive refused to unmount, even though backups were stopped (this was done via System Preferences > Time Machine and then click the circled X near “Backing up” or “Next Backup”. Since that didn’t work, I decided to go for the gusto. I yanked the USB cable to the backup drive. This caused the trash to immediately empty. Remove Office quit. It appears that Time Machine is causing these hangs.

The External Drive

The external hard drive is a Smart Disk, 60GB FireLite XPress.

I then decided to check the disk. I launched the disk utility (Applications>Utilities>Disk Utility.app) and ran “Verify Disk”. It claims that the drive appears to be OK. I repaired it anyway and after a vigorous re-indexing (thank you Spotlight (AKA “mdworker” to ps)) the volume, again, appears to be OK. Things appear to be working again. I’ll try yanking the cable if it misbehaves again.

Problem

Applications not quitting, even after forced quit

Solution

Unplug external hard drives/iPods connected via USB.

Although it appears that Time Machine may be responsible, it may apply to all external USB hard drive devices.

The Switch

no comments

Thanks to my parents over the holidays, I am now a proud owner of an Apple Product: a MacBook. Anyone who has read other articles on my blog knows I’ve been around the operating system block (I’ve used many different operating systems). I am very impressed with the initial start up process. It was up and running in minutes. I am physically unable to express my happiness about not having to re-install Windows to get rid of all the pre-loaded bloat that accompanies just about any other computer you buy from someone. That’s not a problem with Windows, but rather the vendors. Never-the-less nothing is perfect.

Learning Curve

They keys do different things. No big deal. There is a small learning curve about when the Apple key is used and when the control is used.

The application layout also takes some getting used to. I’m familiar with the Windows policy of C:/Program Files and the battle of installing things to D:/Program Files (they really should stop partitioning things and then not changing the default location). I am also familiar with the Linux/Unix policy of /usr/local/bin and /usr/bin. However, Mac, in what may be quite possibly the world’s greatest move ever (though I may speak prematurely here) has created a very very organized way of arranging applications. Each application is stored as a folder with the executable, resources, and configuration files contained in it. It makes getting applications off the ‘net very easy. It’s strange thinking of an application this way. I also thought that many things would be command-line driven. There are many command line counter-parts to most of the utilities (Mac is based on FreeBSD after all), but most things are GUI-based.

Good Stuff

There’s a dashboard application that dims the screen and runs widgets that can do just about everything I care to do with a computer. I really like the sticky notes. They let you put up written notes anywhere on the dashboard.

It’s nice to have a good default music player. Windows Media player is just aweful. It takes me a long time to figure out how to add songs into it when I don’t do it for a few months at a time. I found how to do it in iTunes (without reading a help file) in less than 20 seconds. 2.4GB of music transferred later, I was listening to my songs from my old computer.

The Apple Remote is neat too. No longer must I get up to change the options of a currently playing movie. And using the web camera to pick up the IR, genius. It has a few, but powerful set of buttons: Menu, Fast Forward, Rewind, Volume control, Play and Pause. I was really getting sick of using the XBox for DVD’s. I can actually hear the audio now without the roar of the XBox’s cooling fans. Not having to wait for the wireless controllers to boot is a plus as well. After 10 minutes, they shut down automatically to conserve power. I usually pull the batteries when I’m done starting a movie, however.

I really like that the keyboard lights up. I’ve wanted an illuminated keyboard for a while. Just to prove they’re green, it uses two light detectors embedded in the speaker grill to determine the amount of ambient light. So it shuts off the lights when you can see them, but illuminates when you can’t. The only problem: when you’re logging in, they keyboard will not light up until you’ve actually logged into the computer. Makes it hard to see your keys when you’re entering your password. The screen also dims itself according to the ambient light, so you don’t go blind working in the dark.

I was also impressed that ruby and rails comes with the operating system right out of the box. Good move!

The saga will continue…