-
Notifications
You must be signed in to change notification settings - Fork 187
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
Wrong decrypt SOPS files #421
Comments
I tested this on my cluster and once the secret is mounted, the json is decoded correctly. Create {
"id": "example",
"realm": "example",
"notBefore": 0,
"defaultSignatureAlgorithm": "RS256",
"revokeRefreshToken": false
} Encrypt it in-place: sops --age=$AGEPUB --encrypt --in-place realm.json Create a deployment that mounts the secret: apiVersion: apps/v1
kind: Deployment
metadata:
name: podinfo
namespace: default
spec:
selector:
matchLabels:
app: podinfo
template:
metadata:
labels:
app: podinfo
spec:
containers:
- name: podinfod
image: ghcr.io/stefanprodan/podinfo:6.0.0
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 9898
#protocol: TCP
volumeMounts:
- name: secrets
mountPath: "/secrets"
readOnly: true
volumes:
- name: secrets
secret:
secretName: json-secret Create a kustomization that generates the Kubernetes secret: apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: default
resources:
- deployment.yaml
secretGenerator:
- name: json-secret
files:
- realm.json=realm.json Create a Flux kustomization to apply the above: apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: secrets
namespace: flux-system
spec:
decryption:
provider: sops
secretRef:
name: sops-age
interval: 1m0s
path: ./secrets/test
prune: true
sourceRef:
kind: GitRepository
name: flux-system After Flux reconciles the above, exec into the podinfo pod and print the json:
|
@aivanov-citc the issue here is that you pipe the json into sops without telling SOPS what content type is it. So sops adds the As I posted above you can encrypt in-place or add
|
Yes indeed. When specifying the file type, it works in version 0.16.2, but does not work in version 0.13.4. We will have to update both the flux version and reencrypt the files at the same time. Thanks. |
@aivanov-citc please consider upgrading to latest Flux, see here the upgrade guide: fluxcd/flux2#1916 |
Hey! When switching from version flux 0.13.4 to 0.16.2, files encrypted with SOPs became incorrectly decrypted.
There is file
realm.json
encrypted by such command
Kustomize secretGenerator
When decrypting on version flux 0.13.4, we get a correct contents of the secret
on version flux 0.16.2 this is
version sops - 3.7.1
The text was updated successfully, but these errors were encountered: