Before you install any operating system on your computer, set up a BIOS password and change the boot sequence to disable booting from floppy, cdrom and other devices that shouldn't boot. Otherwise a cracker only needs physical access and a boot disk to access your entire system.
Disabling booting without a password is even better. This can be very effective if you run a server, because it is not rebooted very often. The downside to this tactic is that rebooting requires human intervention which can cause problems if the machine is not easily accessible.
An intelligent partition scheme depends on the how the machine is used. A good rule of thumb is to be fairly liberal with your partitions and to pay attention to the following factors:
The system you are going to install should not be inmediately connected to the Internet during installation. This could sound stupid but is usually done. Since the system will install and activate services inmediately, if the system is connected to the Internet and the services are not properly configured you are opening it to attack.
Also note that some services might have new security vulnerabilities not fixed in the packages you are using for installation. This is usually true if you are installing from old media (like CD-ROMs). In this case, it could even be compromised before you even finished installation!
Since Debian installation and upgrades can be done over the Internet you might
think it is a good idea to use this feature on installation. If the system is
going to be directly connected to the Internet (and not protected by a firewall
or NAT), it is best to install without connection to the Internet and using a
local packages mirror from both the Debian package sources and the security
updates. You can setup package mirrors by using another system connected to
the Internet and Debian-specific (if it's a Debian system) tools like
apt-move
or apt-proxy
or other common mirroring tools
to provide the archive to the installed system.
Setting a good root password is the most basic requirement for having a secure system.
At the end of the installation, you will be asked if shadow passwords should be
enabled. Answer yes to this question, so passwords will be kept in the file
/etc/shadow
. Only the root user and the group shadow have read
access to this file, so no users will be able to grab a copy of this file in
order to run a password cracker against it. You can switch between shadow
passwords and normal passwords at any time by using shadowconfig.
Furthermore you are queried during installation whether you want to use MD5
hashed passwords. This is generally a very good idea since it allows longer
passwords and better encryption.
Read more on Shadow passwords in Shadow
Password
(/usr/share/doc/HOWTO/en-txt/Shadow-Password.txt.gz
).
Services are programmes such as ftp servers and web servers. Since they have to be listening for incoming connections that request the service external computers can connect to yours. Services are sometimes vulnerable (i.e. can be compromised under a given attack) and are hence a security risk.
You should not install services which are not needed on your machine. Every installed service might introduce new, perhaps not obvious (or known), security holes on your computer.
As you may already know, when you install a given service the default behavior is to activate it. In a default Debian installation, with no services installed, the footprint of running services is quite low and it's even lower when talking about services offered in the network. The footprint in Debian 2.1 wasn't as tight as in Debian 2.2 (some inetd services were enabled by default) and in Debian 2.2 the rpc portmapper is enabled upon installation. Rpc is installed by default because it is needed for many services, for example NFS, to run on a given system. It can be easily removed, however, see Disabling daemon services, Section 3.6.1 on how to disable it.
When you install a new network-related service (daemon) in your Debian
GNU/Linux system it can be enabled in two ways: through the inetd superdaemon
(i.e. a line will be added to /etc/inetd.conf
) or through a
standalone program that binds itself to your network interfaces. Standalone
programs are controlled through the /etc/init.d
files, which are
called at boot time through the SysV mechanism (or an alternative one) by using
symlinks in /etc/rc?.d/*
(for more information on how this is done
read /usr/share/doc/sysvinit/README.runlevels.gz
).
If you still want to have some services but you use these rarely, use the update-commands, e.g. 'update-inetd' and 'update-rc.d' for removing them from the startup process.
Disabling a daemon service is quite simple. There are different methods:
/etc/rc${runlevel}.d/
or rename the links (so
that they do not begin with 'S')
/etc/init.d/_service_name_
) to another name
(for example /etc/init.d/OFF._service_name_
)
/etc/init.d/_service_name_
file.
/etc/init.d/_service_name_
script to have it stop
inmediately.
You can remove the links from /etc/rc${runlevel}.d/ manually or using
update-rc.d (see update-rc.d(8)
). For example, you
can disable a service from executing in the multi-user runlevels by doing:
update-rc.d stop XX 2 3 4 5 .
Please note that, if you are not using file-rc
,
update-rc.d -f _service_ remove will not work properly, since
all links are removed, upon re-installation or upgrade of the package
this links will be re-generated (probably not what you wanted). If you think
this is not intuitive you are probably right (see Bug 67095
. From the manpage:
If any files /etc/rcrunlevel.d/[SK]??name already exist then update-rc.d does nothing. This is so that the system administrator can rearrange the links, provided that they leave at least one link remaining, without having their configuration overwritten.
If you are using file-rc
all the information regarding services
bootup is handled by a common configuration file and is maintained even if
packages are removed from the system.
You can use the TUI (Text User Interface) provided by rcconf
to do
all this changes easily (rcconf
works both for file-rc and normal
System V runlevels).
Other (not recommended) methods of disabling services are: chmod 644
/etc/init.d/daemon (but that gives an error message when booting), or
modifying the /etc/init.d/daemon
script (by adding an exit
0
line at the beginning or commenting out the
start-stop-daemon part in it). Since init.d files are
configfiles, they will not get overwritten upon upgrade.
Unfortunately, unlike other (UNIX) operating systems, services in Debian cannot
be disabled by modifying files in /etc/default/_servicename_
.
FIXME: Add more information on handling daemons using file-rc
You should stop all unneeded services on your system, like echo, chargen, discard, daytime, time, talk, ntalk and r-services (rsh, rlogin and rcp) which are considered HIGHLY insecure (use ssh instead). After disabling those, you should check if you really need the inetd daemon. Many people prefer to use daemons instead of calling services via inetd. Denial of Service possibilities exist against inetd, which can increase the machine's load tremendously. If you still want to run some kind of inetd service, switch to a more configurable inet daemon like xinetd or rlinetd.
You can disable services by editing /etc/inetd.conf
directly, but
Debian provides a better alternative to do this: update-inetd
(which comments the services in a way that it can easily be turned on again).
You could remove the telnet daemon by executing this commands to change the
config file and to restart the daemon (in this case the telnet service is
disabled):
/usr/sbin/update-inetd --disable telnet
If you do want services listening, but do not want to have them listen on all
IP addresses of your host, you might want to use some undocumented feature on
inetd. . Or use an alternate inetd daemon like xinetd
.
It is never wrong to take a look at either the debian-security-announce mailing list, where advisories and fixes to released packages are announced by the Debian security team, or at debian-security@lists.debian.org, where you can participate in discussions about things related to Debian security.
In order to receive important security update alerts, send an email to debian-security-announce-request@lists.debian.org
with the word "subscribe" in the subject line. You can also
subscribe to this moderated email list via the web page at http://www.debian.org/MailingLists/subscribe
This mailing list has very low volume, and by subscribing to it you will be immediately alerted of security updates for the Debian distribution. This allows you to quickly download new packages with security bug fixes, which is very important in maintaining a secure system. (See Execute a security update, Section 4.5 for details on how to do this.)
Securing Debian Manual
v2.2 27 april 2002Tue, 23 Apr 2002 20:56:15 +0200jfs@computer.org