Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: Allow using the system CA bundle, with custom CA cert.

Alex Vandiverab743b19de11
diff --git a/docs/production/authentication-methods.md b/docs/production/authentication-methods.md
index b5a576e0df7..035d5b5e43e 100644
--- a/docs/production/authentication-methods.md
+++ b/docs/production/authentication-methods.md
@@ -1201,6 +1201,10 @@ assumes the name is correct, and new users will not be presented with
a registration form unless they need to accept Terms of Service for
the server (i.e. `TERMS_OF_SERVICE_VERSION` is set).
+If your OIDC server's HTTPS server is signed by a custom certificate
+authority, you will need to [configure Zulip to trust
+it](system-configuration.md#custom_ca_path).
+
## JSON Web Tokens (JWT)
Zulip supports using JSON Web Tokens (JWT) authentication in two ways:
diff --git a/docs/production/system-configuration.md b/docs/production/system-configuration.md
index a250d6033ad..45af44c4861 100644
--- a/docs/production/system-configuration.md
+++ b/docs/production/system-configuration.md
@@ -229,6 +229,20 @@ the message to fail to send.
Set to the port number for the KaTeX server; defaults to port 9700.
+#### `custom_ca_path`
+
+If you use a custom certificate authority for your authentication
+provider, you will need to provide the certificate of the signing CA
+so Zulip can successfully make requests to it.
+
+Set this to the fully-qualified path to the `.crt` file containing the
+PEM-encoded CA certificate to trust; we suggest storing this in
+`/etc/zulip/`.
+
+Setting this path also means that Zulip will use the operating
+system's CA certificate store, and not its built-in one. There may be
+minor differences in trusted root CA sets.
+
### `[postgresql]`
#### `effective_io_concurrency`
diff --git a/puppet/zulip/manifests/app_frontend_base.pp b/puppet/zulip/manifests/app_frontend_base.pp
index 9fcf806f3d5..4c1a020ac7c 100644
--- a/puppet/zulip/manifests/app_frontend_base.pp
+++ b/puppet/zulip/manifests/app_frontend_base.pp
@@ -206,6 +206,26 @@ class zulip::app_frontend_base {
} else {
$proxy = ''
}
+ $custom_ca_path = zulipconf('application_server','custom_ca_path', '')
+ if $custom_ca_path != '' {
+ file { '/usr/local/share/ca-certificates/custom-zulip-ca.crt':
+ ensure => file,
+ source => $custom_ca_path,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ notify => Exec['update-ca-certificates'],
+ }
+ exec { 'update-ca-certificates':
+ command => '/usr/sbin/update-ca-certificates',
+ require => Package['ca-certificates'],
+ before => File["${zulip::common::supervisor_conf_dir}/zulip.conf"],
+ refreshonly => true,
+ }
+ $ca_bundle=',REQUESTS_CA_BUNDLE="/etc/ssl/certs/ca-certificates.crt"'
+ } else {
+ $ca_bundle=''
+ }
file { "${zulip::common::supervisor_conf_dir}/zulip.conf":
ensure => file,
require => [Package[supervisor], Exec['stage_updated_sharding']],
diff --git a/puppet/zulip/templates/supervisor/zulip.conf.template.erb b/puppet/zulip/templates/supervisor/zulip.conf.template.erb
index 96612944c03..486b01ce2b1 100644
--- a/puppet/zulip/templates/supervisor/zulip.conf.template.erb
+++ b/puppet/zulip/templates/supervisor/zulip.conf.template.erb
@@ -9,7 +9,7 @@
[program:zulip-django]
command=nice -n5 uv run --no-sync uwsgi --ini /etc/zulip/uwsgi.ini
-environment=HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"
+environment=HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"<%= @ca_bundle %>
priority=100 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected)
@@ -26,7 +26,7 @@ directory=/home/zulip/deployments/current/
[program:zulip-tus]
command=nice -n5 /home/zulip/deployments/current/manage.py runtusd <%= @tusd_server_listen %>:9900
-environment=HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"
+environment=HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"<%= @ca_bundle %>
priority=100 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected)
@@ -45,7 +45,7 @@ directory=/home/zulip/deployments/current/
[program:zulip-tornado]
command=/home/zulip/deployments/current/manage.py runtornado 127.0.0.1:98%(process_num)02d --skip-checks
process_name=zulip-tornado-port-98%(process_num)02d
-environment=PYTHONUNBUFFERED=1,HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"
+environment=PYTHONUNBUFFERED=1,HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"<%= @ca_bundle %>
priority=200 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected)
@@ -61,7 +61,7 @@ numprocs=<%= @tornado_ports.length %>
<% else -%>
[program:zulip-tornado]
command=/home/zulip/deployments/current/manage.py runtornado 127.0.0.1:9800 --skip-checks
-environment=PYTHONUNBUFFERED=1,HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"
+environment=PYTHONUNBUFFERED=1,HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"<%= @ca_bundle %>
priority=200 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected)
@@ -100,7 +100,7 @@ numprocs_start=1
command=nice -n10 /home/zulip/deployments/current/manage.py process_queue --queue_name=<%= queue %> --skip-checks
stdout_logfile=/var/log/zulip/events_<%= queue %>.log ; stdout log path, NONE for none; default AUTO
<%end -%>
-environment=HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"
+environment=HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"<%= @ca_bundle %>
priority=300 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected)
@@ -115,7 +115,7 @@ directory=/home/zulip/deployments/current/
<% else %>
[program:zulip_events]
command=nice -n10 /home/zulip/deployments/current/manage.py process_queue --multi_threaded <%= @queues.join(' ') %> --skip-checks
-environment=HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"
+environment=HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"<%= @ca_bundle %>
priority=300 ; the relative start priority (default 999)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected)