Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
with:
# The Docker Hub Repository you want eventually push to, e.g samply/share-client
image-name: "samply/vaultfetcher"
# Where to push your images ("dockerhub", "ghcr", "both" or "none")
push-to: dockerhub
# Set to none, docker.io or ghcr.io. By default, will push to dockerhub for branches "main" and "develop" and to ghcr for all other branches.
push-to: docker.io
# Define special prefixes for docker tags. They will prefix each images tag.
# image-tag-prefix: "foo"
# Define the build context of your image, typically default '.' will be enough
Expand All @@ -43,4 +43,4 @@ jobs:
# This passes the secrets from calling workflow to the called workflow
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ RUN cargo install rbw && \
FROM ubuntu

RUN apt-get update && \
apt-get -y install jq curl && \
apt-get -y install jq curl proxychains && \
rm -rf /var/lib/apt/lists

COPY --from=builder /rbw /rbw-agent /usr/local/bin/
COPY --from=builder /rbw /rbw-agent /usr/bin/

ADD *.sh /

Expand Down
35 changes: 33 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,29 @@ source ./checkMandVars.sh

export PIN=$(mktemp)

for v in http_proxy HTTP_PROXY https_proxy HTTPS_PROXY; do
[ -n "${!v}" ] && export http_proxy="${!v}" && break
done

if [ -n "$http_proxy" ]; then
hostport="${http_proxy#*://}"
host="${hostport%%:*}"
port="${hostport##*:}"
ip="$(getent hosts $host | awk '{print $1}')"
echo "Setting up http proxy $http_proxy ($ip $port)"
cat <<EOF > /etc/proxychains.conf
strict_chain
#proxy_dns
quiet_mode

tcp_read_time_out 15000
tcp_connect_time_out 8000

[ProxyList]
http $ip $port
EOF
fi

bw_login() {
cat <<EOF > ${PIN}
#!/bin/sh
Expand Down Expand Up @@ -40,7 +63,11 @@ case "$1" in
RESULT="\n"

while (( "$#" )); do
read PASS < <(rbw get password $1)
if [[ -n "${http_proxy:-}" ]]; then
read PASS < <(proxychains rbw get password $1 | grep -v -- '^ProxyChains-')
else
read PASS < <(rbw get password $1)
fi
if [ -z "$PASS" ]; then
echo "ERROR: Password $1 not found in vault. Exiting ..."
exit 1
Expand Down Expand Up @@ -78,7 +105,11 @@ case "$1" in
if [ "$(vault_sealstatus)" == "true" ]; then
bw_login
echo "Getting unseal key ..."
read UNSEAL_KEY < <(rbw get "Vault Unseal Key")
if [[ -n "${http_proxy:-}" ]]; then
read UNSEAL_KEY < <(proxychains rbw get "Vault Unseal Key" | grep -v -- '^ProxyChains-')
else
read UNSEAL_KEY < <(rbw get "Vault Unseal Key")
fi
echo "Got unseal key."
bw_logout
RUNNING=1
Expand Down