-
Notifications
You must be signed in to change notification settings - Fork 690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow SSH over local network instead of Tor #2592
Changes from all commits
454bc41
c6f5c12
9658f74
b5d3b42
ecfe205
8eb54e1
feda2dc
06ab470
8d67a98
b23b3d1
ce95a44
fcd877b
05e5f80
d2fceb8
9d9e1f1
3531ad8
057c7a2
f04a4ea
ba44342
66a070a
a6b0d93
7e26a2e
b41b11a
a55dd5a
51606ed
a5a8a5e
b4e62e3
db0cf42
3314884
8cc1557
927e54c
82a8bed
367827d
4ee572e
113ccd0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
ansible>2.4<2.5 | ||
netaddr |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
SSH Over Local Network | ||
====================== | ||
|
||
Under a production installation post-install, the default way to gain SSH | ||
administrative access is over the Tor network. This provides a number of benefits: | ||
|
||
* Allows remote administration outside of the local network | ||
* Provides anonymity to an administrator while logging into the SecureDrop | ||
back-end. | ||
* Can mitigate against an attacker on your local network attempting to exploit | ||
vulnerabilities against the SSH daemon. | ||
|
||
Most administrators will need SSH access during the course of running a | ||
SecureDrop instance and a few times a year for maintanence. So the | ||
potential short-falls of having SSH over Tor aren't usually a big deal. | ||
The cons of having SSH over Tor can include: | ||
|
||
* Really slow and delayed remote terminal performance | ||
* Allowing SSH access from outside of your local network can be seen as a | ||
potential larger security hole for some organizations. Particularly those | ||
with tight network security controls. | ||
|
||
That being said, the default setting of only allowing SSH over Tor is a good fit | ||
for most organizations. If you happen to require SSH restricted to the local | ||
network instead please continue to read. | ||
|
||
|
||
.. _ssh_over_local: | ||
|
||
Configuring SSH for local access | ||
-------------------------------- | ||
|
||
.. warning:: It is important that your firewall is configured adequately if you | ||
decide you need SSH over the local network. The install process locks | ||
down access as much as possible with net restrictions, SSH-keys, and | ||
google authenticator. However, you could still leave the interface | ||
exposed to unintended users if you did not properly follow our network | ||
firewall guide. | ||
|
||
.. warning:: This setting will lock you out of SSH access to your instance if your | ||
*Admin Workstation* passes through a NAT in order to get to the | ||
SecureDrop servers. If you are unsure whether this is the case, please | ||
consult with your firewall configuration or network administrator. | ||
|
||
.. note:: Whichever network you install from will be the one that SSH is | ||
restricted to post-install. This will come into play particularly if | ||
you have multiple network interfaces. | ||
|
||
First, make sure your local SecureDrop environment is up-to-date and on the | ||
latest production release. | ||
|
||
.. code:: sh | ||
|
||
$ cd ~/Persistent/securedrop | ||
$ ./securedrop-admin update | ||
$ ./securedrop-admin setup | ||
|
||
The setting that controls SSH over LAN access is set during the `sdconfig` step | ||
of the install. Below is an example of what the prompt will look like. You can | ||
answer either 'no' or 'false' when you are prompted for `Enable SSH over Tor`: | ||
|
||
.. code:: sh | ||
|
||
$ ./securedrop-admin sdconfig | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest recommending |
||
|
||
Username for SSH access to the servers: vagrant | ||
Local IPv4 address for the Application Server: 10.0.1.4 | ||
Local IPv4 address for the Monitor Server: 10.0.1.5 | ||
Hostname for Application Server: app | ||
Hostname for Monitor Server: mon | ||
[...] | ||
Enable SSH over Tor: no | ||
|
||
Then you'll have to run the installation script | ||
|
||
.. code:: sh | ||
|
||
$ ./securedrop-admin install | ||
|
||
.. note:: If you are migrating from a production install previously configured | ||
with SSH over Tor, you will be prompted to re-run the `install` portion | ||
twice. This is due to the behind the scenes configuration changes being | ||
done to switch between Tor and the local network. | ||
|
||
Finally, re-configure your *Admin Workstation* as follows: | ||
|
||
.. code:: sh | ||
|
||
$ ./securedrop-admin tailsconfig | ||
|
||
Assuming everything is working you should be able to gain SSH access as follows | ||
|
||
.. code:: sh | ||
|
||
$ ssh app | ||
$ ssh mon | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
--- | ||
# Set the default SSH listening address for the sshd config file. | ||
# In production, sshd listening to localhost (127.0.0.1), since all SSH | ||
# connections are forced over Tor. In staging, this value will be 0.0.0.0 | ||
# to enable direct access for testing during development. | ||
ssh_listening_address: 127.0.0.1 | ||
enable_ssh_over_tor: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default value consistent with current project settings. 👍 |
||
|
||
allow_direct_access: false | ||
# Set the default SSH listening address for the sshd config file. | ||
# If enable_ssh_over_tor is false, open up SSH (additional iptables templates | ||
# helps us for restriction) otherwise restrict to localhost (tor). | ||
ssh_listening_address: "{{ '127.0.0.1' if enable_ssh_over_tor else '0.0.0.0' }}" | ||
|
||
# This var is defined in the tor-hidden-services role, but won't be available | ||
# in separate plays, so declaring it within the context of iptables role, so | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,12 +36,39 @@ | |
- iptables | ||
- permissions | ||
|
||
- name: Determine admin network - first find admin net dev | ||
set_fact: | ||
admin_dev: "{{ lookup('pipe','/bin/ip r get '+ssh_ip)|regex_search('(?<=dev )\\w+') }}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just noticed this so I want to make a note for posterity: this logic doesn't work as is for the
That said, the prod VM workflow works when SSH over Tor is on (double checked this via manual testing), and since the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm actually OK with this, @redshiftzero. Use of the prod VMs has become highly dependent on a virtualized Tails setup, and we'd do well to go more in that direction, e.g. removing the Ansible integration from the Vagrantfile for the "prod" VMs altogether. Holler if you disagree; we can discuss separately. |
||
when: not enable_ssh_over_tor | ||
tags: | ||
- iptables | ||
- permissions | ||
|
||
- name: Gather localhost facts first | ||
setup: | ||
become: no | ||
delegate_to: localhost | ||
delegate_facts: True | ||
run_once: True | ||
|
||
- name: Determine admin network - next compute admin network cidr | ||
set_fact: | ||
admin_net_cidr: "{{ '/'.join([hostvars['localhost']['ansible_'+admin_dev].ipv4.network, | ||
hostvars['localhost']['ansible_'+admin_dev].ipv4.netmask] | ||
)|ipaddr('cidr') }}" | ||
delegate_to: localhost | ||
when: not enable_ssh_over_tor | ||
tags: | ||
- iptables | ||
- permissions | ||
|
||
- name: Copy IPv4 iptables rules. | ||
template: | ||
src: rules_v4 | ||
dest: /etc/network/iptables/rules_v4 | ||
owner: root | ||
mode: "0644" | ||
notify: drop flag for reboot | ||
tags: | ||
- iptables | ||
- permissions | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a statement around physical access controls to the Firewall/server/network room.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you think an expansion of docs are really needed? i ask because we only enable ssh via keys - i don't see the increased threat vector here. If someone has physical access to the server room, the entire system can be compromised regardless of ssh status. If they own the firewall, i guess they could hammer on ssh ? They could technically do that if there is a vulnerability in tor and/or an adversary gets ahold of someone's tails stick + persistence creds.