Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flux bootstrap disables GPG commit verification #1615

Closed
fl42 opened this issue Jul 12, 2021 · 4 comments
Closed

flux bootstrap disables GPG commit verification #1615

fl42 opened this issue Jul 12, 2021 · 4 comments

Comments

@fl42
Copy link

fl42 commented Jul 12, 2021

Describe the bug

I enabled GPG commit verification by adding verify to the default GitRepository in gotk-sync.yaml:

apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
  name: flux-system
  namespace: flux-system
spec:
  interval: 1h0m0s
  ref:
    branch: master
  secretRef:
    name: flux-system
  url: ssh://xxx
  verify:
    mode: head
    secretRef:
      name: flux-gpg-pubkeys

It works as expected.

However running flux bootstrap again (should be idempotent) removes the verify part.

⚠️ That may be considered as a security risk as users may not be aware that GPG commit verification is disabled when running flux bootstrap (e.g., on upgrade)

To Reproduce

  1. Run flux bootstrap
  2. Add flux-gpg-pubkeys Secret (if needed)
  3. Add verify key to GitRepository object in gotk-sync.yaml
verify:
  mode: head
  secretRef:
    name: flux-gpg-pubkeys
  1. Run
kubectl -n flux-system get gitrepositories.source.toolkit.fluxcd.io flux-system -o yaml

✔️ verify key is present
5. Run flux bootstrap again
6. Run

kubectl -n flux-system get gitrepositories.source.toolkit.fluxcd.io flux-system -o yaml

⚠️ verify key is not present anymore (you may also check commit issued by flux)

Expected behavior

GPG commit verification should not be disabled on flux bootstrap.
At least a strong warning message should be raised.
Ideally a --verify parameter to configure GPG commit verification should be added to flux CLI.

Additional context

  • Kubernetes version: 1.21.1
  • Git provider: 0.16.1
  • Container registry provider: N/A

Below please provide the output of the following commands:

flux --version
flux version 0.16.1
flux check
► checking prerequisites
✔ kubectl 1.20.4 >=1.18.0-0
✔ Kubernetes 1.21.1 >=1.16.0-0
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.11.1
✔ image-automation-controller: deployment ready
► ghcr.io/fluxcd/image-automation-controller:v0.14.0
✔ image-reflector-controller: deployment ready
► ghcr.io/fluxcd/image-reflector-controller:v0.11.0
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v0.13.2
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v0.15.0
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v0.15.3
✔ all checks passed
@hiddeco
Copy link
Member

hiddeco commented Jul 12, 2021

If you patch your resources as described in https://fluxcd.io/docs/installation/#customize-flux-manifests this should not happen.

@fl42
Copy link
Author

fl42 commented Jul 13, 2021

Thanks for the point, it works.
I wrote a small guide to help future users

@fl42 fl42 closed this as completed Jul 13, 2021
@fl42
Copy link
Author

fl42 commented Jul 13, 2021

However should I let this issue open until a warning message is issued if flux bootstrap erases user customization?

@fl42 fl42 reopened this Jul 13, 2021
@stefanprodan
Copy link
Member

We've added a warning to the sync manifests in #2050, closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants