Wednesday, December 23, 2009

Amano Chocolate: Dos Rios

I can't even tell you how mad I am right now at Art Pollard, at Amano Chocolate. After my glowing review of his totally excellent Guayas chocolate, he rewarded me by completely failing to mention that he had another chocolate also on the way: Dos Rios. I would have had no idea if I hadn't seen it on the shelf at Pirate-O's today.

I bought a bar, along with my sandwich for lunch, and headed back to the office. After a few bites of sandwich, I decided that I couldn't wait to try the chocolate. So I put the sandwich down and broke off a piece of chocolate. The second I put it in my mouth, I knew I had a problem. Not only did I not want to finish my sandwich, for fear of losing the flavor that was suddenly in my mouth. In fact, I don't know if I can ever eat another kind of chocolate again. I have officially been ruined.

The box that this chocolate comes in describes it as tasting like bergamot oranges, cloves and cinnamon. They're not kidding. The orange punched me in the mouth immediately, and was complimented by an amazing set of spices. I used to like those cheap chocolate oranges that you can find everywhere in America around Christmas time. They are officially crap. This trumps that any day.

There is a bitterness that you expect from dark chocolate, but it's not an unpleasant bitterness. I broke off a piece and gave it to Harleypig, and told him that he had to try it. The look on his face was classic. He finally said, "I do not like dark chocolate. But I like this." The bitterness is one of the things he mentioned. It's not the dark bitterness of overly dark chocolate, but the pleasant bitterness of an orange that isn't too sweet.

You have to try this. If you're in the south part of the Salt Lake valley, go down to Pirate-O's right now and buy a bar. If you're closer to downtown, go to Caputo's and get it. If you're too far from either, order online. This stuff is effing amazing.

Disclaimer: Although he's apparently not much of a friend right now, I do know Art Pollard. I don't believe this to have biased my review of the chocolate itself, but that's your call. And maybe if Art starts telling me about new flavors again, I'll acknowledge him as a friend again.

Update: Art called, and we talked shop until I had to go change a diaper. We're friends again.

Friday, December 18, 2009

Fun with sshd and strace

I suppose this would be a much bigger concern if you could pull it off as an unprivileged user, but you do have to have root access on a server to pull this off. And really, once somebody has root, all bets are off anyway. Still, it's an interesting excercise.

In one window, log into a Linux server (RHEL 5.3 in my case) as root. In another window, use ssh to log from a remote machine into the server:

jhall@bourdain ~$ sftp guest@myserver
Connecting to myserver...
guest@myserver's password:

When it prompts for the password, hop back over to the server and run ps to figure out which process is handling the connection:

[root@myserver ~]# ps auxf | grep ssh
root 28705 0.0 0.0 60672 1184 ? Ss 12:32 0:00 /usr/sbin/sshd
root 29361 0.0 0.0 86856 3116 ? Ss 14:36 0:00 \_ sshd: guest [priv]
sshd 29362 0.0 0.0 62016 1384 ? S 14:36 0:00 \_ sshd: guest [net]

What you need from this is the PID of the sshd process with [priv] next to it. In this case, 29361. Use strace to hop in and monitor this process (redirecting STDERR to a file, for later reference):

[root@myserver ~]# strace -p 29361 2> strace.log

Go back over to the remote system and type in the password. Go back to the server, cancel the strace, and then take a look at the log file. On my system, the 3rd line down had the payload:

Process 29361 attached - interrupt to quit
read(6, "\0\0\0\f", 4) = 4
read(6, "\v\0\0\0\7inmelet", 12) = 12
getuid() = 0
open("/etc/passwd", O_RDONLY) = 4

The text that we're looking for here is "inmelet", which is our sample password. In the clear.

Of course, this was a very manual process. But plenty of techniques exist would would allow us to monitor sshd, and launch strace automagically every time a user logged in. Of course, if you're using ssh keys, then there would be no password to see in the clear anyway. I haven't tested to see if you could steal the ssh key though. That might be a fun excercise too.

Thursday, December 17, 2009

Create a Custom MDA with Postfix and Perl

Wow, this was a fun one. We have an internal "project manager" that we use at work, instead of my prefered program, RT. The other day, my boss asked me to set up this program so that they could email tasks to it, instead of having to pull up the site to create a new task. The easy part was building the queue into our system. But the fun part was setting up Postfix to receive and parse the emails.

