Skip to content

Commit e63ac7d

Browse files
jackivanovYuhui Huang
authored andcommitted
DNS-over-HTTPS (trailofbits#875)
1 parent 7a38654 commit e63ac7d

File tree

25 files changed

+722
-19
lines changed

25 files changed

+722
-19
lines changed

algo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ read -p "
4343
Do you want to install a DNS resolver on this VPN server, to block ads while surfing?
4444
[y/N]: " -r dns_enabled
4545
dns_enabled=${dns_enabled:-n}
46-
if [[ "$dns_enabled" =~ ^(y|Y)$ ]]; then ROLES+=" dns"; fi
46+
if [[ "$dns_enabled" =~ ^(y|Y)$ ]]; then ROLES+=" dns"; EXTRA_VARS+=" local_dns=true"; fi
4747

4848
read -p "
4949
Do you want each user to have their own account for SSH tunneling?

config.cfg

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,20 @@ adblock_lists:
2929
- "https://www.malwaredomainlist.com/hostslist/hosts.txt"
3030
- "https://hosts-file.net/ad_servers.txt"
3131

32+
# Enalbe DNS encryption. Use dns_encrypted_provider to specify the provider. If false dns_servers should be specified
33+
dns_encryption: true
34+
35+
# Possible values: google, cloudflare
36+
dns_encryption_provider: cloudflare
37+
38+
# DNS servers which will be used if dns_encryption disabled
3239
dns_servers:
3340
ipv4:
34-
- 8.8.8.8
35-
- 8.8.4.4
41+
- 1.1.1.1
42+
- 1.0.0.1
3643
ipv6:
37-
- 2001:4860:4860::8888
38-
- 2001:4860:4860::8844
44+
- 2606:4700:4700::1111
45+
- 2606:4700:4700::1001
3946

4047
# IP address for the local dns resolver
4148
local_service_ip: 172.16.0.1

deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
tags: always
6464

6565
roles:
66-
- { role: dns_adblocking, tags: ['dns', 'adblock' ] }
66+
- { role: dns_adblocking, tags: [ 'dns', 'adblock' ] }
6767
- { role: ssh_tunneling, tags: [ 'ssh_tunneling' ] }
6868
- { role: vpn, tags: [ 'vpn' ] }
6969

docs/client-linux.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ In this example we'll assume the IP of our Algo VPN server is `1.2.3.4` and the
6464
* Certificate: `cacert.pem` found at `/path/to/algo/configs/1.2.3.4/cacert.pem`
6565
* Client:
6666
* Authentication: *Certificate/Private key*
67-
* Certificate: `user-name.crt` found at `/path/to/algo/configs/1.2.3.4/pki/certs/user-name.crt`
67+
* Certificate: `user-name.crt` found at `/path/to/algo/configs/1.2.3.4/pki/certs/user-name.crt`
6868
* Private key: `user-name.key` found at `/path/to/algo/configs/1.2.3.4/pki/private/user-name.key`
6969
* Options:
7070
* Check *Request an inner IP address*, connection will fail without this option

docs/setup-roles.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
* **DNS-based Adblocking**
2121
* Install the [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) local resolver with a blacklist for advertising domains
2222
* Constrains dnsmasq with AppArmor and cgroups CPU and memory limitations
23+
* **DNS encryption**
24+
* Install [dnscrypt-proxy](https://github.com/jedisct1/dnscrypt-proxy)
25+
* Constrains dingo with AppArmor and cgroups CPU and memory limitations
2326
* **SSH Tunneling**
2427
* Adds a restricted `algo` group with no shell access and limited SSH forwarding options
2528
* Creates one limited, local account per user and an SSH public key for each

roles/common/tasks/ubuntu.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
- name: Cloud only tasks
33
block:
44
- name: Install software updates
5-
apt: update_cache=yes upgrade=dist
5+
apt:
6+
update_cache: true
7+
install_recommends: true
8+
upgrade: dist
9+
10+
- name: Upgrade the ca certificates
11+
apt:
12+
name: ca-certificates
13+
state: latest
614

715
- name: Check if reboot is required
816
shell: >

roles/dns_adblocking/meta/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22

33
dependencies:
44
- { role: common, tags: common }
5+
- role: dns_encryption
6+
tags: dns_encryption
7+
when: dns_encryption == true

roles/dns_adblocking/tasks/freebsd.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,11 @@
22

33
- name: FreeBSD / HardenedBSD | Enable dnsmasq
44
lineinfile: dest=/etc/rc.conf regexp=^dnsmasq_enable= line='dnsmasq_enable="YES"'
5+
6+
- name: The dnsmasq additional directories created
7+
file:
8+
dest: "{{ item }}"
9+
state: directory
10+
mode: '0755'
11+
with_items:
12+
- "{{ config_prefix|default('/') }}etc/dnsmasq.d"

roles/dns_adblocking/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
- name: The DNS tag is defined
55
set_fact:
6-
local_dns: Y
6+
local_dns: true
77

88
- name: Dnsmasq installed
99
package: name=dnsmasq

roles/dns_adblocking/tasks/ubuntu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
owner: root
88
group: root
99
mode: 0600
10-
when: apparmor_enabled is defined and apparmor_enabled == true
10+
when: apparmor_enabled|default(false)|bool == true
1111
notify:
1212
- restart dnsmasq
1313

1414
- name: Ubuntu | Enforce the dnsmasq AppArmor policy
1515
shell: aa-enforce usr.sbin.dnsmasq
16-
when: apparmor_enabled is defined and apparmor_enabled == true
16+
when: apparmor_enabled|default(false)|bool == true
1717
tags: ['apparmor']
1818

1919
- name: Ubuntu | Ensure that the dnsmasq service directory exist

0 commit comments

Comments
 (0)