abra app secret get <domain> <secret-name>
#480
Closed
opened 2023-08-25 14:30:31 +00:00 by moritz
·
10 comments
Labels
Clear labels
abra
awaiting-feedback
backups
bug
build
ci/cd
community organising
contributing
coopcloud.tech
design
documentation
duplicate
enhancement
fedi
fedi-infra
finance
funding
good first issue
help wanted
installer
legal
performance
proposal
question
security
test
wontfix
Everything to do with abra
Ping/pong on comms
Something is not working
Go build related issues
Getting the robots into the mix
Opening this thing up
Contributors stuff
Our main website
Design thinking required
Let's write things together
This issue or pull request already exists
New feature
Democratic decision making
Money things
Anything related to grant funding
Easy start with development
Need some help
Installation related issues
Performance related
Large change which requires feedback & decisin making
More information is needed
Securing our shit
Unit or integration test suite
This won't be fixed
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
3wordchant
aadil (Aadil Ayub)
abra-bot (Abra Bot)
ammaratef45
amras (Sarma)
Apfelwurm
BornDeleuze
Brooke
carla
cas (Cassowary)
coopcloud
cyrnel
decentral1se (d1)
dede
devydave
fauno (fauno)
iexos
jade (Jade Ambrose)
jjsfunhouse
jmakdah2 (Jackie Makdah)
joe-irving (Joe Irving)
kawaiipunk (KawaiiPunk)
knoflook
kolaente
lambdabundesverband
linnealovespie (April)
moosemower
moritz
notplants
oxaliq (sorrel)
p4u1
pharaohgraphy (Andrew 🐦🔥❤️🔥✴️)
renovate-bot (Comrade Renovate Bot)
ripclap
simon
sixsmith (Sixsmith)
stevensting
trav (Trav Fryer)
val (val (he/him))
yksflip
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: toolshed/organising#480
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
For the autoconfigurator https://git.coopcloud.tech/moritz/alakazam I need to exchange secrets between several apps.
abra app secret get <domain> <secret-name>would be a very useful command.The current workaround is to run
abra app run <domain> <container> cat /var/run/secrets/<secret_name>.The problem with this command is that the app already needs to be deployed and I need to know which container holds the secret.
Update
These are the possible approaches how to implement it:
cat /var/run/secrets/<secret_name>inside the container/var/lib/docker/containers/<container-id>/mounts/secrets/<secret_id>of the host servercat /var/run/secrets/<secret_name>For
1.and2.abra should automatically select the correct container, so the user don't need to know the container. The disadvantage of these approaches is that there need to be a running container. It won't work for new apps that are not yet deployed or for crashed container. Approach3.would solve this issue, but it would create a lot of overhead by launching a new container just to read the secrets.abra app secret get <domain> <secret-name>to `abra app secret get <domain> <secret-name>`👍
Maybe
abra app secret list --machineto get a list of secrets? Altho the current implement ofsecret lsdoesn't list which container holds the secret. This could be added perhaps?coop-cloud/backup-bot-two#28
Maybe the backupbot container could be used for this command. Another idea would be to start a very lightweight container and attach all secrets to it. But running this command would take a lot of time if always a whole container needs to be started.
It could be solved another way by accessing
/var/lib/docker/containers/<container-id>/mounts/secretsvia ssh.A way for exporting and importing all secrets would be very nice for migrating an app to another server.
abra app secret list <old_domain> --machine | abra app secret import <new_domain> -Unfortunately via
/var/lib/dockeronly secrets that are mounted into a running container are accessible. So the only way to access a secret that is not mounted inside a container is to mount it into a container...For estimating the the runtime overhead:
This took about 12s-20s independent of the number of secrets.
There is another way to get secrets that are not mounted to any container without creating a container.
https://medium.com/lucjuggery/raft-logs-on-swarm-mode-1351eff1e690
Using the tool
swarm-rafttoolI can read the content of a secret referenced by its id or name from the raft log.Execution time is about 4s.
On the test server the Raft log is about 130MB, this is way too large for downloading it for dumping the secrets.
The question is how to get the go binary on the server?
@moritz Since we already have a lot of these dependencies, we could just re-work the code from the command itself? Some copy/pasta and delete because we know we only need the secret handling code. See https://github.com/moby/swarmkit/blob/f082dd7a0ceeabf146a4705597b48b1c21aa3b8a/cmd/swarm-rafttool/dump.go#L250-L463 Sounds good?
I think we can use it as it is instead of extra copy/pasta code maintenance. I doubt we can integrate the code directly in abra, because it should be executed on the server side, as it needs to read the raft log. The only way to completely integrate it into abra would be to download the whole raft log, but this can be huge.
Do you have a better idea than building a binary that comes together with abra and abra copies it to the server to parse the raft log? Or is there some magic way for remote go code execution?
from @cyrnel :
Let's continue on toolshed/abra#694.
Thanks for all the input so far folks.