summaryrefslogtreecommitdiff
path: root/doc/help/policies.html
blob: 8a0fc313d51396f1c306559e367db7d99c41a1d1 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
<HTML>
<!-- SECTION: Getting Started -->
<HEAD>
	<TITLE>Managing Operation Policies</TITLE>
	<LINK REL="STYLESHEET" TYPE="text/css" HREF="../cups-printable.css">
</HEAD>
<BODY>

<H1 CLASS="title">Managing Operation Policies</H1>

<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>

<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>

<H2 CLASS="title"><A NAME="BASICS">The Basics</A></H2>

<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>

<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
HREF="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>

<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>

<PRE CLASS="example">
<EM>Listing 1: <A NAME="LISTING01">Default Operation Policy</A></EM>

 1    &lt;Policy default>
 2      # Job-related operations must be done by the owner or an
      administrator...
 3      &lt;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
      CUPS-Move-Job CUPS-Get-Document>
 4        Require user @OWNER @SYSTEM
 5        Order deny,allow
 6      &lt;/Limit>
 7
 8      # All administration operations require an administrator
      to authenticate...
 9      &lt;Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class
      CUPS-Delete-Class CUPS-Set-Default>
10        AuthType Default
11        Require user @SYSTEM
12        Order deny,allow
13      &lt;/Limit>
14
15      # All printer operations require a printer operator
      to authenticate...
16      &lt;Limit Pause-Printer Resume-Printer
      Set-Printer-Attributes 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 CUPS-Accept-Jobs
      CUPS-Reject-Jobs>
17        AuthType Default
18        Require user <em>varies by OS</em>
19        Order deny,allow
20      &lt;/Limit>
21
22      # Only the owner or an administrator can cancel or
      authenticate a job...
23      &lt;Limit Cancel-Job CUPS-Authenticate-Job>
24        Require user @OWNER @SYSTEM
25        Order deny,allow
26      &lt;/Limit>
27
28      &lt;Limit All>
29        Order deny,allow
30      &lt;/Limit>
31    &lt;/Policy>
</PRE>

<H3>The Default CUPS Operation Policy</H3>

<P>The policy definition starts with an opening <TT>Policy</TT> directive:</P>

<PRE CLASS="example">
 1    &lt;Policy default>
</PRE>

<P>The first <TT>Limit</TT> subsection defines the rules for IPP job operations:</P>

<PRE CLASS="example">
 3      &lt;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
      CUPS-Move-Job CUPS-Get-Document>
 4        Require user @OWNER @SYSTEM
 5        Order deny,allow
 6      &lt;/Limit>
</PRE>

<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>

<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>

<PRE CLASS="example">
 9      &lt;Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class
      CUPS-Delete-Class CUPS-Set-Default>
10        AuthType Default
11        Require user @SYSTEM
12        Order deny,allow
13      &lt;/Limit>
14
15      # All printer operations require a printer operator
      to authenticate...
16      &lt;Limit Pause-Printer Resume-Printer
      Set-Printer-Attributes 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 CUPS-Accept-Jobs
      CUPS-Reject-Jobs>
17        AuthType Default
18        Require user <em>varies by OS</em>
19        Order deny,allow
20      &lt;/Limit>
</PRE>

<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>

<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>

<PRE CLASS="example">
16      &lt;Limit Cancel-Job CUPS-Authenticate-Job>
17        Require user @OWNER @SYSTEM
18        Order deny,allow
19      &lt;/Limit>
</PRE>

<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>

<PRE CLASS="example">
21      &lt;Limit All>
22        Order deny,allow
23      &lt;/Limit>
24    &lt;/Policy>
</PRE>


<DIV CLASS="table"><TABLE WIDTH="80%" SUMMARY="IPP Operation Names">
<CAPTION>Table 1: <A NAME="TABLE01">IPP Operation Names</A></CAPTION>
<THEAD>
<TR>
	<TH>Name</TH>
	<TH>Used by CUPS?</TH>
	<TH>Description</TH>
