aboutsummaryrefslogtreecommitdiffhomepage
path: root/docker
diff options
context:
space:
mode:
authorPaolo Asperti <[email protected]>2022-07-13 18:28:10 +0200
committerPaolo Asperti <[email protected]>2022-07-14 15:14:53 +0200
commit0862bc8c043159ab391aef3af46486fb593ff05b (patch)
tree382dfd1b8f93b9053e15324cffa89c81bd480403 /docker
parentbfcfa68eae4d0e706a20395cd1f02aa95709bcf3 (diff)
downloadrustdesk-server-0862bc8c043159ab391aef3af46486fb593ff05b.tar.gz
rustdesk-server-0862bc8c043159ab391aef3af46486fb593ff05b.zip
test secrets
Diffstat (limited to 'docker')
-rwxr-xr-xdocker/Dockerfile3
-rw-r--r--docker/rootfs/etc/s6-overlay/s6-rc.d/hbbr/dependencies1
-rw-r--r--docker/rootfs/etc/s6-overlay/s6-rc.d/hbbs/dependencies1
-rwxr-xr-xdocker/rootfs/etc/s6-overlay/s6-rc.d/key-secret/type1
-rwxr-xr-xdocker/rootfs/etc/s6-overlay/s6-rc.d/key-secret/up1
-rwxr-xr-xdocker/rootfs/etc/s6-overlay/s6-rc.d/key-secret/up.real35
-rwxr-xr-xdocker/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/key-secret0
7 files changed, 41 insertions, 1 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 2ea6425..e6982af 100755
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -7,7 +7,8 @@ ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLA
RUN \
tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz && \
tar -C / -Jxpf /tmp/s6-overlay-${S6_ARCH}.tar.xz && \
- rm /tmp/s6-overlay*.tar.xz
+ rm /tmp/s6-overlay*.tar.xz && \
+ ln -s /run /var/run
COPY rootfs /
diff --git a/docker/rootfs/etc/s6-overlay/s6-rc.d/hbbr/dependencies b/docker/rootfs/etc/s6-overlay/s6-rc.d/hbbr/dependencies
new file mode 100644
index 0000000..23bc57d
--- /dev/null
+++ b/docker/rootfs/etc/s6-overlay/s6-rc.d/hbbr/dependencies
@@ -0,0 +1 @@
+key-secret
diff --git a/docker/rootfs/etc/s6-overlay/s6-rc.d/hbbs/dependencies b/docker/rootfs/etc/s6-overlay/s6-rc.d/hbbs/dependencies
index a689798..f72cf00 100644
--- a/docker/rootfs/etc/s6-overlay/s6-rc.d/hbbs/dependencies
+++ b/docker/rootfs/etc/s6-overlay/s6-rc.d/hbbs/dependencies
@@ -1 +1,2 @@
+key-secret
hbbr
diff --git a/docker/rootfs/etc/s6-overlay/s6-rc.d/key-secret/type b/docker/rootfs/etc/s6-overlay/s6-rc.d/key-secret/type
new file mode 100755
index 0000000..bdd22a1
--- /dev/null
+++ b/docker/rootfs/etc/s6-overlay/s6-rc.d/key-secret/type
@@ -0,0 +1 @@
+oneshot
diff --git a/docker/rootfs/etc/s6-overlay/s6-rc.d/key-secret/up b/docker/rootfs/etc/s6-overlay/s6-rc.d/key-secret/up
new file mode 100755
index 0000000..5255a74
--- /dev/null
+++ b/docker/rootfs/etc/s6-overlay/s6-rc.d/key-secret/up
@@ -0,0 +1 @@
+/etc/s6-overlay/s6-rc.d/key-secret/up.real
diff --git a/docker/rootfs/etc/s6-overlay/s6-rc.d/key-secret/up.real b/docker/rootfs/etc/s6-overlay/s6-rc.d/key-secret/up.real
new file mode 100755
index 0000000..90a13dc
--- /dev/null
+++ b/docker/rootfs/etc/s6-overlay/s6-rc.d/key-secret/up.real
@@ -0,0 +1,35 @@
+#!/command/with-contenv sh
+
+if [ ! -d /data ] ; then
+ mkdir /data
+fi
+
+# normal docker secrets
+if [ ! -f /data/id_ed25519.pub ] && [ -r /run/secrets/key_pub ] ; then
+ cp /run/secrets/key_pub /data/id_ed25519.pub
+ echo "Public key created from secret"
+fi
+
+if [ ! -f /data/id_ed25519 ] && [ -r /run/secrets/key_priv ] ; then
+ cp /run/secrets/key_priv /data/id_ed25519
+ echo "Private key created from secret"
+fi
+
+# ENV variables
+if [ ! -f /data/id_ed25519.pub ] && [ ! "$KEY_PUB" = "" ] ; then
+ echo -n "$KEY_PUB" > /data/id_ed25519.pub
+ echo "Public key created from ENV variable"
+fi
+
+if [ ! -f /data/id_ed25519 ] && [ ! "$KEY_PRIV" = "" ] ; then
+ echo -n "$KEY_PRIV" > /data/id_ed25519
+ echo "Private key created from ENV variable"
+fi
+
+# fix perms
+if [ -f /data/id_ed25519.pub ] ; then
+ chmod 600 /data/id_ed25519.pub
+fi
+if [ -f /data/id_ed25519 ] ; then
+ chmod 600 /data/id_ed25519
+fi
diff --git a/docker/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/key-secret b/docker/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/key-secret
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/docker/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/key-secret