Skip to content

Commit

Permalink
ansible: Add restricted rsync endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jbruechert committed Feb 26, 2024
1 parent fd976f5 commit 9b67112
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
1 change: 1 addition & 0 deletions ansible/hosts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ motis:
ansible_host: vm-motis.spline.de
transitous_nginx_site_include_extra: /etc/ssl/routing.spline.inf.fu-berlin.de/include.nginx
transitous_domain: routing.spline.de
transitous_rsync_public_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL4Pxul2Bci8Vjowx4Q75wQaAXvvWvw1HsCzxBRgi/tI jbb@hyperion"
8 changes: 1 addition & 7 deletions ansible/motis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
- name: Set up MOTIS servers
hosts: motis
roles:
- rsync
- motis
- motis-proxy
- nginx
tasks:
- name: Install rsync
apt:
name:
- rsync
- htop
- zstd
23 changes: 23 additions & 0 deletions ansible/roles/rsync/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- name: Install rsync
apt:
name:
- rsync
- bubblewrap
- dash

- name: Create user for rsync upload
user:
name: rsync
shell: /usr/bin/dash

- name: Create rsync target directory
file:
path: /srv/rsync/transitous/
state: directory
owner: rsync

- name: Add restricted authorized key for rsync
authorized_key:
user: rsync
state: present
key: 'command="bwrap --new-session --die-with-parent --cap-drop ALL --unshare-all --ro-bind /usr/lib/ /usr/lib/ --ro-bind /usr/bin/env /usr/bin/env --ro-bind /usr/bin/python3 /usr/bin/python3 --ro-bind /usr/bin/rrsync /usr/bin/rrsync --ro-bind /usr/bin/rsync /usr/bin/rsync --ro-bind /lib/ /lib/ --ro-bind /lib64/ /lib64 --bind /srv/rsync/transitous/ /srv/rsync/transitous/ -- /usr/bin/rrsync -wo /srv/rsync/transitous/",restrict {{ transitous_rsync_public_key }}'

0 comments on commit 9b67112

Please sign in to comment.