-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsftp-geesefs.butane
138 lines (138 loc) · 4.22 KB
/
sftp-geesefs.butane
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
variant: fcos
version: 1.4.0
passwd:
users:
- name: root
ssh_authorized_keys:
- $MY_SSH_KEY
- name: core
ssh_authorized_keys:
- $MY_SSH_KEY
groups:
- name: sftpusers
storage:
directories:
- path: /srv/sftp_geesefs
mode: 0755
- path: /srv/sftp_geesefs/chroot
mode: 0755
- path: /srv/sftp_geesefs/install-sftp-users
mode: 0700
- path: /srv/sftp_geesefs/install-sftp-users/trigger
mode: 0700
- path: /srv/sftp_geesefs/install-sftp-users/completed
mode: 0700
- path: /etc/ssh/extra_authorized_keys
mode: 0755
files:
- path: /etc/zincati/config.d/30-updates-strategy.toml
mode: 0444
contents:
local: 30-updates-strategy.toml
- path: /etc/ssh/sshd_config.d/sftp_geesefs.conf
mode: 0400
contents:
local: sftp_geesefs.conf
- path: /usr/local/bin/install-sftp-users.bash
mode: 0755
contents:
local: install-sftp-users.bash
- path: /usr/local/bin/mount-geesefs.bash
mode: 0755
contents:
local: mount-geesefs.bash
systemd:
units:
- name: rpm-ostree-install-s3fs-fuse.service
enabled: true
contents: |
[Unit]
Description=Install s3fs-fuse
Wants=network-online.target
After=network-online.target
Before=zincati.service
ConditionPathExists=!/var/lib/%n.stamp
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/rpm-ostree install --apply-live --allow-inactive s3fs-fuse
ExecStart=/bin/touch /var/lib/%n.stamp
[Install]
WantedBy=multi-user.target
- name: geesefs@.service
enabled: true
contents: |
[Unit]
Description=mount geesefs
Wants=network-online.target
Requires=install-geesefs.service
After=network-online.target install-geesefs.service
Before=zincati.service
AssertPathIsDirectory=/srv/sftp_geesefs/chroot/%i/%i
AssertPathIsSymbolicLink=!/home/%i/s3_bucket_name
AssertFileNotEmpty=/home/%i/s3_bucket_name
AssertFileNotEmpty=/home/%i/s3_endpoint
AssertPathExists=/usr/local/bin/geesefs
[Service]
Type=simple
User=%i
Group=%i
ExecStart=/usr/local/bin/mount-geesefs.bash
ExecStop=/bin/fusermount -u /srv/sftp_geesefs/chroot/%i/%i
[Install]
WantedBy=default.target
- name: install-geesefs.service
enabled: true
contents: |
[Unit]
Description=Install geesefs
Wants=network-online.target
After=network-online.target
ConditionPathExists=!/usr/local/bin/geesefs
Before=zincati.service
[Service]
ExecStart=/usr/bin/curl -sL -o /usr/local/bin/geesefs https://github.com/yandex-cloud/geesefs/releases/latest/download/geesefs-linux-amd64
ExecStart=chmod 755 /usr/local/bin/geesefs
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
- name: install-sftp-users.path
enabled: true
contents: |
[Unit]
Description=Install sftp users from JSON
[Path]
PathExists=/srv/sftp_geesefs/install-sftp-users/trigger/install-sftp-users.json
[Install]
WantedBy=multi-user.target
- name: install-sftp-users.service
enabled: false
contents: |
[Unit]
Description=Install users
Wants=network-online.target
After=network-online.target
Before=zincati.service
[Service]
ExecStart=/usr/local/bin/install-sftp-users.bash
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
- name: empty-bucket@.service
enabled: true
contents: |
[Unit]
Description=Empty bucket directly after reboot
Requires=geesefs@%i.service network-online.target install-geesefs.service
After=geesefs@%i.service network-online.target install-geesefs.service
Before=zincati.service
[Service]
Type=oneshot
RemainAfterExit=yes
User=%i
Group=%i
ExecStart=find /srv/sftp_geesefs/chroot/%i/%i -mindepth 1 -xdev -delete
[Install]
WantedBy=multi-user.target