Skip to content

Commit

Permalink
utils: fix remote copy for addOptionalRootCA
Browse files Browse the repository at this point in the history
We can't use `cosa remote-session sync` here because we are
running on the remote as the unprivileged builder user
and not in the root group. Workaround with `sudo`.

Fixup for 99c69fb
  • Loading branch information
dustymabe authored and jlebon committed Oct 6, 2022
1 parent 6d63e84 commit d1af35e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,12 @@ def addOptionalRootCA() {
// Also sync it over to the remote if we're operating in a remote session
shwrap('''
if [ -n "${COREOS_ASSEMBLER_REMOTE_SESSION:-}" ]; then
cosa remote-session sync {,:}/etc/pki/ca-trust/source/anchors/
cosa shell -- /usr/lib/coreos-assembler/update-ca-trust-unpriv
# Can't use `cosa remote-session sync` here because we are
# running on the remote as the unprivileged builder user
# and not in the root group. But.. we can use `sudo`.
cat $ROOT_CA | cosa shell -- sudo tee \
/etc/pki/ca-trust/source/anchors/$(basename $ROOT_CA)
cosa shell -- sudo /usr/lib/coreos-assembler/update-ca-trust-unpriv
fi
''')
}
Expand Down

0 comments on commit d1af35e

Please sign in to comment.