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

feat: support for static hostkeys in ssh core #678

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions charts/lagoon-core/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type: application
# time you make changes to the chart and its templates, including the app
# version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.46.0
version: 1.46.1

# This is the version number of the application being deployed. This version
# number should be incremented each time you make changes to the application.
Expand All @@ -41,18 +41,4 @@ dependencies:
annotations:
artifacthub.io/changes: |
- kind: changed
description: update values for local development
- kind: changed
description: bump minimum Kubernetes version to 1.25
- kind: changed
description: added api-sidecar-handler container to api and webhooks2tasks
- kind: changed
description: update ssh-portal components to v0.37.0
links:
- name: ssh-portal release
url: https://github.com/uselagoon/lagoon-ssh-portal/releases/tag/v0.37.0
- kind: changed
description: update Lagoon appVersion to v2.20.0
links:
- name: lagoon v2.20.0 release notes
url: https://docs.lagoon.sh/releases/2.20.0/
description: add support for injecting hostkeys in core ssh service
61 changes: 61 additions & 0 deletions charts/lagoon-core/ci/linter-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,67 @@ ssh:
resources:
requests:
cpu: "10m"
hostKeys:
rsaPub: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDTU9JXClTTQQB2QvsNegwWOwxdZNyswjDrWO94c7Gej+WkeFC6iYgIkALTFXP+/uSgMdcxISnAqaFial7j2owmnGKbH9MTTmSS68I8FZRN/KAsDTVqzOR8bcwo36uS6cjcvQJevFpKJk/SWDMozqRgWK2I3QfkkCvGyRA9x/kq9BKFORj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QQQ3ODLabuuNJtOWW+DCHMFB+ZuF6Fj9
tUl/AkKo7tKXCsF39MWXs15+e+7zPw6SfRjOSe+DWoKNmInezvpO2kJMAAAAsNTQX8rU0F
/KAAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDc4Mtpu640m05Zb
4MIcwUH5m4XoWP21SX8CQqju0pcKwXf0xZezXn577vM/DpJ9GM5J74Nago2Yid7O+k7aQk
wAAAAhAM1shfG9ZAFn1XxrmsGuqhXTuI+8W8VZJRIF+ucX6J+vAAAAEWJlbkBzaHJlZGRl
ZGJhY29uAQIDBAUG
-----END OPENSSH PRIVATE KEY-----
ed25519Pub: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILWSDwhoTFNA2/itmaRwjB8dz0/Tnd8VDJ6Jkhnix+1w"
ed25519: |-
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACC1kg8IaExTQNv4rZmkcIwfHc9P053fFQyeiZIZ4sftcAAAAJhzIoyXcyKM
lwAAAAtzc2gtZWQyNTUxOQAAACC1kg8IaExTQNv4rZmkcIwfHc9P053fFQyeiZIZ4sftcA
AAAEAWTgia6XF7lvU5UrUbTq4GDvWVpa54m5OwAUqMLF5xXLWSDwhoTFNA2/itmaRwjB8d
z0/Tnd8VDJ6Jkhnix+1wAAAAEWJlbkBzaHJlZGRlZGJhY29uAQIDBA==
-----END OPENSSH PRIVATE KEY-----

