<?xml version='1.0' encoding='utf-8' ?>

<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:atom10='http://www.w3.org/2005/Atom'>
<channel>
  <title>Move along, nothing to read</title>
  <link>https://robbat2.dreamwidth.org/</link>
  <description>Move along, nothing to read - Dreamwidth Studios</description>
  <lastBuildDate>Sun, 21 May 2017 05:45:16 GMT</lastBuildDate>
  <generator>LiveJournal / Dreamwidth Studios</generator>
  <lj:journal>robbat2</lj:journal>
  <lj:journaltype>personal</lj:journaltype>
  <image>
    <url>https://v2.dreamwidth.org/8564366/483469</url>
    <title>Move along, nothing to read</title>
    <link>https://robbat2.dreamwidth.org/</link>
    <width>100</width>
    <height>100</height>
  </image>

<item>
  <guid isPermaLink='true'>https://robbat2.dreamwidth.org/238949.html</guid>
  <pubDate>Sun, 21 May 2017 05:45:16 GMT</pubDate>
  <title>ebtables for EC2-like metadata server on 169.254.169.254 AND bridge</title>
  <link>https://robbat2.dreamwidth.org/238949.html</link>
  <description>&amp;lt;&amp;gt;Playing with the concepts around Cloud metadata services, specifically those that are network-based, rather than the ConfigDrive or serial port variants. 

&lt;p&gt;EC2 ensures that 169.254.169.254 is magically provide your instance with your data, and it won&apos;t be accessible to another instance.  This is trivial to achieve if your instances are using routed or tap network; but is more complex if you are on a bridged network: the client will try to send the packets for 169.254.169.254 to the MAC of the default gateway. &lt;/p&gt;

&lt;p&gt;So far I can force bridged packets that would otherwise be headed for the gateway to be routed locally (and put  169.254.169.254/32 locally on the host). I don&apos;t have a good way to associate the packets with a specific instance yet. Using kernel packet marks work, but  isn&apos;t really scalable. Main requirement is that a simple web service should be able to uniquely identify the client, even if they try to spoof themselves (learn mac+IP of another instance on the same hypervisor &amp; bridge, and ask for it&apos;s metadata from the wrong interface)&lt;/p&gt;

&lt;h3&gt; Variant 1&lt;/h3&gt;
&lt;pre&gt;  ebtables -t nat -N metadata || ebtables -t nat -F metadata
for i in $(seq 0 20) ; do
   ebtables -t nat -A metadata -i vnet$i -j mark --mark-set $((256+$i)) --mark-target CONTINUE
done
ebtables -t broute -A metadata --limit 10/minute --limit-burst 2 --log --log-level debug --log-prefix &quot;ebtables metadata&quot; --log-ip
ebtables -t nat -A metadata -j redirect
ebtables -t nat -F PREROUTING
ebtables -t nat -A PREROUTING -p IPv4 --logical-in br0 --ip-src 169.254.169.254 -j metadata
ebtables -t nat -A PREROUTING -p IPv4 --logical-in br0 --ip-dst 169.254.169.254 -j metadata
&lt;/pre&gt;

&lt;h3&gt;Variant 2&lt;/h3&gt;
&lt;pre&gt;
ebtables -t broute -N metadata || ebtables -t broute -F metadata
ebtables -t broute -F BROUTING
ebtables -t broute -A BROUTING -p IPv4 --ip-src 169.254.169.254 -j metadata
ebtables -t broute -A BROUTING -p IPv4 --ip-dst 169.254.169.254 -j metadata
ebtables -t broute -A metadata --limit 10/minute --limit-burst 2 --log --log-level debug --log-prefix &quot;ebtables metadata&quot; --log-ip
# Repeat the marks if you want them.
ebtables -t broute -A metadata -j redirect
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=robbat2&amp;ditemid=238949&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://robbat2.dreamwidth.org/238949.html</comments>
  <category>amazon</category>
  <category>bridge</category>
  <category>metadata</category>
  <category>networking</category>
  <category>ec2</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://robbat2.dreamwidth.org/238770.html</guid>
  <pubDate>Fri, 05 Jun 2015 17:25:29 GMT</pubDate>
  <title>gnupg-2.1 mutt</title>
  <link>https://robbat2.dreamwidth.org/238770.html</link>
  <description>&lt;p&gt;For the mutt users with GnuPG, depending on your configuration, you might notice that mutt&apos;s handling of GnuPG mail stopped working with GnuPG. There were a few specific cases that would have caused this, which I&apos;ll detail, but if you just want it to work again, put the below into your &lt;tt&gt;Muttrc&lt;/tt&gt;, and make the tweak to &lt;tt&gt;gpg-agent.conf&lt;/tt&gt;. The underlying cause for most if it is that secret key operations have moved to the agent, and many Mutt users used the agent-less mode, because Mutt handled the passphrase nicely on it&apos;s own.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;tt&gt;-u&lt;/tt&gt; must now come BEFORE &lt;tt&gt;--cleansign&lt;/tt&gt;&lt;/li&gt;
&lt;li&gt;Add &lt;tt&gt;allow-loopback-pinentry&lt;/tt&gt; to &lt;tt&gt;gpg-agent.conf&lt;/tt&gt;, and restart the agent&lt;/li&gt;
&lt;li&gt;The below config adds &lt;tt&gt;--pinentry-mode loopback&lt;/tt&gt; before &lt;tt&gt;--passphrase-fd 0&lt;/tt&gt;, so that GnuPG (and the agent) will accept it from Mutt still.&lt;/li&gt;
&lt;li&gt;&lt;tt&gt;--verbose&lt;/tt&gt; is optional, depending what you&apos;re doing, you might find &lt;tt&gt;--no-verbose&lt;/tt&gt; cleaner.&lt;/li&gt;
&lt;li&gt;&lt;tt&gt;--trust-model always&lt;/tt&gt; is a personal preference for my Mutt mail usage, because I do try and curate my keyring&lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;
set pgp_autosign = yes
set pgp_use_gpg_agent = no
set pgp_timeout = 600
set pgp_sign_as=&quot;(your key here)&quot;
set pgp_ignore_subkeys = no

set pgp_decode_command=&quot;gpg %?p?--pinentry-mode loopback  --passphrase-fd 0? --verbose --no-auto-check-trustdb --batch --output - %f&quot;
set pgp_verify_command=&quot;gpg --pinentry-mode loopback --verbose --batch --output - --no-auto-check-trustdb --verify %s %f&quot;
set pgp_decrypt_command=&quot;gpg %?p?--pinentry-mode loopback --passphrase-fd 0? --verbose --batch --output - %f&quot;
set pgp_sign_command=&quot;gpg %?p?--pinentry-mode loopback --passphrase-fd 0? --verbose --batch --output - --armor --textmode %?a?-u %a? --detach-sign %f&quot;
set pgp_clearsign_command=&quot;gpg %?p?--pinentry-mode loopback --passphrase-fd 0? --verbose --batch --output - --armor --textmode %?a?-u %a? --detach-sign %f&quot;
set pgp_encrypt_sign_command=&quot;pgpewrap gpg %?p?--pinentry-mode loopback --passphrase-fd 0? --verbose --batch --textmode --trust-model always --output - %?a?-u %a? --armor --encrypt --sign --armor -- -r %r -- %f&quot;
set pgp_encrypt_only_command=&quot;pgpewrap gpg %?p?--pinentry-mode loopback --passphrase-fd 0? --verbose --batch --trust-model always --output --output - --encrypt --textmode --armor -- -r %r -- %f&quot;
set pgp_import_command=&quot;gpg %?p?--pinentry-mode loopback --passphrase-fd 0? --verbose --import -v %f&quot;
set pgp_export_command=&quot;gpg %?p?--pinentry-mode loopback --passphrase-fd 0? --verbose --export --armor %r&quot;
set pgp_verify_key_command=&quot;gpg %?p?--pinentry-mode loopback --passphrase-fd 0? --verbose --batch --fingerprint --check-sigs %r&quot;
set pgp_list_pubring_command=&quot;gpg %?p?--pinentry-mode loopback --passphrase-fd 0? --verbose --batch --with-colons --list-keys %r&quot;
set pgp_list_secring_command=&quot;gpg %?p?--pinentry-mode loopback --passphrase-fd 0? --verbose --batch --with-colons --list-secret-keys %r&quot;

&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=robbat2&amp;ditemid=238770&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://robbat2.dreamwidth.org/238770.html</comments>
  <category>pgp</category>
  <category>cli</category>
  <category>gentoo</category>
  <category>gpg</category>
  <category>mutt</category>
  <category>gnupg</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
</channel>
</rss>
