Friday, 2026-01-23

opendevreviewTakashi Kajinami proposed openstack/openstack-zuul-jobs master: wip: Drop unused horizon/neutron job template  https://review.opendev.org/c/openstack/openstack-zuul-jobs/+/97444015:40
opendevreviewJames E. Blair proposed openstack/project-config master: Simplify Zuul tenant config for providers  https://review.opendev.org/c/openstack/project-config/+/97446216:07
-opendevstatus- NOTICE: The Gerrit service on review.opendev.org will be offline momentarily while we restart it onto new images after an update to the build toolchain18:01
*** gmaan is now known as gmaan_afk19:39
timburkeanyone around to help me figure out what i'm doing wrong when trying to rotate dockerhub secrets? (clarkb maybe?) it seems like the secret is getting decrypted, but login fails -- even though running something like `docker login -u screamingfrenzy -p $( cat /tmp/secret )` locally succeeds19:53
timburkefor a little more context (including a comment about how i've been generating the encrypted secret), see https://review.opendev.org/c/openstack/swift/+/973990/2/.zuul.yaml19:56
fungitimburke: when running the zuul-client encrypt command, did you specify --tenant=openstack and --project=openstack/swift19:56
timburkeyup19:56
fungiah, looking19:56
timburkei've tried it both with and without a trailing newline in the --infile; neither works19:57
fungitimburke: it's the swift-upload-image post_failure result you're looking at, i guess?20:05
fungihttps://opendev.org/zuul/zuul-jobs/src/branch/master/roles/upload-docker-image/tasks/main.yaml#L12 seems to be the command that's failing there20:08
fungiwhich looks basically like the command you tested locally20:08
timburkeyeah, that's what i was assuming20:10
timburkeis there a way for me to test round-tripping the encrypt/decrypt with some locally generated keys? are they... rsa, or...?20:11
fungitimburke: it uses the openssl command-line tool like https://opendev.org/zuul/zuul-client/src/branch/master/zuulclient/utils/__init__.py#L85-L8820:15
fungiand yes it's basically rsa20:15
fungithough if zuul couldn't decrypt it with that project's private key, it would report a configuration error20:16
fungihttps://zuul-ci.org/docs/zuul/latest/project-config.html#encryption talks about the feature at length20:18
fungiand also in https://zuul-ci.org/docs/zuul/latest/config/secret.html20:31
fungiit does look like the job was running successfully prior to when we had to rotate all the project keys, so presumably the prior secret value was working fine20:37
timburkeso i got my round-trip with something like `PYTHONPATH=../zuul/ python ../zuul/tools/decrypt_secret.py test.pri <( zuul-client --zuul-url https://zuul.opendev.org encrypt --tenant openstack --project openstack/swift --secret-name swift-dockerhub-2026 --infile /tmp/secret --field-name password --public-key test.pub )`20:45
timburkeand it looks good20:45
timburkedo we need to worry about shell safety in that task, at https://opendev.org/zuul/zuul-jobs/src/branch/master/roles/upload-docker-image/tasks/main.yaml#L12 ? like, if there were " or $ characters, would that cause trouble?20:46
fungiyeah, but like i said, if there were a problem decrypting it with the project's key zuul would have reported a clear decryption failure error on the change too20:46
fungimmm, good question20:47
fungithe ansible task uses a command module instead of a shell module, so i don't think it runs under an interpreted shell20:48
fungiclarkb: ^ do you happen to know?20:48
timburkehmmm... https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/command_module.html#parameter-expand_argument_vars20:51
timburkedefaults to true20:51
timburkei can try adding some backslashes to my secret file...20:52
fungiah, so it could be, yep20:52
fungialternatively, adjust the password to not include things that might get expanded, if possible20:53
fungialso seems unlikely that it would find a match for an actual variable name that way, but not impossible i guess20:57
timburkebut not finding a match would drop in an empty string, so no longer the right password. might explain everything! fingers crossed for the new patchset20:58
fungi"If a variable is not matched, it is left unchanged, unlike shell substitution which would remove it." (from the documentation you linked)20:59
clarkbfungi: correct command is like a direct fork and exec without a shell21:08
fungibut apparently it will perform *some* variable substitution21:09
fungithough re-reading the description, it looks like the entire argument would have to match an envvar21:09
clarkbthis command is all ansible vars https://opendev.org/zuul/zuul-jobs/src/branch/master/roles/upload-docker-image/tasks/main.yaml#L1221:09
fungioh, good point, that's what they're talking about i guess, those aren't jinja2 substitutions, those are the vars being substituted21:11
fungithough the command module documentation talks about also replacing arguments like $HOME21:11
clarkbah it must do that on the ansible side then21:12
fungibut only starting with ansible 2.16 apparently21:13
timburkeit merged! apparently i *did* need to sprinkle in some backslashes!23:17
timburkelol! so *upload* worked, but *promote* now failed!23:22
timburkei guess because *that* job goes and POSTs a json body using a uri module... which will have different quoting rules or something? https://opendev.org/zuul/zuul-jobs/src/branch/master/roles/promote-docker-image/tasks/main.yaml#L13-L1823:25
clarkbtimburke: where di you change the quoting?23:34
clarkbin the secret value itself?23:34
timburkeyeah, in the secret file23:42
clarkbhrm I'm not sure I understand why that would help23:47
clarkbthe docker secret is just a random string password type value23:48
clarkbbut yes I suspect that the escapes you added are now not being interpreted by the http request properly23:48
clarkbtimburke: is the problem that the string password include characters that shells want to interpret?23:50
clarkbif so I like to use `pwgen -s 32 1` or similar which should get you a securely generated random string without that problem23:50
clarkbbut other password manager tools can usually be configured to avoid (or include) sepcific characters23:51
clarkbanother option may be to change the quoting in the docker login task23:56
clarkbso that things are escaped at that level (maybe weith ansible raw tags?)23:56
timburkeyeah, it had a few different things -- ", $, ! -- i pinged the guy that owns the email for the dockerhub user to ask him to change the password again, this time to something more ansible/json-friendly23:57
clarkbI think in this case we may need a way to share the secret value (possibly by resetting it to another value so the old one can be exposed) and then we can work through what the best/proper way to make that safe would be. That said I expect with the currnet code using a value from something like `pwgen -s 32 1` would work23:57
clarkbtimburke: note you want to rotate the secret anyway as part of the decryption fix23:58
timburke👍23:58
timburkeyeah, we'd already rotated it once -- i remember you advising we do that *first*, rather than just re-encrypt the old secret with the new key23:59

Generated by irclog2html.py 4.0.0 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!