lprsrv - PPR RFC 1179 (lpr/lpd) server
lprsrv.conf - Access control file
lprsrv-test - Access control test program
lprsrv options
lprsrv-test hostname [username] ...
The --help option prints a brief description of the options. The --version option prints the PPR version information.
lprsrv is an RFC-1179 (Berkeley lpr/lpd) compatible print server. It will accept print jobs over the network and hand them to the Uprint library for processing. By means of the Uprint library, lprsrv can deliver jobs to PPR, as well as the BSD and System V spoolers (if present). It can also handle requests to list print queues and to delete jobs.
PPR version 1.32 introduced a heavily reworked lprsrv. Most of the command line options were changed and the access control scheme was radically altered. The pre-1.32 lprsrv is preserved as olprsrv. It will be removed completely at some point in the future.
The Uprint configuration file /etc/ppr/uprint.conf must be correct for lprsrv to work. See the UPRINT.1 manpage for details.
If you want to run lprsrv on the standard port (and you almost certainly do), you must disable any RFC 1179 server already running on that port. This section contains instructions for disabling various RFC 1179 servers. If your system's print server isn't covered in this section and you figure out how to disable it, please send the necessary instructions to ppr-bugs@trincoll.edu.
If you are using lpd from Berkely (which is popular on Linux), you must either run lprsrv on a port other than 515, or you must arrange for inetd to be started before lpd. If inetd is started before lpd, lpd will be unable to bind to port 515 but will still work in other respects and lprsrv will pass remote jobs to lpr. (Unfortunately, some versions of lpd will die when they fail to bind to the port. Can anyone give better advice than this?)
If you are using LPR-NG, you must add a line such as this to /etc/lpd.conf:
lpd_port=1501
You can choose any unused port that you wish. If you wish you can also restrict access to the loopback device:
lpd_port=127.0.0.1%1501
You should then restart lpd.
If you are using IRIX 6.3, you should edit /etc/init.d/lp and find the place where /usr/lib/lpsched is started. Add the option ``-nobsd'' to the line. That will make sure LP doesn't grab the port at the next reboot. So that you don't have to reboot after making the change, run these commands:
# /usr/lib/lpshut # /usr/lib/lpsched -nobsd
If you are using SunOS 5.6 (Solaris 2.6) then you need only edit /etc/inetd.conf and remove the line which reads:
printer stream tcp nowait root /usr/lib/print/in.lpd in.lpd
Before this change will take effect, it is necessary to tell inetd to reload inetd.conf by sending it the HUP signal. If inetd has the process id 123, then the command for reloading inetd.conf is:
kill -HUP 123
or, if your kill command doesn't support the modern syntax:
kill -1 123
If Inetd was installed on your system when you ran PPR's fixup program during PPR installation, it will have added the necessary line to /etc/services. (Remember, you ran /usr/lib/ppr/fixup/fixup as root right after you ran make install.) The fixup program will also have put an entry in /etc/inetd.conf but left it commented out. In order to enable lprsrv, go through this section and make sure the required lines are present and remove the comment character from in front of the line in /etc/inetd.conf.
First, make sure a line like this is in /etc/services:
printer 515/tcp spooler
Then look in /etc/inetd.conf. For basic versions of inetd, such as those distributed with Solaris, the line should read something like:
printer stream tcp nowait root /usr/lib/ppr/lib/lprsrv lprsrv
If Tcpwrappers was installed on your system when you ran fixup, it will read:
printer stream tcp nowait root /usr/local/sbin/tcpd lprsrv
On Linux systems with TCP wrappers it will read something like:
printer stream tcp nowait.400 root /usr/sbin/tcpd /usr/lib/ppr/lib/lprsrv
If the line is already present, make sure there is no ``#'' in front of it.
The Linux version of Inetd allows us to specify how how many requests per minute the server should be allowed to receive. In the Linux /etc/inetd.conf example above, the ``400'' specifies that the lprsrv should be allowed to handle up to 400 connections per minute. If more than 400 requests are received during one minute, then inetd will disable lprsrv for a little while.
Other versions of Inetd may not have any provision for changing the maximum allowed number of connections. Often they will limit all servers to 60 connections per minute. If this is the case with you, you may want to run lprsrv in standalone mode.
Before your changes to inetd.conf will take effect, inetd must be instructed to reload inetd.conf by sending it the HUP signal. If inetd has the process id 123, then the command for reloading inetd.conf is:
kill -HUP 123
or, if your kill command doesn't support the modern syntax:
kill -1 123
A comparatively new alternative to Inetd is Xinetd. It is designed to be more flexible and to better manage the connection load. Xinetd is used instead of Inetd in some Linux distributions such as Mandrake. You can download the Xinetd source code from http://www.xinetd.org/.
Xinetd uses a configuration file format that is different from that of Inetd. Generally, the configuration file is /etc/xinetd.conf which contains an instruction to include configuration file fragments stored in /etc/xinetd.d/. This setup makes it easy for package installers to add and remove Xinetd configuration information from the system. All they have to do is add files to /etc/xinetd.d when installing the package and delete them when removing the package.
If PPR's fixup finds Xinetd installed on your system, it will use it instead of Inetd. It will create a file called /etc/xinetd.d/ppr which will read in part:
# RFC 1179 (LPR/LPD) server service printer { socket_type = stream wait = no user = root server = /usr/lib/ppr/lib/lprsrv cps = 400 30 instances = 50 disabled = yes }
Notice the line that says ``disabled = yes''. You must change this to ``disabled = no'' in order to enable lprsrv.
After you make a change to Xinetd's configuration, you must send it the USR2 signal. For example, if Xinetd's process id is 123:
kill -USR2 123
Standalone Operation (that is, without inetd) is controled by this option:
If this switch is used, in either form, lprsrv will run as a daemon. You should use this option if for some reason you can't depend on inetd. The argument is the number or name of the port that lprsrv should listen on. The most common value is ``printer'' or its numberic equivelent ``515''.
For you convienance, the PPR rc script (which gets installed as /etc/init.d/ppr or /etc/rc.d/init.d/ppr or something like that) has a commented out line to start lprsrv in standalone mode.
When a client requests a queue listing for a PPR queue, lprsrv will return the output of ppop lpq for the short format and ppop list for the long format. The ppop lpq output is designed to look similiar to the output of BSD lpq.
If the -A switch is used, lprsrv will pass the switch and its argument on to ppop. The argument is an integer which indicates an age in seconds. Arrested jobs older than the specified age will not be shown in queue listings.
When a client requests a queue listing for an LPR/LPD queue, lprsrv simply executes lpq and returns the output.
When a client requests a queue listing for a System V lp queue, lprsrv runs lpstat. Some lpq options are not supported for lp queues.
Access to queues through lprsrv is controled by the file /etc/ppr/lprsrv.conf. The only documentation currently available is in /etc/ppr/lprsrv.conf.sample.
If you use an unmodified lprsrv.conf.sample for lprsrv.conf, then tranditional BSD-style access control will be in effect. Under this style of access control, any computer listed in /etc/hosts.equiv or /etc/hosts.lpd will be allowed to submit jobs. The names listed in these files should be fully qualified names.
Since lprsrv uses its own code, it may not support all of the access control syntax described in hosts.equiv. In particular, ``+'' and ``-'' are not supported. Domain wildcards such as ``.trincoll.edu'' are supported. NIS netgroup support is available on some systems.
If you would like to add support for additional access control syntax in
/etc/hosts.equiv and /etc/hosts.lpd, you should modify the function
authorized_file_check()
in lprsrv/lprsrv_conf.c. If you make improvements,
please consider contributing them to the PPR project.
The program lprsrv-test can be used to test the rules in /etc/ppr/lprsrv.conf, /etc/hosts.equiv, and /etc/hosts.lpd.
You can use it to find out what sort of access certain users on a certain host will have. When you run it the first parameter should be a hostname. The second and subsequent parameters should be usernames.
Since several sections of /etc/ppr/lprsrv.conf may be combined to determine the access settings for a certain host, it can be difficult to determine exactly what access a particular host has. lprsrv-test solves this by printing a merged record in /etc/ppr/lprsrv.conf format which shows the final settings which apply to the host you named on the command line.
For each remote user you name on the command line, lprsrv-test will print the name of the local user which will be used to execute spooler commands on the remote user's behalf. The local user used may be different for each spooler.
The version of lpr supplied with DEC OSF/1 has many more options than the BSD version. Using these extra options results in extra lines in the queue file which lpr sends to lprsrv. These extensions are supported by lprsrv whenever possible.
The print spooler in Solaris 2.6 (SunOS 5.6) is derived from the System V LP spooler. When it sends jobs using the RFC-1179 protocol it include extra control file lines which represent System V lp options. These extensions are supported by lprsrv whenever possible.
The lprsrv configuration file does not provided any way for setting options for individual queues. It is suggested that you use the ppad switchset, ppad group switchset and ppad alias switchset commands do do this. See the ppad switchset description for examples.
Be aware that lprsrv will sometimes override switchset options. It will always override an -m option (which shouldn't be in a switchset anyway). It will also override duplex, paper source, and other options if conflicting instructions are conveyed by means of Solaris or DEC extensions to the RFC-1179 protocol.
The RFC 1179 protocol provides a way for a client to ask to have banner pages suppressed. (The BSD lpr -h option uses this feature.) If lprsrv receives a job that requests suppression of the banner page, it will attempt to do so. However, suppressing the banner page may not be allowed. In that case, the spooler to which lprsrv submits the job will likely print a banner page anyway.
In the case of a PPR printer, if the ppad flags command has been used to set the printer's banner option to always, then it will not be possible for an RFC 1179 client to suppress the banner page.
In the case of a System V lp queue, an RFC 1179 client will probably not be able to suppress the banner page unless the lpadmin -o option has been used to set a list of printer options which includes ``nobanner''.
This section describes the commands needed to set up various print spoolers as clients of lprsrv. If you have information to add to this section, please send it to ppr-bugs@trincoll.edu.
Add an entry similar to the following to /etc/printcap.
myprn|My Printer:\ :rp=somehost.mycoll.edu:rm=myprn:\ :sd=/var/spool/lpd/myprn:\ :mx#0:
Then create the local spool directory.
mkdir /var/spool/lpd/myprn
See the UPRINT.1 manpage and the comments in /etc/ppr/lprsrv.conf.
PPR was written at Trinity College during 1993--2004.
David Chappell, Trinity College Computing Center, Hartford, Connecticut.