My first thought was to set up Procmail to send the messages to my parsing script. I'd never used it before, and I'd heard horror stories about writing "recipes" in it. What I had not heard was how difficult it could be to get it to play right. The mail server that I was using was not one that I had set up, and it had some weirdness about it that I wasn't familiar with. After fighting with Postfix and Procmail for a while, I managed to learn enough about Postfix configuration to realize that I might as well just skip Procmail, and write my own MDA.

Now, when I say MDA, it's a bit of a misnomer. It receives and parses emails, but rather than filtering and delivering emails to a specific mailbox, it dumps a few fields into a database. To avoid confounding the issue too much, I will try and keep this post to the bare minimum. My setup uses virtual mailboxes, but I won't go into the steps to set that up. I also won't cover the DBI code that I wrote. If I get enough requests, maybe those can go into other posts.

First things first. You need to edit the file to set up some transports. There were two specific lines that I needed to add to mine:

virtual_transport = virtual
transport_maps = hash:/etc/postfix/transport

This allows me to only send messages sent to specific email addresses to my MDA. So the next step is to add the addresses to /etc/postfix/transport that you want forwarded to your MDA: mymda mymda

Make sure to hash the file once you've edited it:

postmap /etc/postfix/transport

You've probably guessed that "mymda" is what you're going to call your MDA. This doesn't have to be the name of your script, it's just a pointer to the lines that you're about to add to your file:

mymda unix - n n - - pipe
flags=R user=vmail argv=/usr/local/bin/ USER=${user} EXTENSION=${extension}

You can see in here where we actually define the name of your script, in this case "/usr/local/bin/". Now that we're done with the Postfix configuration (remember to restart postfix for it to take effect), we can go ahead and set up that script. It's going to look something like this:


use Mail::Internet;

my @rfc2822 = <STDIN>;
my $email = Mail::Internet->new( [ @rfc2822 ] );

my $from = $email->head->get("From");
my $date = $email->head->get("Date");
my $subject = $email->head->get("Subject");
my $body = $email->body();
$body = join( '', @$body );

This is a very, very basic script. It will receive the email from Postfix using STDIN, and to save you the trouble of parsing it out manually, I just ran it through Mail::Internet (part of the MailTools package).

Keep in mind that each line that you pull out of the message will have a newline in it, so $from, $date, $subject, etc. may need to be chomped, depending on your needs. Also, the date is hopefully in RFC2822 format, so in my case, I had to run it throught DateTime::Format::Mail to get it ready for MySQL.

Like I said, this isn't a full MDA. But it can be used for accepting things like commands, preformatted data, etc. from email and processing them, without having to deal with the overhead of something like Procmail. And if you want to use it to write a full-featured MDA, by all means feel free. And really, now that you know that the script is going to pull the message from STDIN, you're free to use C, Python, even Bash if you want.

Sunday, December 13, 2009

Cinnamin Craisin Muffins

Okay, so I have a thing for silicone baking molds. And I know the shapes weren't quite what I wanted. So sue me.

Baking molds aside, these muffins are the perfect way to start off a cold, wintery day. As with most muffins, it takes longer for the oven to preheat before than it takes to mix everything together, so set your oven to 375F a good 10 minutes before you start mixing.

1 1/2 cups flour
1 1/2 tsp baking powder
1/2 tsp salt
1/2 tsp nutmeg
1 Tbsp cinnamon
1/2 cup melted butter
1 cup packed brown sugar
1 whole chicken egg
1/2 cup milk
2 oz craisins

Being muffins, we use the muffin method: whisk together the dry stuff (flour, baking powder, salt, nutmeg and cinnamon) in one bowl, whisk together the wet stuff (melted butter, brown sugar, egg and milk) in another bowl, then combine and mix together with a spatula (trust me it's easier to combine wet and dry with that than with a whisk). Fold in the craisins, pour into prepared muffin tins, and bake for 20 to 25 minutes at 375F.

On a diet? Or maybe just looking for a way to add a little extra flavor? I'm told that with the muffin method, you can swap out the liquid fat with apple sauce, cup for cup. I didn't try it with this recipe, but I've done it before and it's worked well. And you can still spread on butter after it bakes, so don't worry about losing that goodness.

Monday, December 7, 2009

Periodic Tables of Food

A couple of days ago, I stumbled upon a poster at AllPosters of a Periodic Table of Vegetables. It's an interesting concept, to be sure. The Periodic Table of the Elements is a mapping of a particular type of data, organized by groups (columns) and periods (rows). Why not use the same style as a visual representation of something tastier?

Unfortunately, the image is a little too small to make out most of the veggies clearly, but it got me wondering what other kinds of periodic tables of food exist. The search was, and still is, on. I found several interesting tables of food, a couple of which I had even seen before. I also found non-food tables, my favorite being of game controllers. Here's what I've found so far:

The table that I've found myself looking at, and wanting to hang up on my wall the most, is the Periodic Table of Dessert. It breaks down its categorization into separate ingredients, which is important, because that's pretty much what the elemental table does. It makes an excellent effort to categorize things clearly, and assigns one- or two-letter symbols to each item. However, it does contain far fewer columns than the original, and uses symbols that I don't necessarily agree with (why P for peanut butter, instead of PB? How does M signify honey?). I would love to send this table through another revision. On the bright side, it is accompanied by a thermal spectrum (which doesn't make a whole lot of sense to me) and what appears to be the crystaline structures for several compounds (which is just awesome). These are all available together as a single poster.

