September 2014

You are currently browsing the monthly archive for September 2014.

So I had a bunch of machines with a standard naming convention that I needed to scan for the Shellshock bug. Since I just needed to run a command on each one and check the output, and I had SSH access, it seemed easy enough to put together a quick script to manage the process.

Here’s a skeleton of that script, with the details on what machines I was logging into elided. This does a pretty reasonable job, checking 300 machines in about a minute. You need to have a more recent copy of Parallel::ForkManager, as versions prior to 1.0 don’t have the  ability to return a data structure from the child.

$|++;
use strict;
use warnings;
use Parallel::ForkManager 1.07;

my $MAX_PROCESSES = 25;
my $pm = Parallel::ForkManager->new($MAX_PROCESSES);
my @servers = @SERVER_NAMES;
my %statuses;
my @diagnostics;
$pm-> run_on_finish (
    sub {
        my($pid, $exit_code, $ident, $exit_signal, $core_dump,
           $data_structure_reference) = @_;
        if (defined($data_structure_reference)) { 
            my ($host_id, $status, $results) = @{$data_structure_reference};
            if ($status eq 'Unknown') {
                push @diagnostics, $host_id, $results;
            } else {
                push @{ $statuses{$status} }, $host_id;
            }
        } else { 
            warn qq|No message received from child process $pid!\n|;
        }
    }
);

print "Testing servers: ";
for my $host_id (@servers) {
    my $pid = $pm->start and next;
    my $result = << `EOF`;
ssh -o StrictHostKeyChecking=no $host_id <<'ENDSSH' 2>&1
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
ENDSSH
EOF
    my $status;
    if ($result =~ /Permission denied/is) {
       $status = q{Inacessible};
    } elsif ($result =~ /key verification failed/s) {
       $status = q{Key changed};
    } elsif ($result =~ /timed out/is) {
       $status = q{Timed out};
    } elsif ($result =~ /vulnerable/s) {
           $status = q{Vulnerable};
    } elsif ($result =~ /ignoring function definition attempt/s) {
       $status = q{Patched};
    } elsif ($result =~ /Name or service not known/s) {
       $status = q{Nonexistent};
    } else {
       $status = q{Unknown}
    }
    print "$host_id, ";
    $pm->finish(0, [$host_id, $status, $result]);
}
$pm->wait_all_children;
print "done!\n";
for my $status (keys %statuses) {
    print "$status: ",join(',', @{$statuses{$status}}), "\n";
}
print "The following hosts returned an undiagnosed status:",
      join("\n", @diagnostics), "\n";

