Ajout : iodined tunnel IP sur DNS.
[lhc/ateliers.git] / remote / iodined-key-send
diff --git a/remote/iodined-key-send b/remote/iodined-key-send
new file mode 100755 (executable)
index 0000000..b1a2a77
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh -eu
+tool=$(readlink -e "${0%/*}/..")
+. "$tool"/remote/lib.sh
+
+install -d -m 700 \
+ "$tool"/var/sec \
+ "$tool"/var/sec/iodine
+if test ! -e "$tool"/var/sec/iodine/"$local_iodine_ns".pass.gpg
+ then gpg --encrypt $gpg_options -o "$tool"/var/sec/iodine/"$local_iodine_ns".pass.gpg <<-EOF
+               $(stdbuf --output 0 tr -d -c '[:alnum:][:punct:]' <"${random:-/dev/urandom}" | head -c 32)
+               EOF
+ fi
+
+gpg --decrypt ${gpg_options-} "$tool"/var/sec/iodine/"$local_iodine_ns".pass.gpg |
+"$tool"/remote/ssh root@"$local_fqdn" '
+       set -eux
+       test ! -e /root/.iodined_pass
+       install -m 400 -o root -g root /dev/stdin \
+        /root/.iodined_pass
+ '