LPI Certification 102 Exam Prep, Part 3
LPI Certification 102 Exam Prep, Part 3
LPI Certification 102 Exam Prep, Part 3
Table of Contents
If you're viewing this document online, you can click any of the topics below to link directly to that section.
If you are new to Linux, we recommend that you first complete the previous tutorials in the
LPI certification 101 and 102 exam prep series before continuing:
• 101 series, Part 1: Linux fundamentals
• 101 series, Part 2: Basic administration
• 101 series, Part 3: Intermediate administration
• 101 series, Part 4: Advanced administration
• 102 series, Part 1: Compiling sources and managing packages
• 102 series, Part 2: Compiling and configuring the kernel
language as well as to a potentially dangerous dose of Pac Man. This probably explains why
he has since served as a Lead Graphic Artist at SONY Electronic Publishing/Psygnosis.
Daniel enjoys spending time with his wife, Mary, and their daughter, Hadassah.
Chris Houser, known to many of his friends as "Chouser," has been a Unix proponent since
1994 when he joined the administration team for the computer science network at Taylor
University in Indiana -- where he earned his Bachelor's degree in Computer Science and
Mathematics. Since then, he has gone on to work in Web application programming, user
interface design, professional video software support, and now Tru64 UNIX device driver
programming at Compaq. He has also contributed to various free software projects, most
recently to Gentoo Linux. He lives with his wife and two cats in New Hampshire.
Aron Griffis graduated from Taylor University with a degree in Computer Science and an
award that proclaimed him to be the "Future Founder of a Utopian UNIX Commune." Working
towards that goal, Aron is employed by Compaq writing network drivers for Tru64 UNIX, and
spending his spare time plunking out tunes on the piano or developing Gentoo Linux. He
lives with his wife Amy (also a UNIX engineer) in Nashua, New Hampshire.
00:01:02:CB:57:3C
Introducing IP addresses
These hardware addresses are used as unique addresses for individual systems on your
Ethernet LAN. Using hardware addresses, one machine can, for example, send an Ethernet
frame addressed to another machine. The problem with this approach is that TCP/IP-based
communication uses a different kind of addressing scheme, using what are called IP
addresses instead. IP addresses look something like this:
192.168.1.1
Linux. In fact, if you are currently using Ethernet with Linux, your distribution's system
initialization scripts very likely have a command in them that looks something like this:
Above, the ifconfig command is used to associate eth0 (and thus eth0's hardware
address) with the 192.168.1.1 IP address. In addition, various other IP-related information is
specified, including a broadcast address (192.168.1.255) and a netmask (255.255.255.0).
When this command completes, your eth0 interface will be enabled and have an associated
IP address.
Using ifconfig -a
You can view all network devices that are currently running by typing ifconfig -a,
resulting in output that looks something like this:
Above, you can see a configured eth0 interface, as well as a configured lo (localhost)
interface. The lo interface is a special virtual interface that's configured so that you can run
TCP/IP applications locally, even without a network.
TCP/IP is working!
Once all of your network interfaces are brought up and associated with corresponding IP
addresses, your Ethernet network can be used to carry TCP/IP traffic as well. The systems
on your LAN can now address each other using IP addresses, and common commands such
as ping, telnet, and ssh will work properly between your machines.
address. So if I had a network with three nodes, my /etc/hosts file might look something like
this:
127.0.0.1 localhost
192.168.1.1 mybox mybox.gentoo.org
192.168.1.2 testbox testbox.gentoo.org
192.168.1.3 mailbox mailbox.gentoo.org
Using DNS
While this approach works for small LANs, it isn't very convenient for larger LANs with many
systems on them. For such configurations, it's generally much better to store all your
IP-to-hostname mapping information on a single machine, and set up what is called a "DNS
server" (domain name service server) on it. Then, you can configure each machine to contact
this particular machine to receive up-to-the-minute IP to name mappings. This is done by
creating an /etc/resolv.conf file on every machine that looks something like this:
domain gentoo.org
nameserver 192.168.1.1
nameserver 192.168.1.2
In the above /etc/resolv.conf, I tell the system that any host names that are not qualified
(such as "testbox" as opposed to "testbox.gentoo.org," etc.) should be considered to be local
hostnames. I also specify that I have a DNS server running on 192.168.1.1, as well as a
backup one running on 192.168.12. Actually, nearly all network-connected Linux PCs already
have a nameserver specified in their resolv.conf file, even if they aren't on a LAN. This is
because they are configured to use a DNS server at their Internet Service Provider, in order
to map hostnames to IP addresses (so that users on that system can do things like browse
the Web and head over to well-known sites like ibm.com without having to refer to them by IP
address!).
In the above route command, the default route is set to 192168.1.80 -- the IP address of the
router. To view all the routes configured on your system, you can type route -n. The route
with a destination of "0.0.0.0" is the default route.
Homework
So far, we've given you a very brief introduction to Linux networking concepts. Unfortunately,
we simply don't have the room to cover everything you need to know, such as how to select
appropriate IP addresses, network masks, broadcast addresses, etc. In fact, there's quite a
bit more information you'll need to learn in order to prepare for the LPI Level 102 exam.
Fortunately, the topic of Linux networking is one of the most comprehensively documented
Linux topics around. In particular, we recommend that you read the Linux Network
Administrators Guide, available from Linuxdoc.org's "Guides" section, especially sections 2
through 6. Accompanied with our gentle introduction to Linux networking, the Linux Network
Administrators Guide should get you up to speed in no time!
In order to provide these services, the remote system either runs an instance of each server
to accept connections (for example /usr/sbin/in.telnetd and /usr/sbin/in.ftpd), or runs inetd.
The inetd program accepts each incoming connection and starts the appropriate services to
handle the connection based on its type. For this reason, inetd is also known as the "Internet
superserver."
On a typical Linux installation, inetd handles most incoming connections. Only a few
programs (such as sshd and lpd) handle their own network communication without relying on
inetd to accept incoming connections.
In general, /etc/services already contains all the useful service names and ports. If you wish
to add your own, you should first consult the list of assigned port numbers.
Since services are specified in inetd.conf by service name rather than port, they must be
listed in /etc/services in order to be eligible for handling by inetd.
Let's look at some common lines from /etc/inetd.conf. For example, the telnet and ftp
services:
For both of these services, the configuration is to use the TCP protocol, and run the server
(in.telnetd or in.ftpd) as the root user. For a complete explanation of the fields in
/etc/inetd.conf, see the inetd(8) man page.
Disabling services
Disabling a service in inetd is simple: Just comment out the line in /etc/inetd.conf. You
probably don't want to remove the line entirely, just in case you need to reference it later. For
example, some system administrators prefer to disable telnet for security reasons (since the
connection is entirely cleartext):
# vi /etc/inetd.conf
[comment out undesired line]
# /etc/rc.d/init.d/inet stop
Stopping INET services: [ OK ]
# /etc/rc.d/init.d/inet start
Starting INET services: [ OK ]
# /etc/rc.d/init.d/inet restart
Stopping INET services: [ OK ]
Starting INET services: [ OK ]
# killall inetd
You can start it again simply by invoking it on the command line. It will automatically run in
the background:
# /usr/sbin/inetd
And there's a shortcut to instruct inetd to reread the configuration file without actually
stopping it: just send it the HUP signal:
At this point you shouldn't be able to telnet or ftp into this system, since telnet and ftp are
disabled. Try telnet localhost to check. If you need telnet or ftp access, all you need to
do is to re-enable it!
# telnet localhost
telnet: Unable to connect to remote host: Connection refused
# telnet localhost
login: (press <ctrl-d> to abort)
# tail -1 /var/log/secure
Feb 12 23:33:05 firewall in.telnetd[440]: connect from 127.0.0.1
The telnet attempt was logged by tcpd, so it looks like we have things working. Since tcpd
provides a consistent connection logging service, that frees up the individual service
daemons from each needing to log connections on their own. In fact, it's similar to inetd doing
the work of accepting connections, since that frees up each of the individual daemons from
needing to accept their own connections. Isn't the simplicity of Linux (UNIX) marvelous?
Access is granted or denied in the following order. The search stops at the first match:
For example, to allow telnet access only to our internal network, we start by setting policy
(reject all connections with a source other than localhost) in /etc/hosts.deny:
# telnet box.yourdomain.com
Trying 10.0.0.1...
Connected to box.yourdomain.com.
Escape character is '^]'.
Connection closed by foreign host.
Slap! Rejected! (This is one of the few times in life that rejection is indicative of success.) To
re-enable access from our own network, we insert the exception in /etc/hosts.allow:
in.telnetd: .yourdomain.com
At this point we're able to successfully telnet into our system again. This is just scraping the
surface of the capabilities of tcp_wrappers. There's lots more information on tcp_wrappers in
the tcpd(8) and hosts_access(5) man pages.
xinetd configuration
The configuration file for xinetd is /etc/xinetd.conf. Most often, that file contains just a few
lines that set default configuration parameters for the rest of the services:
# cat /etc/xinetd.conf
defaults
{
instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST RECORD
}
includedir /etc/xinetd.d
The last line in that file instructs xinetd to read additional configuration from file snippets in
the /etc/xinetd.d directory. Let's take a quick glance at the telnet snippet:
# cat /etc/xinetd.d/telnet
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
As you can see, it's not hard to configure xinetd, and it's more intuitive than inetd. You can
get lots more information about xinetd in the xinetd(8), xinetd.conf(5), and xinetd.log(5) man
pages.
There's also lots of information on the Web regarding inetd, tcp_wrappers, and xinetd. Be
sure to check out some of the links we've provided for these tools in the last section of this
tutorial, Resources; they will give you a much better feel for the capability and configuration
of these tools.
Linux system security can be divided into two parts: internal security and external security.
Internal security refers to guarding against users accidentally or maliciously disrupting the
system. External security refers to preventing unauthorized users from gaining access to the
system.
This section will cover internal security first, then external security, and we'll finish with some
general guidelines and tips.
Regarding file permissions, you may want to modify permissions for the following three
cases:
First, log files in /var/log need not be world-readable. There is no reason for anybody other
than root to be snooping in the logs. See Part 4 of the LPI 101 series for more information on
syslog, plus the logrotate(8) man page for information on configuring that program to create
logs with appropriate permissions.
# cd
# pwd
/root
# chmod 700 .
if [ "$UID" = 0 ]; then
# root user; set world-readable by default so that
# installed files can be read by normal users.
umask 022
else
# make user files secure unless they explicitly open them
# for reading by other users
umask 077
fi
You should consult the umask(2) and bash(1) man pages for more information on setting the
umask. Note that the umask(2) man page refers to the C function, but the information it
contains applies to the bash command as well. See Part 3 of the LPI 101 series for additional
details on umask.
You should consider each program carefully to determine if it needs to have its SUID or
SGID bits on. There may be SUID/SGID programs on your system that you don't need at all.
To search for programs of this nature, use the find command. For example, we could start
searching for SUID/SGID programs in the /usr directory:
# cd /usr
# find . -type f -perm +6000 -xdev -exec ls {} \;
-rwsr-sr-x 1 root root 593972 11-09 12:47 ./bin/gpg
-r-xr-sr-x 1 root man 38460 01-27 22:13 ./bin/man
-rwsr-xr-x 1 root root 15576 09-29 22:51 ./bin/rcp
-rwsr-xr-x 1 root root 8256 09-29 22:51 ./bin/rsh
-rwsr-xr-x 1 root root 29520 01-17 19:42 ./bin/chfn
-rwsr-xr-x 1 root root 27500 01-17 19:42 ./bin/chsh
-rwsr-xr-x 1 lp root 8812 01-15 23:21 ./bin/lppasswd
-rwsr-x--- 1 root cron 10476 01-15 22:16 ./bin/crontab
In this list, I've already found a candidate for closer inspection: lppasswd is part of the CUPS
printing software distribution. Since I don't provide print services on my system, I might
consider removing CUPS, which will also remove the lppasswd program. There may be no
security-compromising bugs in lppasswd, but why take the chance on a program I'm not
using? Similarly, all services that you don't use should be turned off. You can always enable
them if and when you need them.
in /etc/profile, and the limits will irrevocably apply to all users (assuming they're running bash
or another shell that runs /etc/profile on login).
# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 3071
virtual memory (kbytes, -v) unlimited
It can be quite tricky to set these limits in a way that actually increases the security of your
system without causing problems for legitimate users, so be careful when adjusting these
settings.
# time bash
# ulimit -t 1
# while true; do true; done
Killed
real 0m28.941s
user 0m1.990s
sys 0m0.017s
In the example above, "user" time plus "sys" time equals total CPU time used by the process.
When the bash process reached the 2-second mark, Linux judged that it had exceeded the
1-second limit, so the process was killed. Cool, eh?
Note: One second was just an example. Don't do this to your users! Even multiple hours is
bad, since X can really rack up the time (my current session has used 69+ hours of CPU
time). For a real implementation, you may want to ulimit something other than CPU time.
• Clobberd monitors user activity, and meters resources such as time and network activity.
• Idled can log out users that have been idle for too long or who have been logged on for too
long. It can also prevent users from being logged in too many times, and refuse users from
being logged in at all.
• Part 4 of the LPI 101 series discusses the implementation of filesystem quotas.
Intrusion prevention
External security can be split into two categories: intrusion prevention and intrusion
detection. Intrusion prevention measures are taken to prevent unauthorized access to a
system. If these measures fail, intrusion detection may prove useful in determining when
unauthorized access has occurred, and what damage has been done.
A full Linux installation is a large and complex system. It's difficult to keep track of everything
that's installed, and even harder to configure each package's security features. The problem
becomes simpler when fewer packages are installed. A first step to intrusion prevention is to
remove packages you don't need. Take a look back at Part 4 of the LPI 101 series for a
review of packaging systems.
To disable services in inetd, simply comment out the appropriate line in /etc/inetd.conf by
prepending "#;" then restart inetd. (This was described previously in this tutorial, so glance
back a few panels if you need a refresher.)
To disable services in xinetd, you can do something similar with the appropriate snippet in
/etc/xinetd.d. For example, to disable telnet, either comment out the entire content of the file
/etc/xinetd.d/telnet, or simply delete the file. Restart xinetd to complete the procedure.
If you're using tcpd in conjunction with inetd, or if you're using xinetd, you also have the
option of limiting incoming connections to trusted hosts. For tcpd, see the earlier sections in
this tutorial. For xinetd, search for "only_from" in the xinetd.conf(5) man page.
Standalone servers are usually started by the init system when the system boots up or
changes runlevels. If you don't remember how runlevels work, take a look at Part 4 of the LPI
101 series.
To stop the init system from starting a server, find the symlinks to its startup script in each
runlevel directory, and delete them. The runlevel directories are usually named /etc/rc3.d or
/etc/rc.d/rc3.d (for runlevel 3). You'll also want to check the other runlevels.
Once the runlevel symlinks for the service are removed, you will still need to shut down the
currently running server. It is best to do this with the service's init script, usually found in
/etc/init.d or /etc/rc.d/init.d. For example, to shut down sshd:
# /etc/init.d/sshd stop
* Stopping sshd... [ ok ]
In addition to the standard telnet client, you should look into the possibility of using utilities for
testing the "openness" of your system. We recommend netcat and nmap.
ncat is the network Swiss Army knife: it is a simple UNIX utility that reads and writes data
across network connections, using TCP or UDP protocol. nmapis a utility for network
exploration or security auditing. Specifically, nmap scans ports to determine what's open.
You'll find links to these utilities in the last section of this tutorial, Resources.
==============================================
# telnet localhost
login: agriffis
Password:
==============================================
==============================================
Login incorrect
Be sure to delete the file when you're done with maintenance, otherwise nobody will be able
to login until you remember! Not that I've ever done this, no, not me... ;-)
The packet filter rules can be set up to do both firewall and router activities. You can inspect
your current rules with the -L option to iptables:
# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Until you're comfortable building your own ruleset, there are many scripts out there that can
get you started, as long as you trust their authors. One of the most complete is gShield (see
Resources). You can adjust its well-commented and fairly simple configuration file to set up
most normal forms of packet filter rules.
The most basic form of intrusion detection is to pay attention to your syslogs. These usually
appear in the /var/log directory, although the actual filenames will vary depending on your
distribution and configuration.
# less /var/log/messages
Feb 17 21:21:38 [kernel] Vendor: SONY Model: CD-RW CRX140E Rev: 1.0n
Feb 17 21:21:39 [kernel] eth0: generic NE2100 found at 0xe800, Version 0x031243,
DMA 3 (autodetected), IRQ 11 (autodetected).
Feb 17 21:21:39 [kernel] ne.c:v1.10 9/23/94 Donald Becker (becker@scyld.com)
Feb 17 21:22:11 [kernel] NVRM: AGPGART: VIA MVP3 chipset
Feb 17 21:22:11 [kernel] NVRM: AGPGART: allocated 16 pages
Feb 17 22:20:05 [PAM_pwdb] authentication failure; (uid=1000)
-> root for su service
Feb 17 22:20:06 [su] pam_authenticate: Authentication failure
Feb 17 22:20:06 [su] - pts/3 chouser-root
It can take some practice to understand all these messages, but most of the important ones
are fairly clear. For example, at the end of this log we can see that user "chouser" tried to use
su to become root and failed.
Tripwire is one of the most popular of these intrusion detection packages (see Resources at
the end of this tutorial for a link). Once you have installed tripwire, you must customize its
configuration file so that it knows which files should change and which should not. You will
also need to tell it how to send you reports of what has changed, and how often it should run
(usually once per day).
When you have it installed and running, you will be able to see any attempted connections
and how PortSentry responded to them in your syslog:
# tail /var/log/messages
Oct 15 00:21:24 mycroft portsentry[603]: attackalert:
SYN/Normal scan from host: 302.174.40.34/302.174.40.34 to TCP port: 111
Oct 15 00:21:24 mycroft portsentry[603]: attackalert:
Host 302.174.40.34 has been blocked via wrappers with string:
"ALL: 302.174.40.34"
The debate over whether open source or closed-source software is more secure is a hotly
debated one. The best conclusion that can be drawn to date is that they are both usually
adequate when properly administered, which includes keeping security patches up to date!
Several Web sites can help you keep your software up to date, and keep you aware of
known threats. These include the security-conscious CERT and SecurityFocus' BugTraq list,
as well as your normal software update sites like freshmeat.net and your distribution's home
page. We'll repeat these URLs also in Resources, but security is such an important issue that
-- if you are not already familiar with these sites, we do recommend that you take a few
minutes to visit the first two now.
We already mentioned nmap and netcat for testing network security. It is also a good idea to
check for weak passwords, especially if your system has multiple users. There are many
tools available, such as the ones we've put into Resources at the end of this tutorial.
Section 5. Printing
Introduction
This section will walk you through the set-up and use of the classic UNIX printing system on
Linux, sometimes called Berkeley LPD. There are other systems available for Linux that are
not covered here; see the Resources section at the end of the tutorial for information on
these.
Physically installing a printer is beyond the scope of this tutorial. Once it's correctly hooked
up, you'll want to install a print spooler daemon so that machines on the network (including
the one housing the spooler) can send print jobs to the printer.
Once it's installed, the print spooler daemon (officially the Line Printer Daemon) can be run
from the command line. Log in as a normal user and try:
$ /usr/sbin/lpd --help
--X option form illegal
usage: lpd [-FV] [-D dbg] [-L log]
Options
-D dbg - set debug level and flags
Example: -D10,remote=5
set debug level to 10, remote flag = 5
-F - run in foreground, log to STDERR
Example: -D10,remote=5
-L logfile - append log information to logfile
-V - show version info
Now that the daemon is installed, you should make sure that it's set up to run automatically.
Your distribution's LPRng package may have set this up for you already, but if not, see Part 4
of the LPI 101 series for information on using runlevels to start daemons such as lpd
automatically.
When printing on the local printer, both of ends of this "pipeline" are described by the
configuration file /etc/printcap (sometimes located at /etc/lprng/printcap). Each entry in the
printcap (which is short for printer capabilities) describes one print spool:
$ more /etc/printcap
Note that the last line of the entry does not have a trailing backslash (\).
Your distribution may have other entries, and they may be more complex, but they should all
have roughly this form. The name of this entry comes first, lp, followed by a longer
description of this spool. The keyword/value pair lp=/dev/lp0 specifies the Linux device were
print jobs in this spool will be printed, and the sd keyword gives the directory where jobs will
be held until they can be printed.
The rest of the keyword/value pairs provide details about what type of printer is hooked up to
/dev/lp0. They are described in the printcap man page, and we'll cover some of them a little
bit later.
# mkdir -p /var/spool/lpd/lp
# chown lp /var/spool/lpd/lp
# chmod 700 /var/spool/lpd/lp
# checkpc -f
# /etc/init.d/lprng restart
LPRng includes a helpful tool for checking your printcap. It will even set up the spool
directory for you, if you forget to do it manually:
# checkpc -f
Finally, restart the lpd. You'll need to do this any time you change the printcap, in order for
your changes to take effect. You may need to use lpd instead of lprng:
# /etc/init.d/lprng restart
The older Berkeley printing system doesn't include a checkpc tool, so you'll have to try
printing pages to your various printers yourself to make sure the printcap and spool
directories are correct.
up in a print spool and then printed. To try it out, first find or make a small sample text file.
Then:
$ lpr sample.txt
If it worked, you shouldn't see any response on the screen, but your printer should start
going, and soon you'll have a hard copy of your sample text. Don't worry if it doesn't come
out looking quite right; we'll set up filters a bit later that should ensure that all sorts of file
formats print correctly.
You can examine the list of print jobs in the print spool queue with the lpq command. The
-P option specifies the name of the queue to display; if you leave it off, lpq will use the
default spool, just like lpr did before:
$ lpq -Plp
Printer: lp@localhost 'Generic dot-matrix printer entry'
Queue: 1 printable job
Server: pid 1671 active
Unspooler: pid 1672 active
Rank Owner/ID Class Job Files Size Time
active chouser@localhost+670 A 670 sample.txt 8 21:57:30
If you want to stop a job from printing, use the lprm command. You might want to do this if a
job is taking to long, or if a user accidentally sends the same file more than once. Just copy
the job id from the lpq listing above:
$ lprm chouser@localhost+670
Printer lp@localhost:
checking perms 'chouser@localhost+670'
dequeued 'chouser@localhost+670'
You can do many other operations on a print spool using the interactive tool lpc. See the lpc
man page for details.
Here the name of the machine where we want to print is faraway, and the name of the
printer on that machine is lp. The spool directory, /var/spool/lpd/farawaylp, is where print jobs
will be held locally until they can be sent to the remote print spooler, where they may be
spooled again before being sent to the printer. Again, you will need to create this spool
# mkdir -p /var/spool/lpd/farawaylp
# chown lp /var/spool/lpd/farawaylp
# chmod 700 /var/spool/lpd/farawaylp
# checkpc -f
# /etc/init.d/lprng restart
Locally, we have given this remote printer the name farawaylp, so we can send print jobs to
it thusly:
The new key here is if, the input filter. Pointing this to the smbprint script will cause the print
job to be sent to a Windows server instead of the lp device. We still have to list a device
(/dev/null in this case) which the print daemon uses for locking. But no print jobs will actually
be sent there.
# mkdir -p /var/spool/lpd/smb
# chown lp /var/spool/lpd/smb
# chmod 700 /var/spool/lpd/smb
# checkpc -f
# /etc/init.d/lprng restart
In your favorite editor, create a .config file in the spool directory named above. In this case,
/var/spool/lpd/smb/.config:
server="WindowsServerName"
service="PrinterName"
password=""
user=""
Adjust these values to point to the Windows machine and printer name that you want to use,
and you're done:
The smbprint script should come with Samba, but it isn't included in all distributions. If you
can't find it on your system, you can get it from the Samba HOWTO.
Magicfilter
So far we've only tried printing text files, which isn't terribly exciting. Generally any one printer
can only print one format of graphics file -- and yet there are dozens of different formats that
we would like to print: PostScript, gif, jpeg, and many more. A program named Magicfilter
acts as an input filter, much like smbprint does. It doesn't convert the file formats, rather it
provides a framework for identifying the type of document you're trying to print, and runs it
through an appropriate conversion tool: conversion tools must be installed separately. By far,
the most important of these is Ghostscript, which can convert files from Postscript format to
the native format of many printers.
There are filters for dozens and dozens of different printers and printer settings in
/usr/share/magicfilter, so be sure you use the right one for your printer. Each of these filters
is a text file, and usually the full name of the printer is at the top. This may help you if the file
name of the filter isn't clear.
I also added a gqfilter flag to this printcap entry, which will cause the input filter to be used
even when the print job is coming from a remote client. This only works with LPRng.
Since I set up the /var/spool/lpd/lp print spool directory earlier, I only need to check my
printcap syntax and restart the server:
# checkpc -f
# /etc/init.d/lprng restart
Now you are able to print all sorts of documents, including Postscript files. In other words,
choosing "Print" from a menu in your favorite web browser should now work.
directories, printcap entries, and so on. You will still need to make sure you have Ghostscript
installed, but then you can follow the very complete instructions provided in the Apsfilter
handbook.
The netfilter home page is a good place to start learning more about iptables and the Linux
packet filter. Until you're comfortable building your own ruleset, you might want to use an
existing script for this. We recommend gShield.
Useful security tools include Tripwire, one of the most popular intrusion detection
packages, and Psionic Technologies' PortSentry, which is a cross between intrusion
prevention and detection. (The LinuxWorld article How to stop crackers with PortSentry
offers advice on installation and configuration.) Finally, be sure to become familiar with
Wietse Venema's TCP Wrappers, which allow monitoring of and control over connections to
your system. You can view the TCP wrappers README online (it's also available in
/usr/share/doc/tcp_wrappers-7.6). Authenticating users can be much easier with Pluggable
Authentication Modules (also known as PAM).
Is your network wide open? Consider trying these two utilities for checking the vulnerability
(or "openness") of your system: netcat is a simple UNIX utility that reads and writes data
across network connections, using TCP or UDP protocol; nmap is a utility for network
exploration or security auditing. Specifically, nmap scans ports to determine what's open.
Password checkers and other tools that will test how easy it is to guess your passwords
(and those of your users) include John the Ripper from the Openwall Project, built for just this
purpose. You may also want to try a comprehensive checker like SAINT.
These security sites should be among the most-visited by any systems administrator: CERT
is a federally-funded center operated by Carnegie Mellon University. They study Internet
security and vulnerabilities, publish security alerts, and research other security issues.
BugTraq, hosted by Security Focus, is a full-disclosure moderated mailing list for the detailed
discussion and announcement of computer security vulnerabilities. Even if you aren't
particularly interested in this aspect of administration, a subscription to this list can be quite
valuable, as simply scanning subject lines may alert you to vulnerabilities on your own
systems that you might otherwise discover much later, or not at all.
Some more security sites we recommend highly for getting a better grip on the security of
your Linux machines are the Linux Security HOWTO, O'Reilly's Security Page, and of course
developerWorks' Security zone (although it has a greater emphasis on secure programming
practices, it does also feature administrative security).
Printing and spooling resources you'll want to check out include the LPRng print spooler
home page and the Spooling Software overview from the Printing HOWTO. Of course, the
Printing HOWTO itself is a valuable resource, as is LinuxPrinting.org.
For help with specific printers, consult the Serial HOWTO. Also the USB guide offers
valuable information on (you guessed it) USB printers.
Samba is a great help in heterogeneous networks. When setting up printing for this kind of
environment, you will want to check out the Samba home page as well as the Samba
HOWTO, with good printer sharing details.
The two printer filters we discussed were Magicfilter and Apsfilter. Remember that both
need a conversion program (we recommend Ghostscript), as they do not do conversion
themselves. If you are using the latter filter, you may also find the Apsfilter handbook to be
quite useful.
In addition, we recommend the following general resources for learning more about Linux
and preparing for LPI certification in particular:
You'll find a wealth of guides, HOWTOs, FAQs, and man pages at http://www.linuxdoc.org.
Be sure to check out Linux Gazette and LinuxFocus as well.
The Linux Network Administrator's guide, available from Linuxdoc.org's "Guides" section, is a
good complement to this series of tutorials -- give it a read! You may also find Eric S.
Raymond's Unix and Internet Fundamentals HOWTO to be helpful.
In the Bash by example article series on developerWorks, learn how to use bash
programming constructs to write your own bash scripts. This series (particularly parts 1 and
2) are excellent additional preparation for the LPI exam:
The Technical FAQ for Linux Users by Mark Chapman is a 50-page in-depth list of
frequently-asked Linux questions, along with detailed answers. The FAQ itself is in PDF
(Acrobat) format. If you're a beginning or intermediate Linux user, you really owe it to yourself
to check this FAQ out. The Linux glossary for Linux users, also from Mark, is also excellent.
If you're not too familiar with the vi editor, you should check out Daniel's tutorial on Vi. This
developerWorks tutorial will give you a gentle yet fast-paced introduction to this powerful text
editor. Consider this must-read material if you don't know how to use vi.
For more information on the Linux Professional Institute, visit the LPI home page.
Your feedback
We look forward to getting your feedback on this tutorial. Additionally, you are welcome to
contact the lead author, Daniel Robbins, directly at drobbins@gentoo.org.
Colophon
This tutorial was written entirely in XML, using the developerWorks Toot-O-Matic tutorial
generator. The open source Toot-O-Matic tool is an XSLT stylesheet and several XSLT
extension functions that convert an XML file into a number of HTML pages, a zip file, JPEG
heading graphics, and two PDF files. Our ability to generate multiple text and binary formats
from a single source file illustrates the power and flexibility of XML. (It also saves our
production team a great deal of time and effort.)