diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0cafc1c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.venv/ \ No newline at end of file diff --git a/cert.py b/cert.py index 2bf9a38..59666c1 100644 --- a/cert.py +++ b/cert.py @@ -7,7 +7,7 @@ import time AUTH = "" # Check if token file exists -if os.path.isfile("/root/hns_doh_loadbalancer/token"): +if not os.path.isfile("/root/hns_doh_loadbalancer/token"): print("ERROR: Token file not found") # Read token from file @@ -24,7 +24,7 @@ if len(AUTH) == 0: # URL to acme-dns instance -ACMEDNS_URL = "https://nathan.woodburn.au/hnsdoh-acme" +ACMEDNS_URL = "https://nathan.c.woodburn.au/hnsdoh-acme" # Path for acme-dns credential storage STORAGE_PATH = "/etc/letsencrypt/acmedns.json" # Whitelist for address ranges to allow the updates from diff --git a/create_wireform.py b/create_wireform.py new file mode 100644 index 0000000..8964216 --- /dev/null +++ b/create_wireform.py @@ -0,0 +1,15 @@ +import base64 +import dns.message + +# Generate custom request +domain = "woodburn" + +message = dns.message.make_query(domain, dns.rdatatype.A,id=0) + +wireBytes = message.to_wire() +wire = base64.b64encode(wireBytes) +print(wire.decode("utf-8")) + +# Read +message = dns.message.from_wire(wireBytes) +print(str(message)) diff --git a/install.sh b/install.sh index c32d9f6..a033972 100755 --- a/install.sh +++ b/install.sh @@ -20,7 +20,6 @@ sudo apt-get install -y dnsdist sudo apt install snapd -y sudo snap install --classic certbot sudo ln -s /snap/bin/certbot /usr/bin/certbot -sudo certbot certonly --manual --manual-auth-hook /root/hns_doh_loadbalancer/cert.py --preferred-challenges dns -d hnsdoh.com --deploy-hook /root/hns_doh_loadbalancer/cert.sh sudo cp /root/hns_doh_loadbalancer/resolved.conf /etc/systemd/resolved.conf sudo systemctl restart systemd-resolved @@ -32,7 +31,6 @@ sudo systemctl daemon-reload # Restart dnsdist sudo systemctl restart dnsdist - # Install caddy curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list @@ -45,6 +43,8 @@ sudo cp /root/hns_doh_loadbalancer/Caddyfile /etc/caddy/Caddyfile # Restart caddy sudo systemctl restart caddy +sudo certbot certonly --manual --manual-auth-hook /root/hns_doh_loadbalancer/cert.py --preferred-challenges dns -d hnsdoh.com -d *.hnsdoh.com --deploy-hook /root/hns_doh_loadbalancer/cert.sh + # Install NVM curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash diff --git a/public/index.html b/public/index.html index cc663e7..54fd9f2 100644 --- a/public/index.html +++ b/public/index.html @@ -73,13 +73,15 @@
  • DNS over HTTPS
    -

    DNS over HTTPS is supported by most browsers. To add HNSDoH to your revolvers add this URL to your Secure DNS setting
    https://hnsdoh.com/dns-query

    +

    DNS over HTTPS is supported by most browsers. To add HNSDoH to your revolvers add this URL to your Secure DNS setting
    https://hnsdoh.com/dns-query

    +

    You can also specify a specific region to have faster resolution with a lower number of servers for redundancy.
    https://{region}.hnsdoh.com/dns-queryFor example the AU region can be set using: https://au.hnsdoh.com/dns-query

  • DNS over TLS

    DNS over TLS is the best option for mobile phones. Simply set Private DNS to the hostname 
    hnsdoh.com

    +

    You can also specify a specific region to have faster resolution with a lower number of servers for redundancy.
    {region}.hnsdoh.comFor example the AU region can be set using: au.hnsdoh.com

  • @@ -175,7 +177,116 @@ -
    +
    +
    +

    Regions

    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    RegionRegion ID# of nodesLatency
    Australiaau1Pinging...
    Europeeu2Pinging...
    North Americana2Pinging...
    Asiaas1Pinging...
    Asia Pacificap2Pinging...
    +
    + +
    +
    +
    +

    Nodes

    @@ -186,6 +297,7 @@ Provider Location IPv4 + Regions @@ -193,30 +305,41 @@ Nathan.Woodburn/ Australia 194.50.5.27 + AU, AP HNS Canada* Canada 139.177.195.185 + NA EZ Domains* Netherlands 172.233.46.92 + EU EZ Domains* Singapore 172.105.120.203 + AS, AP - Easy HNS + Easy HNS England 18.169.98.42 + EU + + + Zorro + United States + 173.233.72.88 + NA -
    +
    Note: Some nodes are in multiple regions to allow selecting larger regions.
    diff --git a/test_region.sh b/test_region.sh new file mode 100755 index 0000000..1c65015 --- /dev/null +++ b/test_region.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +REGION_IDS=("au" "eu" "na" "as" "ap") + +if [ -z "$1" ]; then + for REGION_ID in "${REGION_IDS[@]}" + do + echo "--------------------------------------------" + echo "Running test for $REGION_ID" + echo "--------------------------------------------" + ./test_region.sh $REGION_ID + echo "Completed test for $REGION_ID" + echo "--------------------------------------------" + done + exit 0 +else + REGION_ID=$1 +fi +# Check if IP is specified +if [ -z "$2" ]; then + RESOLVED_IPS=$(dig +short $REGION_ID.hnsdoh.com) + NODE_IPS=($RESOLVED_IPS) + if [ ${#NODE_IPS[@]} -eq 0 ]; then + echo "No IP addresses resolved for $REGION_ID.hnsdoh.com. Exiting." + exit 1 + fi +else + NODE_IPS=("$2") +fi + + + + + +# Define the domain and host for kdig commands +TLS_HOST="$REGION_ID.hnsdoh.com" +DOH_URL="https://$REGION_ID.hnsdoh.com/dns-query" + +# Loop over each IP and run the kdig commands +for NODE_IP in "${NODE_IPS[@]}" +do + echo "Running kdig commands for NODE_IP=$NODE_IP" + + # Run the kdig commands + kdig +tls +tls-host=$TLS_HOST @$NODE_IP 1.wdbrn TXT +short + kdig +tls-ca +https=@$DOH_URL @$NODE_IP 2.wdbrn TXT +short + kdig @$NODE_IP 3.wdbrn TXT +short + + echo "Completed kdig commands for NODE_IP=$NODE_IP" + echo "--------------------------------------------" +done