blob: d9b6e66381f30e864ff596a35bc8f597212a0edf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/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"
# Create dataset for persistent CUPS configuration.
create_dataset -o "mountpoint=${cups_conf_dir}" "${state_dataset}/cups"
# 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"
# Generate CUPS pam configuration.
install_file -m 0644 /etc/pam.d/cups
# 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
|