security-configmap.yaml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. {{- if .Values.global.enableSecurity }}
  2. apiVersion: v1
  3. kind: ConfigMap
  4. metadata:
  5. name: {{ template "seaweedfs.name" . }}-security-config
  6. namespace: {{ .Release.Namespace }}
  7. labels:
  8. app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
  9. helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
  10. app.kubernetes.io/managed-by: {{ .Release.Service }}
  11. app.kubernetes.io/instance: {{ .Release.Name }}
  12. data:
  13. {{- $existing := (lookup "v1" "ConfigMap" .Release.Namespace (printf "%s-security-config" (include "seaweedfs.name" .))) }}
  14. {{- $securityConfig := fromToml (dig "data" "security.toml" "" $existing) }}
  15. security.toml: |-
  16. # this file is read by master, volume server, and filer
  17. {{- if .Values.global.securityConfig.jwtSigning.volumeWrite }}
  18. # the jwt signing key is read by master and volume server
  19. # a jwt expires in 10 seconds
  20. [jwt.signing]
  21. key = "{{ dig "jwt" "signing" "key" (randAlphaNum 10 | b64enc) $securityConfig }}"
  22. {{- end }}
  23. {{- if .Values.global.securityConfig.jwtSigning.volumeRead }}
  24. # this jwt signing key is read by master and volume server, and it is used for read operations:
  25. # - the Master server generates the JWT, which can be used to read a certain file on a volume server
  26. # - the Volume server validates the JWT on reading
  27. [jwt.signing.read]
  28. key = "{{ dig "jwt" "signing" "read" "key" (randAlphaNum 10 | b64enc) $securityConfig }}"
  29. {{- end }}
  30. {{- if .Values.global.securityConfig.jwtSigning.filerWrite }}
  31. # If this JWT key is configured, Filer only accepts writes over HTTP if they are signed with this JWT:
  32. # - f.e. the S3 API Shim generates the JWT
  33. # - the Filer server validates the JWT on writing
  34. # the jwt defaults to expire after 10 seconds.
  35. [jwt.filer_signing]
  36. key = "{{ dig "jwt" "filer_signing" "key" (randAlphaNum 10 | b64enc) $securityConfig }}"
  37. {{- end }}
  38. {{- if .Values.global.securityConfig.jwtSigning.filerRead }}
  39. # If this JWT key is configured, Filer only accepts reads over HTTP if they are signed with this JWT:
  40. # - f.e. the S3 API Shim generates the JWT
  41. # - the Filer server validates the JWT on writing
  42. # the jwt defaults to expire after 10 seconds.
  43. [jwt.filer_signing.read]
  44. key = "{{ dig "jwt" "filer_signing" "read" "key" (randAlphaNum 10 | b64enc) $securityConfig }}"
  45. {{- end }}
  46. # all grpc tls authentications are mutual
  47. # the values for the following ca, cert, and key are paths to the PERM files.
  48. [grpc]
  49. ca = "/usr/local/share/ca-certificates/ca/tls.crt"
  50. [grpc.volume]
  51. cert = "/usr/local/share/ca-certificates/volume/tls.crt"
  52. key = "/usr/local/share/ca-certificates/volume/tls.key"
  53. [grpc.master]
  54. cert = "/usr/local/share/ca-certificates/master/tls.crt"
  55. key = "/usr/local/share/ca-certificates/master/tls.key"
  56. [grpc.filer]
  57. cert = "/usr/local/share/ca-certificates/filer/tls.crt"
  58. key = "/usr/local/share/ca-certificates/filer/tls.key"
  59. # use this for any place needs a grpc client
  60. # i.e., "weed backup|benchmark|filer.copy|filer.replicate|mount|s3|upload"
  61. [grpc.client]
  62. cert = "/usr/local/share/ca-certificates/client/tls.crt"
  63. key = "/usr/local/share/ca-certificates/client/tls.key"
  64. # volume server https options
  65. # Note: work in progress!
  66. # this does not work with other clients, e.g., "weed filer|mount" etc, yet.
  67. [https.client]
  68. enabled = false
  69. [https.volume]
  70. cert = ""
  71. key = ""
  72. {{- end }}