Next up is the Table of Condiments that Periodically Go Bad. Unlike the dessert table, this table is numbered. Unfortunately, the numbers really only make sense paradoically (is that a word?). Again, elements are given symbols, and any that crossover to the dessert table actually seem to match. This kills me. I don't think that salt should be S, I think it should be Sl or Sa. Ideally, we would break into a three-letter designation, and use Sal. <End Rant> The most important part of this table is the designation for each condiment of how long you have before it goes bad. Very nice, in terms of food safety.

The Periodic Table of Produce is similar, except that it feels much more serious to me. Really, it's a table of food storage of fresh produce, including storage suggestions and timelines to when a particular veg will go bad. I would love to find a higher-quality version of this, and put it on my refrigerator door.

Growing more complex, we have a Periodic Table of Cheeses, complete with full merchandizing on t-shirts, mugs, mouse pads and, of course, posters. According to the site, this table was created by the blind Russian cook Anatoli Grigor Konchalovsky, apparently in 1865. I don't know how true that is, but if it is, that probably makes it the first periodic parody of food. Some thought has clearly gone into its organization, but I'm not entirely sure yet what each color means, or how some of the groupings fit. I love the "Noble Cheeses" classification, though.

I found the Periodic Breakfast Table interesting, though I haven't yet found a copy that looks to be complete. Offhand, it seems to be sorted visually, rather than by type of grain, manufacturer, history, etc. It does have some of this printed with each cereal, but it doesn't seem to be sorted that way.

Going back to deserts, there was a Periodic Table of Cupcakes posted in Women's Day earlier this year. There's a part of me that is impressed, because I never would have expected any mainstream periodical (other than the venerable Cook's Illustrated) to expect their readers to enjoy a scientific nod like this. But then another part of me looks at the actual cupcakes printed, and would be entirely confused by the majority of them if it didn't know that really it's probably just a marketing gimmick for their own recipes. Still, it's cool.

The Periodic Table of Candy looks to be entirely parody, listing commercial candy varieties, numbered, and in alphabetical order. I haven't decided yet whether the little girl at the top is cute or frightening.

Our journey is almost over. Back at AllPosters, I also came across a poster of the Periodic Table of Sandwichry. There is no way I can make out anything sensible on this, but as one of the cheaper posted presented, I might be willing to order it along with something else.

To finish up, I present to you the Periodic Tables of Beer Styles and of Mixology. Add these to the category of "Text to small to read, so no clue as to any useful information, including accuracy." Still, it's a nice thought.

Tuesday, December 1, 2009

T-Shirts For Sale!

Some of you may recall that when I did my Object Oriented Cooking presentation at the 2009 Utah Open Source Conference, I was wearing a t-shirt with an 8-bit stand mixer on it, instead of one of the bowling shirts that I usually wear. I actually designed and had that shirt made about a year ago. The idea was always to put up a few designs for sale, but I never got around to it; mostly because I only ever came up with one other design that I was even remotely happy with.

Well, a couple of nights ago, I got an idea for another design. It was based on the source code that I used in my presentation for a PB&J sandwich, written in Perl. I drew up the 8-bit graphics, added the source code to the back of the shirt, and after a couple of revisions, posted it for sale.

I now have three shirt designs for sale, in my Spreadshirt store. All feature 8-bit graphics depicting various food-related items. We have the stand mixer that I wore at the conference, a big-ol' jug of moonshine, and of source the PB&J in Perl. And just in time for Christmas too!

So if you want to show your geek side and your food side all at once, head over to my Spreadshirt store and grab a t-shirt. Or direct your friends and/or family members in that direction! I'll post more shirts as ideas come to me, but at least now we have an appetizer to get everyone started.