<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Cloudflare – Yeri Tiete</title>
    <link>https://yeri.be/tag/cloudflare/</link>
    <description>Yeri Tiete&#39;s blog</description>
    <language>en</language>
    <copyright>© Yeri Tiete</copyright>
    <lastBuildDate>Tue, 09 Apr 2024 18:44:29 +0200</lastBuildDate>
    <atom:link href="https://yeri.be/tag/cloudflare/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>GTFS</title>
      <link>https://yeri.be/gtfs/</link>
      <pubDate>Tue, 09 Apr 2024 18:44:29 +0200</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/gtfs/</guid><enclosure url="https://static.yeri.be/2024/04/gtfs.webp" length="0" type="image/webp" />
      <description>&lt;p&gt;As &lt;a href=&#34;https://gtfs.irail.be/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;iRail&#39;s servers&lt;/a&gt; go down once in a while (and contain some legacy files, making it a bit messy), I decided to back up and host the GTFS feeds of Belgian Railway (NMBS), and the 3 Belgian bus companies (De Lijn, TEC and MIVB) at &lt;a href=&#34;https://gtfs.flatturtle.cloud/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;gtfs.flatturtle.cloud&lt;/a&gt;. &lt;/p&gt;&#xA;&lt;p&gt;Every night, around 3am (CET), the GTFS files are uploaded to Cloudflare R2. &lt;/p&gt;&#xA;&lt;p&gt;I keep the historical files as well (&lt;a href=&#34;https://hello.irail.be/?s=gtfs&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;iRail&lt;/a&gt; only did this for NMBS, but I&#39;m doing it for all). The latest available GTFS is in &lt;code&gt;*/_latest/&amp;lt;file&gt;.zip&lt;/code&gt;. &lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2024/04/gtfs.webp" alt="GTFS"></p><p>As <a href="https://gtfs.irail.be/" target="_blank" rel="noreferrer noopener">iRail's servers</a> go down once in a while (and contain some legacy files, making it a bit messy), I decided to back up and host the GTFS feeds of Belgian Railway (NMBS), and the 3 Belgian bus companies (De Lijn, TEC and MIVB) at <a href="https://gtfs.flatturtle.cloud/" target="_blank" rel="noreferrer noopener">gtfs.flatturtle.cloud</a>. </p>
<p>Every night, around 3am (CET), the GTFS files are uploaded to Cloudflare R2. </p>
<p>I keep the historical files as well (<a href="https://hello.irail.be/?s=gtfs" target="_blank" rel="noreferrer noopener">iRail</a> only did this for NMBS, but I'm doing it for all). The latest available GTFS is in <code>*/_latest/&lt;file>.zip</code>. </p>
<p>The directory listing is created using <a href="https://github.com/cmj2002/r2-dir-list/" target="_blank" rel="noreferrer noopener">Workers</a>.</p>
<p>I'm trying to get access to <a href="http://dewaterbus.be" target="_blank" rel="noreferrer noopener">dewaterbus.be</a> as well, but so far, they haven't replied. </p>
]]></content:encoded>
      <category>linux</category><category>software</category><category>irail</category>
      <category>belgium</category><category>cloudflare</category>
    </item>
    
    <item>
      <title>Taking the Airbus to the IKEA Cloud</title>
      <link>https://yeri.be/taking-the-airbus-to-the-ikea-cloud/</link>
      <pubDate>Thu, 11 Jan 2024 22:13:16 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/taking-the-airbus-to-the-ikea-cloud/</guid><enclosure url="https://static.yeri.be/2024/01/field-clouds-sky-earth-46160.jpeg" length="0" type="image/jpeg" />
      <description>&lt;blockquote class=&#34;wp-block-quote&#34;&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;All of computing is moving to the cloud at a rapid clip, including (government) parts you might want to keep under your own control&lt;/li&gt;&#xA;&lt;li&gt;Europe has no relevant ‘hyperscaler’ cloud providers at all, and there is a desire to change this by policy means&lt;/li&gt;&#xA;&lt;li&gt;Competing with the IKEA-concept is nearly impossible. Offering IKEA-like products but then with &lt;strong&gt;a smaller range is not an attractive proposition&lt;/strong&gt;. You can’t replicate IKEA without a LOT of upfront work&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Replicating a company like Airbus (or ASML) is similarly very hard&lt;/strong&gt;: both companies (and their ecosystems) are one of the very few places where you can buy modern wide body jets and extreme UV wafer steppers. Their products are technically incredibly advanced.&lt;/li&gt;&#xA;&lt;li&gt;The ‘hyperscaler’ cloud providers (like Amazon, Microsoft, Google, Alibaba) are &lt;strong&gt;both IKEA&lt;/strong&gt; and &lt;strong&gt;Airbus/ASML hard to replicate&lt;/strong&gt;. They offer a huge and complete range services that are also incredibly advanced and years ahead of commodity products&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Europe has precisely nothing that competes, and is 100% dependent on the ‘IKEA clouds’&lt;/strong&gt;. We only have partial companies.&lt;/li&gt;&#xA;&lt;li&gt;Fixing that situation will not be possible through legislation, standardisation or concerted government action. &lt;strong&gt;You can’t procure a competitive mega cloud into existence&lt;/strong&gt;. Europe did assemble Airbus from its component parts but it was very hard&lt;/li&gt;&#xA;&lt;li&gt;Although IKEA exists, you can still get (better) furniture from more specialised places. &lt;strong&gt;A European owned email, communication and collaboration cloud might be a feasible idea&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;European procurement law makes it entirely doable for governments to order their services from such European communication clouds&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;From that, &lt;strong&gt;a more viable European cloud ecosystem&lt;/strong&gt; could perhaps evolve&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;cite&gt;&lt;em&gt;Source&lt;/em&gt;: &lt;a href=&#34;https://berthub.eu/articles/posts/taking-the-airbus-to-the-ikea-cloud/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;Taking the Airbus to the IKEA Cloud&lt;/a&gt; by &lt;a href=&#34;https://berthub.eu/articles/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;Bert Hubert&lt;/a&gt;&lt;/cite&gt;&lt;/blockquote&gt;&#xA;&lt;p&gt;We do have some (smaller) cloud (Scaleway) and datacenter players (Leaseweb, could use some innovation) and some inbetween (OVH, Hetzner)... But none are really a true cloud provider with serverless, all the storage stuff, etc.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2024/01/field-clouds-sky-earth-46160.jpeg" alt="Taking the Airbus to the IKEA Cloud"></p><blockquote class="wp-block-quote">
<ul>
<li>All of computing is moving to the cloud at a rapid clip, including (government) parts you might want to keep under your own control</li>
<li>Europe has no relevant ‘hyperscaler’ cloud providers at all, and there is a desire to change this by policy means</li>
<li>Competing with the IKEA-concept is nearly impossible. Offering IKEA-like products but then with <strong>a smaller range is not an attractive proposition</strong>. You can’t replicate IKEA without a LOT of upfront work</li>
<li><strong>Replicating a company like Airbus (or ASML) is similarly very hard</strong>: both companies (and their ecosystems) are one of the very few places where you can buy modern wide body jets and extreme UV wafer steppers. Their products are technically incredibly advanced.</li>
<li>The ‘hyperscaler’ cloud providers (like Amazon, Microsoft, Google, Alibaba) are <strong>both IKEA</strong> and <strong>Airbus/ASML hard to replicate</strong>. They offer a huge and complete range services that are also incredibly advanced and years ahead of commodity products</li>
<li><strong>Europe has precisely nothing that competes, and is 100% dependent on the ‘IKEA clouds’</strong>. We only have partial companies.</li>
<li>Fixing that situation will not be possible through legislation, standardisation or concerted government action. <strong>You can’t procure a competitive mega cloud into existence</strong>. Europe did assemble Airbus from its component parts but it was very hard</li>
<li>Although IKEA exists, you can still get (better) furniture from more specialised places. <strong>A European owned email, communication and collaboration cloud might be a feasible idea</strong></li>
<li><strong>European procurement law makes it entirely doable for governments to order their services from such European communication clouds</strong></li>
<li>From that, <strong>a more viable European cloud ecosystem</strong> could perhaps evolve</li>
</ul>
<cite><em>Source</em>: <a href="https://berthub.eu/articles/posts/taking-the-airbus-to-the-ikea-cloud/" target="_blank" rel="noreferrer noopener">Taking the Airbus to the IKEA Cloud</a> by <a href="https://berthub.eu/articles/" target="_blank" rel="noreferrer noopener">Bert Hubert</a></cite></blockquote>
<p>We do have some (smaller) cloud (Scaleway) and datacenter players (Leaseweb, could use some innovation) and some inbetween (OVH, Hetzner)... But none are really a true cloud provider with serverless, all the storage stuff, etc.</p>
<p><a href="https://evroc.com/" target="_blank" rel="noreferrer noopener">Evroc</a> is trying just that -- being a real competitor to GCP and AWS -- but that'll need a lot of funding, and it's been rather quiet from their end for a few months. </p>
<p>To be seen what'll come out of it ... </p>
<p>Then again, I've recently (year or two) seen a push from medium-sized companies to get away from the cloud (<a href="https://world.hey.com/dhh/we-have-left-the-cloud-251760fb" target="_blank" rel="noreferrer noopener">Basecamp/Hey</a> for one, but they are not alone) -- at least the big players -- due to exaggerated vendor lock-in and pricing. </p>
]]></content:encoded>
      <category>misc</category>
      <category>china</category><category>cloudflare</category><category>europe</category><category>google</category><category>politics</category>
    </item>
    
    <item>
      <title>killwarp</title>
      <link>https://yeri.be/killwarp/</link>
      <pubDate>Mon, 03 Jul 2023 15:48:30 +0200</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/killwarp/</guid><enclosure url="https://static.yeri.be/2023/05/warp-desktop-3.png" length="0" type="image/png" />
      <description>&lt;p&gt;Is your company forcing &lt;a href=&#34;https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp/download-warp/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;Cloudflare Warp&lt;/a&gt; on you, and are you running on a Mac (with &lt;code&gt;sudo&lt;/code&gt; access)?&lt;/p&gt;&#xA;&lt;p&gt;It probably sucks, spies on you, does MitM attacks, breaks most video conferencing tools, and is generally not very stable... Also... Zero trust!&lt;/p&gt;&#xA;&lt;p&gt;Add this function to your &lt;code&gt;.bashrc&lt;/code&gt; or &lt;code&gt;.zshrc&lt;/code&gt; (whichever shell you&#39;re using*):&lt;/p&gt;&#xA;&lt;pre class=&#34;wp-block-code&#34;&gt;&lt;code&gt;func killwarp() {&#xA;&#x9;sudo launchctl remove com.cloudflare.1dot1dot1dot1.macos.warp.daemon&#xA;&#x9;sudo killall Cloudflare\ WARP&#xA;}&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Open a new shell window (to reload your dot files), and type &lt;code&gt;killwarp&lt;/code&gt;.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2023/05/warp-desktop-3.png" alt="killwarp"></p><p>Is your company forcing <a href="https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp/download-warp/" target="_blank" rel="noreferrer noopener">Cloudflare Warp</a> on you, and are you running on a Mac (with <code>sudo</code> access)?</p>
<p>It probably sucks, spies on you, does MitM attacks, breaks most video conferencing tools, and is generally not very stable... Also... Zero trust!</p>
<p>Add this function to your <code>.bashrc</code> or <code>.zshrc</code> (whichever shell you're using*):</p>
<pre class="wp-block-code"><code>func killwarp() {
	sudo launchctl remove com.cloudflare.1dot1dot1dot1.macos.warp.daemon
	sudo killall Cloudflare\ WARP
}</code></pre>
<p>Open a new shell window (to reload your dot files), and type <code>killwarp</code>.</p>
<p>This will permanently disable Warp (until your Mac is rebooted; as it's most likely force installed/started by your admin). So just run this after every reboot. </p>
<p>(*) Find out with <code>echo $SHELL</code>. </p>
]]></content:encoded>
      <category>apple</category><category>networking</category><category>software</category>
      <category>cloudflare</category><category>vpn</category>
    </item>
    
    <item>
      <title>Keeping Mastodon storage in check</title>
      <link>https://yeri.be/keeping-mastodon-storage-in-check/</link>
      <pubDate>Mon, 29 May 2023 14:28:59 +0200</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/keeping-mastodon-storage-in-check/</guid><enclosure url="https://static.yeri.be/2023/05/clearing_mastodon_storage.png" length="0" type="image/png" />
      <description>&lt;p&gt;For my &lt;a rel=&#34;noreferrer noopener&#34; href=&#34;https://m.superuser.one/&#34; target=&#34;_blank&#34;&gt;Mastodon instance&lt;/a&gt;, I use &lt;a href=&#34;https://yeri.be/mastodon-server-r2&#34;&gt;Cloudflare R2&lt;/a&gt;; mainly for two reasons: &lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Storage was growing quickly (~80Gb during its peak); I am hosting my instance on a RPi4 (w/ 8Gb RAM) and the SSD was filling up rapidly,&lt;/li&gt;&#xA;&lt;li&gt;I wanted something speedy to serve (big and cacheable) content (i.e. a CDN). &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;While I didn&#39;t care much about storage any more, I still wanted to make sure it was kept in check, also for two reasons:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2023/05/clearing_mastodon_storage.png" alt="Keeping Mastodon storage in check"></p><p>For my <a rel="noreferrer noopener" href="https://m.superuser.one/" target="_blank">Mastodon instance</a>, I use <a href="https://yeri.be/mastodon-server-r2">Cloudflare R2</a>; mainly for two reasons: </p>
<ul>
<li>Storage was growing quickly (~80Gb during its peak); I am hosting my instance on a RPi4 (w/ 8Gb RAM) and the SSD was filling up rapidly,</li>
<li>I wanted something speedy to serve (big and cacheable) content (i.e. a CDN). </li>
</ul>
<p>While I didn't care much about storage any more, I still wanted to make sure it was kept in check, also for two reasons:</p>
<ul>
<li>Mastodon downloads a copy of all content it says on the Fediverse, and keeps it until purged. So every instance has all the content from other instances. This could theoretically lead to you hosting illegal content and getting in trouble for it,</li>
<li>Cloudflare used to be my employer, and I have free access to R2. However, there's always a risk they'll disable my employee benefits one day and get me to pay for my used storage.</li>
</ul>
<p>I run my Mastodon in a Docker instance, so your commands may vary (basically <code>tootctl X Y</code> is what matters). I run most of these commands once a week using systemd (except the media remover, that runs every day). </p>
<p>This will clear:</p>
<ul>
<li>accounts (you never interacted with)</li>
<li>header files (big picture every account can upload)</li>
<li>profile pictures</li>
<li>link preview cards</li>
<li>orphaned media (uploaded media but not posted)</li>
<li>media (from other accounts)</li>
<li>statuses (from other accounts)</li>
<li><em>and as a bonus</em> include updating Elasticsearch indices (which sound run every once in a while to optimise search)</li>
</ul>
<pre class="wp-block-code"><code>/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl accounts prune

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl media remove --remove-headers --days 15

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl media remove--prune-profiles --days 30

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl preview_cards remove --days 15

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl media remove-orphans

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl media remove --days 30

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl statuses remove --days 30

/usr/bin/docker compose -f /srv/mastodon/docker-compose.yml run --rm shell tootctl search deploy</code></pre>
<p>Note that you should play with the <code>--days X</code> to find something that works for you (i.e.: you can scroll back in the history and still see posts/media, but not overload your storage). </p>
<p>I've included all the systemd files that's needed <a rel="noreferrer noopener" href="https://static.yeri.be/2023/05/mastodon-cleanup.tar" target="_blank">here</a>. Again, will only work in a Docker environment using the same paths as me. </p>
<p>The systemd files will need to be activated using something similar to this (but again, don't blindly run these commands as it'll likely not work):</p>
<pre class="wp-block-code"><code>cp *.service *.timer /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now *.timer
systemctl list-timers | grep masto</code></pre>
<p>Oh, and this is not specific to R2. This works even when storing everything locally.</p>
<p>I've <a href="https://yeri.be/using-mastodon-with-cloudflare">written before</a> on how to use Cloudflare CDN to protect/speed up your instance. </p>
]]></content:encoded>
      <category>software</category><category>www</category>
      <category>cloudflare</category><category>fediverse</category><category>mastodon</category>
    </item>
    
    <item>
      <title>Mastodon server: R2</title>
      <link>https://yeri.be/mastodon-server-r2/</link>
      <pubDate>Tue, 22 Nov 2022 11:49:00 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/mastodon-server-r2/</guid><enclosure url="https://static.yeri.be/2022/11/cf-r2.png" length="0" type="image/png" />
      <description>&lt;p&gt;This is a very short post because to be honest, I &lt;a href=&#34;https://m.superuser.one/@lxcid@kopiti.am/109374284873832578&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;didn&#39;t figure much out myself&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My uploads/static files are now saved in &lt;a href=&#34;http://web.archive.org/web/20230723095440/https://www.cloudflare.com/en-gb/products/r2/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;R2&lt;/a&gt; under &lt;a rel=&#34;noreferrer noopener&#34; href=&#34;https://media.m.superuser.one/media_attachments/files/109/385/863/456/667/693/original/764c92352c9e9b5a.jpg&#34; target=&#34;_blank&#34;&gt;its own URL&lt;/a&gt; (part of my enterprise zone) so that my &lt;a href=&#34;https://developers.cloudflare.com/r2/data-access/public-buckets/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;normal caching rules&lt;/a&gt; and other settings are applied.&lt;/p&gt;&#xA;&lt;p&gt;Add &lt;a href=&#34;https://github.com/mastodon/mastodon/issues/20416#issuecomment-1312454331&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;these&lt;/a&gt; to your application.env file:&lt;/p&gt;&#xA;&lt;pre class=&#34;wp-block-code&#34;&gt;&lt;code&gt;3_ENABLED = &#34;true&#34;&#xA;S3_BUCKET = &#34;&amp;lt;bucket name&gt;&#34;&#xA;S3_ENDPOINT = &#34;https://&amp;lt;some-id&gt;.r2.cloudflarestorage.com&#34;&#xA;S3_ALIAS_HOST = &#34;&amp;lt;connected domain&gt;&#34; &#xA;S3_PERMISSION = &#34;private&#34;&#xA;AWS_ACCESS_KEY_ID = &#34;&amp;lt;access_key&gt;&#34;&#xA;AWS_SECRET_ACCESS_KEY = &#34;&amp;lt;secret_access_key&gt;&#34;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The token/API key is a bit hard to find, but it&#39;s on &lt;a rel=&#34;noreferrer noopener&#34; href=&#34;https://developers.cloudflare.com/r2/data-access/s3-api/tokens/&#34; target=&#34;_blank&#34;&gt;the top right&lt;/a&gt;. &lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2022/11/cf-r2.png" alt="Mastodon server: R2"></p><p>This is a very short post because to be honest, I <a href="https://m.superuser.one/@lxcid@kopiti.am/109374284873832578" target="_blank" rel="noreferrer noopener">didn't figure much out myself</a>.</p>
<p>My uploads/static files are now saved in <a href="http://web.archive.org/web/20230723095440/https://www.cloudflare.com/en-gb/products/r2/" target="_blank" rel="noreferrer noopener">R2</a> under <a rel="noreferrer noopener" href="https://media.m.superuser.one/media_attachments/files/109/385/863/456/667/693/original/764c92352c9e9b5a.jpg" target="_blank">its own URL</a> (part of my enterprise zone) so that my <a href="https://developers.cloudflare.com/r2/data-access/public-buckets/" target="_blank" rel="noreferrer noopener">normal caching rules</a> and other settings are applied.</p>
<p>Add <a href="https://github.com/mastodon/mastodon/issues/20416#issuecomment-1312454331" target="_blank" rel="noreferrer noopener">these</a> to your application.env file:</p>
<pre class="wp-block-code"><code>3_ENABLED = "true"
S3_BUCKET = "&lt;bucket name>"
S3_ENDPOINT = "https://&lt;some-id>.r2.cloudflarestorage.com"
S3_ALIAS_HOST = "&lt;connected domain>" 
S3_PERMISSION = "private"
AWS_ACCESS_KEY_ID = "&lt;access_key>"
AWS_SECRET_ACCESS_KEY = "&lt;secret_access_key>"</code></pre>
<p>The token/API key is a bit hard to find, but it's on <a rel="noreferrer noopener" href="https://developers.cloudflare.com/r2/data-access/s3-api/tokens/" target="_blank">the top right</a>. </p>
<p>Then (re)deploy your site. </p>
<pre class="wp-block-verse">I did set up a <a rel="noreferrer noopener" href="http://m.superuser.one/@yeri" target="_blank">new server</a> (my RPi4 started to struggle, and I guess if I'm half serious about Mastodon, I shouldn't host it at home), so I started afresh... But there's a way to migrate existing data to R2 as well, following <a rel="noreferrer noopener" href="https://stanislas.blog/2018/05/moving-mastodon-media-files-to-wasabi-object-storage/" target="_blank">this guide</a>. </pre>
]]></content:encoded>
      <category>software</category><category>www</category>
      <category>cloudflare</category><category>fediverse</category><category>mastodon</category>
    </item>
    
    <item>
      <title>Using Mastodon with Cloudflare</title>
      <link>https://yeri.be/using-mastodon-with-cloudflare/</link>
      <pubDate>Wed, 16 Nov 2022 16:07:46 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/using-mastodon-with-cloudflare/</guid><enclosure url="https://static.yeri.be/2022/11/mastodon.png" length="0" type="image/png" />
      <description>&lt;p&gt;If you&#39;re using Mastodon with Cloudflare CDN/protection and &lt;a href=&#34;http://web.archive.org/web/20230202013849/https://support.cloudflare.com/hc/en-us/articles/200168196-Using-Cloudflare-Auto-Minify&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;minify&lt;/a&gt; turned on, you&#39;ll notice the site may look broken (after a few visits, when hitting Cloudflare cache).&lt;/p&gt;&#xA;&lt;figure class=&#34;wp-block-image size-large&#34;&gt;&lt;a href=&#34;https://static.yeri.be/2022/11/Screenshot-2022-11-15-at-16.00.15.png&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;&lt;img src=&#34;https://static.yeri.be/2022/11/Screenshot-2022-11-15-at-16.00.15-1024x944.png&#34; alt=&#34;&#34; class=&#34;wp-image-70935&#34;/&gt;&lt;/a&gt;&lt;figcaption class=&#34;wp-element-caption&#34;&gt;Yeah, that&#39;s not how it&#39;s supposed to look.&lt;/figcaption&gt;&lt;/figure&gt;&#xA;&lt;p&gt;And you&#39;ll notice errors in the webdev tools similar to &lt;code&gt;Failed to find a valid digest in the &#39;integrity&#39; attribute, with computed SHA-256 integrity&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre class=&#34;wp-block-code&#34;&gt;&lt;code&gt;Failed to find a valid digest in the &#39;integrity&#39; attribute for resource &#39;https://mastodon.yeri.be/packs/js/common-997d98113e1e433a9a9f.js&#39; with computed SHA-256 integrity &#39;YgEhHmwjKL88zKfUOMt/qRulYurIuHzhn4SZC9QQ5Mg=&#39;. The resource has been blocked.&#xA;@yeri:1 Failed to find a valid digest in the &#39;integrity&#39; attribute for resource &#39;https://mastodon.yeri.be/packs/js/locale_en-f70344940a5a8f625e92.chunk.js&#39; with computed SHA-256 integrity &#39;1VgpQjY/9w/fgRLw1QH2pfzqr36p3hINvg9ahpBiI2U=&#39;. The resource has been blocked.&#xA;@yeri:1 Failed to find a valid digest in the &#39;integrity&#39; attribute for resource &#39;https://mastodon.yeri.be/packs/js/public-a52a3460655116c9cf18.chunk.js&#39; with computed SHA-256 integrity &#39;onh6vHxzykkVgJkiww+OCPk0tKC48KMUD9GVJ8/LKJQ=&#39;. The resource has been blocked.&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Basically, the sha256 hash doesn&#39;t match the js or css static files. &lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2022/11/mastodon.png" alt="Using Mastodon with Cloudflare"></p><p>If you're using Mastodon with Cloudflare CDN/protection and <a href="http://web.archive.org/web/20230202013849/https://support.cloudflare.com/hc/en-us/articles/200168196-Using-Cloudflare-Auto-Minify" target="_blank" rel="noreferrer noopener">minify</a> turned on, you'll notice the site may look broken (after a few visits, when hitting Cloudflare cache).</p>
<figure class="wp-block-image size-large"><a href="https://static.yeri.be/2022/11/Screenshot-2022-11-15-at-16.00.15.png" target="_blank" rel="noreferrer noopener"><img src="https://static.yeri.be/2022/11/Screenshot-2022-11-15-at-16.00.15-1024x944.png" alt="" class="wp-image-70935"/></a><figcaption class="wp-element-caption">Yeah, that's not how it's supposed to look.</figcaption></figure>
<p>And you'll notice errors in the webdev tools similar to <code>Failed to find a valid digest in the 'integrity' attribute, with computed SHA-256 integrity</code>:</p>
<pre class="wp-block-code"><code>Failed to find a valid digest in the 'integrity' attribute for resource 'https://mastodon.yeri.be/packs/js/common-997d98113e1e433a9a9f.js' with computed SHA-256 integrity 'YgEhHmwjKL88zKfUOMt/qRulYurIuHzhn4SZC9QQ5Mg='. The resource has been blocked.
@yeri:1 Failed to find a valid digest in the 'integrity' attribute for resource 'https://mastodon.yeri.be/packs/js/locale_en-f70344940a5a8f625e92.chunk.js' with computed SHA-256 integrity '1VgpQjY/9w/fgRLw1QH2pfzqr36p3hINvg9ahpBiI2U='. The resource has been blocked.
@yeri:1 Failed to find a valid digest in the 'integrity' attribute for resource 'https://mastodon.yeri.be/packs/js/public-a52a3460655116c9cf18.chunk.js' with computed SHA-256 integrity 'onh6vHxzykkVgJkiww+OCPk0tKC48KMUD9GVJ8/LKJQ='. The resource has been blocked.</code></pre>
<p>Basically, the sha256 hash doesn't match the js or css static files. </p>
<p>This happens because Cloudflare minifies those files and thus the hash has been changed.</p>
<p>To get it to work correctly, you'll need to create a Page Rule via <code>Rules > Page Rules > Create Page Rule</code> with the following info: </p>
<figure class="wp-block-image size-large"><a href="https://static.yeri.be/2022/11/page-rule.png" target="_blank" rel="noreferrer noopener"><img src="https://static.yeri.be/2022/11/page-rule-1024x500.png" alt="" class="wp-image-70937"/></a><figcaption class="wp-element-caption">The page rule created; in this screenshot, the rule is still turned off.</figcaption></figure>
<ul>
<li>URL: YourMastodonURL.com/packs/*</li>
<li>Settings: Auto Minify: off (do not select anything)</li>
<li>Rocket Loader: slider off</li>
</ul>
<figure class="wp-block-image size-large"><a href="https://static.yeri.be/2022/11/page-rule-details.png" target="_blank" rel="noreferrer noopener"><img src="https://static.yeri.be/2022/11/page-rule-details-1011x1024.png" alt="" class="wp-image-70938"/></a><figcaption class="wp-element-caption">Details on the page rule. Save and deploy.</figcaption></figure>
<p>Don't forget to purge your cache via the dashboard (for the Mastodon domain) via <code>Caching > Custom Purge > Hostname > YourMastodonURL.com</code>.</p>
]]></content:encoded>
      <category>errors</category><category>software</category><category>www</category>
      <category>cloudflare</category><category>fediverse</category><category>javascript</category><category>mastodon</category>
    </item>
    
    <item>
      <title>Remote desktop and Wake-on-LAN</title>
      <link>https://yeri.be/remote-desktop-and-wake-on-lan/</link>
      <pubDate>Sat, 09 Jul 2022 23:14:54 +0200</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/remote-desktop-and-wake-on-lan/</guid><enclosure url="https://static.yeri.be/2022/07/pexels-photo-1438073.jpeg" length="0" type="image/jpeg" />
      <description>&lt;p&gt;&lt;a href=&#34;http://shanwong.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;Shan&lt;/a&gt; uses her iPad a lot, but a lot of the more serious (interior design) work needs to happen on &lt;a href=&#34;https://yeri.be/screen-going-black-with-autocad-lt&#34;&gt;AutoCAD&lt;/a&gt; or Photoshop. That is just not going to work on an iPad. &lt;/p&gt;&#xA;&lt;p&gt;When we&#39;re travelling (read: holiday) she&#39;s carrying an old Lenovo &lt;a href=&#34;https://www.lenovo.com/gb/en/laptops/thinkpad/13-series/ThinkPad-13-Windows-2nd-Gen/p/22TP2TX133E&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;ThinkPad 13&lt;/a&gt; (great device!) just &#34;in case&#34; she needs to open AutoCAD and edit something minor or read the drawings/dimensions. But honestly, most of the time that device is turned off and dead weight.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2022/07/pexels-photo-1438073.jpeg" alt="Remote desktop and Wake-on-LAN"></p><p><a href="http://shanwong.com" target="_blank" rel="noreferrer noopener">Shan</a> uses her iPad a lot, but a lot of the more serious (interior design) work needs to happen on <a href="https://yeri.be/screen-going-black-with-autocad-lt">AutoCAD</a> or Photoshop. That is just not going to work on an iPad. </p>
<p>When we're travelling (read: holiday) she's carrying an old Lenovo <a href="https://www.lenovo.com/gb/en/laptops/thinkpad/13-series/ThinkPad-13-Windows-2nd-Gen/p/22TP2TX133E" target="_blank" rel="noreferrer noopener">ThinkPad 13</a> (great device!) just "in case" she needs to open AutoCAD and edit something minor or read the drawings/dimensions. But honestly, most of the time that device is turned off and dead weight.</p>
<p>But all the above is just an excuse to "I was bored, and I wanted to test something": can I use an old Raspberry Pi (<a href="https://www.raspberrypi.com/products/raspberry-pi-zero-w/" target="_blank" rel="noreferrer noopener">zero W</a>) to remotely wake her Intel NUC, and then use <a href="http://tailscale.com/" target="_blank" rel="noreferrer noopener">Tailscale</a> to use RD on her iPad? Well, yes I can. </p>
<p>I completed this using:</p>
<ul><li>Tailscale to remote desktop from anywhere to home</li><li>Cloudflare Tunnels, Access and DNS to have a web interface to wake the desktop</li><li>A Linux device that's always on and in the same LAN, and that'll run a PHP script. </li></ul>
<h2>Prep work: enable WOL</h2>
<p>First off: enable Wake-on-LAN (WOL) in the BIOS <em>and </em>in your Windows settings. <a href="https://www.intel.com/content/www/us/en/support/articles/000027615/intel-nuc.html" target="_blank" rel="noreferrer noopener">This article explains</a> it for Intel NUCs, but would be similar enough for most devices. The Device Manager pane looked different on our i5 NUC, but was close enough. </p>
<p>On Mac, you just need to enable it in the Energy preference pane, for Linux I have no clue. 🤷‍♂️</p>
<p>Second step: have a working Raspberry Pi (or any Linux device) in <em>the same LAN</em>. This device needs to be turned on 24/7, so use something that uses very little power. </p>
<pre class="wp-block-verse">I do have a more powerful <a href="https://yeri.be/making-bluetooth-work-on-rpi4">RPi4</a> I wish I could've reused (running <a href="https://yeri.be/running-wireguard-in-a-docker-container-rpi">Docker</a> and some other "serious" stuff; however it's currently in a different VLAN, and it's quite crucial the Linux device is in the same LAN as the device(s) you want to wake up), so I went with an old Raspberry Pi Zero W that was collecting dust (it used to run <a href="https://pwnagotchi.ai/" target="_blank" rel="noreferrer noopener">pwnagotchi</a>).</pre>
<p>On the Linux device, install <a href="https://www.mkssoftware.com/docs/man1/etherwake.1.asp" target="_blank" rel="noreferrer noopener">etherwake</a>. The command to run is quite simply <code>etherwake aa:bb:cc:11:22:33</code> (= the ethernet MAC address of your device).</p>
<p>If this doesn't wake your desktop, something is wrong and there's no point continuing. Go and troubleshoot. </p>
<h2>Install Tailscale and RD</h2>
<p>On the (<a href="https://www.youtube.com/watch?v=lKQroybFqg4" target="_blank" rel="noreferrer noopener">Windows</a>) desktop and your iPad, install <a href="https://tailscale.com/download" target="_blank" rel="noreferrer noopener">Tailscale</a>. Login, and make sure it works by pinging from one to the other. </p>
<p>Then set up Remote Desktop on both (<a href="https://support.microsoft.com/en-us/windows/how-to-use-remote-desktop-5fe128d5-8fb1-7a23-3b8a-41e636865e8c#ID0EDD=Windows_10" target="_blank" rel="noreferrer noopener">Windows</a>, <a href="https://apps.apple.com/us/app/remote-desktop-mobile/id714464092" target="_blank" rel="noreferrer noopener">iPad</a>). You should test and make sure you can properly connect using the LAN IP address and then the Tailscale IP address.</p>
<pre class="wp-block-verse">Fun fact: I create a DNS record for all my devices using <a href="https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/" target="_blank" rel="noreferrer noopener">Cloudflare DNS</a> with the syntax of <a href="https://smokeping-sg.superuser.one/smokeping/?target=yeri.TSwol" target="_blank" rel="noreferrer noopener">device-name.ts.yeri.be</a>, so I don't need to ever remember IPs, and can easily <code>ssh</code> or <code>ping</code> devices without having to look up IPs. </pre>
<figure class="wp-block-image size-large is-resized"><img src="https://static.yeri.be/2022/07/cf-dns-ts-1024x461.png" alt="" class="wp-image-70039" width="610" height="274"/><figcaption>Cloudflare DNS screenshot, filtered on "ts". I add both <code>A</code> and <code>AAAA</code> records (not shown in the screenshot) </figcaption></figure>
<pre class="wp-block-verse">Fun fact side track: I actually have a dynamic script that runs (on Linux) and creates <code>hostname.ts.yeri.be</code> for the Tailscale IP, <code>hostname.wg.yeri.be</code> based on the <a href="https://yeri.be/wireguard" target="_blank" rel="noreferrer noopener">Wireguard</a> IP, <code>hostname.lan.yeri.be</code> based on the LAN IP. This dyndns script runs every so often and updates IPs if needed. All this is running using <a href="https://github.com/tech-otaku/cloudflare-dns" target="_blank" rel="noreferrer noopener">Cloudflare DNS and their API</a>. Super convenient.</pre>
<h2>Nginx, php and etherwake</h2>
<pre class="wp-block-verse">I'm a 80s kid, so I'll use dirty PHP to run this script. I'm sure I'll go straight to hell for this, but yolo.</pre>
<p>Install <a href="https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-ubuntu-18-04" target="_blank" rel="noreferrer noopener">nginx and PHP</a> (no need for MySQL and other stuff).</p>
<p><code>etherwake</code> requires root to run (because it needs root access to create a weird <a href="https://en.wikipedia.org/wiki/Wake-on-LAN#Magic_packet" target="_blank" rel="noreferrer noopener">magic</a> ethernet packet). Create a file in <code>/etc/sudoers.d/etherwake</code> and add this line:</p>
<pre class="wp-block-code"><code>www-data ALL=(ALL) NOPASSWD: /usr/sbin/etherwake</code></pre>
<p>This will allow <code>www-data</code> (nginx/php) to run <code>/usr/sbin/etherwake</code> using <code>sudo</code>, without password.</p>
<p>In <code>/var/www/html/</code> create an <code>index.php</code> file with:</p>
<pre class="wp-block-code"><code>&lt;html&gt;
&lt;head&gt;&lt;title&gt;Wake on Lan&lt;/title&gt;&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;Wake up &lt;a href="mycooldesktop.php"&gt;My Cool Desktop&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>And a <code>mycooldesktop.php</code> (or whatever) file with:</p>
<pre class="wp-block-code"><code>&lt;?php
$output = shell_exec('sudo /usr/sbin/etherwake aa:bb:cc:11:22:33 2&gt;&amp;1');
echo "&lt;pre&gt;$output&lt;/pre&gt;";
?&gt;
&lt;p&gt;&lt;a href=".."&gt;Back&lt;/a&gt;&lt;/p&gt;</code></pre>
<pre class="wp-block-verse">It ain't pretty -- but it gets the job done. </pre>
<p>And be sure to edit the MAC address to match your desktop's ethernet MAC address. </p>
<h2>Cloudflare tunnels</h2>
<p>Install Cloudflare Tunnel (via <a href="https://dash.teams.cloudflare.com" target="_blank" rel="noreferrer noopener">Zero Trust</a> dashboard). </p>
<p>When creating a new tunnel, the dashboard will give you all needed commands to install the tunnel on your RPi -- but be sure to select the right OS/architecture (arm64? arm? armhf?). </p>
<figure class="wp-block-image size-large"><img src="https://static.yeri.be/2022/07/cf-tunnel-1024x448.png" alt="" class="wp-image-70047"/><figcaption>Easy.</figcaption></figure>
<p>And then point the tunnel to <code>http://localhost</code>. No need to mess around with <a href="https://yeri.be/tag/ssl">SSL</a> certs.</p>
<p>Lastly, set up Cloudflare Access (via the same Zero Trust dashboard): create a new application, and make sure only approved users can sign in (i.e.: using a pin code emailed to only approved emails). </p>
<figure class="wp-block-image size-large"><img src="https://static.yeri.be/2022/07/cf-access-1024x796.png" alt="" class="wp-image-70048"/><figcaption>I only allow access to my own emails, and my family, by using groups.</figcaption></figure>
<p>You can try it yourself via <a href="https://wol.superuser.one/" target="_blank" rel="noreferrer noopener">wol.superuser.one</a>. You won't get in. :)</p>
<pre class="wp-block-verse">Optionally, but recommended: lock down Nginx to only allow connections from localhost (<code>127.0.0.0/8</code> and <code>::1</code>) if using Cloudflare Tunnels, or <a href="https://www.frankindev.com/2020/11/18/allow-cloudflare-only-in-nginx/" target="_blank" rel="noreferrer noopener">Cloudflare IPs</a> if using port forwarding with <a href="https://www.cloudflare.com/en-gb/products/zero-trust/access/" target="_blank" rel="noreferrer noopener">Cloudflare Access</a> in front. </pre>
<figure class="wp-block-image size-large is-resized"><img src="https://static.yeri.be/2022/07/wol-interface-1024x540.png" alt="" class="wp-image-70042" width="610" height="321"/><figcaption>Love my design skills... But it gets the job done: click that link, and it'll execute <code>etherwake</code>.</figcaption></figure>
<h2>To recap</h2>
<ul><li>We used Tailscale to create a VPN network between the desktop and the iPad. The big benefit is that Tailscale works effortlessly across NAT networks without having to open ports,</li><li>We used Cloudflare DNS so we don't need to remember hostnames :),</li><li>We used Cloudflare Tunnels to make sure the RPi web interface is accessible across NAT (without port forwarding) and from anywhere, </li><li>We used Cloudflare Acces and locked down access to the right people using ACLs,</li><li>We used <code>etherwake</code> running on a RPi to wake up devices that are hibernating or turned off.</li></ul>
<p>And that's it really.</p>
<pre class="wp-block-verse">PS: technically WoL works with WiFi, but when I enabled WoL on the WiFi adapter, the NUC refused to hibernate/sleep for more than a minute, and kept waking itself up. So, there seems to be some kind of trigger in my network that keeps waking it up. Also, not sure if WoL via WiFi would work if the device is turned off (as opposed to sleep or hibernate). I just ended up using ethernet. 

PPS: both Cloudflare Tunnels and Tailscale use <a href="https://www.wireguard.com/" target="_blank" rel="noreferrer noopener">Wireguard</a> tech in the background, so that's really cool. </pre>
]]></content:encoded>
      <category>apple</category><category>hardware</category><category>linux</category><category>misc</category><category>networking</category><category>software</category><category>windows</category><category>www</category>
      <category>windows</category><category>cloudflare</category><category>tailscale</category><category>vpn</category>
    </item>
    
  </channel>
</rss>