</TR>
</THEAD>
<TBODY>
<TR>
	<TD NOWRAP><TT>Activate-Printer</TT></TD>
	<TD>No</TD>
	<TD>Activates a printer or class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Cancel-Current-Job</TT></TD>
	<TD>No</TD>
	<TD>Cancels the current job on a printer or class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Cancel-Job</TT></TD>
	<TD>Yes</TD>
	<TD>Cancels a print job.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Cancel-Jobs</TT></TD>
	<TD>Yes</TD>
	<TD>Cancels all print jobs.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Cancel-My-Jobs</TT></TD>
	<TD>Yes</TD>
	<TD>Cancels a user's print job.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Cancel-Subscription</TT></TD>
	<TD>Yes</TD>
	<TD>Cancels an event subscription.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Close-Job</TT></TD>
	<TD>Yes</TD>
	<TD>Closes a user's print job so that it can be printed.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Create-Job</TT></TD>
	<TD>Yes</TD>
	<TD>Creates a print job with no files or URIs.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Create-Job-Subscriptions</TT></TD>
	<TD>Yes</TD>
	<TD>Creates one or more event subscriptions for a job.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Create-Printer-Subscriptions</TT></TD>
	<TD>Yes</TD>
	<TD>Creates one or more event subscriptions for a printer or the server.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Deactivate-Printer</TT></TD>
	<TD>No</TD>
	<TD>Deactivates a printer or class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Disable-Printer</TT></TD>
	<TD>Yes</TD>
	<TD>Stops a printer or class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Enable-Printer</TT></TD>
	<TD>Yes</TD>
	<TD>Starts a printer or class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Get-Job-Attributes</TT></TD>
	<TD>Yes</TD>
	<TD>Gets information and options associated with a job.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Get-Jobs</TT></TD>
	<TD>Yes</TD>
	<TD>Gets a list of jobs.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Get-Notifications</TT></TD>
	<TD>Yes</TD>
	<TD>Gets (pending) events for an event subscription.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Get-Printer-Attributes</TT></TD>
	<TD>Yes</TD>
	<TD>Gets information and options associated with a printer or class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Get-Printer-Supported-Values</TT></TD>
	<TD>Yes</TD>
	<TD>Gets -supported attributes for a printer based on job
	options.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Get-Subscription-Attributes</TT></TD>
	<TD>Yes</TD>
	<TD>Gets information for an event subscription.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Get-Subscriptions</TT></TD>
	<TD>Yes</TD>
	<TD>Gets a list of event subscriptions.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Hold-Job</TT></TD>
	<TD>Yes</TD>
	<TD>Holds a print job for printing.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Hold-New-Jobs</TT></TD>
	<TD>Yes</TD>
	<TD>Holds new jobs submitted to a printer or class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Pause-Printer</TT></TD>
	<TD>Yes</TD>
	<TD>Stops a printer or class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Pause-Printer-After-Current-Job</TT></TD>
	<TD>No</TD>
	<TD>Stops a printer or class after the current job is finished.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Print-Job</TT></TD>
	<TD>Yes</TD>
	<TD>Creates a print job with a single file.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Print-URI</TT></TD>
	<TD>No</TD>
	<TD>Create a print job with a single URI.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Promote-Job</TT></TD>
	<TD>No</TD>
	<TD>Prints a job before others.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Purge-Jobs</TT></TD>
	<TD>Yes</TD>
	<TD>Cancels all jobs on the server or a printer or class
	and removes the job history information.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Release-Held-New-Jobs</TT></TD>
	<TD>Yes</TD>
	<TD>Releases jobs that were held because of the
	Hold-New-Jobs operation.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Release-Job</TT></TD>
	<TD>Yes</TD>
	<TD>Releases a print job for printing.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Renew-Subscription</TT></TD>
	<TD>Yes</TD>
	<TD>Renews an event subscription that is about to expire.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Reprocess-Job</TT></TD>
	<TD>No</TD>
	<TD>Reprints a job on a different printer or class; CUPS has the
	CUPS-Move-Job operation instead.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Restart-Job</TT></TD>
	<TD>Yes</TD>
	<TD>Reprints a print job.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Restart-Printer</TT></TD>
	<TD>No</TD>
	<TD>Restarts a printer or class, resuming print jobs as needed.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Resubmit-Job</TT></TD>
	<TD>No</TD>
	<TD>Reprints a job with new options.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Resume-Job</TT></TD>
	<TD>No</TD>
	<TD>Resumes printing of a stopped job.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Resume-Printer</TT></TD>
	<TD>Yes</TD>
	<TD>Starts a printer or class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Schedule-Job-After</TT></TD>
	<TD>No</TD>
	<TD>Prints a job after others.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Send-Document</TT></TD>
	<TD>Yes</TD>
	<TD>Adds a file to a print job.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Send-URI</TT></TD>
	<TD>No</TD>
	<TD>Adds a URI to a print job.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Set-Printer-Attributes</TT></TD>
	<TD>Yes</TD>
	<TD>Sets printer or class information; CUPS uses
	CUPS-Add-Modify-Printer and CUPS-Add-Modify-Class
	for most attributes instead.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Set-Job-Attributes</TT></TD>
	<TD>Yes</TD>
	<TD>Changes job options.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Shutdown-Printer</TT></TD>
	<TD>No</TD>
	<TD>Powers a printer or class off.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Startup-Printer</TT></TD>
	<TD>No</TD>
	<TD>Powers a printer or class on.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Suspend-Current-Job</TT></TD>
	<TD>No</TD>
	<TD>Stops the current job on a printer or class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Validate-Document</TT></TD>
	<TD>No</TD>
	<TD>Validates a document request before sending.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>Validate-Job</TT></TD>
	<TD>Yes</TD>
	<TD>Validates a print request before printing.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Accept-Jobs</TT></TD>
	<TD>Yes</TD>
	<TD>Sets a printer's or class' printer-is-accepting-jobs
	attribute to true.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Add-Modify-Class</TT></TD>
	<TD>Yes</TD>
	<TD>Adds or modifies a class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Add-Modify-Printer</TT></TD>
	<TD>Yes</TD>
	<TD>Adds or modifies a printer.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Authenticate-Job</TT></TD>
	<TD>Yes</TD>
	<TD>Authenticates a job for printing.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Delete-Class</TT> *</TD>
	<TD>Yes</TD>
	<TD>Removes a class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Delete-Printer</TT> *</TD>
	<TD>Yes</TD>
	<TD>Removes a printer.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Get-Classes</TT> *</TD>
	<TD>Yes</TD>
	<TD>Gets a list of classes.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Get-Default</TT> *</TD>
	<TD>Yes</TD>
	<TD>Gets the server/network default printer or class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Get-Devices</TT> *</TD>
	<TD>Yes</TD>
	<TD>Gets a list of printer devices.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Get-Document</TT></TD>
	<TD>Yes</TD>
	<TD>Retrieves a document file from a job.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Get-PPDs</TT> *</TD>
	<TD>Yes</TD>
	<TD>Gets a list of printer drivers or manufacturers.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Get-Printers</TT> *</TD>
	<TD>Yes</TD>
	<TD>Gets a list of printers and/or classes.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Move-Job</TT></TD>
	<TD>Yes</TD>
	<TD>Moves a job to a different printer or class.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Reject-Jobs</TT></TD>
	<TD>Yes</TD>
	<TD>Sets a printer's or class' printer-is-accepting-jobs
	attribute to false.</TD>
