-
Notifications
You must be signed in to change notification settings - Fork 687
/
install_shell_extension.yml
123 lines (105 loc) · 4.07 KB
/
install_shell_extension.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
- name: Check for v3 Source Interface file
stat:
path: app-sourcev3-ths
register: v3_source_file
- name: Check for v3 Journalist Interface file
stat:
path: app-journalist.auth_private
register: v3_journalist_file
- name: Check for site specific file
stat:
path: group_vars/all/site-specific
register: site_specific_file
- name: Look up v3 Source Interface URL.
command: grep -Po '.{56}\.onion' app-sourcev3-ths
changed_when: false
register: sourcev3_interface_lookup_result
when: v3_source_file.stat.exists == true
- name: Look up v3 Journalist Interface URL.
command: awk -F ':' '{print $1 ".onion"}' app-journalist.auth_private
changed_when: false
register: journalistv3_interface_lookup_result
when: v3_source_file.stat.exists == true
- name: Look up app server hostname
command: "awk -v FS='app_hostname: ' 'NF>1{print $2}' group_vars/all/site-specific"
changed_when: false
register: app_server_lookup_result
when: site_specific_file.stat.exists == true
- name: Look up mon server hostname
command: "awk -v FS='monitor_hostname: ' 'NF>1{print $2}' /home/amnesia/Persistent/securedrop/install_files/ansible-base/group_vars/all/site-specific"
changed_when: false
register: mon_server_lookup_result
when: site_specific_file.stat.exists == true
- name: Create the SecureDrop GNOME Shell Extension directories
file:
state: directory
path: "{{ item }}"
with_items: "{{ tails_config_extension_directories }}"
- name: Set normal user ownership on subset of directories.
become: yes
file:
state: directory
path: "{{ item }}"
owner: amnesia
group: amnesia
# Only set normal user ownership for files in ~amnesia.
when: item.startswith(tails_config_amnesia_home)
with_items: "{{ tails_config_extension_directories }}"
- name: Copy the extension metadata to the extension directory in Persistent Storage
become: yes
copy:
src: [email protected]/metadata.json
dest: "{{ tails_config_live_dotfiles }}/.local/share/gnome-shell/extensions/[email protected]/"
owner: amnesia
group: amnesia
- name: Copy the extension CSS to the extension directory in Persistent Storage
become: yes
copy:
src: [email protected]/stylesheet.css
dest: "{{ tails_config_live_dotfiles }}/.local/share/gnome-shell/extensions/[email protected]/"
owner: amnesia
group: amnesia
- name: Copy the symbolic icon used for the shell extension in Persistent Storage
become: yes
copy:
src: securedrop-symbolic.png
dest: "{{ tails_config_live_dotfiles }}/.local/share/gnome-shell/extensions/[email protected]/icons/"
owner: amnesia
group: amnesia
- name: Set the right variable for source
set_fact:
source_iface: "{{ sourcev3_interface_lookup_result }}"
- name: Set the right variable for journalist
set_fact:
journalist_iface: "{{ journalistv3_interface_lookup_result }}"
- name: Set the right variable for app server hostname
set_fact:
app_hostname: "{{ app_server_lookup_result }}"
- name: Set the right variable for app server hostname
set_fact:
mon_hostname: "{{ mon_server_lookup_result }}"
- name: Assemble interface information for extension
set_fact:
_securedrop_extension_info:
- src: extension.js.in
filename: extension.js
source_interface_address: "{{ source_iface.stdout }}"
journalist_interface_address: "{{ journalist_iface.stdout }}"
app_hostname: "{{ app_hostname.stdout }}"
mon_hostname: "{{ mon_hostname.stdout }}"
- name: Create SecureDrop extension
become: yes
template:
src: "{{ item.0.src }}"
dest: "{{ item.1 }}/{{ item.0.filename }}"
owner: amnesia
group: amnesia
mode: "0700"
with_nested:
- "{{ _securedrop_extension_info }}"
- "{{ tails_config_extension_directories }}"
- name: Add extension translations in Persistent Storage
synchronize:
src: roles/tails-config/templates/locale/
dest: "{{ tails_config_live_dotfiles }}/.local/share/gnome-shell/extensions/[email protected]/locale/"