<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>IT notes - cdn</title>
    <subtitle>DBRE, AWS platform engineering, PostgreSQL, Linux, FreeBSD, and Rust reference notes.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://nbari.com/tags/cdn/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://nbari.com"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2018-05-02T12:42:22+02:00</updated>
    <id>https://nbari.com/tags/cdn/atom.xml</id>
    <entry xml:lang="en">
        <title>Domain Fronting</title>
        <published>2018-05-02T12:42:22+02:00</published>
        <updated>2018-05-02T12:42:22+02:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/domain-fronting/"/>
        <id>https://nbari.com/domain-fronting/</id>
        
        <content type="html" xml:base="https://nbari.com/domain-fronting/">&lt;p&gt;If your domain becomes blocked you &quot;could use&quot; another one to bypass the block:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl -s -H &amp;quot;Host: your-blocked-domain&amp;quot; -H &amp;quot;Connection: close&amp;quot; &amp;quot;https://new-tld/your/path&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Both domains must be hosted within the same CDN, example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;curl -s -H &amp;quot;Host: images-na.ssl-images-amazon.com&amp;quot; -H &amp;quot;Connection: close&amp;quot; &amp;quot;https://cdn.atlassian.com/images/I/01rgQ3jqo7L.css&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;More info:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;https://www.optiv.com/blog/escape-and-evasion-egressing-restricted-networks&lt;/li&gt;
&lt;li&gt;https://www.peew.pw/blog/2018/2/22/how-i-identified-93k-domain-frontable-cloudfront-domains&lt;/li&gt;
&lt;/ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>cdn token</title>
        <published>2016-11-22T12:43:16+01:00</published>
        <updated>2016-11-22T12:43:16+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/cdn-token/"/>
        <id>https://nbari.com/cdn-token/</id>
        
        <content type="html" xml:base="https://nbari.com/cdn-token/">&lt;h1 id=&quot;restrict-access-only-to-the-cdn-cloudfront&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#restrict-access-only-to-the-cdn-cloudfront&quot; aria-label=&quot;Anchor link for: restrict-access-only-to-the-cdn-cloudfront&quot;&gt;🔗&lt;/a&gt;Restrict access only to the CDN (cloudfront)&lt;/h1&gt;
&lt;p&gt;To only allow, handle request from the CDN you could add a custom header/token
and check on your backend (nginx/haproxy) if is matching otherwise return a 401&lt;/p&gt;
&lt;p&gt;If using AWS cloudfront you edit your origins like this:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/x-cf-token.png&quot; alt=&quot;cloudfront x-cf-token&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The token can be any UUID / has or common secret between the CDN and the
backend.&lt;/p&gt;
&lt;p&gt;If your backends are using nginx you could verify the token like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	listen 80;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	server_name _;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	if ($http_x_cf_token != &amp;#39;4147E877-7C6D-4B4E-96CE-B173B6F0B755&amp;#39;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		return 401;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case the token is an UUID and if the request come with no token they
will got a 401.&lt;/p&gt;
</content>
        
    </entry>
</feed>