</TR>
<TR>
	<TD NOWRAP><TT>CUPS-Set-Default</TT> *</TD>
	<TD>Yes</TD>
	<TD>Sets the server/network default printer or class.</TD>
</TR>
</TBODY>
</TABLE></DIV>

<P>* = These operations only apply to the default policy.</P>

<H2 CLASS="title"><A NAME="CREATING">Creating Your Own Policies</A></H2>

<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>

<PRE CLASS="example">
&lt;Policy mypolicy>
</PRE>

<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>

<PRE CLASS="example">
&lt;Limit Cancel-Job>
  Order deny,allow
&lt;/Limit>
</PRE>

<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>

<DIV CLASS="table"><TABLE WIDTH="80%" SUMMARY="Access Control Recipes">
<CAPTION>Table 2: <A NAME="TABLE02">Access Control Recipes</A></CAPTION>
<THEAD>
<TR>
	<TH>Access Level</TH>
	<TH>Directives to Use</TH>
</TR>
</THEAD>
<TBODY>
<TR>
	<TD>Allow Everyone</TD>
	<TD><PRE>Order deny,allow
Allow from all</PRE></TD>
</TR>
<TR>
	<TD>Allow Everyone on the Local Network</TD>
	<TD><PRE>Order deny,allow
Allow from @LOCAL</PRE></TD>
</TR>
<TR>
	<TD>Deny Everyone/Disable Operation(s)</TD>
	<TD><PRE>Order deny,allow</PRE></TD>
</TR>
<TR>
	<TD>Require Login (System) Password</TD>
	<TD><PRE>AuthType Basic</PRE></TD>
</TR>
<TR>
	<TD>Require CUPS (lppasswd) Password</TD>
	<TD><PRE>AuthType BasicDigest</PRE></TD>
</TR>
<TR>
	<TD>Require Kerberos</TD>
	<TD><PRE>AuthType Negotiate</PRE></TD>
</TR>
<TR>
	<TD>Require the Owner of a Job or Subscription</TD>
	<TD><PRE>Require user @OWNER</PRE></TD>
</TR>
<TR>
	<TD>Require an Administrative User</TD>
	<TD><PRE>Require user @SYSTEM</PRE></TD>
</TR>
<TR>
	<TD>Require Member of Group "foogroup"</TD>
	<TD><PRE>Require user @foogroup</PRE></TD>
</TR>
<TR>
	<TD>Require "john" or "mary"</TD>
	<TD><PRE>Require user john mary</PRE></TD>
</TR>
<TR>
	<TD>Require Encryption</TD>
	<TD><PRE>Encryption Required</PRE></TD>
</TR>
</TABLE></DIV>


<H3>Creating a Policy for a Computer Lab</H3>

<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>

<PRE CLASS="example">
<EM>Listing 2: <A NAME="LISTING02">Operation Policy for a Lab</A></EM>

 1    &lt;Policy lab999>
 2      # Job- and subscription-related operations must be done
      by the owner, a lab technician, or an administrator...
 3      &lt;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
      CUPS-Move-Job Cancel-Job CUPS-Authenticate-Job CUPS-Get-Document>
 4        Require user @OWNER @lab999 @SYSTEM
 5        Order allow,deny
 6        Allow from 10.0.2.0/24
 7      &lt;/Limit>
 8
 9      # All administration operations require a lab technician
      or an administrator to authenticate...
10      &lt;Limit Pause-Printer Resume-Printer
      Set-Printer-Attributes 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 CUPS-Accept-Jobs
      CUPS-Reject-Jobs CUPS-Set-Default>
11        AuthType Default
12        Require user @lab999 @SYSTEM
13        Order allow,deny
14        Allow from 10.0.2.0/24
15      &lt;/Limit>
16
17      # All other operations are allowed from the lab network...
18      &lt;Limit All>
19        Order allow,deny
20        Allow from 10.0.2.0/24
21      &lt;/Limit>
22    &lt;/Policy>
</PRE>


<H2 CLASS="title"><A NAME="SELECT">Using Policies</A></H2>

<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>

<PRE CLASS="example">
DefaultPolicy lab999
</PRE>

<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>

<PRE CLASS="command">
lpadmin -p LaserJet4000 -o printer-op-policy=lab999
</PRE>

<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>

</BODY>
</HTML>