{"id":3373,"date":"2018-10-09T10:05:58","date_gmt":"2018-10-09T14:05:58","guid":{"rendered":"https:\/\/antipaucity.com\/?p=3373"},"modified":"2018-10-09T10:05:58","modified_gmt":"2018-10-09T14:05:58","slug":"rethinking-pi-hole-again","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=3373","title":{"rendered":"rethinking pi-hole (again)"},"content":{"rendered":"<p>About <a href=\"https:\/\/antipaucity.com\/2016\/11\/21\/results-from-running-pi-hole-for-several-weeks\/#.W7yvLFIpCU0\">2 years ago<\/a>, I started running Pi-hole as a DNS resolver and ad-blocker. Then last year, <a href=\"https:\/\/antipaucity.com\/2017\/08\/11\/pi-hole-revisited\">I ditched it<\/a>.<\/p>\n<p>After seeing a recent post by <a href=\"https:\/\/www.troyhunt.com\/mmm-pi-hole\/?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+TroyHunt+%28Troy+Hunt%29\">Troy Hunt<\/a>, though, I thought it <em>might<\/em> be worth revisiting..but I needed a better way to control how it worked.<\/p>\n<p>Enter {{OpenVPN}} &#8211; a service I already run on three endpoints. Here&#8217;s what I did:<\/p>\n<p>Install Pi-hole per the usual (<code>curl -sSL https:\/\/install.pi-hole.net | bash<\/code> if you&#8217;re feeling brave, <code>curl -sSL https:\/\/install.pi-hole.net<\/code>, inspect, <em>then<\/em> run, if you&#8217;re feeling a little more wary).<\/p>\n<p>This time, though, I set my upstream DNS providers to Cloudflare (1.1.1.1) and <a href=\"https:\/\/en.wikipedia.org\/wiki\/Quad9\">Quad9<\/a> (9.9.9.9) instead of <a href=\"\/\/Freenom.com\">Freenom<\/a> and Google.<\/p>\n<p>I also did a two-step install &#8211; once with Pi-hole listening on the primary network interface on my OpenVPN endpoint (ie the public IP), and then, once I made sure all was happy, I flipped it to listen on <code>tun0<\/code> &#8211; the OpenVPN-provided interface. This means Pi-hole can only hear DNS queries if you&#8217;re connected to the {{VPN}}.<\/p>\n<p>Why the change from how I&#8217;d done it before? Two reasons (at least):<\/p>\n<p>First, if you leave Pi-hole open to the world, you can get involved in DNS amplification attacks. That is <em>muy no bueno<\/em>.<\/p>\n<p>Second, sometimes I don&#8217;t care about ads &#8211; sometimes I do. I don&#8217;t care, for example, <em>most<\/em> of the time when I&#8217;m home. But when I&#8217;m traveling or on my {{iPhone}}? I care a lot more then.<\/p>\n<p>Bonus &#8211; since it&#8217;s only &#8220;working&#8221; when connected to my VPN, it&#8217;s super easy to check if a site isn&#8217;t working because of Pi-hole, or because it just doesn&#8217;t like my browser (hop off the VPN, refresh, and see if all is well that wasn&#8217;t when on the VPN).<\/p>\n<h3>Changes you need to make to your OpenVPN&#8217;s <code>server.conf<\/code>:<\/h3>\n<p><code><br \/>\npush \"dhcp-option DNS 10.8.0.1\"<br \/>\n<\/code><\/p>\n<p>This ensures clients use the OpenVPN server as their DNS resolver. (Note: 10.8.0.1 might not be your OpenVPN parent IP address; adjust as necessary.) Restart OpenVPN after making this change.<\/p>\n<h3>My <code>setupVars.conf for Pi-hole:<\/code><\/h3>\n<p><code><br \/>\nPIHOLE_INTERFACE=tun0<br \/>\nIPV4_ADDRESS=10.8.0.1\/24<br \/>\nIPV6_ADDRESS=<br \/>\nQUERY_LOGGING=true<br \/>\nINSTALL_WEB_SERVER=true<br \/>\nINSTALL_WEB_INTERFACE=true<br \/>\nLIGHTTPD_ENABLED=false<br \/>\nWEBPASSWORD=01f3217c12bcdf8aa0ca08cdf737f99cd68a46dbdc92ce35fd75f39ce2faaf81<br \/>\nDNSMASQ_LISTENING=single<br \/>\nPIHOLE_DNS_1=1.1.1.1<br \/>\nPIHOLE_DNS_2=1.0.0.1<br \/>\nPIHOLE_DNS_3=9.9.9.9<br \/>\nDNS_FQDN_REQUIRED=true<br \/>\nDNS_BOGUS_PRIV=true<br \/>\nDNSSEC=false<br \/>\nCONDITIONAL_FORWARDING=false<br \/>\n<\/code><\/p>\n<p>I tried getting {{lighttpd}} to only listen on on port 443 so I could use Let&#8217;s Encrypt&#8217;s <a href=\"https:\/\/antipaucity.com\/tag\/ssl\/\">SSL certs<\/a> following a handful of tutorials and walk-throughs, but was unsuccessful. So I disabled lighttpd, and only start it by hand if I want to check on my Pi-hole&#8217;s status.<\/p>\n<p>Speaking of which, as I write this, here is what the admin console looks like:<\/p>\n<p><a href=\"https:\/\/merikebi.warrenmyers.com\/wp-content\/uploads\/2018\/10\/Screenshot_2018-10-09Pi-holeAdminConsole.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/merikebi.warrenmyers.com\/wp-content\/uploads\/2018\/10\/Screenshot_2018-10-09Pi-holeAdminConsole-228x300.png\" alt=\"admin console screenshot\" width=\"228\" height=\"300\" class=\"aligncenter size-medium wp-image-3375\" srcset=\"https:\/\/merikebi.warrenmyers.com\/wp-content\/uploads\/2018\/10\/Screenshot_2018-10-09Pi-holeAdminConsole-228x300.png 228w, https:\/\/merikebi.warrenmyers.com\/wp-content\/uploads\/2018\/10\/Screenshot_2018-10-09Pi-holeAdminConsole-768x1010.png 768w, https:\/\/merikebi.warrenmyers.com\/wp-content\/uploads\/2018\/10\/Screenshot_2018-10-09Pi-holeAdminConsole-778x1024.png 778w, https:\/\/merikebi.warrenmyers.com\/wp-content\/uploads\/2018\/10\/Screenshot_2018-10-09Pi-holeAdminConsole.png 1388w\" sizes=\"auto, (max-width: 228px) 100vw, 228px\" \/><\/a><\/p>\n<p>Hope this helps you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>About 2 years ago, I started running Pi-hole as a DNS resolver and ad-blocker. Then last year, I ditched it. After seeing a recent post by Troy Hunt, though, I thought it might be worth revisiting..but I needed a better way to control how it worked. Enter {{OpenVPN}} &#8211; a service I already run on &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=3373\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">rethinking pi-hole (again)<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[41,46],"tags":[70,73,532,565,828],"keyring_services":[],"class_list":["post-3373","post","type-post","status-publish","format-standard","hentry","category-technical","category-update","tag-ads","tag-advertising","tag-openvpn","tag-pihole","tag-vpn"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/3373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3373"}],"version-history":[{"count":0,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/3373\/revisions"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3373"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=3373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}