| 1 |
.TH LPD.PERMS 5 2006-12-09 "LPRng" "lpd.perms file" |
| 2 |
.SH NAME |
| 3 |
|
| 4 |
lpd.perms \- permissions control file for the LPRng line printer spooler system |
| 5 |
|
| 6 |
.SH DESCRIPTION |
| 7 |
The file \fBlpd.perms\fR is used to provide permission information for |
| 8 |
the LPRng Printer spooler system. |
| 9 |
Blank lines and all |
| 10 |
characters after a hash sign (``#'') to the end of line are ignored. |
| 11 |
If a hash sign is desired in the |
| 12 |
permission information, |
| 13 |
it should be escaped with a backslash |
| 14 |
(``\\''). |
| 15 |
All other lines |
| 16 |
specify permissions entry and should be of the following form: |
| 17 |
.RS |
| 18 |
ACCEPT [[not] key = value[,value]* ]* |
| 19 |
.br |
| 20 |
REJECT [[not] key = value[,value]* ]* |
| 21 |
.br |
| 22 |
DEFAULT ACCEPT |
| 23 |
.br |
| 24 |
DEFAULT REJECT |
| 25 |
.RE |
| 26 |
.PP |
| 27 |
Each LPD service request is checked against |
| 28 |
the entries in the permissions database or file. |
| 29 |
The following is a typical permissions file: |
| 30 |
.RS |
| 31 |
.nf |
| 32 |
.ft CW |
| 33 |
# Set default permissions |
| 34 |
DEFAULT ACCEPT |
| 35 |
# Reject any connections from outside our subnet |
| 36 |
REJECT SERVICE=X NOT REMOTEIP=130.191.0.0/255.255.0.0 |
| 37 |
# Only accept spooling (LPR) from |
| 38 |
# Engineering Lab or the Dean's office |
| 39 |
REJECT SERVICE=R NOT REMOTEHOST=*.eng.sdsu.edu,dean.sdsu.edu |
| 40 |
# Do not accept forwarded jobs for printing |
| 41 |
REJECT SERVICE=R FORWARD |
| 42 |
# Allow only the administrators control access |
| 43 |
ACCEPT SERVICE=C,M REMOTEHOST=spooler.eng.sdsu.edu REMOTEUSER=root,papowell |
| 44 |
ACCEPT SERVICE=C,M SERVER REMOTEUSER=root,papowell |
| 45 |
# Allow only the user on the same host who spooled job to remove it |
| 46 |
ACCEPT SERVICE=M SAMEUSER SAMEHOST |
| 47 |
# Allow users to check status |
| 48 |
ACCEPT SERVICE=C LPC=status |
| 49 |
# Require connection for other operations over UNIX socket |
| 50 |
# not TCP/IP port. Effectively requiring them to be made from the |
| 51 |
# localhost |
| 52 |
ACCEPT SERVICE=C UNIXSOCKET |
| 53 |
REJECT SERVICE=C |
| 54 |
|
| 55 |
# Variation - accept all spooled jobs, but then apply |
| 56 |
# permissions checking when job is printed. Allows |
| 57 |
# prevents remote spoolers from locking up trying resend |
| 58 |
# same request |
| 59 |
ACCEPT SERVICE=R |
| 60 |
REJECT SERVICE=P NOT REMOTEHOST=*.eng.sdsu.edu,dean.sdsu.edu |
| 61 |
.RE |
| 62 |
.fi |
| 63 |
.sp |
| 64 |
.LP |
| 65 |
Permission checking is done by using a set of keys (or fields) |
| 66 |
with associated values to check for permission. |
| 67 |
The SERVICE key has value P for printing (i.e.- unspooling), |
| 68 |
R for spooling (i.e.- LPR request), |
| 69 |
P for printing (i.e., after job has been spooled), |
| 70 |
C printer control (i.e. - LPC), |
| 71 |
M for removal (i.e.- LPRM request), |
| 72 |
and |
| 73 |
Q for queue information (i.e.- LPQ request). |
| 74 |
The |
| 75 |
.B X |
| 76 |
key is used when checking for connection information. |
| 77 |
.LP |
| 78 |
Initially, |
| 79 |
all of the keys have undefined or NULL values, |
| 80 |
and are assigned values during the permissions checking process. |
| 81 |
When a connection is made to the server, |
| 82 |
it assigns |
| 83 |
The REMOTEHOST (alias REMOTEIP) key the list of IP addresses and hostnames |
| 84 |
determined by doing a reverse Domain Name Service (DNS) |
| 85 |
lookup on the remote host's IP address. |
| 86 |
If the reverse DNS fails, |
| 87 |
then only the IP address will be used. |
| 88 |
The REMOTEPORT (PORT is an alias for REMOTEPORT) is assigned |
| 89 |
the port number of the connection origination. |
| 90 |
The UNIXSOCKET key will match (be true) if the connection |
| 91 |
is over a UNIX socket. |
| 92 |
By convention, |
| 93 |
this is from the localhost. |
| 94 |
Finally, |
| 95 |
the SERVICE value is assigned X, |
| 96 |
and the lpd server will check the database to see if the |
| 97 |
connection is accepted or rejected. |
| 98 |
.LP |
| 99 |
The server will then read the request information from the connection. |
| 100 |
If the request is for an authenticated data transfer, |
| 101 |
the server will invoke the appropriate authentication mechanism |
| 102 |
which will assign AUTH a true (or matching) value, |
| 103 |
AUTHTYPE the type of authentication, |
| 104 |
AUTHUSER the authenticated user id value, which may differ from the |
| 105 |
actual user name, |
| 106 |
and AUTHFROM the authenticated identification of the originator |
| 107 |
of the request, |
| 108 |
which may be a server if the request is forwarded. |
| 109 |
.LP |
| 110 |
Next, |
| 111 |
the SERVICE value is set to R, C, M, or Q depending on whether it is |
| 112 |
an LPR, LPC, LPRM, or LPQ request, |
| 113 |
and the LPC value set to the requested LPC command if it was an LPC |
| 114 |
request. |
| 115 |
If the request contained a user name, |
| 116 |
then REMOTEUSER is set to this name. |
| 117 |
If the request contained a printer name, |
| 118 |
then PRINTER is set to the printer name. |
| 119 |
If the request is a print request, |
| 120 |
then the HOST value is set to the list of host names and IP |
| 121 |
addresses given by a DNS lookup of the value in the |
| 122 |
H field of the job. |
| 123 |
The database is scanned again to determine if the operation can be |
| 124 |
performed on the requested queue. |
| 125 |
To simplify the rule writing, |
| 126 |
if the operation requires modification or checking of individual |
| 127 |
jobs, |
| 128 |
such as the LPC, LPQ, or LPRM commands, |
| 129 |
then the various checks that depend on jobs will succeed in this step. |
| 130 |
.LP |
| 131 |
Finally, |
| 132 |
if the operation requires modification or checking of individual |
| 133 |
jobs, |
| 134 |
such as the LPC, LPQ, or LPRM commands, |
| 135 |
then the specified print queue is scanned, |
| 136 |
and for each job in the print queue, |
| 137 |
the HOST and USER values are set to the host and user |
| 138 |
values in the control file for the job. |
| 139 |
.LP |
| 140 |
The database is checked as follows. |
| 141 |
Each line of the permissions file is scanned for key names and |
| 142 |
values, and these are matched against the request keys information. |
| 143 |
When all matches on a line are made, |
| 144 |
then search terminates with the specified action (ACCEPT/REJECT). |
| 145 |
If no match is found the default permission value is used. |
| 146 |
The |
| 147 |
DEFAULT key is used to specify the current default permission to |
| 148 |
be used for successful matches or if there is no match after |
| 149 |
scanning the entire permissions database. |
| 150 |
.LP |
| 151 |
The following keys provide some additional checking capabilities. |
| 152 |
The REMOTEGROUP entry checks that the REMOTEUSER |
| 153 |
value appears in a group or netgroup entry in the system database, |
| 154 |
and the GROUP entry for the USER value. |
| 155 |
For example, |
| 156 |
GROUP=student*,staff* |
| 157 |
would check to see if any of the group names matching |
| 158 |
student* or staff* have the specified user name in them. |
| 159 |
If a system has the |
| 160 |
.I netgroups |
| 161 |
capability, |
| 162 |
a printer, group, or remotegroup name starting with a |
| 163 |
\f(CW@\fP |
| 164 |
will be treated as a netgroup name, |
| 165 |
and specified user name or printer will be checked to see if |
| 166 |
it is in the group. |
| 167 |
.LP |
| 168 |
The SERVER entry will be true (match) if the request originated from |
| 169 |
the print server. |
| 170 |
The SAMEHOST is true (matches) if the REMOTEHOST and HOST values |
| 171 |
have a common entry, |
| 172 |
i.e. - are the same host. |
| 173 |
The SAMEUSER is true (matches) if the REMOTEUSER and USER values are identical. |
| 174 |
The AUTHSAMEUSER is true (matches) if the AUTHUSER |
| 175 |
value that originated the request and the AUTHUSER which |
| 176 |
was used to transfer a job are identical. |
| 177 |
AUTHJOB is true (matches) if the job was transferred using authentication. |
| 178 |
The FORWARD value is an alias for NOT SAMEHOST. |
| 179 |
.LP |
| 180 |
The CONTROLLINE value can be used to determine if there is a matching line |
| 181 |
in the control file. |
| 182 |
This facility has been used to ensure that jobs contain various |
| 183 |
information fields in order to be printed. |
| 184 |
.LP |
| 185 |
.sp |
| 186 |
.nf |
| 187 |
.ne 20v |
| 188 |
.ta \w'Key__________'u +\w'Match_'u +\w'Connect_'u +\w'Job___'u +\w'Job____'u +\w'LPQ__'u +\w'LPRM__'u +\w'LPC'u |
| 189 |
Key Match Connect Job Job LPQ LPRM LPC |
| 190 |
\0 \0 \0 Spool Print |
| 191 |
SERVICE S 'X' 'R' 'P' 'Q' 'M' 'C,S' |
| 192 |
USER S - JUSR JUSR JUSR JUSR JUSR |
| 193 |
HOST S RH JH JH JH JH JH |
| 194 |
GROUP S - JUSR JUSR JUSR JUSR JUSR |
| 195 |
REMOTEPORT N PORT PORT - PORT PORT PORT |
| 196 |
REMOTEUSER S - JUSR JUSR JUSR CUSR CUSR |
| 197 |
REMOTEHOST S RH RH JH RH RH RH |
| 198 |
UNIXSOCKET V SK SK SK SK SK SK |
| 199 |
REMOTEGROUP S - JUSR JUSR JUSR CUSR CUSR |
| 200 |
CONTROLLINE S - CL CL CL CL CL |
| 201 |
PRINTER S - PR PR PR PR PR |
| 202 |
FORWARD V - SA - - SA SA |
| 203 |
SAMEHOST V - SA - SA SA SA |
| 204 |
SAMEUSER V - - - SU SU SU |
| 205 |
SERVER V - SV - SV SV SV |
| 206 |
AUTH V - AU - AU AU AU |
| 207 |
AUTHTYPE S - AU - AU AU AU |
| 208 |
AUTHUSER S - AU - AU AU AU |
| 209 |
AUTHSAMEUSER S - AU - AU AU AU |
| 210 |
AUTHFROM S - AU - AU AU AU |
| 211 |
AUTHJOB V - AU - AU AU AU |
| 212 |
PORT is alias for REMOTEPORT |
| 213 |
REMOTEIP is alias for REMOTEHOST |
| 214 |
IP is alias for HOST |
| 215 |
|
| 216 |
.ta 3m +\w'RH = REMOTEHOST 'u |
| 217 |
KEY: |
| 218 |
JH = HOST host in control file |
| 219 |
RH = REMOTEHOST connecting host name/IP |
| 220 |
JUSR = USER user in control file |
| 221 |
CUSR = REMOTEUSER user from control request |
| 222 |
JIP= IP host/IP addr of host in control file |
| 223 |
RIP= REMOTEIP host/IP addr of requesting host |
| 224 |
PORT= connecting host origination port |
| 225 |
SK= match if connection over a UNIX socket |
| 226 |
CONTROLLINE= pattern match of control line in control file |
| 227 |
FW= IP of source of request == IP of host in control file |
| 228 |
SA= IP of source of request == IP of host in control file |
| 229 |
SU= user from request == user in control file |
| 230 |
SA= IP of source of request == IP of server host |
| 231 |
SV= matches if from same address as server |
| 232 |
AU= value determined by server authentication operation |
| 233 |
AUTH is true if authenticated transfer, |
| 234 |
TYPE is set to the type of authentication (kerberos, etc) |
| 235 |
AUTHUSER is user authentication id |
| 236 |
AUTHFROM is sender authentication id (can be remote server) |
| 237 |
AUTHSAMEUSER matches if remote user authentication id matches original |
| 238 |
user authentication id |
| 239 |
AUTHJOB it true if print job has authentication |
| 240 |
Match: S = string with wild card, IP = IP address[/netmask], |
| 241 |
N = low[-high] number range, V = exact value match |
| 242 |
SERVICE: 'X' - Connection request; 'R' - lpr request from remote host; |
| 243 |
'P' - print job in queue; 'Q' - lpq request, 'M' - lprm request; |
| 244 |
'C' - lpc spool control request; 'S' - lpc spool status request |
| 245 |
'U' - administratively allowed user operation |
| 246 |
NOTE: when printing (P action), the remote and job check values |
| 247 |
(i.e. - RUSR, JUSR) are identical. |
| 248 |
.fi |
| 249 |
.sp |
| 250 |
.PP |
| 251 |
The special key |
| 252 |
.I letter=patterns |
| 253 |
searches the control file line starting with the |
| 254 |
(upper case) letter, |
| 255 |
and is usually used with printing and spooling checks. |
| 256 |
For example, |
| 257 |
C=A*,B* |
| 258 |
would check that the class information (i.e.- line in the control file |
| 259 |
starting with C) had a value starting with A or B. |
| 260 |
.PP |
| 261 |
A permission line consists of a list of tests and a result value. |
| 262 |
If all of the tests succeed, then a match has been found and the |
| 263 |
permission testing completes with the result value. You use the |
| 264 |
DEFAULT reserved word to set the default ACCEPT/DENY result. |
| 265 |
The NOT keyword will reverse the sense of a test. |
| 266 |
.PP |
| 267 |
Each test can have one or more optional values separated by |
| 268 |
commas. For example USER=john,paul,mark has 3 test values. |
| 269 |
The Match value specifies how the matching is done. |
| 270 |
.sp |
| 271 |
.nf |
| 272 |
S = string type match - string match with glob. |
| 273 |
.ta 4n +4n +4n +4n +4n +4n |
| 274 |
.nf |
| 275 |
Format: string with wildcards (*) |
| 276 |
* matches 0 or more chars |
| 277 |
Character comparison is case insensitive. |
| 278 |
For example - USER=th*s matches uTHS, This, This, Theses |
| 279 |
.sp |
| 280 |
IP = IP address and submask. IP address must be in dotted form. |
| 281 |
Format: x.x.x.x[/y.y.y.y or /z] |
| 282 |
x.x.x.x is IP address |
| 283 |
y.y.y.y is optional submask, default is 255.255.255.255 |
| 284 |
z is a netmask with most significant z bits set. |
| 285 |
Match is done by IP address to a 32 bit value and using: |
| 286 |
success = ((x ^ IP ) & y) == 0 (C language notation) |
| 287 |
i.e.- only bits where mask is non-zero are used in comparison. |
| 288 |
For example - IP=130.191.0.0/255.255.0.0 matches all address 130.191.X.X |
| 289 |
IP=130.191.0.0/16 has the same value. |
| 290 |
.sp |
| 291 |
N = numerical range - low-high integer range. |
| 292 |
Format: low[-high] |
| 293 |
Example: PORT=0-1023 matches a port in range 0 - 1023 (privileged) |
| 294 |
.fi |
| 295 |
.PP |
| 296 |
The authentication entries |
| 297 |
AUTH, AUTHTYPE, |
| 298 |
AUTHUSER, AUTHSAMEUSER and AUTHFROM |
| 299 |
can be used to check permissions for authenticated operations. |
| 300 |
AUTH is set (true) if authentication was done. |
| 301 |
We can use this to reject non-authenticated transfers: |
| 302 |
.br |
| 303 |
REJECT NOT AUTH |
| 304 |
.br |
| 305 |
The AUTHTYPE will match the authentication type |
| 306 |
being used or requested by the remote client or server. |
| 307 |
The AUTHUSER matches the original client authentication information |
| 308 |
used by the client to make a request to the server, |
| 309 |
and the AUTHFROM matches the sender authentication information. |
| 310 |
The AUTHSAMEUSER will match if the remote client or user authentication |
| 311 |
id is the same as that used for the job generation. |
| 312 |
.SH "LPC=OP" |
| 313 |
.PP |
| 314 |
The LPC=op entry is useful to allow various users to |
| 315 |
perform administration operations. |
| 316 |
The following permissions entry would |
| 317 |
allows users to hold or release their own jobs: |
| 318 |
.br |
| 319 |
ACCEPT SERVICE=C SAMEUSER SAMEHOST LPC=release |
| 320 |
.SH "DNS, IPV6, AND MULTIHOMED HOSTS" |
| 321 |
.PP |
| 322 |
There is a subtle problem with names and IP addresses which are |
| 323 |
obtained for 'multi-homed hosts', i.e. - those with multiple |
| 324 |
Ethernet interfaces, and for IPV6 (IP Version 6), in which a host |
| 325 |
can have multiple addresses, and for the normal host which can have |
| 326 |
both a short name and a fully qualified domain name. |
| 327 |
.PP |
| 328 |
When performing an IP address match, the entire list of IP addresses |
| 329 |
for a system will now be checked. If one of these matches, then success |
| 330 |
is reported. Similarly, the entire list of host names and aliases will |
| 331 |
be checked. If one of these matches, then success will be reported. |
| 332 |
.br |
| 333 |
.SH FILES |
| 334 |
.PP |
| 335 |
The files used by LPRng are set by values in the |
| 336 |
printer configuration file. |
| 337 |
The following are a commonly used set of default values. |
| 338 |
.nf |
| 339 |
.ta \w'/var/spool/lpd/printcap.<hostname> 'u |
| 340 |
/etc/lprng/lpd.conf LPRng configuration file |
| 341 |
${HOME}/.printcap user printer description file |
| 342 |
/etc/printcap printer description file |
| 343 |
/etc/lprng/lpd.perms permissions |
| 344 |
/var/run/lprng/lpd lock file for queue control |
| 345 |
/var/spool/lpd spool directories |
| 346 |
/var/spool/lpd/QUEUE/control queue control |
| 347 |
/var/spool/lpd/QUEUE/log trace or debug log file |
| 348 |
/var/spool/lpd/QUEUE/acct accounting file |
| 349 |
/var/spool/lpd/QUEUE/status status file |
| 350 |
.fi |
| 351 |
.SH "SEE ALSO" |
| 352 |
lpd.conf(5), |
| 353 |
lpc(8), |
| 354 |
lpd(8), |
| 355 |
checkpc(8), |
| 356 |
lpr(1), |
| 357 |
lpq(1), |
| 358 |
lprm(1), |
| 359 |
printcap(5), |
| 360 |
pr(1), lprng_certs(1), lprng_index_certs(1). |
| 361 |
.SH "AUTHOR" |
| 362 |
Patrick Powell <[email protected]>. |
| 363 |
.SH "HISTORY" |
| 364 |
LPRng is a enhanced printer spooler system |
| 365 |
with functionality similar to the Berkeley LPR software. |
| 366 |
The LPRng developer mailing list is [email protected]; |
| 367 |
subscribe by visiting |
| 368 |
.B https://lists.sourceforge.net/lists/listinfo/lprng-devel |
| 369 |
or sending mail to |
| 370 |
.B [email protected] |
| 371 |
with |
| 372 |
the word |
| 373 |
.I subscribe |
| 374 |
in the body. |
| 375 |
.br |
| 376 |
The software is available via |
| 377 |
.B http://lprng.sourceforge.net |