Fixed tor setup

This commit is contained in:
Philip (a-0) 2022-07-28 21:57:18 +02:00
parent 3809353256
commit 50b06b54cf
3 changed files with 123 additions and 56 deletions

View file

@ -13,66 +13,25 @@
name: iptables-persistent
state: present
- name: Forward IPv4 TCP traffic to TOR
- name: set iptables rules
become: yes
iptables:
ip_version: ipv4
table: nat
chain: PREROUTING
in_interface: "{{ vm_net_interface_name }}"
ctstate: NEW
protocol: tcp
jump: REDIRECT
to_ports: "{{ tor_trans_port }}"
script: iptables.sh
notify: persist iptables
- name: Forward IPv6 TCP traffic to TOR
become: yes
iptables:
ip_version: ipv6
table: nat
chain: PREROUTING
in_interface: "{{ vm_net_interface_name }}"
ctstate: NEW
protocol: tcp
jump: REDIRECT
to_ports: "{{ tor_trans_port }}"
notify: persist iptables
- name: set nameserver to localhost
copy:
content: "nameserver 127.0.0.1"
dest: /etc/resolv.conf
- name: Forward IPv4 DNS traffic to TOR
become: yes
iptables:
ip_version: ipv4
table: nat
chain: PREROUTING
in_interface: "{{ vm_net_interface_name }}"
protocol: udp
jump: REDIRECT
to_ports: "{{ tor_dns_port }}"
notify: persist iptables
- name: Restart systemd-resolved
service:
name: systemd-resolved
state: restarted
daemon_reload: yes
- name: Forward IPv6 DNS traffic to TOR
become: yes
iptables:
ip_version: ipv6
table: nat
chain: PREROUTING
in_interface: "{{ vm_net_interface_name }}"
protocol: udp
jump: REDIRECT
to_ports: "{{ tor_dns_port }}"
notify: persist iptables
- name: Ensure log file exists
file:
path: "{{ tor_logfile_path }}"
state: touch
owner: debian-tor
mode: 0644
- name: Start and enable tor service
- name: (Re)start and enable tor service
service:
name: tor
state: started
state: restarted
enabled: yes
daemon_reload: yes