Note that this doesn’t test the most recent version (#3) of the bug; I have modified it slightly to test for that, but that’s a reasonable exercise for the reader.

Tags: , ,

Laundry part 3: solved

University Electric came through like champs. I found a 24″ GE unitized washer-dryer that would fit and that had generally positive reviews, checked that they were a GE dealer, called them up on last Tuesday, and asked if they could get it for me. “Yes. Saturday.” Well then. That’s faster than I expected. They called me Friday to let me know that yes, I was on the schedule 8-11 AM tomorrow. They arrived at 8:30, and they were done and I was taking care of the queued laundry by 9:30.

All in all a very satisfactory experience; I do recommend that you figure out what you want yourself, though –  the last-year’s Bosch that they had would have been fine, I’m sure, but the reviews were too up-and-down for me to feel comfortable spending almost $700 more than I would have for the original full-size pair I tried to get in here. I was also a bit doubtful about getting service.

The new machine is a 2.0 cu. ft. washer/4.0 cu ft. dryer, so it’s not large, but neither is it hideously small. Seems to do a fine job both washing and drying. It has a 240V vented dryer, so it can actually manage to dry the clothes, getting around the problem that people were complaining about the non-vented and 120V dryers. Doing a good job so far; I’ll wait for a few months’ experience before I try to rate it.

 

Tags:

First, if you read my blog, and you send music to stillstream.com, please note that my address has changed; check the stillstream.com site for the new address. The new tenant in my old apartment is quite confused by the CDs he’s getting even though I’m set up forwarding for my mail. Now on to the trivia of everyday life.

So I still haven’t actually gotten anything into the new place to do laundry with. Obviously I’m going to need to do this sometime soon as I cannot wait until I run out of underwear to make the decision on this. Well I can, but I won’t be very popular.

So today I am headed over to University Electric in Santa Clara to see what they can do for me in terms of a washer-dryer that will actually fit into the space that I have. It looks like I’m either going to have to go with a stacked unit similar to the one I had in here before (I wouldn’t wash anybody’s clothes in that, and I suppose it’s just as well the Best Buy guys took it away), or I’m going to have to go with a European washer and dryer. Those are still not very popular here in the US, so I don’t have a very good basis on which to judge them. The ratings tend to be all over the place, from “oh my God best washer ever” to “this is a terrible piece of junk and I wasted my money and I hate life”, so it’s difficult to get a bead on exactly how good or bad they are.

Sorry – just got distracted by a hummingbird in the tree outside the window. Where was I?

I also made a slight misjudgment as far as the crime rate in the local neighborhood. Understand, the place is safe to walk around in, even at night,but there is apparently a potential for petty theft. (Apparently there’s a problem with some of the local high school age kids.) When I arrived, I put my bicycle in the bicycle rack inside the parking garage, and the rest of the bicycles didn’t seem to be locked up. So I figured, “Oh, this must be plenty secure then.” and left it unlocked and didn’t think anything further about it. About a week later I came home, thinking, ” hey, I should probably take my bike out for a ride today,” and…no bike. Apparently during the time when the outside of the place was being painted someone came into the garage and lifted my bicycle.

Not really happy about this because I really did like that bicycle quite a lot – it wasn’t the world’s most wonderful or expensive bicycle but it was my bicycle. (It may have been one of the local homeless folks, and in that case I don’t feel quite so bad, but I really wasn’t planning to give my bicycle away – I was planning to ride it.)

A neighbor happened to have a what looks like 1990s-vintage Specialized Ground Control bicycle sitting in his garage which he gave me; according to the folks at REI when I took it in to see what repairs it needed, it’s not worth repairing. I’m going to check in with a local Specialized bicycle shop and see if they have a different take on this; it looks like a really nice mountain bike.  If it’s not too terribly expensive to fix up I actually kind of like it. Looks like it’ll need new front forks and probably a new rear shock; the tires are probably also going to need replacing and the brake pads are shot… Okay, so the frame is in good shape…

The REI guy said that I probably ought to consider saving up for a new bike instead because he could probably get me into something for around $200-300,  which I’m guessing means that he thought it would be at least that much to fix it. I’ll get a second opinion today at Mike’s Bikes, which is a Specialized shop, and if they say the same, I’ll consider the bike a lost cause, and take it over to Goodwill to drop off.

The other thing today is that I realized that the clerestory windows I have in my main room, beautiful as they are, really let a lot of sun in. I really haven’t spent enough time here to this point to notice this. The AC cools the place off again okay, but they’re going to have to be blocked off at least part of the time; I got toasted enough by the hot sunlight that I needed to put on some anti-sunburn lotion and drink a lot of water. I need to talk to my real estate agent and see if putting in remote-controlled blinds for those windows is a good idea, or if I’ll have to take them down again when I want to sell the place, In which case it’s not worth doing, And I suppose I have to check with the HOA as well and make sure that’s this is not breaking one of the covenants.

Anyway overall the new house is really quite nice and livable, or it least it will be as soon as I get all of these bloody boxes out of here. Still in the process of unpacking, and there’s always more stuff you find out you have to have, bring in, assemble, and then get rid of the boxes from that too. My weekends will not be idle for a while yet.

Off to the appliance store; back later.

Tags: