{"id":899,"date":"2022-03-20T14:29:22","date_gmt":"2022-03-20T13:29:22","guid":{"rendered":"https:\/\/www.labtinker.net\/?p=899"},"modified":"2022-03-20T14:29:22","modified_gmt":"2022-03-20T13:29:22","slug":"cname-of-shame","status":"publish","type":"post","link":"http:\/\/18.135.13.153\/?p=899","title":{"rendered":"CNAME of shame"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Before I left work on Friday some of our proxies were showing a DNS error getting to <strong>https:\/\/app.powerbi.com <\/strong>our MSP was left pursuing this. I decided to do a bit of digging myself. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A DNS query can provide an &#8216;A&#8217; response which tells the querier the ip address associated with the given name, but often a CNAME record can be returned (Canonical Name) which effectively just points to another address. For example this website is available  on <strong>18.135.13.153\/ <\/strong> or just  <strong>labtinker.net<\/strong>. My DNS (Route 53 in AWS) provides the &#8216;A&#8217; record for <strong>labtinker.net:<\/strong> .<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"763\" height=\"80\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-4.png\" alt=\"\" class=\"wp-image-900\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-4.png 763w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-4-300x31.png 300w\" sizes=\"auto, (max-width: 763px) 100vw, 763px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">but a CNAME for <strong>18.135.13.153\/ <\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"864\" height=\"107\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-5.png\" alt=\"\" class=\"wp-image-901\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-5.png 864w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-5-300x37.png 300w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-5-768x95.png 768w\" sizes=\"auto, (max-width: 864px) 100vw, 864px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">so if you query <strong>18.135.13.153\/ <\/strong>  you are re-directed to <strong>labtinker.net<\/strong>  which in turn provides the ip address. This excerpt from an <strong>nslookup -debug 18.135.13.153\/<\/strong> illustrates this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"401\" height=\"181\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-6.png\" alt=\"\" class=\"wp-image-902\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-6.png 401w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-6-300x135.png 300w\" sizes=\"auto, (max-width: 401px) 100vw, 401px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now, there is nothing to stop you from pointing your CNAME to another CNAME:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So here <strong>test2.labtinker.net <\/strong> has a CNAME for <strong>test1.labtinker.net<\/strong>  which in turn has a CNAME for <strong>labtinker.net<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"255\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-7.png\" alt=\"\" class=\"wp-image-903\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-7.png 640w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-7-300x120.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Of course, each time you do this another DNS lookup has to be made but two layers of CNAMEs isn&#8217;t terrible.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> Now <strong>app.powerbi.com<\/strong>  has considerably more as seen in this Wireshark DNS response.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"377\" height=\"73\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-8.png\" alt=\"\" class=\"wp-image-904\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-8.png 377w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-8-300x58.png 300w\" sizes=\"auto, (max-width: 377px) 100vw, 377px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-9-1024x144.png\" alt=\"\" class=\"wp-image-905\" width=\"840\" height=\"118\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-9-1024x144.png 1024w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-9-300x42.png 300w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-9-768x108.png 768w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-9-1536x216.png 1536w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-9.png 1603w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">&#8230;and doing <strong>nslookup -debug app.powerbi.com<\/strong> you&#8217;ll see the merry dance the DNS response sends you on.  I don&#8217;t have access to a lab version of the proxy that&#8217;s used at work but I do have a Fortigate in a GNS3 lab and that can act as an explict proxy. I won&#8217;t bore you with the topology. (It&#8217;s a host going through an Fortigate set up an explicit proxy). This proxy has no issues with <em>app.powerbi.com<\/em>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"151\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-16-1024x151.png\" alt=\"\" class=\"wp-image-913\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-16-1024x151.png 1024w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-16-300x44.png 300w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-16-768x114.png 768w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-16.png 1529w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">so I decided to set up &#8216;nested&#8217; CNAMEs as follows&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"739\" height=\"458\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-10.png\" alt=\"\" class=\"wp-image-906\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-10.png 739w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-10-300x186.png 300w\" sizes=\"auto, (max-width: 739px) 100vw, 739px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">&#8230;and then browse to <strong>testf.labtinker.net<\/strong> to see what happens.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If I browse on this laptop, I get to <strong>testf.labtinker.net:<\/strong>  (I&#8217;m using my ISP&#8217;s DNS &#8211; Virgin)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"631\" height=\"178\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-12.png\" alt=\"\" class=\"wp-image-908\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-12.png 631w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-12-300x85.png 300w\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">And this is what Wireshark showed me&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"805\" height=\"506\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-15.png\" alt=\"\" class=\"wp-image-912\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-15.png 805w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-15-300x189.png 300w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-15-768x483.png 768w\" sizes=\"auto, (max-width: 805px) 100vw, 805px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Through a VM running through my Fortigate proxy:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"526\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-13.png\" alt=\"\" class=\"wp-image-909\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-13.png 1024w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-13-300x154.png 300w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-13-768x395.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">(This was when the proxy was running Fortigate&#8217;s own DNS).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, if I go one layer down and go to <strong>teste.labtinker.net<\/strong> (slightly unfortunate hostname but you can see how it was derived)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"564\" height=\"117\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-14.png\" alt=\"\" class=\"wp-image-910\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-14.png 564w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-14-300x62.png 300w\" sizes=\"auto, (max-width: 564px) 100vw, 564px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Initially, I though this was a limitation on the proxy but I changed the proxy DNS to point at 1.1.1.1 and cleared the DNS and it then resolved<em><strong> testf.labtinker.net<\/strong><\/em>  without issue. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I suppose I was hoping to hit a universal  practical limitation with nested CNAMEs, and while there do appear to be some inefficiencies (which you would expect) they don&#8217;t appear around the levels of nesting in use for <strong>app.powerbi.com<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I have two options &#8211; carry on playing around with this or go and get some lunch then sit on the balcony drinking wine. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>UPDATE:<\/strong> I wasn&#8217;t on the inner circle on the issue which prompted my experimentation but I learnt that it had been resolved when the DNS TCP listener was enabled on the load-balancer the proxies got their DNS from. Presuambly, the size of the DNS request had triggered the proxy to use DNS over TCP. Historically, dns over tcp was only used for zone transfers but this is no longer the case:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.ietf.org\/id\/draft-ietf-dnsop-dns-tcp-requirements-15.html\">https:\/\/www.ietf.org\/id\/draft-ietf-dnsop-dns-tcp-requirements-15.html<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can get &#8216;nslookup&#8217; to use tcp for dns by typing &#8216;set vc&#8217; within the utility. Here is a Wireshark extract of TCP DNS.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"858\" height=\"381\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-18.png\" alt=\"\" class=\"wp-image-922\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-18.png 858w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-18-300x133.png 300w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-18-768x341.png 768w\" sizes=\"auto, (max-width: 858px) 100vw, 858px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Incidentally, I carried on with my CNAME chaining to see when they would break (just from a normal laptop (using 1.1.1.1)) &#8211; I got as far as <strong>testj.labtinker.net <\/strong>which was 20 layers of CNAMES (tcp or udp made no difference).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"649\" height=\"226\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-19.png\" alt=\"\" class=\"wp-image-923\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-19.png 649w, http:\/\/18.135.13.153\/wp-content\/uploads\/2022\/03\/image-19-300x104.png 300w\" sizes=\"auto, (max-width: 649px) 100vw, 649px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This post feels somewhat <s>rambling<\/s> discursive but let&#8217;s double-down: this podcast deals with the subject of DNS over TCP &#8211; the takeaway it&#8217;s not just for zone transfers so allow it!<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-packet-pushers wp-block-embed-packet-pushers\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/packetpushers.net\/podcast\/heavy-networking-638-dont-block-dns-over-tcp\/\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Before I left work on Friday some of our proxies were showing a DNS error getting to https:\/\/app.powerbi.com our MSP was left pursuing this. I decided to do a bit of digging myself. A DNS query can provide an &#8216;A&#8217; response which tells the querier the ip address associated with the given name, but often [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-899","post","type-post","status-publish","format-standard","hentry","category-dns"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/posts\/899","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=899"}],"version-history":[{"count":0,"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/posts\/899\/revisions"}],"wp:attachment":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=899"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=899"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}