Comments (4)
If someone comes across this and doesn't want --watch
, but still wants to chown
things before they get out, I used this workaround:
tmpfile=$(mktemp)
cat <<EOF >$tmpfile
chown -R $UID:$(id -g) /shared/certs
kill 1
EOF
docker run --rm \
-v $tmpfile:/tmp/chownme \
ldez/traefik-certs-dumper file \
--source /data/acme.json \
--dest /shared/certs \
--watch --post-hook "sh /tmp/chownme"
rm $tmpfile
(Of course, you'd need additional -v
s to mount the data you are working with for your own cases)
The reason for the heredoc'd script is that passing in --post-hook "sh -c 'chown -R $UID:$(id -g) /shared/certs && kill 1'"
appears to drop the final '
, not allowing the command to run, and it also seems like you can't run multiple commands outside of a sh
.
The kill 1
is to kill the root process (the cert dumper) after --watch
successfully triggers the --post-hook
, since watch mode is required for the --post-hook
to run. That means that this container runs, and exits after it does its thing!
I'd also love an option to set the ownership of files generated after running this--but until then, I hope this workaround is useful to someone else~
from traefik-certs-dumper.
Maybe adding a flag to change permissions of the cert and key ?
One for key and one for certs would be optimal.
Currently it wirtes with static permissions at least for v2. Didin't look further into it.
traefik-certs-dumper/dumper/v2/dumper.go
Line 58 in 1e5c66d
traefik-certs-dumper/dumper/v2/dumper.go
Line 76 in 1e5c66d
traefik-certs-dumper/dumper/v2/dumper.go
Line 88 in 1e5c66d
from traefik-certs-dumper.
I was able to change the permissions via the "--post-hook" option:
traefik-certs-dumper file --watch --version v2 --source /data/acme.json --dest /shared/certs --post-hook "chown -R $PUID:$PGID /shared/certs"
from traefik-certs-dumper.
is it possible to go even further and execute a script with --post-hook? every time I try to execute a bash script it stops parsing when it encounters a firs space in the command. For example my script file (named posthook.sh) is:
chown -R $PUID:$PGID /shared/certs && scp /shared/certs/* [email protected]:/mnt/data/
it always fails at scp. Also I did add scp to the container by modifying entrypoint: from apk add jq to apk add jq openssh-client.
edit: the scp command by itself works flawlessly when executed inside the container (I have known_hosts and keys mapped inside the container)
from traefik-certs-dumper.
Related Issues (20)
- filename of wildcard certificates with single quotes with docker HOT 8
- Dependabot can't parse your go.mod
- csr? HOT 1
- Nothing happens when I run this via docker-compose
- Example fails, when you have more than one certresolver configured HOT 4
- Change clean behaviour HOT 4
- Add support for other certificate file standards HOT 10
- output folders empty
- Empty directories after running file command HOT 1
- acme.json unexpected EOF HOT 4
- Exporting sans wildcard cert into a file name, replacing star (*). HOT 3
- Docker issue with certain flags HOT 24
- Crypto Go :we are a research group to help developers build secure applications.
- make domain name as crt-name and key-name HOT 5
- I'm having difficulty converting the entrypoint compose for docker run ( GUI of unraid) HOT 7
- Add jq during build of the docker image HOT 1
- Unknown Operand HOT 1
- Possible to export a subdomain from a wildcard domain? HOT 2
- SANS in acme.json vs SANS in dumped certificate HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from traefik-certs-dumper.