sshPortalAPI:
enabled: true
Expand Down
63 changes: 63 additions & 0 deletions charts/lagoon-core/templates/ssh.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,69 @@ spec:
port: ssh
resources:
{{- toYaml .Values.ssh.resources | nindent 10 }}
volumeMounts:
{{- with .Values.ssh.hostKeys.ecdsa }}
- name: {{ include "lagoon-core.ssh.fullname" $ }}
mountPath: "/etc/ssh/ssh_host_ecdsa_key"
subPath: ssh_host_ecdsa_key
{{- end }}
{{- with .Values.ssh.hostKeys.ecdsaPub }}
- name: {{ include "lagoon-core.ssh.fullname" $ }}
mountPath: "/etc/ssh/ssh_host_ecdsa_key.pub"
subPath: ssh_host_ecdsa_pubkey
{{- end }}
{{- with .Values.ssh.hostKeys.ed25519 }}
- name: {{ include "lagoon-core.ssh.fullname" $ }}
mountPath: "/etc/ssh/ssh_host_ed25519_key"
subPath: ssh_host_ed25519_key
{{- end }}
{{- with .Values.ssh.hostKeys.ed25519Pub }}
- name: {{ include "lagoon-core.ssh.fullname" $ }}
mountPath: "/etc/ssh/ssh_host_ed25519_key.pub"
subPath: ssh_host_ed25519_pubkey
{{- end }}
{{- with .Values.ssh.hostKeys.rsa }}
- name: {{ include "lagoon-core.ssh.fullname" $ }}
mountPath: "/etc/ssh/ssh_host_rsa_key"
subPath: ssh_host_rsa_key
{{- end }}
{{- with .Values.ssh.hostKeys.rsaPub }}
- name: {{ include "lagoon-core.ssh.fullname" $ }}
mountPath: "/etc/ssh/ssh_host_rsa_key.pub"
subPath: ssh_host_rsa_pubkey
{{- end }}
volumes:
{{- if or .Values.ssh.hostKeys.rsa .Values.ssh.hostKeys.ecdsa .Values.ssh.hostKeys.ed25519 }}
- secret:
defaultMode: 432
items:
{{- with .Values.ssh.hostKeys.rsa }}
- key: HOST_KEY_RSA
path: ssh_host_rsa_key
{{- end }}
{{- with .Values.ssh.hostKeys.rsaPub }}
- key: HOST_PUBKEY_RSA
path: ssh_host_rsa_pubkey
{{- end }}
{{- with .Values.ssh.hostKeys.ecdsa }}
- key: HOST_KEY_ECDSA
path: ssh_host_ecdsa_key
{{- end }}
{{- with .Values.ssh.hostKeys.ecdsaPub }}
- key: HOST_PUBKEY_ECDSA
path: ssh_host_ecdsa_pubkey
{{- end }}
{{- with .Values.ssh.hostKeys.ed25519 }}
- key: HOST_KEY_ED25519
path: ssh_host_ed25519_key
{{- end }}
{{- with .Values.ssh.hostKeys.ed25519Pub }}
- key: HOST_PUBKEY_ED25519
path: ssh_host_ed25519_pubkey
{{- end }}
secretName: {{ include "lagoon-core.ssh.fullname" . }}
name: {{ include "lagoon-core.ssh.fullname" . }}
{{- end }}
{{- with .Values.ssh.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
34 changes: 34 additions & 0 deletions charts/lagoon-core/templates/ssh.secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{- if .Values.ssh.enabled -}}
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: {{ include "lagoon-core.ssh.fullname" . }}
labels:
{{- include "lagoon-core.ssh.labels" . | nindent 4 }}
stringData:
{{- with .Values.ssh.hostKeys.ecdsa }}
HOST_KEY_ECDSA: |
{{- . | nindent 4 }}
{{- end }}
{{- with .Values.ssh.hostKeys.ecdsaPub }}
HOST_PUBKEY_ECDSA: |
{{- . | nindent 4 }}
{{- end }}
{{- with .Values.ssh.hostKeys.ed25519 }}
HOST_KEY_ED25519: |
{{- . | nindent 4 }}
{{- end }}
{{- with .Values.ssh.hostKeys.ed25519Pub }}
HOST_PUBKEY_ED25519: |
{{- . | nindent 4 }}
{{- end }}
{{- with .Values.ssh.hostKeys.rsa }}
HOST_KEY_RSA: |
{{- . | nindent 4 }}
{{- end }}
{{- with .Values.ssh.hostKeys.rsaPub }}
HOST_PUBKEY_RSA: |
{{- . | nindent 4 }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/lagoon-core/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,15 @@ ssh:
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

# host keys, PEM encoded
hostKeys:
ecdsaPub: ""
ecdsa: ""
ed25519Pub: ""
ed25519: ""
rsaPub: ""
rsa: ""

workflows:
enabled: true
replicaCount: 2
Expand Down
Loading