2 <!-- SECTION: Getting Started -->
4 <TITLE>Managing Operation Policies
</TITLE>
8 <P>Operation policies are the rules used for each IPP operation
9 in CUPS. These rules include things like
"user must provide a
10 password",
"user must be in the system group",
"allow only from
11 the local system", and so forth. Until CUPS
1.2, these rules were
12 largely hardcoded and could only be customized at a very basic
15 <P>CUPS
1.2 adds a new fine-grained policy layer which allows you
16 to completely redefine the rules for each operation and/or
17 printer. Each policy is named and defines access control rules
18 for each IPP operation. This document describes how to manage
19 policies and their rules.
</P>
21 <H2 CLASS=
"title"><A NAME=
"BASICS">The Basics
</A></H2>
23 <P>Operation policies are used for all IPP requests sent to the
24 scheduler and are evaluated
<em>after
</em> the
<A
25 HREF=
"ref-cupsd-conf.html#Location"><TT>Location
</TT></A> based
26 access control rules. This means that operation policies can only
27 add additional security restrictions to a request, never relax
28 them. Use
<TT>Location
</TT> based access control rules for
29 server-wide limits and operation policies for limits on
30 individual printers, tasks, or services.
</P>
32 <P>Policies are stored in the
<VAR>cupsd.conf
</VAR> file in
<A
33 HREF=
"ref-cupsd-conf.html#Policy"><TT>Policy
</TT></A> sections.
34 Each policy has an alphanumeric name that is used to select it.
35 Inside the policy section are one or more
<A
36 HREF=
"ref-cupsd-conf.html#LimitIPP"><TT>Limit
</TT></A>
37 subsections which list the operations that are affected by the
38 rules inside it.
<A HREF=
"#LISTING01">Listing
1</A> shows the
39 default operation policy, appropriately called
"default", that is
40 shipped with CUPS.
</P>
42 <P>The easiest way to add a policy to the
<VAR>cupsd.conf
</VAR>
43 file is to use the web interface. Click on the
44 <VAR>Administration
</VAR> tab and then the
<VAR>Edit
45 Configuration File
</VAR> button to edit the current
46 <VAR>cupsd.conf
</VAR> file. Click on the
<VAR>Save Changes
</VAR>
47 button to save the changes and restart the scheduler. If you edit
48 the
<VAR>cupsd.conf
</VAR> file from the console, make sure to
<A
49 HREF=
"ref-cupsd-conf.html">restart the cupsd process
</A> before
50 trying to use the new policy.
</P>
53 <EM>Listing
1:
<A NAME=
"LISTING01">Default Operation Policy
</A></EM>
56 2 # Job-related operations must be done by the owner or an
58 3 <Limit Send-Document Send-URI Hold-Job Release-Job
59 Restart-Job Purge-Jobs Set-Job-Attributes
60 Create-Job-Subscription Renew-Subscription
61 Cancel-Subscription Get-Notifications Reprocess-Job
62 Cancel-Current-Job Suspend-Current-Job Resume-Job
64 4 Require user @OWNER @SYSTEM
68 8 # All administration operations require an administrator
70 9 <Limit CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class
71 CUPS-Delete-Class CUPS-Set-Default
>
73 11 Require user @SYSTEM
77 15 # All printer operations require a printer operator
79 16 <Limit Pause-Printer Resume-Printer
80 Set-Printer-Attributes Enable-Printer Disable-Printer
81 Pause-Printer-After-Current-Job Hold-New-Jobs
82 Release-Held-New-Jobs Deactivate-Printer Activate-Printer
83 Restart-Printer Shutdown-Printer Startup-Printer
84 Promote-Job Schedule-Job-After CUPS-Accept-Jobs
87 18 Require user
<em>varies by OS
</em>
91 22 # Only the owner or an administrator can cancel or
93 23 <Limit Cancel-Job CUPS-Authenticate-Job
>
94 24 Require user @OWNER @SYSTEM
104 <H3>The Default CUPS Operation Policy
</H3>
106 <P>The policy definition starts with an opening
<TT>Policy
</TT>
109 <PRE CLASS=
"example">
110 1 <Policy default
>
113 <P>The first
<TT>Limit
</TT> subsection defines the rules for IPP
116 <PRE CLASS=
"example">
117 3 <Limit Send-Document Send-URI Hold-Job Release-Job
118 Restart-Job Purge-Jobs Set-Job-Attributes
119 Create-Job-Subscription Renew-Subscription
120 Cancel-Subscription Get-Notifications Reprocess-Job
121 Cancel-Current-Job Suspend-Current-Job Resume-Job
123 4 Require user @OWNER @SYSTEM
128 <P>The operation names are listed on a single line
129 with spaces separating them. Each name corresponds to the IPP
130 operation described in any of the IETF or PWG standards documents
131 for the Internet Printing Protocol.
<A HREF=
"#TABLE01">Table
132 1</A> lists all of the operations that have been defined along
133 with their usage in CUPS.
</P>
135 <P>The access control rules are listed after the
<TT>Limit
</TT>
136 line and are the same as those used for
<A
137 HREF=
"ref-cupsd-conf.html#Location"><TT>Location
</TT></A>
138 sections. In this case, we require the owner of the job
139 (
"@OWNER") or a member of the
<A
140 HREF=
"ref-cupsd-conf.html#SystemGroup"><TT>SystemGroup
</TT></A>
141 (
"@SYSTEM") to do the operation. Because we do not include an
<A
142 HREF=
"ref-cupsd-conf.html#AuthType"><TT>AuthType
</TT></A>
143 directive here, the user information can come from the IPP
144 request itself or the authenticated username from the HTTP
145 request. The administrative operations starting on line
9,
146 however,
<em>do
</em> use the
<TT>AuthType
</TT> directive, and so
147 administrative operations need to be authenticated:
</P>
149 <PRE CLASS=
"example">
150 9 <Limit CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class
151 CUPS-Delete-Class CUPS-Set-Default
>
153 11 Require user @SYSTEM
157 15 # All printer operations require a printer operator
159 16 <Limit Pause-Printer Resume-Printer
160 Set-Printer-Attributes Enable-Printer Disable-Printer
161 Pause-Printer-After-Current-Job Hold-New-Jobs
162 Release-Held-New-Jobs Deactivate-Printer Activate-Printer
163 Restart-Printer Shutdown-Printer Startup-Printer
164 Promote-Job Schedule-Job-After CUPS-Accept-Jobs
167 18 Require user
<em>varies by OS
</em>
172 <P>The
"Order deny,allow" line at the end of both
<TT>Limit
</TT>
173 subsections allows the request to come from any system allowed by
174 the
<TT>Location
</TT> sections elsewhere in the
175 <VAR>cupsd.conf
</VAR> file.
</P>
177 <P>The
<TT>Cancel-Job
</TT> and
<TT>CUPS-Authenticate-Job
</TT>
178 operations are listed separately to allow the web interface to
179 more easily edit their policy without disturbing the rest. Like
180 the rest of the job operations, we want the job's owner
181 (
"@OWNER") or an administrator (
"@SYSTEM") to do it:
</P>
183 <PRE CLASS=
"example">
184 16 <Limit Cancel-Job CUPS-Authenticate-Job
>
185 17 Require user @OWNER @SYSTEM
190 <P>The last
<TT>Limit
</TT> subsection in any policy uses the
191 special operation name
<TT>All
</TT>. CUPS will use the rules in
192 this subsection for any operation you don't list specifically in
193 the policy. In this case, all other operations are allowed
194 without a username or authentication:
</P>
196 <PRE CLASS=
"example">
204 <DIV CLASS=
"table"><TABLE WIDTH=
"80%" SUMMARY=
"IPP Operation Names">
205 <CAPTION>Table
1:
<A NAME=
"TABLE01">IPP Operation Names
</A></CAPTION>
209 <TH>Used by CUPS?
</TH>
215 <TD NOWRAP
><TT>Print-Job
</TT></TD>
217 <TD>Creates a print job with a single file.
</TD>
220 <TD NOWRAP
><TT>Print-URI
</TT></TD>
222 <TD>Create a print job with a single URI.
</TD>
225 <TD NOWRAP
><TT>Validate-Job
</TT></TD>
227 <TD>Validates a print request before printing.
</TD>
230 <TD NOWRAP
><TT>Create-Job
</TT></TD>
232 <TD>Creates a print job with no files or URIs.
</TD>
235 <TD NOWRAP
><TT>Send-Document
</TT></TD>
237 <TD>Adds a file to a print job.
</TD>
240 <TD NOWRAP
><TT>Send-URI
</TT></TD>
242 <TD>Adds a URI to a print job.
</TD>
245 <TD NOWRAP
><TT>Cancel-Job
</TT></TD>
247 <TD>Cancels a print job.
</TD>
250 <TD NOWRAP
><TT>Get-Job-Attributes
</TT></TD>
252 <TD>Gets information and options associated with a job.
</TD>
255 <TD NOWRAP
><TT>Get-Jobs
</TT></TD>
257 <TD>Gets a list of jobs.
</TD>
260 <TD NOWRAP
><TT>Get-Printer-Attributes
</TT></TD>
262 <TD>Gets information and options associated with a printer or class.
</TD>
265 <TD NOWRAP
><TT>Hold-Job
</TT></TD>
267 <TD>Holds a print job for printing.
</TD>
270 <TD NOWRAP
><TT>Release-Job
</TT></TD>
272 <TD>Releases a print job for printing.
</TD>
275 <TD NOWRAP
><TT>Restart-Job
</TT></TD>
277 <TD>Reprints a print job.
</TD>
280 <TD NOWRAP
><TT>Pause-Printer
</TT></TD>
282 <TD>Stops a printer or class.
</TD>
285 <TD NOWRAP
><TT>Resume-Printer
</TT></TD>
287 <TD>Starts a printer or class.
</TD>
290 <TD NOWRAP
><TT>Purge-Jobs
</TT></TD>
292 <TD>Cancels all jobs on the server or a printer or class
293 and removes the job history information.
</TD>
296 <TD NOWRAP
><TT>Set-Printer-Attributes
</TT></TD>
298 <TD>Sets printer or class information; CUPS uses
299 CUPS-Add-Modify-Printer and CUPS-Add-Modify-Class
303 <TD NOWRAP
><TT>Set-Job-Attributes
</TT></TD>
305 <TD>Changes job options.
</TD>
308 <TD NOWRAP
><TT>Get-Printer-Supported-Values
</TT></TD>
310 <TD>Gets -supported attributes for a printer based on job
314 <TD NOWRAP
><TT>Create-Printer-Subscription
</TT></TD>
316 <TD>Creates an event subscription for a printer or the server.
</TD>
319 <TD NOWRAP
><TT>Create-Job-Subscription
</TT></TD>
321 <TD>Creates an event subscription for a job.
</TD>
324 <TD NOWRAP
><TT>Get-Subscription-Attributes
</TT></TD>
326 <TD>Gets information for an event subscription.
</TD>
329 <TD NOWRAP
><TT>Get-Subscriptions
</TT></TD>
331 <TD>Gets a list of event subscriptions.
</TD>
334 <TD NOWRAP
><TT>Renew-Subscription
</TT></TD>
336 <TD>Renews an event subscription that is about to expire.
</TD>
339 <TD NOWRAP
><TT>Cancel-Subscription
</TT></TD>
341 <TD>Cancels an event subscription.
</TD>
344 <TD NOWRAP
><TT>Get-Notifications
</TT></TD>
346 <TD>Gets (pending) events for an event subscription.
</TD>
349 <TD NOWRAP
><TT>Send-Notifications
</TT></TD>
351 <TD>Sends events for an event subscription.
</TD>
354 <TD NOWRAP
><TT>Get-Printer-Support-Files
</TT></TD>
356 <TD>Gets printer driver files for a Novell client.
</TD>
359 <TD NOWRAP
><TT>Enable-Printer
</TT></TD>
361 <TD>Starts a printer or class.
</TD>
364 <TD NOWRAP
><TT>Disable-Printer
</TT></TD>
366 <TD>Stops a printer or class.
</TD>
369 <TD NOWRAP
><TT>Pause-Printer-After-Current-Job
</TT></TD>
371 <TD>Stops a printer or class after the current job is finished.
</TD>
374 <TD NOWRAP
><TT>Hold-New-Jobs
</TT></TD>
376 <TD>Holds new jobs submitted to a printer or class.
</TD>
379 <TD NOWRAP
><TT>Release-Held-New-Jobs
</TT></TD>
381 <TD>Releases jobs that were held because of the
382 Hold-New-Jobs operation.
</TD>
385 <TD NOWRAP
><TT>Deactivate-Printer
</TT></TD>
387 <TD>Deactivates a printer or class.
</TD>
390 <TD NOWRAP
><TT>Activate-Printer
</TT></TD>
392 <TD>Activates a printer or class.
</TD>
395 <TD NOWRAP
><TT>Restart-Printer
</TT></TD>
397 <TD>Restarts a printer or class, resuming print jobs as needed.
</TD>
400 <TD NOWRAP
><TT>Shutdown-Printer
</TT></TD>
402 <TD>Powers a printer or class off.
</TD>
405 <TD NOWRAP
><TT>Startup-Printer
</TT></TD>
407 <TD>Powers a printer or class on.
</TD>
410 <TD NOWRAP
><TT>Reprocess-Job
</TT></TD>
412 <TD>Reprints a job on a different printer or class; CUPS has the
413 CUPS-Move-Job operation instead.
</TD>
416 <TD NOWRAP
><TT>Cancel-Current-Job
</TT></TD>
418 <TD>Cancels the current job on a printer or class.
</TD>
421 <TD NOWRAP
><TT>Suspend-Current-Job
</TT></TD>
423 <TD>Stops the current job on a printer or class.
</TD>
426 <TD NOWRAP
><TT>Resume-Job
</TT></TD>
428 <TD>Resumes printing of a stopped job.
</TD>
431 <TD NOWRAP
><TT>Promote-Job
</TT></TD>
433 <TD>Prints a job before others.
</TD>
436 <TD NOWRAP
><TT>Schedule-Job-After
</TT></TD>
438 <TD>Prints a job after others.
</TD>
441 <TD NOWRAP
><TT>CUPS-Get-Default
</TT></TD>
443 <TD>Gets the server/network default printer or class.
</TD>
446 <TD NOWRAP
><TT>CUPS-Get-Printers
</TT></TD>
448 <TD>Gets a list of printers and/or classes.
</TD>
451 <TD NOWRAP
><TT>CUPS-Add-Modify-Printer
</TT></TD>
453 <TD>Adds or modifies a printer.
</TD>
456 <TD NOWRAP
><TT>CUPS-Delete-Printer
</TT></TD>
458 <TD>Removes a printer.
</TD>
461 <TD NOWRAP
><TT>CUPS-Get-Classes
</TT></TD>
463 <TD>Gets a list of classes.
</TD>
466 <TD NOWRAP
><TT>CUPS-Add-Modify-Class
</TT></TD>
468 <TD>Adds or modifies a class.
</TD>
471 <TD NOWRAP
><TT>CUPS-Delete-Class
</TT></TD>
473 <TD>Removes a class.
</TD>
476 <TD NOWRAP
><TT>CUPS-Accept-Jobs
</TT></TD>
478 <TD>Sets a printer's or class' printer-is-accepting-jobs
479 attribute to true.
</TD>
482 <TD NOWRAP
><TT>CUPS-Reject-Jobs
</TT></TD>
484 <TD>Sets a printer's or class' printer-is-accepting-jobs
485 attribute to false.
</TD>
488 <TD NOWRAP
><TT>CUPS-Set-Default
</TT></TD>
490 <TD>Sets the server/network default printer or class.
</TD>
493 <TD NOWRAP
><TT>CUPS-Get-Devices
</TT></TD>
495 <TD>Gets a list of printer devices.
</TD>
498 <TD NOWRAP
><TT>CUPS-Get-PPDs
</TT></TD>
500 <TD>Gets a list of printer drivers or manufacturers.
</TD>
503 <TD NOWRAP
><TT>CUPS-Move-Job
</TT></TD>
505 <TD>Moves a job to a different printer or class.
</TD>
508 <TD NOWRAP
><TT>CUPS-Authenticate-Job
</TT></TD>
510 <TD>Authenticates a job for printing.
</TD>
516 <H2 CLASS=
"title"><A NAME=
"CREATING">Creating Your Own Policies
</A></H2>
518 <P>The easiest way to create a new policy is to start with the
519 default policy and then make changes to the copy. The first
520 change you'll make is to give the policy a new name. Policy names
521 can use the same characters as a printer name, specifically all
522 printable characters except space, slash (/), and pound (#):
</P>
524 <PRE CLASS=
"example">
528 <P>Then you need to decide exactly what limits you want for the
529 policy. For example, if you want to allow any user to cancel any
530 other users' jobs, you can change the
<TT>Cancel-Job
</TT> limits
533 <PRE CLASS=
"example">
534 <Limit Cancel-Job
>
539 <P>The directives inside the
<TT>Limit
</TT> subsection can use
540 any of the normal limiting directives:
<A
541 HREF=
"ref-cupsd-conf.html#Allow"><TT>Allow
</TT></A>,
<A
542 HREF=
"ref-cupsd-conf.html#AuthType"><TT>AuthType
</TT></A>,
<A
543 HREF=
"ref-cupsd-conf.html#Deny"><TT>Deny
</TT></A>,
<A
544 HREF=
"ref-cupsd-conf.html#Encryption"><TT>Encryption
</TT></A>,
<A
545 HREF=
"ref-cupsd-conf.html#Require"><TT>Require
</TT></A>, and
<A
546 HREF=
"ref-cupsd-conf.html#Satisfy"><TT>Satisfy
</TT></A>.
<A
547 HREF=
"#TABLE02">Table
2</A> lists some basic
"recipes" for
548 different access control rules.
</P>
550 <DIV CLASS=
"table"><TABLE WIDTH=
"80%" SUMMARY=
"Access Control Recipes">
551 <CAPTION>Table
2:
<A NAME=
"TABLE02">Access Control Recipes
</A></CAPTION>
554 <TH>Access Level
</TH>
555 <TH>Directives to Use
</TH>
560 <TD>Allow Everyone
</TD>
561 <TD><PRE>Order deny,allow
562 Allow from all
</PRE></TD>
565 <TD>Allow Everyone on the Local Network
</TD>
566 <TD><PRE>Order deny,allow
567 Allow from @LOCAL
</PRE></TD>
570 <TD>Deny Everyone/Disable Operation(s)
</TD>
571 <TD><PRE>Order allow,deny
572 Deny from all
</PRE></TD>
575 <TD>Require Login (System) Password
</TD>
576 <TD><PRE>AuthType Basic
</PRE></TD>
579 <TD>Require CUPS (lppasswd) Password
</TD>
580 <TD><PRE>AuthType BasicDigest
</PRE></TD>
583 <TD>Require the Owner of a Job or Subscription
</TD>
584 <TD><PRE>Require user @OWNER
</PRE></TD>
587 <TD>Require an Administrative User
</TD>
588 <TD><PRE>Require user @SYSTEM
</PRE></TD>
591 <TD>Require Member of Group
"foogroup"</TD>
592 <TD><PRE>Require user @foogroup
</PRE></TD>
595 <TD>Require
"john" or
"mary"</TD>
596 <TD><PRE>Require user john mary
</PRE></TD>
599 <TD>Require Encryption
</TD>
600 <TD><PRE>Encryption Required
</PRE></TD>
605 <H3>Creating a Policy for a Computer Lab
</H3>
607 <P>One common operating scenario is a computer lab. The lab is
608 managed by one or more technicians that assist the users of the
609 lab and handle the basic administration tasks.
<A
610 HREF=
"#LISTING02">Listing
2</A> shows an operation policy that
611 only allows access from the lab's subnet,
10.0.2.x, and allows
612 the lab technicians, who are members of a special UNIX group for
613 that lab called
"lab999", to do job, printer, and subscription
614 management operations.
</P>
616 <PRE CLASS=
"example">
617 <EM>Listing
2:
<A NAME=
"LISTING02">Operation Policy for a Lab
</A></EM>
620 2 # Job- and subscription-related operations must be done
621 by the owner, a lab technician, or an administrator...
622 3 <Limit Send-Document Send-URI Hold-Job Release-Job
623 Restart-Job Purge-Jobs Set-Job-Attributes
624 Create-Job-Subscription Renew-Subscription
625 Cancel-Subscription Get-Notifications Reprocess-Job
626 Cancel-Current-Job Suspend-Current-Job Resume-Job
627 CUPS-Move-Job Cancel-Job CUPS-Authenticate-Job
>
628 4 Require user @OWNER @lab999 @SYSTEM
630 6 Allow from
10.0.2.0/
24
633 9 # All administration operations require a lab technician
634 or an administrator to authenticate...
635 10 <Limit Pause-Printer Resume-Printer
636 Set-Printer-Attributes Enable-Printer Disable-Printer
637 Pause-Printer-After-Current-Job Hold-New-Jobs
638 Release-Held-New-Jobs Deactivate-Printer Activate-Printer
639 Restart-Printer Shutdown-Printer Startup-Printer
640 Promote-Job Schedule-Job-After CUPS-Accept-Jobs
641 CUPS-Reject-Jobs CUPS-Set-Default
>
643 12 Require user @lab999 @SYSTEM
645 14 Allow from
10.0.2.0/
24
648 17 # All other operations are allowed from the lab network...
651 20 Allow from
10.0.2.0/
24
657 <H2 CLASS=
"title"><A NAME=
"SELECT">Using Policies
</A></H2>
659 <P>Once you have created a policy, you can use it in two ways.
660 The first way is to assign it as the default policy for the
662 HREF=
"ref-cupsd-conf.html#DefaultPolicy"><TT>DefaultPolicy
</TT></A>
663 directive in the
<VAR>cupsd.conf
</VAR> file. For example, add the
664 following line to the
<VAR>cupsd.conf
</VAR> file to use the
665 "lab999" policy from the previous section:
</P>
667 <PRE CLASS=
"example">
671 <P>To associate the policy with one or more printers, use either
672 the
<A HREF=
"man-lpadmin.html">lpadmin(
8)
</A> command or the web
673 interface to change the operation policy for each printer. When
674 using the
<B>lpadmin
</B> command, the
<TT>-o
675 printer-op-policy=name
</TT> option sets the operation policy for
676 a printer. For example, enter the following command to use the
677 "lab999" policy from the previous section with a printer named
680 <PRE CLASS=
"command">
681 lpadmin -p LaserJet4000 -o printer-op-policy=lab999
684 <P>To make the same change in the web interface, go to the
685 printer's web page, for example
686 "http://localhost:631/printers/LaserJet4000", and click on the
687 <VAR>Set Printer Options
</VAR> button. Scroll down to the bottom
688 of the page and choose the desired policy from the pull-down
689 list. Click on
<VAR>Set Printer Options
</VAR> to change the policy for