aboutsummaryrefslogtreecommitdiff
path: root/roles/tor/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/tor/tasks')
-rw-r--r--roles/tor/tasks/ssh_hidden_service.yaml14
-rw-r--r--roles/tor/tasks/tor_install.yaml9
2 files changed, 18 insertions, 5 deletions
diff --git a/roles/tor/tasks/ssh_hidden_service.yaml b/roles/tor/tasks/ssh_hidden_service.yaml
index cbac7fa..d2415f2 100644
--- a/roles/tor/tasks/ssh_hidden_service.yaml
+++ b/roles/tor/tasks/ssh_hidden_service.yaml
@@ -13,7 +13,13 @@
block: |
HiddenServiceDir /var/lib/tor/ssh
HiddenServicePort 22 127.0.0.1:22
- notify: restart tor
+
+- name: restart tor
+ systemd:
+ name: tor
+ state: restarted
+ enabled: true
+ when: ansible_service_mgr == 'systemd'
- name: wait for hidden service hostname file
wait_for:
@@ -78,7 +84,7 @@
fetch:
src: /root/.ssh/id_ed25519_onion
dest: "./{{ onion_address }}/{{ onion_address }}_id_ed25519"
- flat: yes
+ flat: true
- name: set correct permissions on fetched hidden service private key
file:
@@ -90,13 +96,13 @@
fetch:
src: /root/.ssh/id_ed25519_onion.pub
dest: "./{{ onion_address }}/{{ onion_address }}_id_ed25519.pub"
- flat: yes
+ flat: true
- name: fetch hidden service private key
fetch:
src: "/var/lib/tor/ssh/hs_ed25519_secret_key"
dest: "./{{ onion_address }}/hs_ed25519_secret_key"
- flat: yes
+ flat: true
mode: '0600'
- name: generate onion-specific ssh config snippet
diff --git a/roles/tor/tasks/tor_install.yaml b/roles/tor/tasks/tor_install.yaml
index 96cf98e..f1fc92f 100644
--- a/roles/tor/tasks/tor_install.yaml
+++ b/roles/tor/tasks/tor_install.yaml
@@ -9,6 +9,7 @@
- netcat-openbsd
state: present
update_cache: true
+ cache_valid_time: 86400
- name: check if /etc/tor/torrc exists
stat:
@@ -31,7 +32,13 @@
owner: debian-tor
group: debian-tor
mode: '0644'
- notify: restart tor
+
+- name: restart tor
+ systemd:
+ name: tor
+ state: restarted
+ enabled: true
+ when: ansible_service_mgr == 'systemd'
- name: check if tor is routing traffic correctly
command: curl --socks5-hostname 127.0.0.1:9050 https://check.torproject.org/api/ip