Skip to content

Commit e529e82

Browse files
committed
Configure CUPS for network access via cupsd.conf
Default cupsd.conf listens on Port 631 (not localhost only) and grants Allow @Local to all Location and Policy blocks, so containers on cups-net and LAN hosts can browse, submit, and manage print jobs. Made-with: Cursor
1 parent cec1145 commit e529e82

3 files changed

Lines changed: 103 additions & 1 deletion

File tree

apps/cups/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ which ships with a comprehensive set of print filters and supporting programs:
2828

2929
| Mount | Purpose |
3030
|---|---|
31-
| `../../lib/cups``/config` | All CUPS state: config, spool, logs, per-queue PPDs |
31+
| `../../lib/cups``/config` | All CUPS state: spool, logs, per-queue PPDs |
32+
| `./config/cupsd.conf``/etc/cups/cupsd.conf` (read-only) | Scheduler config; pre-configured to accept connections from `@LOCAL` (all Docker networks and LAN hosts) |
3233
| `./ppds``/usr/share/cups/model/custom` (read-only) | Custom PPD files; any PPD placed here appears as an available driver in the CUPS add-printer wizard |
3334

3435
## Adding custom PPDs
@@ -49,6 +50,10 @@ cp /path/to/Printer80.ppd apps/cups/ppds/
4950
```sh
5051
cp .env.example .env
5152
# Edit .env if you need non-default PUID/PGID or TZ
53+
54+
cp config/cupsd.conf.default config/cupsd.conf
55+
# Edit config/cupsd.conf if you need to restrict or expand access
56+
5257
docker compose up -d
5358
```
5459

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# CUPS scheduler configuration
2+
# Configured for network access from Docker containers and the local subnet.
3+
# See https://www.cups.org/doc/man-cupsd.conf.html for full reference.
4+
5+
# Listen on all interfaces so other containers and LAN hosts can connect.
6+
# The default "Listen localhost:631" would block all external access.
7+
Port 631
8+
Listen /run/cups/cups.sock
9+
10+
# Allow mDNS/DNS-SD printer discovery on the LAN.
11+
Browsing Yes
12+
BrowseLocalProtocols dnssd
13+
14+
# Default log destinations.
15+
AccessLog syslog
16+
ErrorLog syslog
17+
LogLevel warn
18+
19+
# Paths
20+
ServerRoot /etc/cups
21+
StateDir /var/lib/cups
22+
RequestRoot /var/spool/cups
23+
TempDir /var/spool/cups/tmp
24+
25+
MaxLogSize 0
26+
27+
# Restrict access to the local subnet and Docker networks.
28+
# @LOCAL matches any interface that is not the loopback and any
29+
# address on those interfaces — covers both the host LAN and
30+
# all attached Docker bridge networks.
31+
<Location />
32+
Order allow,deny
33+
Allow @LOCAL
34+
</Location>
35+
36+
<Location /admin>
37+
Order allow,deny
38+
Allow @LOCAL
39+
</Location>
40+
41+
<Location /admin/conf>
42+
AuthType Default
43+
Require user @SYSTEM
44+
Order allow,deny
45+
Allow @LOCAL
46+
</Location>
47+
48+
<Location /admin/log>
49+
AuthType Default
50+
Require user @SYSTEM
51+
Order allow,deny
52+
Allow @LOCAL
53+
</Location>
54+
55+
<Policy default>
56+
JobPrivateAccess default
57+
JobPrivateValues default
58+
SubscriptionPrivateAccess default
59+
SubscriptionPrivateValues default
60+
61+
<Limit Create-Job Print-Job Print-URI Validate-Job>
62+
Order deny,allow
63+
Allow @LOCAL
64+
</Limit>
65+
66+
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
67+
Require user @OWNER @SYSTEM
68+
Order deny,allow
69+
Allow @LOCAL
70+
</Limit>
71+
72+
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
73+
AuthType Default
74+
Require user @SYSTEM
75+
Order deny,allow
76+
Allow @LOCAL
77+
</Limit>
78+
79+
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
80+
AuthType Default
81+
Require user @SYSTEM
82+
Order deny,allow
83+
Allow @LOCAL
84+
</Limit>
85+
86+
<Limit Cancel-Job CUPS-Authenticate-Job>
87+
Require user @OWNER @SYSTEM
88+
Order deny,allow
89+
Allow @LOCAL
90+
</Limit>
91+
92+
<Limit All>
93+
Order deny,allow
94+
Allow @LOCAL
95+
</Limit>
96+
</Policy>

apps/cups/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
TZ: ${TZ:-America/Los_Angeles}
1111
volumes:
1212
- ../../lib/cups:/config
13+
- ./config/cupsd.conf:/etc/cups/cupsd.conf:ro
1314
- ./ppds:/usr/share/cups/model/custom:ro
1415
# ports:
1516
# - 631:631

0 commit comments

Comments
 (0)