1<HTML>
2<!-- SECTION: Getting Started -->
3<HEAD>
4	<TITLE>Managing Operation Policies</TITLE>
5	<LINK REL="STYLESHEET" TYPE="text/css" HREF="../cups-printable.css">
6</HEAD>
7<BODY>
8
9<H1 CLASS="title">Managing Operation Policies</H1>
10
11<P>Operation policies are the rules used for each IPP operation in CUPS. These rules include things like "user must provide a password", "user must be in the system group", "allow only from the local system", and so forth. Until CUPS 1.2, these rules were largely hardcoded and could only be customized at a very basic level.</P>
12
13<P>CUPS 1.2 and later provides a fine-grained policy layer which allows you to completely redefine the rules for each operation and/or printer. Each policy is named and defines access control rules for each IPP operation. This document describes how to manage policies and their rules.</P>
14
15<H2 CLASS="title"><A NAME="BASICS">The Basics</A></H2>
16
17<P>Operation policies are used for all IPP requests sent to the scheduler and are evaluated <em>after</em> the <A HREF="man-cupsd.conf.html#Location"><TT>Location</TT></A> based access control rules. This means that operation policies can only add additional security restrictions to a request, never relax them. Use <TT>Location</TT> based access control rules for server-wide limits and operation policies for limits on individual printers, tasks, or services.</P>
18
19<P>Policies are stored in the <VAR>cupsd.conf</VAR> file in <A HREF="man-cupsd.conf.html#Policy"><TT>Policy</TT></A> sections. Each policy has an alphanumeric name that is used to select it. Inside the policy section are one or more <A
20HREF="man-cupsd.conf.html#LimitIPP"><TT>Limit</TT></A> subsections which list the operations that are affected by the rules inside it. <A HREF="#LISTING01">Listing 1</A> shows the default operation policy, appropriately called "default", that is shipped with CUPS.</P>
21
22<P>The easiest way to add a policy to the <VAR>cupsd.conf</VAR> file is to use the web interface. Click on the <VAR>Administration</VAR> tab and then the <VAR>Edit Configuration File</VAR> button to edit the current <VAR>cupsd.conf</VAR> file. Click on the <VAR>Save Changes</VAR> button to save the changes and restart the scheduler. If you edit the <VAR>cupsd.conf</VAR> file from the console, make sure to <A HREF="man-cupsd.conf.html">restart the cupsd process</A> before trying to use the new policy.</P>
23
24<PRE CLASS="example">
25<EM>Listing 1: <A NAME="LISTING01">Default Operation Policy</A></EM>
26
27 1    &lt;Policy default>
28 2      # Job-related operations must be done by the owner or an
29      administrator...
30 3      &lt;Limit Send-Document Send-URI Hold-Job Release-Job
31      Restart-Job Purge-Jobs Set-Job-Attributes
32      Create-Job-Subscription Renew-Subscription
33      Cancel-Subscription Get-Notifications Reprocess-Job
34      Cancel-Current-Job Suspend-Current-Job Resume-Job
35      CUPS-Move-Job CUPS-Get-Document>
36 4        Require user @OWNER @SYSTEM
37 5        Order deny,allow
38 6      &lt;/Limit>
39 7
40 8      # All administration operations require an administrator
41      to authenticate...
42 9      &lt;Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class
43      CUPS-Delete-Class CUPS-Set-Default>
4410        AuthType Default
4511        Require user @SYSTEM
4612        Order deny,allow
4713      &lt;/Limit>
4814
4915      # All printer operations require a printer operator
50      to authenticate...
5116      &lt;Limit Pause-Printer Resume-Printer
52      Set-Printer-Attributes Enable-Printer Disable-Printer
53      Pause-Printer-After-Current-Job Hold-New-Jobs
54      Release-Held-New-Jobs Deactivate-Printer Activate-Printer
55      Restart-Printer Shutdown-Printer Startup-Printer
56      Promote-Job Schedule-Job-After CUPS-Accept-Jobs
57      CUPS-Reject-Jobs>
5817        AuthType Default
5918        Require user <em>varies by OS</em>
6019        Order deny,allow
6120      &lt;/Limit>
6221
6322      # Only the owner or an administrator can cancel or
64      authenticate a job...
6523      &lt;Limit Cancel-Job CUPS-Authenticate-Job>
6624        Require user @OWNER @SYSTEM
6725        Order deny,allow
6826      &lt;/Limit>
6927
7028      &lt;Limit All>
7129        Order deny,allow
7230      &lt;/Limit>
7331    &lt;/Policy>
74</PRE>
75
76<H3>The Default CUPS Operation Policy</H3>
77
78<P>The policy definition starts with an opening <TT>Policy</TT> directive:</P>
79
80<PRE CLASS="example">
81 1    &lt;Policy default>
82</PRE>
83
84<P>The first <TT>Limit</TT> subsection defines the rules for IPP job operations:</P>
85
86<PRE CLASS="example">
87 3      &lt;Limit Send-Document Send-URI Hold-Job Release-Job
88      Restart-Job Purge-Jobs Set-Job-Attributes
89      Create-Job-Subscription Renew-Subscription
90      Cancel-Subscription Get-Notifications Reprocess-Job
91      Cancel-Current-Job Suspend-Current-Job Resume-Job
92      CUPS-Move-Job CUPS-Get-Document>
93 4        Require user @OWNER @SYSTEM
94 5        Order deny,allow
95 6      &lt;/Limit>
96</PRE>
97
98<P>The operation names are listed on a single line with spaces separating them. Each name corresponds to the IPP operation described in any of the IETF or PWG standards documents for the Internet Printing Protocol. <A HREF="#TABLE01">Table 1</A> lists all of the operations that have been defined along with their usage in CUPS.</P>
99
100<P>The access control rules are listed after the <TT>Limit</TT> line and are the same as those used for <A HREF="man-cupsd.conf.html#Location"><TT>Location</TT></A> sections. In this case, we require the owner of the job ("@OWNER") or a member of the <A HREF="man-cups-files.conf.html#SystemGroup"><TT>SystemGroup</TT></A> ("@SYSTEM") to do the operation. Because we do not include an <A HREF="man-cupsd.conf.html#AuthType"><TT>AuthType</TT></A> directive here, the user information can come from the IPP request itself or the authenticated username from the HTTP request. The administrative operations starting on line 9, however, <em>do</em> use the <TT>AuthType</TT> directive, and so administrative operations need to be authenticated:</P>
101
102<PRE CLASS="example">
103 9      &lt;Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class
104      CUPS-Delete-Class CUPS-Set-Default>
10510        AuthType Default
10611        Require user @SYSTEM
10712        Order deny,allow
10813      &lt;/Limit>
10914
11015      # All printer operations require a printer operator
111      to authenticate...
11216      &lt;Limit Pause-Printer Resume-Printer
113      Set-Printer-Attributes Enable-Printer Disable-Printer
114      Pause-Printer-After-Current-Job Hold-New-Jobs
115      Release-Held-New-Jobs Deactivate-Printer Activate-Printer
116      Restart-Printer Shutdown-Printer Startup-Printer
117      Promote-Job Schedule-Job-After CUPS-Accept-Jobs
118      CUPS-Reject-Jobs>
11917        AuthType Default
12018        Require user <em>varies by OS</em>
12119        Order deny,allow
12220      &lt;/Limit>
123</PRE>
124
125<P>The "Order deny,allow" line at the end of both <TT>Limit</TT> subsections allows the request to come from any system allowed by the <TT>Location</TT> sections elsewhere in the <VAR>cupsd.conf</VAR> file.</P>
126
127<P>The <TT>Cancel-Job</TT> and <TT>CUPS-Authenticate-Job</TT> operations are listed separately to allow the web interface to more easily edit their policy without disturbing the rest. Like the rest of the job operations, we want the job's owner ("@OWNER") or an administrator ("@SYSTEM") to do it:</P>
128
129<PRE CLASS="example">
13016      &lt;Limit Cancel-Job CUPS-Authenticate-Job>
13117        Require user @OWNER @SYSTEM
13218        Order deny,allow
13319      &lt;/Limit>
134</PRE>
135
136<P>The last <TT>Limit</TT> subsection in any policy uses the special operation name <TT>All</TT>. CUPS will use the rules in this subsection for any operation you don't list specifically in the policy. In this case, all other operations are allowed without a username or authentication:</P>
137
138<PRE CLASS="example">
13921      &lt;Limit All>
14022        Order deny,allow
14123      &lt;/Limit>
14224    &lt;/Policy>
143</PRE>
144
145
146<DIV CLASS="table"><TABLE WIDTH="80%" SUMMARY="IPP Operation Names">
147<CAPTION>Table 1: <A NAME="TABLE01">IPP Operation Names</A></CAPTION>
148<THEAD>
149<TR>
150	<TH>Name</TH>
151	<TH>Used by CUPS?</TH>
152	<TH>Description</TH>
153</TR>
154</THEAD>
155<TBODY>
156<TR>
157	<TD NOWRAP><TT>Activate-Printer</TT></TD>
158	<TD>No</TD>
159	<TD>Activates a printer or class.</TD>
160</TR>
161<TR>
162	<TD NOWRAP><TT>Cancel-Current-Job</TT></TD>
163	<TD>No</TD>
164	<TD>Cancels the current job on a printer or class.</TD>
165</TR>
166<TR>
167	<TD NOWRAP><TT>Cancel-Job</TT></TD>
168	<TD>Yes</TD>
169	<TD>Cancels a print job.</TD>
170</TR>
171<TR>
172	<TD NOWRAP><TT>Cancel-Jobs</TT></TD>
173	<TD>Yes</TD>
174	<TD>Cancels all print jobs.</TD>
175</TR>
176<TR>
177	<TD NOWRAP><TT>Cancel-My-Jobs</TT></TD>
178	<TD>Yes</TD>
179	<TD>Cancels a user's print job.</TD>
180</TR>
181<TR>
182	<TD NOWRAP><TT>Cancel-Subscription</TT></TD>
183	<TD>Yes</TD>
184	<TD>Cancels an event subscription.</TD>
185</TR>
186<TR>
187	<TD NOWRAP><TT>Close-Job</TT></TD>
188	<TD>Yes</TD>
189	<TD>Closes a user's print job so that it can be printed.</TD>
190</TR>
191<TR>
192	<TD NOWRAP><TT>Create-Job</TT></TD>
193	<TD>Yes</TD>
194	<TD>Creates a print job with no files or URIs.</TD>
195</TR>
196<TR>
197	<TD NOWRAP><TT>Create-Job-Subscriptions</TT></TD>
198	<TD>Yes</TD>
199	<TD>Creates one or more event subscriptions for a job.</TD>
200</TR>
201<TR>
202	<TD NOWRAP><TT>Create-Printer-Subscriptions</TT></TD>
203	<TD>Yes</TD>
204	<TD>Creates one or more event subscriptions for a printer or the server.</TD>
205</TR>
206<TR>
207	<TD NOWRAP><TT>Deactivate-Printer</TT></TD>
208	<TD>No</TD>
209	<TD>Deactivates a printer or class.</TD>
210</TR>
211<TR>
212	<TD NOWRAP><TT>Disable-Printer</TT></TD>
213	<TD>Yes</TD>
214	<TD>Stops a printer or class.</TD>
215</TR>
216<TR>
217	<TD NOWRAP><TT>Enable-Printer</TT></TD>
218	<TD>Yes</TD>
219	<TD>Starts a printer or class.</TD>
220</TR>
221<TR>
222	<TD NOWRAP><TT>Get-Job-Attributes</TT></TD>
223	<TD>Yes</TD>
224	<TD>Gets information and options associated with a job.</TD>
225</TR>
226<TR>
227	<TD NOWRAP><TT>Get-Jobs</TT></TD>
228	<TD>Yes</TD>
229	<TD>Gets a list of jobs.</TD>
230</TR>
231<TR>
232	<TD NOWRAP><TT>Get-Notifications</TT></TD>
233	<TD>Yes</TD>
234	<TD>Gets (pending) events for an event subscription.</TD>
235</TR>
236<TR>
237	<TD NOWRAP><TT>Get-Printer-Attributes</TT></TD>
238	<TD>Yes</TD>
239	<TD>Gets information and options associated with a printer or class.</TD>
240</TR>
241<TR>
242	<TD NOWRAP><TT>Get-Printer-Supported-Values</TT></TD>
243	<TD>Yes</TD>
244	<TD>Gets -supported attributes for a printer based on job
245	options.</TD>
246</TR>
247<TR>
248	<TD NOWRAP><TT>Get-Subscription-Attributes</TT></TD>
249	<TD>Yes</TD>
250	<TD>Gets information for an event subscription.</TD>
251</TR>
252<TR>
253	<TD NOWRAP><TT>Get-Subscriptions</TT></TD>
254	<TD>Yes</TD>
255	<TD>Gets a list of event subscriptions.</TD>
256</TR>
257<TR>
258	<TD NOWRAP><TT>Hold-Job</TT></TD>
259	<TD>Yes</TD>
260	<TD>Holds a print job for printing.</TD>
261</TR>
262<TR>
263	<TD NOWRAP><TT>Hold-New-Jobs</TT></TD>
264	<TD>Yes</TD>
265	<TD>Holds new jobs submitted to a printer or class.</TD>
266</TR>
267<TR>
268	<TD NOWRAP><TT>Pause-Printer</TT></TD>
269	<TD>Yes</TD>
270	<TD>Stops a printer or class.</TD>
271</TR>
272<TR>
273	<TD NOWRAP><TT>Pause-Printer-After-Current-Job</TT></TD>
274	<TD>No</TD>
275	<TD>Stops a printer or class after the current job is finished.</TD>
276</TR>
277<TR>
278	<TD NOWRAP><TT>Print-Job</TT></TD>
279	<TD>Yes</TD>
280	<TD>Creates a print job with a single file.</TD>
281</TR>
282<TR>
283	<TD NOWRAP><TT>Print-URI</TT></TD>
284	<TD>No</TD>
285	<TD>Create a print job with a single URI.</TD>
286</TR>
287<TR>
288	<TD NOWRAP><TT>Promote-Job</TT></TD>
289	<TD>No</TD>
290	<TD>Prints a job before others.</TD>
291</TR>
292<TR>
293	<TD NOWRAP><TT>Purge-Jobs</TT></TD>
294	<TD>Yes</TD>
295	<TD>Cancels all jobs on the server or a printer or class
296	and removes the job history information.</TD>
297</TR>
298<TR>
299	<TD NOWRAP><TT>Release-Held-New-Jobs</TT></TD>
300	<TD>Yes</TD>
301	<TD>Releases jobs that were held because of the
302	Hold-New-Jobs operation.</TD>
303</TR>
304<TR>
305	<TD NOWRAP><TT>Release-Job</TT></TD>
306	<TD>Yes</TD>
307	<TD>Releases a print job for printing.</TD>
308</TR>
309<TR>
310	<TD NOWRAP><TT>Renew-Subscription</TT></TD>
311	<TD>Yes</TD>
312	<TD>Renews an event subscription that is about to expire.</TD>
313</TR>
314<TR>
315	<TD NOWRAP><TT>Reprocess-Job</TT></TD>
316	<TD>No</TD>
317	<TD>Reprints a job on a different printer or class; CUPS has the
318	CUPS-Move-Job operation instead.</TD>
319</TR>
320<TR>
321	<TD NOWRAP><TT>Restart-Job</TT></TD>
322	<TD>Yes</TD>
323	<TD>Reprints a print job.</TD>
324</TR>
325<TR>
326	<TD NOWRAP><TT>Restart-Printer</TT></TD>
327	<TD>No</TD>
328	<TD>Restarts a printer or class, resuming print jobs as needed.</TD>
329</TR>
330<TR>
331	<TD NOWRAP><TT>Resubmit-Job</TT></TD>
332	<TD>No</TD>
333	<TD>Reprints a job with new options.</TD>
334</TR>
335<TR>
336	<TD NOWRAP><TT>Resume-Job</TT></TD>
337	<TD>No</TD>
338	<TD>Resumes printing of a stopped job.</TD>
339</TR>
340<TR>
341	<TD NOWRAP><TT>Resume-Printer</TT></TD>
342	<TD>Yes</TD>
343	<TD>Starts a printer or class.</TD>
344</TR>
345<TR>
346	<TD NOWRAP><TT>Schedule-Job-After</TT></TD>
347	<TD>No</TD>
348	<TD>Prints a job after others.</TD>
349</TR>
350<TR>
351	<TD NOWRAP><TT>Send-Document</TT></TD>
352	<TD>Yes</TD>
353	<TD>Adds a file to a print job.</TD>
354</TR>
355<TR>
356	<TD NOWRAP><TT>Send-URI</TT></TD>
357	<TD>No</TD>
358	<TD>Adds a URI to a print job.</TD>
359</TR>
360<TR>
361	<TD NOWRAP><TT>Set-Printer-Attributes</TT></TD>
362	<TD>Yes</TD>
363	<TD>Sets printer or class information; CUPS uses
364	CUPS-Add-Modify-Printer and CUPS-Add-Modify-Class
365	for most attributes instead.</TD>
366</TR>
367<TR>
368	<TD NOWRAP><TT>Set-Job-Attributes</TT></TD>
369	<TD>Yes</TD>
370	<TD>Changes job options.</TD>
371</TR>
372<TR>
373	<TD NOWRAP><TT>Shutdown-Printer</TT></TD>
374	<TD>No</TD>
375	<TD>Powers a printer or class off.</TD>
376</TR>
377<TR>
378	<TD NOWRAP><TT>Startup-Printer</TT></TD>
379	<TD>No</TD>
380	<TD>Powers a printer or class on.</TD>
381</TR>
382<TR>
383	<TD NOWRAP><TT>Suspend-Current-Job</TT></TD>
384	<TD>No</TD>
385	<TD>Stops the current job on a printer or class.</TD>
386</TR>
387<TR>
388	<TD NOWRAP><TT>Validate-Document</TT></TD>
389	<TD>No</TD>
390	<TD>Validates a document request before sending.</TD>
391</TR>
392<TR>
393	<TD NOWRAP><TT>Validate-Job</TT></TD>
394	<TD>Yes</TD>
395	<TD>Validates a print request before printing.</TD>
396</TR>
397<TR>
398	<TD NOWRAP><TT>CUPS-Accept-Jobs</TT></TD>
399	<TD>Yes</TD>
400	<TD>Sets a printer's or class' printer-is-accepting-jobs
401	attribute to true.</TD>
402</TR>
403<TR>
404	<TD NOWRAP><TT>CUPS-Add-Modify-Class</TT></TD>
405	<TD>Yes</TD>
406	<TD>Adds or modifies a class.</TD>
407</TR>
408<TR>
409	<TD NOWRAP><TT>CUPS-Add-Modify-Printer</TT></TD>
410	<TD>Yes</TD>
411	<TD>Adds or modifies a printer.</TD>
412</TR>
413<TR>
414	<TD NOWRAP><TT>CUPS-Authenticate-Job</TT></TD>
415	<TD>Yes</TD>
416	<TD>Authenticates a job for printing.</TD>
417</TR>
418<TR>
419	<TD NOWRAP><TT>CUPS-Delete-Class</TT> *</TD>
420	<TD>Yes</TD>
421	<TD>Removes a class.</TD>
422</TR>
423<TR>
424	<TD NOWRAP><TT>CUPS-Delete-Printer</TT> *</TD>
425	<TD>Yes</TD>
426	<TD>Removes a printer.</TD>
427</TR>
428<TR>
429	<TD NOWRAP><TT>CUPS-Get-Classes</TT> *</TD>
430	<TD>Yes</TD>
431	<TD>Gets a list of classes.</TD>
432</TR>
433<TR>
434	<TD NOWRAP><TT>CUPS-Get-Default</TT> *</TD>
435	<TD>Yes</TD>
436	<TD>Gets the server/network default printer or class.</TD>
437</TR>
438<TR>
439	<TD NOWRAP><TT>CUPS-Get-Devices</TT> *</TD>
440	<TD>Yes</TD>
441	<TD>Gets a list of printer devices.</TD>
442</TR>
443<TR>
444	<TD NOWRAP><TT>CUPS-Get-Document</TT></TD>
445	<TD>Yes</TD>
446	<TD>Retrieves a document file from a job.</TD>
447</TR>
448<TR>
449	<TD NOWRAP><TT>CUPS-Get-PPDs</TT> *</TD>
450	<TD>Yes</TD>
451	<TD>Gets a list of printer drivers or manufacturers.</TD>
452</TR>
453<TR>
454	<TD NOWRAP><TT>CUPS-Get-Printers</TT> *</TD>
455	<TD>Yes</TD>
456	<TD>Gets a list of printers and/or classes.</TD>
457</TR>
458<TR>
459	<TD NOWRAP><TT>CUPS-Move-Job</TT></TD>
460	<TD>Yes</TD>
461	<TD>Moves a job to a different printer or class.</TD>
462</TR>
463<TR>
464	<TD NOWRAP><TT>CUPS-Reject-Jobs</TT></TD>
465	<TD>Yes</TD>
466	<TD>Sets a printer's or class' printer-is-accepting-jobs
467	attribute to false.</TD>
468</TR>
469<TR>
470	<TD NOWRAP><TT>CUPS-Set-Default</TT> *</TD>
471	<TD>Yes</TD>
472	<TD>Sets the server/network default printer or class.</TD>
473</TR>
474</TBODY>
475</TABLE></DIV>
476
477<P>* = These operations only apply to the default policy.</P>
478
479<H2 CLASS="title"><A NAME="CREATING">Creating Your Own Policies</A></H2>
480
481<P>The easiest way to create a new policy is to start with the default policy and then make changes to the copy. The first change you'll make is to give the policy a new name. Policy names can use the same characters as a printer name, specifically all printable characters except space, slash (/), and pound (#):</P>
482
483<PRE CLASS="example">
484&lt;Policy mypolicy>
485</PRE>
486
487<P>Then you need to decide exactly what limits you want for the policy. For example, if you want to allow any user to cancel any other users' jobs, you can change the <TT>Cancel-Job</TT> limits to:</P>
488
489<PRE CLASS="example">
490&lt;Limit Cancel-Job>
491  Order deny,allow
492&lt;/Limit>
493</PRE>
494
495<P>The directives inside the <TT>Limit</TT> subsection can use any of the normal limiting directives: <A HREF="man-cupsd.conf.html#Allow"><TT>Allow</TT></A>, <A HREF="man-cupsd.conf.html#AuthType"><TT>AuthType</TT></A>, <A HREF="man-cupsd.conf.html#Deny"><TT>Deny</TT></A>, <A HREF="man-cupsd.conf.html#Encryption"><TT>Encryption</TT></A>, <A HREF="man-cupsd.conf.html#Require"><TT>Require</TT></A>, and <A HREF="man-cupsd.conf.html#Satisfy"><TT>Satisfy</TT></A>. <A HREF="#TABLE02">Table 2</A> lists some basic "recipes" for different access control rules.</P>
496
497<DIV CLASS="table"><TABLE WIDTH="80%" SUMMARY="Access Control Recipes">
498<CAPTION>Table 2: <A NAME="TABLE02">Access Control Recipes</A></CAPTION>
499<THEAD>
500<TR>
501	<TH>Access Level</TH>
502	<TH>Directives to Use</TH>
503</TR>
504</THEAD>
505<TBODY>
506<TR>
507	<TD>Allow Everyone</TD>
508	<TD><PRE>Order deny,allow
509Allow from all</PRE></TD>
510</TR>
511<TR>
512	<TD>Allow Everyone on the Local Network</TD>
513	<TD><PRE>Order deny,allow
514Allow from @LOCAL</PRE></TD>
515</TR>
516<TR>
517	<TD>Deny Everyone/Disable Operation(s)</TD>
518	<TD><PRE>Order deny,allow</PRE></TD>
519</TR>
520<TR>
521	<TD>Require Login (System) Password</TD>
522	<TD><PRE>AuthType Basic</PRE></TD>
523</TR>
524<TR>
525	<TD>Require CUPS (lppasswd) Password</TD>
526	<TD><PRE>AuthType BasicDigest</PRE></TD>
527</TR>
528<TR>
529	<TD>Require Kerberos</TD>
530	<TD><PRE>AuthType Negotiate</PRE></TD>
531</TR>
532<TR>
533	<TD>Require the Owner of a Job or Subscription</TD>
534	<TD><PRE>Require user @OWNER</PRE></TD>
535</TR>
536<TR>
537	<TD>Require an Administrative User</TD>
538	<TD><PRE>Require user @SYSTEM</PRE></TD>
539</TR>
540<TR>
541	<TD>Require Member of Group "foogroup"</TD>
542	<TD><PRE>Require user @foogroup</PRE></TD>
543</TR>
544<TR>
545	<TD>Require "john" or "mary"</TD>
546	<TD><PRE>Require user john mary</PRE></TD>
547</TR>
548<TR>
549	<TD>Require Encryption</TD>
550	<TD><PRE>Encryption Required</PRE></TD>
551</TR>
552</TABLE></DIV>
553
554
555<H3>Creating a Policy for a Computer Lab</H3>
556
557<P>One common operating scenario is a computer lab. The lab is managed by one or more technicians that assist the users of the lab and handle the basic administration tasks. <A HREF="#LISTING02">Listing 2</A> shows an operation policy that only allows access from the lab's subnet, 10.0.2.x, and allows the lab technicians, who are members of a special UNIX group for that lab called "lab999", to do job, printer, and subscription management operations.</P>
558
559<PRE CLASS="example">
560<EM>Listing 2: <A NAME="LISTING02">Operation Policy for a Lab</A></EM>
561
562 1    &lt;Policy lab999>
563 2      # Job- and subscription-related operations must be done
564      by the owner, a lab technician, or an administrator...
565 3      &lt;Limit Send-Document Send-URI Hold-Job Release-Job
566      Restart-Job Purge-Jobs Set-Job-Attributes
567      Create-Job-Subscription Renew-Subscription
568      Cancel-Subscription Get-Notifications Reprocess-Job
569      Cancel-Current-Job Suspend-Current-Job Resume-Job
570      CUPS-Move-Job Cancel-Job CUPS-Authenticate-Job CUPS-Get-Document>
571 4        Require user @OWNER @lab999 @SYSTEM
572 5        Order allow,deny
573 6        Allow from 10.0.2.0/24
574 7      &lt;/Limit>
575 8
576 9      # All administration operations require a lab technician
577      or an administrator to authenticate...
57810      &lt;Limit Pause-Printer Resume-Printer
579      Set-Printer-Attributes Enable-Printer Disable-Printer
580      Pause-Printer-After-Current-Job Hold-New-Jobs
581      Release-Held-New-Jobs Deactivate-Printer Activate-Printer
582      Restart-Printer Shutdown-Printer Startup-Printer
583      Promote-Job Schedule-Job-After CUPS-Accept-Jobs
584      CUPS-Reject-Jobs CUPS-Set-Default>
58511        AuthType Default
58612        Require user @lab999 @SYSTEM
58713        Order allow,deny
58814        Allow from 10.0.2.0/24
58915      &lt;/Limit>
59016
59117      # All other operations are allowed from the lab network...
59218      &lt;Limit All>
59319        Order allow,deny
59420        Allow from 10.0.2.0/24
59521      &lt;/Limit>
59622    &lt;/Policy>
597</PRE>
598
599
600<H2 CLASS="title"><A NAME="SELECT">Using Policies</A></H2>
601
602<P>Once you have created a policy, you can use it in two ways. The first way is to assign it as the default policy for the system using the <A HREF="man-cupsd.conf.html#DefaultPolicy"><TT>DefaultPolicy</TT></A> directive in the <VAR>cupsd.conf</VAR> file. For example, add the following line to the <VAR>cupsd.conf</VAR> file to use the "lab999" policy from the previous section:</P>
603
604<PRE CLASS="example">
605DefaultPolicy lab999
606</PRE>
607
608<P>To associate the policy with one or more printers, use either the <A HREF="man-lpadmin.html">lpadmin(8)</A> command or the web interface to change the operation policy for each printer. When using the <B>lpadmin</B> command, the <TT>-o printer-op-policy=name</TT> option sets the operation policy for a printer. For example, enter the following command to use the "lab999" policy from the previous section with a printer named "LaserJet4000":</P>
609
610<PRE CLASS="command">
611lpadmin -p LaserJet4000 -o printer-op-policy=lab999
612</PRE>
613
614<P>To make the same change in the web interface, go to the printer's web page, for example "http://localhost:631/printers/LaserJet4000", and choose <VAR>Set Default Options</VAR> from the <VAR>Administration</VAR> menu button. Click on the <VAR>Policies</VAR> link and choose the desired policy from the pull-down list. Click on <VAR>Set Default Options</VAR> to change the policy for the printer.</P>
615
616</BODY>
617</HTML>
618