FAQ
What is fsnmp?
The fsnmp program is a very simple print filter for the LPRng print system.
It performs the following processing:
- Save standard input (the print job data) to a temporary file.
- Retrieve pagecounter value from the printer using SNMP, report
the pagecounter value to accounting mechanism configured for LPRng.
- Transfer the temporary file contents to the printer over a
network socket.
- Retrieve pagecounter value from the printer using SNMP, report
the pagecounter value to the accounting mechanism configured for LPRng.
- Remove the temporary file.
Which license conditions are applied to the package?
- fsnmp
Copyright (C) 2008 Dipl.-Ing. Dirk Krause
- Redistribution and use in source and binary forms,
with or without modification, are permitted provided
that the following conditions are met:
- Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
- Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
- Neither the name of the Dirk Krause nor the names of
contributors may be used to endorse or promote
products derived from this software without specific
prior written permission.
- This software is provided by the copyright holders
and contributors ``as is'' and any express or implied warranties,
including, but not limited to, the implied warranties of
merchantability and fitness for a particular purpose
are disclaimed.
In no event shall the copyright owner or contributors be
liable for any direct, indirect, incidental, special,
exemplary, or consequential damages (including, but not
limited to, procurement of substitute goods or services;
loss of use, data or profits; or business interruption)
however caused and on any theory of liability, whether
in contract, strict liability, or tort (including negligence
or otherwise) arising in any way out of the use of this
software, even if advised of the possibility of such damage.
Why is there a need for another print filter?
Our faculty used LPRng for a long time, in the PC lab we had
HP printers. The ifhp filter available from the LPRng web site
worked well with these printers, the pagecounter value was retrieved
via PCL commands.
After changing to Xerox phaser printers we needed to retrieve the
pagecounter values using SNMP. I attempted multiple configuration
settings for ifhp, this took me some days. Unfortunately I did not succeed
to configure ifhp to work with my printers. In this time I read
the manuals for LPRng and ifhp multiple times and learned a lot about
LPRng's print filtering.
Although I knew which tasks the filter must perform I did not find out
how to configure ifhp to do the tasks. So I decided to write a
dedicated print filter.
Which filtering is performed by fsnmp?
The name "filter" is a little bit misleading. The fsnmp program
is more an output driver than a filter, only minimal filtering is done:
- If you configured the option "ctrl-d at start" fsnmp
checks whether or not the first byte in the print job is a Control-D.
If it isn't, fsnmp sends an additional Control-D to the printer before
starting the print job data.
- If you configured the option "ctrl-d at end" fsnmp
checks whether or not the last byte in the print job is a Control-D.
If it isn't, fsnmp sends an additional Control-D to the printer
after sending the print job data.
Is it still usefull to develop for LPRng?
I know there was no new version for over a year and no mailing
list activity for a long time.
Many Linux distribution use CUPS, i.e. on Fedora (my preferred
Linux distribution) there are no longer LPRng packages available.
Although CUPS is possibly a good choice for print clients
(PPD files can be read, users can use all features of a printer if
the PPD file is present) I prefer to use LPRng on my print server
over CUPS and other print systems for several reasons:
- LPRng seems to be smaller.
There's only the lpd daemon handling LPD protocol requests
instead of multiple daemons for multiple protocols.
Normally I also would expect smaller and simpler software to
have less security problems than large and over-featured software.
The reference manual can be read and understood within some hours.
- Installation and configuration is easy and well-documented.
For instance it is relatively easy to turn off automatic filtering and
conversions
(Why? See below.).
- LPRng is flexible. It is sometimes referred to as the "swiss army knife of printing".
It is well-documented how to write filters (like fsnmp),
specifications how to write accounting software (either as a pipe command
or a network server) is available too. Accounting software can also be
used to limit printer usage. Limitation can be done "just-in-time"
rather than periodically build deny- and allow-files.
- LPRng compiles without problems on all my systems.
Attempts to compile CUPS on a Solaris system using the workshop
compilers failed.
C++ != C++.
If I have a native C/C++ compiler for my system I want to use this compiler,
I don't want to spend several MBs and days just to install and learn
about another compiler producing binaries showing less performance.
The ifhp filter recognizes file types and invokes conversion programs? Why doesn't fsnmp do so?
From a security-related point of view it is not a good idea to run
conversion
programs as user "lp" (or "daemon" or in worst case "root") and feed
the conversion programs with input provided by users.
It is better to leave it up to the users to do conversions if necessary;
users should only send "ready-to-print" jobs to the print system.
I know the security problems but I want automatic conversion. How do I do that?
You can create bounce queues, see the LPRng reference manual.
You need one print queue using fsnmp as filter to send the print job
data to the printer.
Another queue can be configured to use different filters for different
input classes or a filter recognizing file types and invoking conversion
programs. This queue sends it's output to the first queue.
Are you really sure you need automatic filtering? See next question, please!
Which security problems are there in automatic filtering?
Here are some reasons why not to use automatic filtering:
- Security problems
Each of the conversion programs may have security problems. Some
of the programs used for conversions even allow to execute shell commands.
If the programs are run by normal users, each user can only destroy
his own files...
If the programs are run by "lp", "daemon" or "root" (you really should not
do that!) anyone can submit a destructive "print job" which can at
least disturb the printing system.
- Secure mode restricts functionality
Some of the conversion programs can be turned into secure mode, denying
dangerous operations. Typically this restricts functionality.
Leaving all conversions up to the users, the user can decide whether
or not to trust the input file and find a compromise between
security and functionally. (Example: If I wrote a LaTeX source file
I know I can trust this file and I do not need secure mode for latex
and dvips. If I receive LaTeX sources from other people I prefer to turn
secure mode on or to inspect the source.)
- Secure mode is not always the default setting
For some programs the secure mode is the default setting, other
programs need special options to enter secure mode.
Example: For automatic conversion of *.dvi files in the print system,
are you sure dvips is run using the "-R" option?
- Changed environment
Some of the conversion programs use environment variables or
personal settings from setup files. The settings for the print system's
user account will differ
from individual user settings, this might result in
"resource not found" problems or other unexpected output.
Where can I download fsnmp?
The sources are available at SourceForge, see
http://fsnmp.sourceforge.net.
Which software packages are required to install fsnmp?
How do I build and install fsnmp?
After unpacking the sources change into the fsnmp directory and run
./configure
make
make install
Some libraries are specified multiple times. How do I fix the linker problems?
Manually edit the Makefile and make sure each library is used only once.
The configure script uses the net-snmp-config script to find the
libraries needed by Net-SNMP. So may be some libraries are found here
and found by other configure script sections.
How do I handle compiler/linker errors about wrong ELF classes?
The configure script uses the net-snmp-config script to find
CFLAGS (C compiler options) for programs linked against the Net-SNMP
libraries. At least on one system I found the net-snmp-config script
producing very strange options like
-R../.../sfw -xarch=...
If the Makefile contains CFLAGS and/or LDFLAGS looking strange and
differing from your normal CFLAGS/LDFLAGS settings, do the following:
- Remove compiler-specific, platform-specific options, i.e.
the "-xarch=...".
- In -R... and -L... replace relative paths by absolute paths
or remove the option.
After changing the Makefile run
make clean
make
make install
or
rm -fr fsnmp *.o
make
make install
Which configuration files are used by fsnmp?
There are two configuration files:
- printcap
This file is typically located in /etc or /etc/lprng.
- fsnmp.conf
This file is typically located in ${prefix}/etc/fsnmp.
How do I configure the printcap file entry?
In the printcap file we must make sure that LPRng does not
open a network connection to the printer. So we use the
/dev/null device instead.
We configure fsnmp as filter for all input types.
lp
:lp=/dev/null
:filter=/usr/local/libexec/filters/fsnmp
How do I configure the fsnmp.conf file entry?
In fsnmp.conf you must at least configure the host name (or IP
address) and the port number of the printer,
the SNMP version and the SNMP community.
[lp]
lp = 192.168.1.99%9100
snmp community = public
snmp version = 1
Other settings are optional, it is a good idea to start from the
following settings:
[lp]
lp = 192.168.1.99%9100
snmp community = public
snmp version = 1
ctrld-d at end = yes
shutdown data socket = no
minimum pagecount time = 30
shutdown accounting socket = yes
The purpose of the settings is explained on the
usage
page.
Do I need to restart LPRng after applying configuration changes?
You need to restart LPRng only if you applied changes
to the printcap file.
Changes in the fsnmp.conf file do not require to restart LPRng.
Should I change the *.c or the *.ctr files?
Please make changes only in the *.ctr files, these are the original
source files.
The
tracecc
program is used to generate *.c files from *.ctr files.