From 2debac35b290b28b549198908af1c9051482e74f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 22 May 2020 23:26:34 +0200 Subject: [PATCH] Implement login workflow --- entrypoint.sh | 16 ++++++++++++++-- isolated-protonmail-bridge.sh | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 7719cae..419144e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,9 +1,21 @@ #!/usr/bin/env bash set -euo pipefail +BRIDGE="${BRIDGE:-/usr/bin/protonmail-bridge}" + + gpg --generate-key --batch gpg-keygen-params.txt pass init proton -/usr/bin/protonmail-bridge --cli -# TODO: login on cli +mkfifo input +sleep infinity > input & +$BRIDGE --cli < input & +bridge_pid=$! + +echo "login" > input +echo "$BRIDGE_USER" > input +echo "$BRIDGE_PASS" > input +echo "info" > input + +wait $! diff --git a/isolated-protonmail-bridge.sh b/isolated-protonmail-bridge.sh index f455707..19913d4 100755 --- a/isolated-protonmail-bridge.sh +++ b/isolated-protonmail-bridge.sh @@ -20,5 +20,7 @@ nsjail -Mo --bindmount_ro /etc/resolv.conf \ --env HOME=/home/proton \ --env PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin \ + --env BRIDGE_USER \ + --env BRIDGE_PASS \ -- ${BIN}