Wednesday, July 15, 2015

Going "Off the Graph"

That's not a typo, I'm curious about getting off the graph, not off the grid.  I love the grid.  It streams movies at me, and lets me get cash from a machine, and lets me send text messages, and lets me look up words I read in my digital book right there on the same tablet.
Königsberg's Troublesome Bridges

It's the graph that spooks me.  It's the connection of every digital transaction (money, tweet, border crossing, phone call) you ever make into one big fat map that suggests ("profiles?") who you are.

You don't have to be paranoid about the NSA watching every single thing you do.  (Ding! Just added a node to their graph.)  You could be paranoid about stores watching your buying habits to target you with marketing.  For instance, as my brother explains, when you purchase felt pads to keep your furniture from scratching the floor, you get added to a marketing list of new homeowners.  It's presumed that your sudden care for floors stems from presently owning them, instead of renting them.

Is it possible to reduce the number of nodes you're adding to your graph, in this day and age?  I'm curious.  Drug dealers have been doing it for ages with "burner phones."  Executives count on the fact that their hotel pay-per-view purchases will be "discreetly charged."  You can't surprise your partner on Valentines' Day if they saw the hotel room deposit on your joint credit card statement.

So.  How far off the graph can a fully functional, modern-day, employed, human get?

Wednesday, July 8, 2015

Changing VMware Fusion DHCP Lease Times

At any one time, I've got a dozen or so virtual machines that I might want to boot a subset of.  Monday and Tuesday I might need one bunch, but Wednesday through Friday another.  VMware Fusion's default lease time is a day, which means frequently those early-week machines are assigned IPs that the later-in-the-week machines were previously using.  Flip-flop batches and they collide.

Well, you can change the default and maximum lease times that Fusion gives out to guests by using the `vmnet-cfgcli` command.  It's pretty easy, and you do it on a per-vmnet basis.  To query the current values, for example on the NAT vmnet8 device, goes like this:


  sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli getdhcpparam vmnet8 defleasetime
  sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli getdhcpparam vmnet8 maxleasetime

And you set the values, again with an example on the NAT network, like this:

  sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli setdhcpparam vmnet8 defleasetime <seconds>
  sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cfgcli setdhcpparam vmnet8 maxleasetime <seconds>

Restart VMware Fusion and you're all set.  Machines requesting a new lease will now receive one with the updated settings.  By the way, a week is 604800 seconds.

Thursday, April 9, 2015

Build a Puppet Master on CentOS 7 -- Hella Quick-Style

I build Puppet environments all the time, which means I need to set up Puppet Masters all the time.  Here's what I do to get a Master running on CentOS 7 "hella quick-style."

Build a CentOS 7 machine and set its hostname. I'm going to call mine "kermit.localdomain."

hostnamectl set-hostname kermit.localdomain

Then add the official PuppetLabs yum repo to the system's sources.

rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm

Now yum can install the Puppet Master for you.

yum -y install puppet-server

The easiest way to generate the Master's SSL keypair and self-sign its certificate is to just start up the Master in the foreground and then control-C out of it once it's done the SSL bits. (There must be a more elegant way to do this.)

puppet master --verbose --no-daemonize
[Ctrl-C]

Aim the Master's own Agent at itself. The last stanza in a stock Puppet install's puppet.conf is the [agent] section, so we can get away with just appending to it. (Again, using "kermit" in this example.)

echo 'server = kermit.localdomain' >> /etc/puppet/puppet.conf

Add a [master] stanza to the puppet.conf file. On a stock install, it's safe to just append to the file.

cat >> /etc/puppet/puppet.conf <<EOF
[master]
    environmentpath = \$confdir/environments
    basemodulepath = /etc/puppet/modules
    reports = store,log
EOF


The Master won't start without a production environment, so make an empty one.

mkdir -p /etc/puppet/environments/production/{modules,manifests}
echo 'node default {}' > /etc/puppet/environments/production/manifests/site.pp

Copy the package-supplied Hiera configuration file to a place where the Master can find it. Later, you'll likely need to update the 'datadir' and your hierarchy, but for now the stock one is fine.

cp /etc/hiera.yaml /etc/puppet/hiera.yaml

Set up firewalld with a rule for Puppet traffic on port 8140.

cat > /etc/firewalld/services/puppetmaster.xml <<EOF
<?xml version="1.0" encoding="utf-8"?>
  <service>
    <short>puppetmaster</short>
    <description>Puppet Master</description>
    <port protocol="tcp" port="8140"/>
  </service>
EOF

Tell firewalld to use the rule.

firewall-cmd --permanent --add-service=puppetmaster   # may take two tries
firewall-cmd --reload

And finally, start up the pieces.

puppet resource service puppetmaster ensure=running enable=true
puppet resource service puppet ensure=running enable=true

That's it! If you have to troubleshoot, tail /var/log/messages for clues. Remember, you can kick off Puppet runs manually with `puppet agent -t` to see what's going on during a run.

Tuesday, July 29, 2014

Right Turn on Red?

Okay, so I drive in lots of different places.  I figured I'd better get a grip on which states allow you to turn right at a red light after stopping.  (Little known fact: in California, "stop" is an acronym.  It stands for "softly touch other pedal.")

The Wikipedia article on the subject is, well, a festival of "citation needed" requests.  So I wandered around a little to try to sort it out.

It looks like it's a Federal guideline.  Maybe.  It actually might be just a recommendation of the National Committee on Uniform Traffic Laws and Ordinances.  Their idea was that you should be able to expect similar driving laws in all the states of the union.  (Think base speed limit, dui, dwb, &c.)  If you collect antiques, you're in luck, their website says "Copyright 1997."  Take that, time travel naysayers!

Ostensibly, it's for fuel economy, and seems to've been promoted in the late seventies when the US was enjoying an early beta-test of the Manufactured Fuel Shortage(tm) system.  You don't want cars idling at a red light if they can safely proceed through the intersection and down to a nearby gas station.  Feed the beast.

The exception?  The five boroughs of New York.  Which means New Jersey wishes they had the same thing, but just can't manage to pull it off in a cheap-but-still-classy way.  Anywhere else though, you're probably fine unless otherwise posted.  Clever tip from a site's comments: stay stopped at the red light, and if the person behind you honks, it's legal to turn there.