aboutsummaryrefslogtreecommitdiff
path: root/scripts/hostclass/cups_server
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/hostclass/cups_server')
-rw-r--r--scripts/hostclass/cups_server25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/hostclass/cups_server b/scripts/hostclass/cups_server
new file mode 100644
index 0000000..e3ad928
--- /dev/null
+++ b/scripts/hostclass/cups_server
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+: ${cups_admin_group='sysadmins'}
+: ${cups_server_admin="${cups_admin_group}@${email_domain}"}
+
+cups_user=cups
+cups_conf_dir=/usr/local/etc/cups
+cups_tls_dir=${cups_conf_dir}/ssl
+cups_tls_cert="${cups_tls_dir}/${fqdn}.crt"
+cups_tls_key="${cups_tls_dir}/${fqdn}.key"
+
+# Install required packages.
+pkg install -y cups cups-filters
+
+# Copy TLS certificate for CUPS.
+install_certificate -g "$cups_user" cups "$cups_tls_cert"
+install_certificate_key -g "$cups_user" cups "$cups_tls_key"
+
+# Copy CUPS configuration.
+install_template -o root -g "$cups_user" -m 0640 \
+ "${cups_conf_dir}/cupsd.conf" \
+ "${cups_conf_dir}/cups-files.conf"
+
+sysrc -v cupsd_enable=YES
+service cupsd restart