<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Paranoid Beavers</title><link href="https://paranoidbeavers.ca/" rel="alternate"></link><link href="https://paranoidbeavers.ca/feeds/all.atom.xml" rel="self"></link><id>https://paranoidbeavers.ca/</id><updated>2017-11-25T23:00:00-05:00</updated><entry><title>Spy stuff: symmetric crypto with forward secrecy</title><link href="https://paranoidbeavers.ca/spy-stuff.html" rel="alternate"></link><published>2017-11-25T23:00:00-05:00</published><updated>2017-11-25T23:00:00-05:00</updated><author><name>Konstantin Ryabitsev</name></author><id>tag:paranoidbeavers.ca,2017-11-25:/spy-stuff.html</id><summary type="html">&lt;p&gt;We're all impatiently waiting on quantum-proof asymmetrical crypto algorithms to
become commonplace. Until that happens, we must all live with the assumption
that all currently used asymmetric crypto will be trivially decryptable once
quantum computers become powerful enough.  This is probably the reason why
government agencies have been wholesale logging …&lt;/p&gt;</summary><content type="html">&lt;p&gt;We're all impatiently waiting on quantum-proof asymmetrical crypto algorithms to
become commonplace. Until that happens, we must all live with the assumption
that all currently used asymmetric crypto will be trivially decryptable once
quantum computers become powerful enough.  This is probably the reason why
government agencies have been wholesale logging all encrypted traffic --
doubtless it's done in hopes that eventually it can be decrypted and analyzed.&lt;/p&gt;
&lt;p&gt;The only sure way to remain quantum-proof using today's technology is to use
symmetric cryptography with good key sizes, but there are huge downsides when it
comes to two-way communication using symmetric crypto:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;you have to establish and exchange symmetric keys&lt;/li&gt;
&lt;li&gt;if you reuse the same keys for multiple messages, the entirety of your
conversation becomes known to the adversary if they get the encryption key
(i.e. no &amp;quot;forward secrecy&amp;quot;)&lt;/li&gt;
&lt;li&gt;the encryption key can be obtained from you or your correspondent using
coercion (a.k.a. &amp;quot;rubber-hose cryptanalysis&amp;quot;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I was pondering how I would go about devising a way to communicate online
&lt;em&gt;today&lt;/em&gt; that would address some of the above problems, but would also be:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;cheap&lt;/li&gt;
&lt;li&gt;practical&lt;/li&gt;
&lt;li&gt;2-factor&lt;/li&gt;
&lt;li&gt;offer forward/backward secrecy&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What I came up with fits all of the above, but with the notable caveat that
it is not scalable. It's a scheme that can be used between two secret agents,
but not something that can be used by run of the mill internauts. Still, I
hope it proves to be a fun read if you're a crypto-nerd. :)&lt;/p&gt;
&lt;div class="section" id="the-setup"&gt;
&lt;h2&gt;The setup&lt;/h2&gt;
&lt;img alt="Yubikey nano" src="/images/spy-stuff-yubikeys.jpg" style="width: 100%;" /&gt;
&lt;p&gt;You will need two devices capable of doing standard OATH-HOTP. They are
extremely cheap and fairly commonplace -- in my example I will be using two
original Yubikey Nanos (not the latest 4th gen stuff, but you can use those just
as well). You can get them pretty much anywhere, in almost any country, and they
are not generally controlled as crypto devices, even though they have a crypto
chip. Certainly, finding a techie with a yubikey is not at all suspicious.&lt;/p&gt;
&lt;p&gt;The goal is to configure two of these in an identical way. One would be given to
Alice, and another to Bob.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="configuring-the-yubikeys"&gt;
&lt;h2&gt;Configuring the yubikeys&lt;/h2&gt;
&lt;p&gt;There are two &amp;quot;slots&amp;quot; on the yubikey where the pre-shared key can go. In my
example, I will be configuring the slots in the following way:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Slot 1: key used to generate the long static password (always the same)&lt;/li&gt;
&lt;li&gt;Slot 2: key used to generate changing 8-digit OATH-HOTP codes&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;While we don't absolutely need to use the static password key in slot 1,
it's handy for giving our encryption key extra entropy that will be
unrecoverable if the yubikey is destroyed, so why not use it?&lt;/p&gt;
&lt;p&gt;Here are the commands:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
$ unset HISTFILE
$ ykpersonalize -1 -ostatic-ticket -o-append-cr \
      -a7fd554b1e4a711155d20e9f9615b0451
$ ykpersonalize -2 -ooath-hotp -ooath-hotp8 -o-append-cr \
      -a7fd554b1e4a711155d20e9f9615b0451152db3bb
# Remove first key, insert the second, and repeat
&lt;/pre&gt;
&lt;p&gt;What follows the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-a&lt;/span&gt;&lt;/tt&gt; are hexadecimal keys that will be used for AES
operations inside the yubikey. In the example they are almost the same, but they
don't have to be, though whether they are similar or not does not matter much
for our needs.&lt;/p&gt;
&lt;p&gt;You can generate your random keys on the system where you're doing provisioning,
the 16-bit for the static key and the 20-bit for the HOTP key:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
xxd -l 16 -p /dev/random
xxd -l 20 -p /dev/random
&lt;/pre&gt;
&lt;p&gt;Do remember that they have to be the same on both yubikeys.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="using-the-yubikeys-to-generate-symmetric-encryption-keys"&gt;
&lt;h2&gt;Using the yubikeys to generate symmetric encryption keys&lt;/h2&gt;
&lt;p&gt;So, now we have two yubikeys configured identically. Alice takes one, and Bob
takes the other (and hopefully they don't have photographic memory good enough
to remember the 16-bit and 20-bit keys loaded onto the yubikeys). Both of them
also agree on an additional shared passphrase that they will use, let's make it
&amp;quot;somethingiknow&amp;quot; in our example.&lt;/p&gt;
&lt;p&gt;Now what?&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="https://en.wikipedia.org/wiki/HMAC-based_One-time_Password_Algorithm"&gt;HOTP protocol&lt;/a&gt;'s purpose is to generate one-time passwords by performing a
HMAC operation on the pre-shared key stored on the device and the keypress event
counter. Normally, a user would press a button on the device, which will cause
it to increment the internal event counter, and then perform a simple math
operation to calculate the combined passphrase+counter HMAC. It is then
truncated and represented as a 6- or 8-digit one-time code. HOTP is designed in a
way such that knowing any number of previously generated one-time codes would
still make it impossible to predict the codes generated in the future (or those
generated in the past, which is equally important for our use-case).&lt;/p&gt;
&lt;p&gt;We will be using this to generate one-time encryption passwords that would allow
Alice and Bob to generate identical encryption/decryption keys without having to
coordinate them with each other. Each encryption key will consist of:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;The pre-shared phrase both agents know, &amp;quot;somethingiknow&amp;quot;&lt;/li&gt;
&lt;li&gt;The long static password using the yubikey slot 1 (one &amp;quot;quick tap&amp;quot;)&lt;/li&gt;
&lt;li&gt;Three 8-digit codes using the Yubikey slot 2 (three &amp;quot;2-second taps&amp;quot;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you're curious, starting with the HOTP counter at 0 and using the keys in the
above examples, this will generate the following string:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
somethingiknowlnrvntetfedgrgtfbhudrljbgrtrunjh475935282635905679326316
&lt;/pre&gt;
&lt;p&gt;We can use more than 3 HOTP codes if we want to increase the key entropy. We
don't want to use a single HOTP code because this would make the encryption key
easily brute-forceable if Eve finds out about Alice and Bob's scheme and manages
to get her hands on the yubikey (e.g. Bob didn't have time to flush it down
the toilet).&lt;/p&gt;
&lt;p&gt;Using 3 or 4 keypresses should make brute-forcing decryption unfeasible -- it
will be cheaper (but still really expensive) to get the keys from the yubikey's
crypto chip.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="avoiding-key-desync"&gt;
&lt;h2&gt;Avoiding key desync&lt;/h2&gt;
&lt;p&gt;One of the obvious downsides to this method would be if Alice and Bob's yubikeys
become desynchronized. Say, Bob fumbles his key and accidentally fires off the
HOTP keypress, therefore incrementing the counter by 1. If that happens,
identical operations done by Alice and Bob will generate different encryption
passwords and the scheme would break down.&lt;/p&gt;
&lt;p&gt;This is one of the reasons why the HOTP code is in the 2nd slot, which fires
only after 2 seconds of being touched continuously. Even with that precaution,
accidental misfires will still undoubtedly happen, which is why the agents need
to pass along their counter information to each-other with each message, in
cleartext (remember, knowing the value of HOTP code does not give any useful
information about the key, nor weakens future generated codes, so this is a
safe operation).&lt;/p&gt;
&lt;p&gt;Easiest would be for each agent to perform 5-6 intentional discards before each
message, and then pass the HOTP code immediately preceding the encryption key
generation to the other agent in cleartext.&lt;/p&gt;
&lt;p&gt;For example, if Alice's counter is at 3 and she needs to communicate with Bob,
she does several long keypresses to discard a few HOTP codes, and then uses the
last one to pass it along in cleartext in the message to Bob, before using the
following 3 HOTP codes as part of the encryption key.&lt;/p&gt;
&lt;p&gt;When Bob receives that message, he locates the HOTP code in cleartext and
discards his own HOTP codes until the one returned by his key matches the one in
cleartext from Alice. He now knows that the next 3 HOTP codes will be the ones
used by Alice to generate the encryption key. This scheme allows the agents to
synchronize their keys before each decryption -- as long as the HOTP counter
desync between the keys remains minor (as would be expected from accidental
keypresses).&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="example-with-gnupg"&gt;
&lt;h2&gt;Example with GnuPG&lt;/h2&gt;
&lt;p&gt;We assume that both Alice and Bob use an amnesiac system like Tails for their
communication. If Alice needs to send Bob a message, she would boot up Tails,
write out the message into message.txt and then perform the encryption
operation (first discarding a few tokens for the reasons mentioned above, until
she gets to 51951508, which she sticks into the comment field of the PGP
header):&lt;/p&gt;
&lt;pre class="literal-block"&gt;
$ echo &amp;quot;somethingiknowlnrvntetfedgrgtfbhudrljbgrtrunjh629455431454256015151006&amp;quot; \
  | gpg2 -c -a --batch --passphrase-fd 0 --comment '51959508' message.txt
&lt;/pre&gt;
&lt;p&gt;This results in the following output:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
-----BEGIN PGP MESSAGE-----
Comment: 51959508

jA0EBwMCQG8UWYaboQLp0sDWAQrTCDH0FJbc5jKV685UcxaNL45+VkgUt/bKrhcb
rQ2W6Nn28MNUmYdXsdUN8GeS2IPCrwaW5qD5KpmeTsHhexABvRiQ5dKQ0UsUJNFr
SNL3a2YO138hl1BzVVO/Vx0+qnmWPx1HZCGYHXzDOK07xjmYRCFp+bxxVrsNpsif
QlltT+HxsI/9+yDKtBSzeIQS+ZpyNtvDYR8pxvzH8qeuN08aizQ7Jk6nGV6Vl7PW
51ln/TI+RzNDpbTkbTgVc8WU1YG2XtBiqJ+c2CV52pKABlfkBVy05T+vOPcW6fxm
LCjF3Cd3nU3VrbtzecAEGzEP6dM9MAdR8r1O7j4jeFdXDI7TL7Uz+jRvs8AaWhq0
4t6yneU93a04W0SC3wv4Dcxy0Usu0KLddSr2fTNnxL1x/gmlIvPmIPO32wByCGoi
g27JYttuJllHG+8mqzicMZ41Cx9klPb5m4upDWvCTEBaxS3dbcfhUjXn61bEPikF
F/eyoQvegfGv6yaWm2tkzU6JWrfRsNWTgxOWqllRWibEcOe/az1Wsg==
=jXzE
-----END PGP MESSAGE-----
&lt;/pre&gt;
&lt;p&gt;She then posts it in some pre-arranged public resource (pastebin, a public
forum, etc) or sends it via regular email or chat software that would look
inconspicuous and indistinguishable from her regular internet use (Gmail,
Whatsapp, Facebook, etc).&lt;/p&gt;
&lt;p&gt;Bob (also using Tails, of course), receives the communication and saves it into
message.txt.asc. He then starts discarding his HOTP codes until he gets to
51959508, and then generates the identical decryption password using his yubikey
and his remembered passphrase:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
$ echo &amp;quot;somethingiknowlnrvntetfedgrgtfbhudrljbgrtrunjh629455431454256015151006&amp;quot; \
  | gpg2 -d --batch --passphrase-fd 0 message.txt.asc
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="example-with-openstego"&gt;
&lt;h2&gt;Example with OpenStego&lt;/h2&gt;
&lt;p&gt;It's also possible to use &lt;a class="reference external" href="https://www.openstego.com/"&gt;OpenStego&lt;/a&gt; to conceal your message using
&lt;a class="reference external" href="https://en.wikipedia.org/wiki/Steganography"&gt;steganography&lt;/a&gt;.  To generate an encrypted payload and conceal it inside a PNG
image, Alice can do the following (I am using the official 150-anniversary of
Canada picture of the Queen, which I &lt;a class="reference external" href="/images/thequeen.png"&gt;converted to png&lt;/a&gt;):&lt;/p&gt;
&lt;pre class="literal-block"&gt;
$ ./openstego.sh embed -mf message.txt -cf thequeen.png -sf 51959508.png -e \
  -p &amp;quot;somethingiknowlnrvntetfedgrgtfbhudrljbgrtrunjh629455431454256015151006&amp;quot;
&lt;/pre&gt;
&lt;p&gt;She then uploads the resulting file to some image sharing service that Bob
monitors (here it is below).&lt;/p&gt;
&lt;img alt="Her majester" src="/images/51959508.png" style="width: 100%;" /&gt;
&lt;p&gt;To get the contents of the message, Bob would then download the
original image (just make sure the service doesn't optimize/recompress the image
files -- or if it does, that it always preserves the originals). He then uses
the name of the file to synchronize his HOTP counter and generates the password
needed to get the message back out of the concealed file:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
$ ./openstego.sh extract -sf 51959508.png \
  -p &amp;quot;somethingiknowlnrvntetfedgrgtfbhudrljbgrtrunjh629455431454256015151006&amp;quot;
&lt;/pre&gt;
&lt;p&gt;Try it out yourself with the picture seen above, it's pretty cool. :)&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="why-this-method-is-awesome"&gt;
&lt;h2&gt;Why this method is awesome&lt;/h2&gt;
&lt;p&gt;As stated above, this method has the following things going for it:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;it is cheap (HOTP devices cost about $10, or a bit more for better crypto
chips, like those in Yubikey 4s)&lt;/li&gt;
&lt;li&gt;it is practical, and not even that tedious&lt;/li&gt;
&lt;li&gt;it requires both a physical device (something you have) and a passphrase
(something you know), meaning that it's inherently 2-factor&lt;/li&gt;
&lt;li&gt;it offers forward and backward secrecy -- even if one of the used passwords
becomes fully known to Eve, she cannot use that knowledge to read previous
or future messages&lt;/li&gt;
&lt;li&gt;even if the agent is captured and is coerced to divulge the scheme, the
pre-shared passphrase, and the HOTP device -- even that won't allow Eve to read
previous communications unless she gets the HOTP master key from the yubikey
(which is expensive, but not impossible -- so don't expect this to save you if
well-funded state actors are on your tail and you didn't manage to flush the
yubikey down the toilet or bake it in a microwave)&lt;/li&gt;
&lt;li&gt;if both devices are destroyed, all exchanged communication remains forever
encrypted in a manner that is extremely resistant even to very powerful
quantum computers of the distant future (at least, much more so than any
asymmetric algorithm used today)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="the-downsides"&gt;
&lt;h2&gt;The downsides&lt;/h2&gt;
&lt;p&gt;As I said, this is &amp;quot;spy games&amp;quot; kind of stuff -- you have to a be a very
dedicated and paranoid person to stick to this kind of protocol. It is good for
one-to-one or one-to-many communication, but would quickly break down if
attempted for group messaging due to inevitable HOTP counter desync. That said,
it can probably be used to establish time-limited group chat sessions that are
rekeyed daily.&lt;/p&gt;
&lt;p&gt;If anything, this is just a mental paranoia exercise -- it was fun to do, but I
certainly hope never to be in a situation where I have to worry about needing to
use anything like it.&lt;/p&gt;
&lt;p&gt;Thanks for reading, and please feel free to email me at &lt;a class="reference external" href="mailto:hbic&amp;#64;paranoidbeavers.ca"&gt;hbic&amp;#64;paranoidbeavers.ca&lt;/a&gt;
if you have any comments.&lt;/p&gt;
&lt;/div&gt;
</content><category term="crypto"></category><category term="security"></category><category term="privacy"></category><category term="quantum"></category></entry><entry><title>Reverse Proxy Grapher</title><link href="https://paranoidbeavers.ca/rev-proxy-grapher.html" rel="alternate"></link><published>2017-10-06T12:00:00-04:00</published><updated>2017-10-06T12:00:00-04:00</updated><author><name>Konstantin Ryabitsev</name></author><id>tag:paranoidbeavers.ca,2017-10-06:/rev-proxy-grapher.html</id><summary type="html">&lt;p&gt;I am working on documentation for an upcoming security audit and needed
a way to display how various externally available ports and URLs mapped
to internal VMs, clusters, and services. I didn't want to draw them
manually in various charting tools because this is the kind of data that
quickly …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I am working on documentation for an upcoming security audit and needed
a way to display how various externally available ports and URLs mapped
to internal VMs, clusters, and services. I didn't want to draw them
manually in various charting tools because this is the kind of data that
quickly becomes obsolete as things are added and retired -- and manually
rejigging things every time a node is added or deleted takes a lot of
effort.&lt;/p&gt;
&lt;p&gt;So, I wrote a small tool in python that uses graphviz to generate such
graphs automatically. All it requires is a simple yaml file like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;subnets&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
  &lt;span class="l l-Scalar l-Scalar-Plain"&gt;dmz&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;cidr&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;192.168.1.0/24&amp;#39;&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;color&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;orange&amp;#39;&lt;/span&gt;
  &lt;span class="l l-Scalar l-Scalar-Plain"&gt;webapps&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;cidr&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;10.0.200.0/24&amp;#39;&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;color&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;blue&amp;#39;&lt;/span&gt;
  &lt;span class="l l-Scalar l-Scalar-Plain"&gt;mailhosts&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;cidr&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;10.0.25.0/24&amp;#39;&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;color&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;purple&amp;#39;&lt;/span&gt;
  &lt;span class="l l-Scalar l-Scalar-Plain"&gt;jumphosts&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;cidr&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;10.0.0.0/24&amp;#39;&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;color&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;red&amp;#39;&lt;/span&gt;

&lt;span class="l l-Scalar l-Scalar-Plain"&gt;clusters&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
  &lt;span class="s"&gt;&amp;#39;php-fpm.web&amp;#39;&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;ips&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
      &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;10.0.200.0/29&amp;#39;&lt;/span&gt;
  &lt;span class="s"&gt;&amp;#39;ha-cluster.dmz&amp;#39;&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;ips&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
      &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;192.168.1.11&amp;#39;&lt;/span&gt;
      &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;192.168.1.12&amp;#39;&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;vips&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
      &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;192.168.1.10&amp;#39;&lt;/span&gt;

&lt;span class="l l-Scalar l-Scalar-Plain"&gt;proxies&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
  &lt;span class="l l-Scalar l-Scalar-Plain"&gt;192.168.1.10&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;22&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
      &lt;span class="l l-Scalar l-Scalar-Plain"&gt;haproxy&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;10.0.0.10&amp;#39;&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;25&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
      &lt;span class="l l-Scalar l-Scalar-Plain"&gt;dnat&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;10.0.25.100&amp;#39;&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;443&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
      &lt;span class="l l-Scalar l-Scalar-Plain"&gt;nginx&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
        &lt;span class="s"&gt;&amp;#39;www.example.com&amp;#39;&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;10.0.200.100:80&amp;#39;&lt;/span&gt;
        &lt;span class="s"&gt;&amp;#39;www.example.com/blog&amp;#39;&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;php-fpm.web:80&amp;#39;&lt;/span&gt;
        &lt;span class="s"&gt;&amp;#39;git.example.com&amp;#39;&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;10.0.200.120:80&amp;#39;&lt;/span&gt;
        &lt;span class="s"&gt;&amp;#39;mail.example.com&amp;#39;&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;10.0.25.100:80&amp;#39;&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;587&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
      &lt;span class="l l-Scalar l-Scalar-Plain"&gt;dnat&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;10.0.25.100&amp;#39;&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;9418&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
      &lt;span class="l l-Scalar l-Scalar-Plain"&gt;haproxy&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;10.0.200.120&amp;#39;&lt;/span&gt;
  &lt;span class="l l-Scalar l-Scalar-Plain"&gt;192.168.1.100&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;22&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
      &lt;span class="l l-Scalar l-Scalar-Plain"&gt;haproxy&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;10.0.0.100&amp;#39;&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;43022&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
      &lt;span class="l l-Scalar l-Scalar-Plain"&gt;haproxy&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;10.0.0.100:22&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then it will generate a pretty graph like this:&lt;/p&gt;
&lt;img alt="" src="images/rev-proxy-grapher-example.png" style="width: 100%;" /&gt;
&lt;p&gt;You can also plug the XML output of your nmap scans to add some more
details to your graph, such as hostnames and product/version details
identified by nmap:&lt;/p&gt;
&lt;img alt="" src="images/rev-proxy-grapher-example-with-nmap.png" style="width: 100%;" /&gt;
&lt;p&gt;There's still lots of missing functionality in the code -- for example,
I've not tested how badly this would break with ipv6 at all, plus
there's no way to specify multiple proxy levels. However, hopefully this
should prove useful for simpler configurations and will help you impress
your bosses. :)&lt;/p&gt;
&lt;p&gt;You can find the project on github:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="https://github.com/mricon/rev-proxy-grapher"&gt;https://github.com/mricon/rev-proxy-grapher&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content><category term="infosec"></category><category term="sysadmin"></category><category term="graphviz"></category><category term="python"></category></entry><entry><title>The coming cryptocoin blackmail market</title><link href="https://paranoidbeavers.ca/coming-cryptocoin-blackmail-market.html" rel="alternate"></link><published>2017-10-01T18:00:00-04:00</published><updated>2017-10-01T18:00:00-04:00</updated><author><name>Konstantin Ryabitsev</name></author><id>tag:paranoidbeavers.ca,2017-10-01:/coming-cryptocoin-blackmail-market.html</id><summary type="html">&lt;p&gt;This is the most depressing thing I've written. I hope I am proven wrong
on all counts.&lt;/p&gt;
&lt;div class="section" id="in-the-beginning"&gt;
&lt;h2&gt;In the beginning&lt;/h2&gt;
&lt;p&gt;It started out fairly slow. A couple thousand people received the
same poorly-worded email, coming from &lt;a class="reference external" href="mailto:pay4silence&amp;#64;gmail.com"&gt;pay4silence&amp;#64;gmail.com&lt;/a&gt;:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Hello.

Your name is Bob Jones. You live in Cityville, ST …&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;This is the most depressing thing I've written. I hope I am proven wrong
on all counts.&lt;/p&gt;
&lt;div class="section" id="in-the-beginning"&gt;
&lt;h2&gt;In the beginning&lt;/h2&gt;
&lt;p&gt;It started out fairly slow. A couple thousand people received the
same poorly-worded email, coming from &lt;a class="reference external" href="mailto:pay4silence&amp;#64;gmail.com"&gt;pay4silence&amp;#64;gmail.com&lt;/a&gt;:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Hello.

Your name is Bob Jones. You live in Cityville, ST. On these dates you
accessed porn from these sites:

January 24: pornhub.com
    [list with titles, headline screenshots, exact times accessed]

January 25: pornhub.com
    [list with titles, headline screenshots, exact times accessed]

[continued over a period of a few weeks]

In exactly 14 days we will send this list to following people:

    Jane Jones, your wife, email jjones&amp;#64;...
    Martha Jones, your mother, email mjones&amp;#64;...
    Bill Jones, your father, email bjones&amp;#64;...
    Melinda Smith, your coworker, email msmith&amp;#64;...

    [the list continued with coworkers, friends, family members]

To stop us from doing this, you must send us following Bitcoin payments.

0.012383 BTC to [wallet hash 1]
0.018344 BTC to [wallet hash 2]
0.018113 BTC to [wallet hash 3]

IT IS IMPORTANT THAT YOU SEND EXACT AMOUNTS LISTED TO ALL THREE
WALLETS OR YOUR PAYMENT WILL NOT BE PROCESSED CORRECTLY.

Failure to to so will result in incriminating email going out.

There is no way to contact us. Any email sent back will not be read.
&lt;/pre&gt;
&lt;p&gt;When reached, Google confirmed that &lt;a class="reference external" href="mailto:pay4silence&amp;#64;gmail.com"&gt;pay4silence&amp;#64;gmail.com&lt;/a&gt; was only
accessed once from an IP address belonging to a webcam pointing at a
vacant construction lot in Romania, and then never logged into again.
All outgoing emails were purged from the &amp;quot;Sent Mail&amp;quot; folder, but the
company was forced to disable the account anyway and set up an
auto-responder stating that they were in no way associated with the
blackmailer (or blackmailers) and recommending that all affected parties
contact law enforcement in appropriate jurisdictions.&lt;/p&gt;
&lt;p&gt;When the deadline came, the attacker delivered the threat as promised.
Messages came in from various throwaway email accounts:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Hello.

Your name is Jane Jones. Your are wife of Bob Jones, who lives in
Cityville, ST. On these days, Bob Jones accessed following porn sites:

(same list with dates and times)

This information is true and not fake. We have access to Bob Jones's
router (D-Link AC750, serial number #####) and monitored web traffic.

We email this to you because Bob Jones chose not to pay the small sum
we asked in exchange for our silence.
&lt;/pre&gt;
&lt;p&gt;The news were reported with a mix of horror and amusement. The FBI asked
all affected parties to contact them and were able to verify that
victims' routers were indeed broken into, and a simple SSL-strip proxy
was installed to downgrade secure https traffic going out to popular
porn sites in order to get the exact videos accessed by victims. The
logs were sent to multiple IPs across the world, almost all belonging
to webcams and other &amp;quot;internet of things&amp;quot; devices that were since purged
clean.&lt;/p&gt;
&lt;p&gt;Pornhub got flack for disabling HSTS in their site headers and home
router manufacturers got well-deserved flack for their abysmal patching
and security practices. Tracing bitcoin transactions proved futile and
meaningless, as the attackers set up multiple wallets and even used some
accounts that appeared to belong to completely unrelated individuals
either as a way to create a false trail or because the whole setup was a
test of the larger things to come.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="initial-reaction"&gt;
&lt;h2&gt;Initial Reaction&lt;/h2&gt;
&lt;p&gt;The media loved it. Among the affected were several notable conservative
politicians and religious leaders, now gleefully paraded as hypocrites
despite their adamant denials.&lt;/p&gt;
&lt;p&gt;Technology sites filled with content advising how to set up VPNs in
order to hide your &amp;quot;naughty traffic&amp;quot; and how to download and install the
Tor browser. Security professionals were quick to warn that, if not
done right, this can make the situation worse -- and were right.
Services offering &amp;quot;free anonymous VPN&amp;quot; proliferated and the number of
domains with every possible way of writing &amp;quot;get-tor-browser.com&amp;quot; popped
up, all offering downloads of the popular privacy suite (with a few
backdoors added).&lt;/p&gt;
&lt;p&gt;The next attack came a few months later and was almost word-for-word
similar. Victims were again asked to send 3 payments of bitcoins,
amounting to $100-$200 dollars in total, or have their embarrassing
browsing habits sent to their family and coworkers. When not paid, the
attackers meticulously delivered the payload, but appeared to fulfil
their promise of keeping quiet when the blackmail request was accepted
and bitcoin payments sent.&lt;/p&gt;
&lt;p&gt;In the payload emails they again disclosed how they got the data -- in
order to add weight to their statements. There were still quite a few
routers there, but also a significant number of fake VPN services and
trojaned Tor browser downloads, which were now all collecting data for
the attackers while masquerading as privacy tools.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="the-quiet-before-the-storm"&gt;
&lt;h2&gt;The quiet before the storm&lt;/h2&gt;
&lt;p&gt;The next few months were quiet -- at least on the surface. Some
jurisdictions passed legislation that required ISPs to offer timely
security updates and free consultation for clients in order to improve
home networking security. Technology sites were now more cautious
mentioning &amp;quot;a VPN service&amp;quot; and were instead recommending several notable
leading providers, strongly advising against &amp;quot;free VPN.&amp;quot; Search engines
started offering &amp;quot;Assured site&amp;quot; markup for anyone searching for &amp;quot;Tor
browser&amp;quot; with heavy filtering of all other results. Porn sites started
providing &amp;quot;privacy bundles&amp;quot; that set up Tor browser when downloaded, and
the sites themselves displayed a warning when you browsed from a non-Tor
connection (with limited success, because with the increase of Tor
traffic without the increase in Tor exit nodes, streaming videos became
almost impossible).&lt;/p&gt;
&lt;p&gt;However, the security field was abuzz, because someone was paying a lot
of money buying account passwords and all sorts of stolen database
dumps. They also put up bounties -- tens of dollars for security camera
footage; hundreds of dollars for ISP client databases and social site
logins; thousands for medical records and DMV vehicle registrations. The
vaunted Russian face tracking database sold for a staggering 6-figure
number paid to what was almost certainly an insider from the FSB. All
paid with Bitcoin, all impossible to trace, embargo, or seize.&lt;/p&gt;
&lt;p&gt;Someone was receiving all this data, meticulously correlating it... and
biding their time.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="the-big-con"&gt;
&lt;h2&gt;The big con&lt;/h2&gt;
&lt;p&gt;Suddenly, extortion notices were everywhere. Men with embarrassing STDs
were asked if $200 was worth their coworkers knowing exactly when and
after what trip they got their genital herpes. Teenagers were asked if
their parents and classmates should know that they have logins on gay
dating sites. Pastors were asked if their church members should know how
frequently their car ends up parked two blocks away from a Thai massage
place in the neighbouring city. Moscovites faced the dilemma of paying
up or having their wives know exactly how often they are seen in the
company of a certain female coworker.&lt;/p&gt;
&lt;p&gt;Then it got downright horrifying. Women were asked if $100 is worth not
sending their photos, names, addresses, and exact routes they take to
get to work from being sent to known sex offenders living in their area.
Parents were asked what price was too large to keep private the bath
time videos they took of their kids. Women who had abortions were
blackmailed to pay up or have all their Facebook friends know exactly
when and at what stage of pregnancy they chose to terminate.&lt;/p&gt;
&lt;p&gt;And there was always the same request. Three fairly small cryptocoin
payments to three different wallets. Or else. There, of course, was no
guarantee that you were off the hook once you paid -- or that you
wouldn't have to pay again in the future.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="the-big-too-late"&gt;
&lt;h2&gt;The big too late&lt;/h2&gt;
&lt;p&gt;People were terrified, and this time nobody smugly proclaimed that they
needn't worry because they didn't have anything to hide -- because it
was obvious that everyone did. In the age of mass surveillance and data
collection almost every aspect of people's lives was recorded somewhere
and could be sold, bought, correlated using massive computational powers
of modern cloud computing -- and then used for extortion and blackmail.&lt;/p&gt;
&lt;p&gt;Data protection legislation extolling huge fines on companies that
collect citizens' personal data was passed, but proved too late and too
ineffective. It was too late because so much of it was already in
malicious hands, and it was ineffective because a lot of this data came
from law enforcement and anti-terrorist mass surveillance databases
themselves -- and because the bounties offered by blackmailers continued
to increase, multiplying insider leaks. The irony that the tools that
were supposed to make the populace more safe were now used to terrorize
it was not lost on anyone.&lt;/p&gt;
&lt;p&gt;Attempts to ban bitcoin were futile -- not only because it was not
technically possible, but because by then so many powerful interests
were invested in it, including most narco cartels. Since the
blackmailers were careful never to cash out the payments, finding them
proved impossible, and by then it was also obvious that the number of
copycats was multiplying daily. There were massive blackmail campaigns
in China, Russia and other parts of the world where mass surveillance
went hand in hand with meticulous record keeping by the state.&lt;/p&gt;
&lt;p&gt;Nobody knew what measures to take in order for it all to stop. However,
one thing was clear: entire generations of people lost the war for their
private lives, and there was no way to put that genie back into the
bottle.&lt;/p&gt;
&lt;p&gt;The only way to stop was to start from scratch.&lt;/p&gt;
&lt;/div&gt;
</content><category term="infosec"></category><category term="security"></category><category term="privacy"></category><category term="cryptocoin"></category><category term="depressing"></category></entry><entry><title>Travel (Linux) laptop setup</title><link href="https://paranoidbeavers.ca/travel-laptop-setup.html" rel="alternate"></link><published>2017-06-15T18:00:00-04:00</published><updated>2017-06-15T18:00:00-04:00</updated><author><name>Konstantin Ryabitsev</name></author><id>tag:paranoidbeavers.ca,2017-06-15:/travel-laptop-setup.html</id><summary type="html">&lt;p&gt;The Linux Foundation Open Source Summit is happening in Beijing next
week, and some of the topics I've had to cover in my capacity as &amp;quot;the
security person&amp;quot; were from members of the IT staff asking my advice
about the best strategy for bringing laptops and being able to do …&lt;/p&gt;</summary><content type="html">&lt;p&gt;The Linux Foundation Open Source Summit is happening in Beijing next
week, and some of the topics I've had to cover in my capacity as &amp;quot;the
security person&amp;quot; were from members of the IT staff asking my advice
about the best strategy for bringing laptops and being able to do work
while in China. This is a quick write-up covering my recommendations
that others can hopefully benefit from. It is not too China-specific and
can be used for any other international conference travel.&lt;/p&gt;
&lt;div class="section" id="china-s-special-case"&gt;
&lt;h2&gt;China's special case&lt;/h2&gt;
&lt;p&gt;China is not signatory to the &amp;quot;&lt;a class="reference external" href="https://informationsecurity.princeton.edu/encryption/encryption-and-internatio"&gt;Personal Use Exemption&lt;/a&gt;&amp;quot; when it
comes to encrypted devices, so bringing a laptop with encrypted hard
drive with you is not technically legal. If the border officer does not
like you for some reason and has grounds to suspect you are not being
truthful about your stated reasons for entering China, you may be asked
to decrypt your devices for a search. Failure to do so may result in
unpleasantness, and you may be detained or fined merely on the grounds
of having an encrypted device when entering the country. (As opposed to,
for example, entering a country that &lt;em&gt;is&lt;/em&gt; signatory to the personal use
exemption, where just having an encrypted device is not grounds for
any action. That said, it is &lt;em&gt;never&lt;/em&gt; in your interest to make the border
officer not like you for some reason. Until you are admitted to the
country as a legal alien, the Geneva Convention and the Universal
Declaration of Human Rights are pretty much the only legal frameworks
protecting you as a person against foreign government action.)&lt;/p&gt;
&lt;p&gt;It is important to point out that you are &lt;em&gt;extremely unlikely&lt;/em&gt; to be
penalized for bringing in an encrypted laptop with you to China, as any
kind of widespread zealous application of such practice would quickly
shut down any business travel to China -- and this is definitely not in
the government's interest.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="easiest-bring-a-chromebook"&gt;
&lt;h2&gt;Easiest: bring a ChromeBook&lt;/h2&gt;
&lt;p&gt;My simplest recommendation when going travelling is to buy or loan a
ChromeBook. ChromeOS has some of the best boot-level and runtime
security protections on the sub-$1000 market, and will perform most of
your computing needs admirably.&lt;/p&gt;
&lt;p&gt;ChromeOS user storage is encrypted, so the best course of action is to
do a full &amp;quot;factory wipe&amp;quot; of the ChromeBook and only set it up &lt;em&gt;after&lt;/em&gt;
crossing the border -- except this doesn't work very well in China where
Google is pretty much unusable. One option is to log in to your account,
set up a VPN service that is reliable in China (&lt;a class="reference external" href="https://www.expressvpn.com/"&gt;ExpressVPN&lt;/a&gt; has a good
record), and then do a full shut down before you cross the border. Note
that merely logging in to your ChromeBook will create an encrypted user
storage directory, so if you want to be 100% compliant with the &amp;quot;no
encrypted devices&amp;quot; policy, you don't want to do this.&lt;/p&gt;
&lt;p&gt;The other option is to find someone at the conference who has already
set up VPN and ask them to share a wifi hotspot with you, allowing you
to set up your Chromebook. I am also told that foreigners' mobile
roaming traffic is not subject to filtering, so tethering via your
mobile phone (with a non-Chinese SIM card) is also an option for setting
up your ChromeBook, but may be expensive depending on your roaming data
plan.&lt;/p&gt;
&lt;p&gt;Perform a factory wipe again before crossing the border on your way
home. Then, depending on your level of paranoia, give the ChromeBook
away to what is likely to be a very thankful kid/student, or keep it for
future travel.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="chromebook-and-ssh"&gt;
&lt;h2&gt;Chromebook and ssh&lt;/h2&gt;
&lt;p&gt;If you need to be able to use SSH during your trip, you will need to
install the &lt;a class="reference external" href="https://chrome.google.com/webstore/detail/secure-shell/pnhechapfaindjhompbnflcldabbghjo"&gt;Secure Shell Chrome extension&lt;/a&gt;. You can import your keys
or generate a new keypair just for travelling, and use it to access a
trusted &amp;quot;jumpserver&amp;quot; that will act as your &amp;quot;$HOME away from home.&amp;quot;&lt;/p&gt;
&lt;p&gt;If you do set up such jumpserver for yourself, I also highly recommend
setting up &lt;a class="reference external" href="https://mosh.org/"&gt;Mosh&lt;/a&gt; on it and installing the &lt;a class="reference external" href="https://chrome.google.com/webstore/detail/mosh/ooiklbnjmhbcgemelgfhaeaocllobloj"&gt;Mosh for Chrome&lt;/a&gt; client that
will allow you to much better withstand shaky conference/hotel
networking -- I'm yet to travel to a technical conference where wifi is
good for any ssh work that isn't an exercise in frustration.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="setting-up-a-ssh-jumpserver"&gt;
&lt;h2&gt;Setting up a ssh jumpserver&lt;/h2&gt;
&lt;p&gt;I recommend picking a cloud provider that offers VM hosting in the
general geographical area where you will be travelling and picking the
smallest VM they offer. All you'd need is ability to ssh in and run some
basic shell apps (plus mosh). Having this jumpserver located close to
where your conference is taking place will help reduce some of the
latency you are likely to see.&lt;/p&gt;
&lt;p&gt;If you are going to China, then AWS Singapore, Rackspace Hong Kong, or
&lt;a class="reference external" href="https://www.packet.net/locations/tokyo/"&gt;Packet&lt;/a&gt; Japan should be good candidates for such a jumpserver. I
heartily recommend using Packet, as their pure-hardware hosting will
mean that your ssh keys (or PGP subkeys, see below) aren't floating in
the hypervisor RAM alongside other VM tenants.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="if-chromebooks-aren-t-good-enough-for-you"&gt;
&lt;h2&gt;If Chromebooks aren't good enough for you&lt;/h2&gt;
&lt;p&gt;If you are not comfortable with a ChromeBook or can't use one for some
reason, you can bring a loaner laptop or get a cheap lightweight netbook
just for travel. Since our IT team has a strong requirement that all our
SSH keys must be stored on PGP smartcards, I can't actually use ssh on
Chromebooks, so I have a cheap Acer netbook that cost me $350 back in
2013 that will continue to serve me until it falls apart (I'm afraid not
for much longer).&lt;/p&gt;
&lt;p&gt;Here's my strategy when travelling internationally.&lt;/p&gt;
&lt;ol class="arabic"&gt;
&lt;li&gt;&lt;p class="first"&gt;Before you leave, download and prepare your favourite distro's
install media. Test that you can still use it by reinstalling your
laptop (without choosing to encrypt your disk if you're going to
China). This is an important step that lets you make sure that your
hardware is still good and is supported by the install media you are
bringing with you -- &lt;strong&gt;and also because you do not want to travel
with a laptop you cannot boot on demand.&lt;/strong&gt; Seriously, you do not want
to tell the border officer that your laptop cannot be booted because
this will look extremely suspicious and guarantees bad time. Have it
installed and configured to the point where you can use wifi and
bring up a browser (in fact, &amp;quot;can I still use wifi&amp;quot; should be part of
your install test before you leave).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Prepare your travelling home directory plus an ansible
(chef/puppet/salt/whatnot) playbook that will quickly configure your
system for how you want it post-install. If you're old-school, just
write a shell script full of &lt;tt class="docutils literal"&gt;dnf install&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;cp foo.conf /etc&lt;/tt&gt;
commands.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Tar up your travelling home directory (with the above playbook in it)
and symmetrically encrypt it using a good long passphrase:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
gpg2 -c home.tar.xz
(you will be prompted for the passphrase)
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Upload the resulting &lt;tt class="docutils literal"&gt;home.tar.xz.gpg&lt;/tt&gt; file into some public location
where you'll be able to get it over the web once you arrive to the
conference. It doesn't matter where, since it's encrypted -- as long
as it's accessible from your target country. You may want to rename
the file to &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;conference-slides.ppt&lt;/span&gt;&lt;/tt&gt; depending on how paranoid you
are. :)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Bring your fully bootable laptop and distro installation media with
you on the trip.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Once you're at the conference, fully reinstall your laptop (with disk
encryption this time), then download your symmetrically encrypted
homedir file and decrypt/untar it into /home:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
gpg2 -d conference-slides.ppt &amp;gt; home.tar.xz
(you will be prompted for the passphrase)
tar xf home.tar.xz
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Run your playbook script to get your system quickly configured for
how you need it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;Reinstall the laptop again before you head out (you can even do this
at the airport while you wait to board your flight home). You want to
get it to the point where you can boot it up for the border crossing
officer, should they ask you to do it.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Again, depending on your level of paranoia, once you get back home, you
can either sell or give away that laptop or keep it until your next
international travel.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="using-short-lived-pgp-subkeys-for-travelling"&gt;
&lt;h2&gt;Using short-lived PGP subkeys for travelling&lt;/h2&gt;
&lt;p&gt;It is a good idea to keep your master PGP key away from your travel
laptop. I recommend keeping your PGP subkeys on a smartcard device like
&lt;a class="reference external" href="https://shop.nitrokey.com/shop/product/nitrokey-pro-3"&gt;NitroKey Pro&lt;/a&gt; (open-source) or a &lt;a class="reference external" href="https://www.yubico.com/product/yubikey-4-series/"&gt;Yubikey&lt;/a&gt; (proprietary),
but if this is too much hassle for you, you can also create temporary
short-lived subkeys that you can store directly on your laptop and use
to sign your emails or git tags while you are travelling.&lt;/p&gt;
&lt;p&gt;To do so, just follow the &lt;a class="reference external" href="https://wiki.debian.org/Subkeys"&gt;Debian Subkeys&lt;/a&gt; guide and when you create
the subkey using the &lt;tt class="docutils literal"&gt;addkey&lt;/tt&gt; command, set up the expiration date
shortly after you expect to return home (not on the exact date your
flight is scheduled to get back, but a week or two past that just in
case you get delayed). You should only need to create a Sign (S) key, as
attempting to use short-lived Encryption (E) keys will be frustrating
both to you and people you'll try to communicate with.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Make sure you upload your updated key to the keyservers, otherwise
nobody will be able to verify the signatures created with your temporary
subkey&lt;/strong&gt;:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
gpg2 --send-keys YOURKEYID
&lt;/pre&gt;
&lt;p&gt;Follow the procedure described in the Debian wiki to copy ONLY your
temporary subkey to your travel laptop (or into the encrypted directory
tarball you are preparing).&lt;/p&gt;
&lt;p&gt;If you are taking a ChromeBook with you and are setting up a jumpserver
(see above), you can use this procedure to put your temporary Signing
subkey onto it as well, just in case you need to send signed email or
sign some git tags.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="laptop-use-while-at-the-conference"&gt;
&lt;h2&gt;Laptop use while at the conference&lt;/h2&gt;
&lt;p&gt;Best recommendation is to always keep your laptop within your reach and
never leave it unattended -- especially in your hotel room. If you have
SecureBoot or other boot-time security protections (as offered by
ChromeBooks, for example), then you &lt;em&gt;might&lt;/em&gt; consider leaving your laptop
at your hotel unattended if you see no other option. After all, there
are easier ways of gaining access to your secrets than physically
defeating SecureBoot (and attackers who want that bad enough can usually
afford to send operatives to some location where you least expect it).&lt;/p&gt;
&lt;p&gt;If you are done with your laptop for a while, remember to fully shut it
down and not suspend to RAM -- especially if you do leave it unattended.&lt;/p&gt;
&lt;p&gt;Pay especial attention to any browser warnings or any reported key
mismatches while you're using your system. The wifi network at technical
conferences is an attractive target for attackers, as it would allow
stealing a lot of valuable secrets at once. Malicious attacks on the
conference wifi &lt;em&gt;have&lt;/em&gt; happened in the past and will likely happen again
in the future.&lt;/p&gt;
&lt;p&gt;Do set up VPN and do use it, as it will help mitigate some of the local
wifi attacks, but this comes at the cost of extra connection
instability.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="in-conclusion"&gt;
&lt;h2&gt;In conclusion&lt;/h2&gt;
&lt;p&gt;I understand that this is way too paranoid for most people (and not
nearly paranoid enough for some others -- as I like to say, IT security
is just like driving on the highway in the sense that anyone going
slower than you is an idiot, and anyone going faster is clearly a
maniac). Whether this guide is of any use to you is entirely your call,
but I hope I gave you some good ideas to help secure your digital life
next time you are away from the comfort of your home or office.&lt;/p&gt;
&lt;/div&gt;
</content><category term="infosec"></category><category term="security"></category><category term="travel"></category><category term="laptops"></category></entry><entry><title>Turn Openscap OVAL report into Puppet facts</title><link href="https://paranoidbeavers.ca/openscap-oval-facter.html" rel="alternate"></link><published>2017-06-09T16:00:00-04:00</published><updated>2017-06-09T16:00:00-04:00</updated><author><name>Konstantin Ryabitsev</name></author><id>tag:paranoidbeavers.ca,2017-06-09:/openscap-oval-facter.html</id><summary type="html">&lt;p&gt;I wanted to have a quick way to find out which systems had a particular
set of outstanding errata. There are actually quite a few solutions that
will do that for you, but I wanted a free/libre way of doing it that
would integrate with our existing open-source Puppet …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I wanted to have a quick way to find out which systems had a particular
set of outstanding errata. There are actually quite a few solutions that
will do that for you, but I wanted a free/libre way of doing it that
would integrate with our existing open-source Puppet (we don't use PE)
and would be easy to query via mcollective orchestration.&lt;/p&gt;
&lt;p&gt;Red Hat dutifully publishes an &lt;a class="reference external" href="https://www.redhat.com/security/data/oval/Red_Hat_Enterprise_Linux_7.xml"&gt;Openscap OVAL file&lt;/a&gt; for RHEL, but we
needed a solution that worked both for RHEL and CentOS (not because
we're cheapskates, but because we use Cloud providers that do not offer
a RHEL option and we need to track errata on those systems, too).&lt;/p&gt;
&lt;p&gt;After a bit of effort, I had a small wrapper script around openscap that
would translate the report results into &lt;a class="reference external" href="https://github.com/mricon/openscap-oval-facter/blob/master/exmple-facts.yaml"&gt;Puppet facts&lt;/a&gt;:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="https://github.com/mricon/openscap-oval-facter"&gt;Openscap OVAL facter&lt;/a&gt; on Github&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It comes with a sample &lt;a class="reference external" href="https://github.com/mricon/openscap-oval-facter/blob/master/example-tweaks.yaml"&gt;tweaks file&lt;/a&gt; to make it work on a CentOS 7
system should you be in a similar position as us and be dependent on an
upstream cloud provider who doesn't offer RHEL.&lt;/p&gt;
&lt;p&gt;Once the facts are collected, you can use MCO to query which systems
have specific outstanding errata. For example, by RHSA number:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
mco find -S &amp;quot;fact('openscap.oval.rhsa.RHSA-2017:1308-01').exists=true&amp;quot;
&lt;/pre&gt;
&lt;p&gt;or by CVE:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
mco find -S &amp;quot;fact('openscap.oval.cve.CVE-2017-7502').exists=true&amp;quot;
&lt;/pre&gt;
&lt;p&gt;or list systems with outstanding important/critical errata in general:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
mco find -S &amp;quot;fact('openscap.oval.severity.critical').exists=true&amp;quot;
&lt;/pre&gt;
&lt;p&gt;There's also a full HTML report generated for each of these systems and
placed into &lt;cite&gt;/var/lib/openscap&lt;/cite&gt;.&lt;/p&gt;
&lt;p&gt;It is a handy tool and I hope it's useful to others.&lt;/p&gt;
</content><category term="infosec"></category><category term="security"></category><category term="puppet"></category><category term="python"></category></entry><entry><title>Keep track of weird logins with Howler</title><link href="https://paranoidbeavers.ca/weird-logins-howler.html" rel="alternate"></link><published>2017-06-05T13:00:00-04:00</published><updated>2017-06-05T13:00:00-04:00</updated><author><name>Konstantin Ryabitsev</name></author><id>tag:paranoidbeavers.ca,2017-06-05:/weird-logins-howler.html</id><summary type="html">&lt;p&gt;&lt;a class="reference external" href="https://github.com/mricon/howler"&gt;Howler&lt;/a&gt; is a small utility I wrote to be notified when my users were
logging in from unusual locations. I wanted to know if someone who
normally logs in from Canada was suddenly logging in from Korea -- and
especially if they were suddenly rapidly hopping between two different
locations. It's …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;a class="reference external" href="https://github.com/mricon/howler"&gt;Howler&lt;/a&gt; is a small utility I wrote to be notified when my users were
logging in from unusual locations. I wanted to know if someone who
normally logs in from Canada was suddenly logging in from Korea -- and
especially if they were suddenly rapidly hopping between two different
locations. It's a red flag when someone logs in from Seattle, then from
Barcelona, then from Seattle again, all within the same 4 hours, because
it's a good indicator that their credentials got stolen (though usually
it's because they are using Tor or their corporate VPN).&lt;/p&gt;
&lt;p&gt;At either rate, Howler will keep a watchful eye on where your users are
coming from and alert you if they change locations:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
This user logged in from a new location:

      User    : mricon
      IP Addr : x.x.x.x
      Location: Portland, Oregon, US
      Hostname: myhost.kernel.org
      Daemon  : sshd

Previously seen locations for this user:
      2017-04-08: Montréal, Quebec, CA
&lt;/pre&gt;
&lt;p&gt;or when they start hopping:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Hopping detected for user mricon!

Locations seen in the past 12 hours (UTC):

      15:04:09: Montréal, Quebec, CA
      14:58:31: Vancouver, Washington, US
      14:51:42: Montréal, Quebec, CA
      14:44:58: Vancouver, Washington, US
&lt;/pre&gt;
&lt;p&gt;It's best used on your central syslog aggregator with the help of &lt;a class="reference external" href="https://github.com/simple-evcorr/sec"&gt;SEC&lt;/a&gt;,
which is a handy tool used to poll your logs and trigger actions based
on matching regexes. I provide a few &lt;a class="reference external" href="https://github.com/mricon/howler/blob/master/conf/howler.sec"&gt;sample&lt;/a&gt; sec rules for sshd,
openvpn, and gitolite.&lt;/p&gt;
</content><category term="infosec"></category><category term="security"></category></entry><entry><title>Airbags and steel frames</title><link href="https://paranoidbeavers.ca/airbags-and-steel-frames.html" rel="alternate"></link><published>2016-01-11T13:00:00-05:00</published><updated>2016-01-11T13:00:00-05:00</updated><author><name>Konstantin Ryabitsev</name></author><id>tag:paranoidbeavers.ca,2016-01-11:/airbags-and-steel-frames.html</id><summary type="html">&lt;p&gt;In my &lt;a class="reference external" href="http://kernsec.org/files/lss2015/giant-bags-of-mostly-water.pdf"&gt;keynote&lt;/a&gt; to the 2015 Linux Kernel Summit I compared the way we
currently approach IT security to the way car makers approached
automotive design in the 1960s. Back in the day, car companies
concentrated on adding more engine power, improving vehicle reliability
and tweaking the overall body design …&lt;/p&gt;</summary><content type="html">&lt;p&gt;In my &lt;a class="reference external" href="http://kernsec.org/files/lss2015/giant-bags-of-mostly-water.pdf"&gt;keynote&lt;/a&gt; to the 2015 Linux Kernel Summit I compared the way we
currently approach IT security to the way car makers approached
automotive design in the 1960s. Back in the day, car companies
concentrated on adding more engine power, improving vehicle reliability
and tweaking the overall body design so it was both pleasing to the eye
and comfortable to drive -- all at an affordable price. They were so
successful at doing this, that we now describe that whole era as
“America’s love affair with the automobile,” and this era is far from
over yet.&lt;/p&gt;
&lt;p&gt;But, as the auto industry was celebrating its successes, several voices
started sounding an alarm. People were spending more and more time
behind the wheel, driving longer distances and at much faster speeds.
Meanwhile, safety features offered in cars were still designed for the
era where most drivers were either professionals or drove for leisure,
at slow speeds, and on poor quality roads with few other vehicles.
With the advent of suburbs, highways, four-lane traffic interchanges and
speeds in excess of 70 miles per hour, the safety features designed to
keep humans safe were no longer adequate. What used to be a minor
fender-bender at 30 miles per hour was likely to become a fatal accident
at highway speeds. Offering merely seat belts and a padded dashboard was
no longer seen as acceptable. We needed front, side, and passenger
airbags. We needed crumple zones, anti-lock braking systems, and solid
steel frames.&lt;/p&gt;
&lt;p&gt;We, as the IT industry, are going through the same growing pains. The
computing reality of 2015 is wholly different than 10, or even 5 years
ago, but our approach to IT security is still based on the assumption
that critical IT systems will be run by professionals who will take care
of safeguarding the OS for us. These professionals will set up
firewalls, virus scanners, web filters -- and will apply security
patches if critical bugs are discovered and fixed in the OS itself.&lt;/p&gt;
&lt;p&gt;However, today’s is the world of millions upon millions of smartphones,
tablets, and other handheld devices. Today’s is the world where your TV
set and your security camera have an IP address -- and tomorrow it will
be your light bulbs, your water heater, and your front door lock.
Today’s is the world where your 2-year-old smartphone may stop receiving
security updates because the phone company is more interested in selling
you a new device than keeping the older one safe. Today’s is the world
where the Internet of Things gadgets can’t reasonably be patched at all
due to limited computing capabilities. And, as we are transitioning to
IPv6, more and more of these devices will no longer be tucked away
behind NAT routers, but will be globally accessible due to configuration
errors and insufficient network isolation. Are we truly ready for that?&lt;/p&gt;
&lt;p&gt;As IT professionals, we need to ask ourselves some hard questions. What
approach should we be taking if we cannot reasonably expect that devices
will receive timely security updates? How can we teach the OS to
recognize when it is under attack so it can take necessary measures to
minimize the impact? What technologies do we need to develop and put
into our software that will be our equivalent of driver and passenger
airbags that will auto-deploy to protect our users from harm? Yes, even
if it’s all their own fault. We all make mistakes.&lt;/p&gt;
&lt;p&gt;This is a conversation that all IT professionals should be having,
whether they are working on Linux, Windows, iOS, or any other operating
system used on consumer devices. Neither should it be a conversation
limited to the core OS developers. Systems administrators, end-user app
designers, network engineers -- everyone across the IT spectrum should
work to design systems that expect human mistakes or deliberate
malicious actions and then fail in the safest way possible in order to
protect the device operator.&lt;/p&gt;
&lt;p&gt;Security is not a technology -- it’s a process and a mindset. Hopefully,
if we can change the mindset, the necessary changes to the process will
follow.&lt;/p&gt;
</content><category term="infosec"></category><category term="security"></category><category term="cars"></category></entry><entry><title>Obligatory first post</title><link href="https://paranoidbeavers.ca/init.html" rel="alternate"></link><published>2016-01-11T10:00:00-05:00</published><updated>2016-01-11T10:00:00-05:00</updated><author><name>Konstantin Ryabitsev</name></author><id>tag:paranoidbeavers.ca,2016-01-11:/init.html</id><summary type="html">&lt;p&gt;Obligatory first post is obligatory. I guess I've grown fond of using
pelican for kernel.org, so I'm going to adopt it for my own needs as
well. Besides, I find writing my articles in VIM so much more appealing
than any kind of web tool like Medium.&lt;/p&gt;
&lt;p&gt;This &amp;quot;blog …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Obligatory first post is obligatory. I guess I've grown fond of using
pelican for kernel.org, so I'm going to adopt it for my own needs as
well. Besides, I find writing my articles in VIM so much more appealing
than any kind of web tool like Medium.&lt;/p&gt;
&lt;p&gt;This &amp;quot;blog&amp;quot; will be a mishmash of various topics that interest me, from
IT security to EVs, to energy storage and politics. It should be devoid
of pointless rants, as I normally use G+ for that. If you're looking for
a way to leave a comment... well, I'm not into that sort of thing. :)&lt;/p&gt;
</content><category term="helloworld"></category></entry></feed>