-
Notifications
You must be signed in to change notification settings - Fork 161
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
Add Postgresql sslrootcert
option
#439
base: develop
Are you sure you want to change the base?
Add Postgresql sslrootcert
option
#439
Conversation
Thanks for submitting this pull request, @joachimBurket. It would be something like that: OPTIONS: {{- include "common.tplvalues.render" (dict "value" .Values.externalDatabase.options "context" $) | nindent 8 }} What do you think? |
@LeoColomb yeah, I like this; should be pretty easy to implement and avoids a TON of boilerplate on the user's part |
and allows you to decide how to set |
OPTIONS: | ||
sslmode: {{ .Values.externalDatabase.sslMode | quote }} | ||
{{- if .Values.externalDatabase.sslRootCert }} | ||
sslrootcert: {{ .Values.externalDatabase.sslRootCert | quote }} | ||
{{- end}} | ||
target_session_attrs: {{ .Values.externalDatabase.targetSessionAttrs | default "read-write" | quote }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPTIONS: | |
sslmode: {{ .Values.externalDatabase.sslMode | quote }} | |
{{- if .Values.externalDatabase.sslRootCert }} | |
sslrootcert: {{ .Values.externalDatabase.sslRootCert | quote }} | |
{{- end}} | |
target_session_attrs: {{ .Values.externalDatabase.targetSessionAttrs | default "read-write" | quote }} | |
OPTIONS: {{- include "common.tplvalues.render" (dict "value" .Values.externalDatabase.options "context" $) | nindent 8 }} |
sslMode: prefer | ||
sslRootCert: "" | ||
connMaxAge: 300 | ||
disableServerSideCursors: false | ||
targetSessionAttrs: read-write |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sslMode: prefer | |
sslRootCert: "" | |
connMaxAge: 300 | |
disableServerSideCursors: false | |
targetSessionAttrs: read-write | |
connMaxAge: 300 | |
disableServerSideCursors: false | |
## @param externalDatabase.options Additional PostgreSQL client parameters | |
## Ref: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS | |
## | |
options: | |
sslmode: "prefer" | |
target_session_attrs: "read-write" |
| `externalDatabase.sslMode` | PostgreSQL client SSL Mode setting | `prefer` | | ||
| `externalDatabase.sslRootCert` | PostgreSQL client SSL Root Certificate setting | `""` | | ||
| `externalDatabase.connMaxAge` | The lifetime of a database connection, as an integer of seconds | `300` | | ||
| `externalDatabase.disableServerSideCursors` | Disable the use of server-side cursors transaction pooling | `false` | | ||
| `externalDatabase.targetSessionAttrs` | Determines whether the session must have certain properties | `read-write` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `externalDatabase.sslMode` | PostgreSQL client SSL Mode setting | `prefer` | | |
| `externalDatabase.sslRootCert` | PostgreSQL client SSL Root Certificate setting | `""` | | |
| `externalDatabase.connMaxAge` | The lifetime of a database connection, as an integer of seconds | `300` | | |
| `externalDatabase.disableServerSideCursors` | Disable the use of server-side cursors transaction pooling | `false` | | |
| `externalDatabase.targetSessionAttrs` | Determines whether the session must have certain properties | `read-write` | | |
| `externalDatabase.connMaxAge` | The lifetime of a database connection, as an integer of seconds | `300` | | |
| `externalDatabase.disableServerSideCursors` | Disable the use of server-side cursors transaction pooling | `false` | | |
| `externalDatabase.options` | Additional PostgreSQL client parameters | `{}` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: We are currently using these options:
'OPTIONS': {
'sslmode': 'require',
'sslcert': '/etc/ssl/certs/netbox/cloudsql/dev/cert.crt',
'sslkey': '/etc/ssl/certs/netbox/cloudsql/dev/key.crt',
'sslrootcert': '/etc/ssl/certs/netbox/cloudsql/dev/ca_cert.crt',
}
So in the options parameter, we'd do something like?
- options:
sslmode: require
sslcert: /etc/ssl/certs/netbox/cloudsql/dev/cert.crt
sslkey: /etc/ssl/certs/netbox/cloudsql/dev/key.crt
sslrootcert: /etc/ssl/certs/netbox/cloudsql/dev/ca_cert.crt
The
sslrootcert
parameter specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities (in the case of an SSL connection to the PostgreSQL DB).See the option in the documentation here: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT
Resolves #417