Product SiteDocumentation Site

Capítulo 12. Preguntas Frecuentes

12.1. La seguridad en el sistema operativo Debian
12.1.1. ¿Es más seguro Debian que X?
12.1.2. My system is vulnerable! (Are you sure?)
12.2. Software específico
12.2.1. Proftpd es vulnerable a un ataque en el servicio Denial.
12.2.2. After installing portsentry, there are a lot of ports open.
12.3. Preguntas con respecto al equipo de seguridad Debian
Este capítulo introduce algunas de las preguntas más comunes de la lista de seguridad de Debian. Debería leerlas antes de preguntar o la gente posiblemente le diga RTFM (N.T. Read The Fucking Manual - Lea el P*to Manual).

12.1. La seguridad en el sistema operativo Debian

12.1.1. ¿Es más seguro Debian que X?

Un sistema es sólo tan seguro como su administrador es capaz de hacerlo. La instalación predeterminada de Debian de servicios trata de ser segura, pero puede no ser tan paranoica como la de otros sistemas operativos que instalan todos los servicios deshabilitados de manera predeterminada. En cualquier caso, el administrador del sistema necesita adaptar la seguridad del sistema a su política de seguridad local. Para ver una recopilación de datos acerca de vulnerabilidades de seguridad de muchos sistemas operativos mire en http://securityfocus.com/vulns/stats.shtml. ¿Le son útiles estos datos? El servidor lista varios factores a considerar cuando se interpretan los datos y avisa de que los datos no pueden usarse para comparar las vulnerabilidades de un sistema operativo frente a otro.[72]Tenga también en mente que alguna de las vulnerabilidades de BugTraq que afectan a Debian se aplican sólo a la rama unstable.
For a collection of data regarding security vulnerabilities for many operating systems, see the http://www.cert.org/stats/cert_stats.html or generate stats using the http://nvd.nist.gov/statistics.cfm (formerly ICAT) Is this data useful? There are several factors to consider when interpreting the data, and it is worth noticing that the data cannot be used to compare the vulnerabilities of one operating system versus another.[73] Also, keep in mind that some reported vulnerabilities regarding Debian apply only to the unstable (i.e. unreleased) branch.

12.1.1.1. Is Debian more secure than other Linux distributions (such as Red Hat, SuSE...)?

There are not really many differences between Linux distributions, with exceptions to the base installation and package management system. Most distributions share many of the same applications, with differences mainly in the versions of these applications that are shipped with the distribution's stable release. For example, the kernel, Bind, Apache, OpenSSH, Xorg, gcc, zlib, etc. are all common across Linux distributions.
For example, Red Hat was unlucky and shipped when foo 1.2.3 was current, which was then later found to have a security hole. Debian, on the other hand, was lucky enough to ship foo 1.2.4, which incorporated the bug fix. That was the case in the big http://www.cert.org/advisories/CA-2000-17.html problem from a couple years ago.
There is a lot of collaboration between the respective security teams for the major Linux distributions. Known security updates are rarely, if ever, left unfixed by a distribution vendor. Knowledge of a security vulnerability is never kept from another distribution vendor, as fixes are usually coordinated upstream, or by http://www.cert.org. As a result, necessary security updates are usually released at the same time, and the relative security of the different distributions is very similar.
One of Debian's main advantages with regards to security is the ease of system updates through the use of apt. Here are some other aspects of security in Debian to consider:

12.1.1.2. Hay muchos errores de Debian en Bugtraq. ¿Significa eso que es muy vulnerable?

The Debian distribution boasts a large and growing number of software packages, probably more than provided by many proprietary operating systems. The more packages installed, the greater the potential for security issues in any given system.
Más y más personas están examinando el código fuente en busca de debilidades. Hay muchos avisos acerca de auditorías del código fuente de los componentes más importantes de Debian. Cuando esas auditorías de código fuente descubren vulnerabilidades, se solucionan y se envía un aviso a las listas y a Bugtraq.
Bugs that are present in the Debian distribution usually affect other vendors and distributions as well. Check the "Debian specific: yes/no" section at the top of each advisory (DSA).

12.1.1.3. Does Debian have any certification related to security?

Short answer: no.
Long answer: certification costs money (specially a serious security certification), nobody has dedicated the resources in order to certify Debian GNU/Linux to any level of, for example, the http://niap.nist.gov/cc-scheme/st/. If you are interested in having a security-certified GNU/Linux distribution, try to provide the resources needed to make it possible.
There are currently at least two linux distributions certified at different http://en.wikipedia.org/wiki/Evaluation_Assurance_Level levels. Notice that some of the CC tests are being integrated into the http://ltp.sourceforge.net which is available in Debian in the ltp.

12.1.1.4. ¿Hay algún programa de securización para Debian?

Sí. http://www.bastille-unix.org, originalmente orientado hacia otras distribuciones de Linux (RedHat y Mandrake), actualmente funciona para Debian. Los pasos están siendo tomados para integrar los cambios hechos a la versión original al paquete Debian llamado bastille.
Sin embargo, algunas personas creen que una herramienta de securización no elimina la necesidad de una buena administración.

12.1.1.5. I want to run XYZ service, which one should I choose?

One of Debian's great strengths is the wide variety of choice available between packages that provide the same functionality (DNS servers, mail servers, ftp servers, web servers, etc.). This can be confusing to the novice administrator when trying to determine which package is right for you. The best match for a given situation depends on a balance between your feature and security needs. Here are some questions to ask yourself when deciding between similar packages:
  • Is the software maintained upstream? When was the last release?
  • Is the package mature? The version number really does not tell you about its maturity. Try to trace the software's history.
  • Is the software bug-ridden? Have there been security advisories related to it?
  • Does the software provide all the functionality you need? Does it provide more than you really need?

12.1.1.6. Quiero ejecutar el servicio XYZ, ¿cuál debería elegir?

Una de las mayores fortalezas de Debian es la gran variedad de elecciones posibles entre paquetes que proporcionan la misma funcionalidad (servidores de DNS, servidores de correo, servidores de FTP, servidores WEB, etc.). Eso puede resultar confuso para el administrador novel al tratar de determinar que paquete es el adecuado. La mejor opción para una situación concreta se basa en el compromiso entre su funcionalidad y los requerimientos de seguridad. Hay algunas preguntas que debe contestar antes de decidir entre paquetes similares:

12.1.1.7. How can I remove all the banners for services?

If you do not like users connecting to your POP3 daemon, for example, and retrieving information about your system, you might want to remove (or change) the banner the service shows to users. [75] Doing so depends on the software you are running for a given service. For example, in postfix, you can set your SMTP banner in /etc/postfix/main.cf:
 
  smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
Other software is not as easy to change. ssh will need to be recompiled in order to change the version that it prints. Take care not to remove the first part (SSH-2.0) of the banner, which clients use to identify which protocol(s) is supported by your package.

12.1.1.8. ¿Son seguros todos los paquetes de Debian?

The Debian security team cannot possibly analyze all the packages included in Debian for potential security vulnerabilities, since there are just not enough resources to source code audit the whole project. However, Debian does benefit from the source code audits made by upstream developers.
De todas formas un desarrollador Debian podría distribuir un troyano en un paquete y no habría forma posible de comprobarlo. Incluso si se introduce en una rama de Debian, podría ser imposible cubrir todas las posibles situaciones en las que un troyano puede ejecutarse. Esa es la razón por la que Debian tiene una cláusula de "no garantías" en su licencia.
Aun así, los usuarios de Debian tiene confianza en el hecho de que el código estable tiene una gran audiencia y la mayoría de los problemas pueden descubrirse con el uso. Instalar programas no probados no es recomendable en un sistema crítico (si no puede hacer la auditoría de código necesaria). En cualquier caso, si se introduce una vulnerabilidad de seguridad en una distribución, el proceso que se usa para incluir paquetes (usando firma digital) asegura que el problema puede seguirse hasta el desarrollador. El proyecto Debian no se ha tomado a la ligera este tema.

12.1.1.9. Why are some log files/configuration files world-readable, isn't this insecure?

Of course, you can change the default Debian permissions on your system. The current policy regarding log files and configuration files is that they are world readable unless they provide sensitive information.
Be careful if you do make changes since:
  • Processes might not be able to write to log files if you restrict their permissions.
  • Some applications may not work if the configuration file they depend on cannot be read. For example, if you remove the world-readable permission from /etc/samba/smb.conf, the smbclient program will not work when run by a normal user.
FIXME: Check if this is written in the Policy. Some packages (i.e. ftp daemons) seem to enforce different permissions.

12.1.1.10. Why does /root/ (or UserX) have 755 permissions?

As a matter of fact, the same questions stand for any other user. Since Debian's installation does not place any file under that directory, there's no sensitive information to protect there. If you feel these permissions are too broad for your system, consider tightening them to 750. For users, read Sección 4.11.19.1, “Limitar el acceso a los datos de otros usuarios”.
This Debian security mailing list http://lists.debian.org/debian-devel/2000/debian-devel-200011/msg00783.html has more on this issue.

12.1.1.11. After installing a grsec/firewall, I started receiving many console messages! How do I remove them?

If you are receiving console messages, and have configured /etc/syslog.conf to redirect them to either files or a special TTY, you might be seeing messages sent directly to the console.
The default console log level for any given kernel is 7, which means that any message with lower priority will appear in the console. Usually, firewalls (the LOG rule) and some other security tools log lower that this priority, and thus, are sent directly to the console.
To reduce messages sent to the console, you can use dmesg (-n option, see dmseg(8)), which examines and controls the kernel ring buffer. To fix this after the next reboot, change /etc/init.d/klogd from:
  KLOGD=""
para:
  KLOGD="-c 4"
Use a lower number for -c if you are still seeing them. A description of the different log levels can be found in /usr/include/sys/syslog.h:
  #define LOG_EMERG       0       /* system is unusable */
  #define LOG_ALERT       1       /* action must be taken immediately */
  #define LOG_CRIT        2       /* critical conditions */
  #define LOG_ERR         3       /* error conditions */
  #define LOG_WARNING     4       /* warning conditions */
  #define LOG_NOTICE      5       /* normal but significant condition */
  #define LOG_INFO        6       /* informational */
  #define LOG_DEBUG       7       /* debug-level messages */

12.1.1.12. Usuarios y grupos del sistema operativo

12.1.1.12.1. ¿Son necesarios todos los usuarios del sistema?
Yes and no. Debian comes with some predefined users (user id (UID) < 99 as described in http://www.debian.org/doc/debian-policy/ or /usr/share/doc/base-passwd/README) to ease the installation of some services that require that they run under an appropriate user/UID. If you do not intend to install new services, you can safely remove those users who do not own any files in your system and do not run any services. In any case, the default behavior is that UID's from 0 to 99 are reserved in Debian, and UID's from 100 to 999 are created by packages on install (and deleted when the package is purged).
To easily find users who don't own any files, execute the following command[76] (run it as root, since a common user might not have enough permissions to go through some sensitive directories):
  cut -f 1 -d : /etc/passwd | \
  while read i; do find / -user "$i" | grep -q . || echo "$i"; done
Estos usuarios son del paquete base-passwd. Mire en su documentación si quiere más información acerca de cómo se gestionan estos usuarios en Debian. La lista de usuarios predeterminados (con su grupo correspondiente) es la siguiente:
  • root: Root es (típicamente) el super usuario.
  • daemon: Algunos demonios sin privilegios que necesitan escribir en archivos del del disco se ejecutan como daemon.daemon (p.e., portmap, atd, y probablemente otros). Los demonios que no necesitan tener ningún archivo corren como nobody.nogroup, algunos otros demonios más complejos se ejecutan con usuarios dedicados. El usuario del demonio es también útil para demonios instalados localmente.
  • bin: mantenido por razones históricas.
  • sys: igual que bin. Aun así, /dev/vcs* y /var/spool/cups son del usuario y grupo sys.
  • sync: La shell del usuario sync es /bin/sync. Aun así si su contraseña se pone fácil de adivinar (como ""), cualquiera puede sincronizar el sistema en la consola incluso si no tiene cuenta.
  • games: Muchos juegos tienen SETGID de manera que puedan escribir sus propios archivos de puntuación más alta. Se explica en la política.
  • man: El programa man (a veces) se ejecuta con el usuario man, para que pueda escribir páginas en /var/cache/man.
  • lp: Usado por los demonios de impresión.
  • mail: los buzones de /var/mail son del grupo mail, como se explica en la política. El usuario y grupo se usan también con otros propósitos por varios MTAs.
  • news: Varios servidores de noticias y programas asociados (como suck) usan el usuario y grupo news de varias formas. Los archivos en la cola news son habitualmente del usuario y grupo news. Programas como inews que pueden usarse para enviar noticias son típicamente noticias con SETGID.
  • uucp: El usuario y grupo uucp es usado por el subsistema UUCP. Tiene su propia cola y archivos de configuración. Los usuarios en el grupo uucp pueden ejecutar uucico.
  • proxy: Como daemon, este usuario y grupo lo usan algunos demonios (especialmente demonios de proxy) que no tienen usuarios dedicados y necesitan tener archivos. Por ejemplo el grupo proxy lo usan pdnsd, y squid.
  • majordom: Majordomo tiene un UID estático en sistemas Debian por razones históricas. No se instala en sistemas nuevos.
  • postgres: Las bases de datos de Postgresql son de este usuario y grupo. Todos los archvos de /var/lib/postgresql son de este usuario para reforzar la seguridad.
  • www-data: Algunos servidores web corren como www-data. El contenido *no* debe ser de este usuario o un servidor comprometido podría reescribir el web. Los datos escritos por el servidor web incluyendo los archivos de registro, deben ser de www-data.
  • backup: Muchas funciones de copia/restauración pueden ser delegadas a alguien sin privilegios completos de root.
  • operator: Operator es históricamente (y prácticamente) el único 'usuario' que puede acceder al sistema de forma remota y no depende de NIS/NFS.
  • list: Los archivos de listas de correo y sus datos son de este usuario y grupo. Algunos programas de listas de correo pueden ejecutarse también con este usuario.
  • irc: Usado por demonios de IRC. Un usuario determinado se necesita únicamente por un error de ircd, que hace SETUID()s de si mismo a un UID determinado en el arranque.
  • gnats.
  • nobody, nogroup: Los demonios que no necesitan ningún archivo se ejecutan con el usuario nobody y grupo nogroup. Así que no debería existir ningún archivo de este usuario o grupo en el sistema.
Otros grupos que no tienen un usuario asociado:
  • adm: El grupo adm se usa para tareas de monitorización del sistema. Los miembros de este grupo pueden leer muchos de los archivos de /var/log, y pueden usar xconsole. Históricamente /var/log eran /usr/adm (y más tarde /var/adm), del mismo grupo.
  • tty: Los dispositivos TTY son de este grupo. Lo usan write y wall para escribir en los TTYs de otras personas.
  • disk: Acceso directo a disco. Mayormente equivalente al acceso de root.
  • kmem: /dev/kmem y archivos similares son accesibles en modo lectura por este grupo. Esto es, mayormente, una reliquia de BSD pero algunos programas siguen necesitando acceso directo de lectura a la memoria del sistema que se hace con SETGID kmem.
  • dialout: Acceso directo y completo a los puertos serie. Los miembros de este grupo pueden reconfigurar el módem, llamar a cualquier parte, etc.
  • dip: El nombre del grupo viene de "Dial-up IP", y ser de ese grupo le permite usar herramientas como ppp, dip, wvdial, etc. para comenzar una conexión. La mayoría de los usuarios de este grupo no pueden configurar el módem, pero pueden ejecutar programas que lo usa.
  • fax: Permite a los miembros usar el programa de fax para enviar / recibir faxes.
  • voice: Voicemail, usado por sistemas que usan módems como contestadores.
  • cdrom: Este grupo puede ser usado localmente para dar acceso al CDROM a los usuarios.
  • floppy: Este grupo puede ser usado localmente para dar acceso a la disquetera a los usuarios.
  • tape: Este grupo puede ser usado localmente para dar acceso a la cinta a los usuarios.
  • sudo: Los miembros de este grupo no necesitan teclear la contraseña cuando usen el programa sudo. Mire /usr/share/doc/sudo/OPTIONS.
  • audio: Este grupo puede ser usado localmente para dar acceso a los usuarios al dispositivo de audio.
  • src: Este grupo tiene el código fuente incluyendo los archivos de /usr/src. Puede usarse para darle al usuario la capacidad de gestionar el sistema de código fuente.
  • shadow: /etc/shadow es de lectura para este grupo. Algunos programas que necesitan acceso a este archivo tienen SETGID shadow.
  • utmp: Este grupo puede escribir en /var/run/utmp y archivos similares. Los programas que necesitan escribir ahí tienen SETGID utmp.
  • video: Este grupo puede ser usado para dar a los usuarios acceso al dispositivo de video.
  • staff: Permite a los usuarios añadir modificaciones locales al sistema (/usr/local, /home) sin necesidad de tener privilegios de root. Comparar con el grupo "adm", que está más relacionado con monitorización/seguridad.
  • users: Mientras los sistemas Debian usan el sistema de usuarios privados de forma predeterminada (cada usuario tiene su propio grupo), algunos prefieren un sistema de grupos más tradicional, en el que cada usuario es miembro de este grupo.
12.1.1.12.2. I removed a system user! How can I recover?
If you have removed a system user and have not made a backup of your password and group files you can try recovering from this issue using update-passwd (see update-passwd(8)).
12.1.1.12.3. ¿Qué diferencia hay entre el grupo adm y el staff?
The 'adm' group are usually administrators, and this group permission allows them to read log files without having to su. The 'staff' group are usually help-desk/junior sysadmins, allowing them to work in /usr/local and create directories in /home.

12.1.1.13. Why is there a new group when I add a new user? (or Why does Debian give each user one group?)

The default behavior in Debian is that each user has its own, private group. The traditional UN*X scheme assigned all users to the users group. Additional groups were created and used to restrict access to shared files associated with different project directories. Managing files became difficult when a single user worked on multiple projects because when someone created a file, it was associated with the primary group to which they belong (e.g. 'users').
Debian's scheme solves this problem by assigning each user to their own group; so that with a proper umask (0002) and the SETGID bit set on a given project directory, the correct group is automatically assigned to files created in that directory. This makes it easier for people who work on multiple projects, because they will not have to change groups or umasks when working on shared files.
You can, however, change this behavior by modifying /etc/adduser.conf. Change the USERGROUPS variable to 'no', so that a new group is not created when a new user is created. Also, set USERS_GID to the GID of the users group which all users will belong to.

12.1.1.14. Cuestiones sobre servicios en ejecución y puertos abiertos.

12.1.1.14.1. ¿Por qué están todos los servicios activados tras la instalación?
Es una aproximación al problema de, por una parte la seguridad y por otra la usabilidad. Al contrario que como OpenBSD, deshabilita los servicios a no ser que los habilite el administrador, Debian GNU/Linux habilitará todos los servicios instalados a no ser que se desactiven (mire en Sección 3.5.1, “Deshabilitar servicios” para ver más información). Después de todo usted instaló el servicio ¿no es así?
There has been much discussion on Debian mailing lists (both at debian-devel and at debian-security) regarding which is the better approach for a standard installation. However, as of this writing (March 2002), there still isn't a consensus.
12.1.1.14.2. Can I remove inetd?
Inetd no es fácil de eliminar porque netbase depende del paquete que lo provee (netkit-inetd). Si quiere deshabilitarlo (mire disableserv o elimine el paquete usando el paquete equivs).
12.1.1.14.3. ¿Por qué tengo abierto el puerto 111?
El puerto 111 es el portmapper de sunrpc y se instala de manera predeterminada como parte del sistema base de Debian porque no se sabe cuando un programa de usuario necesitará usar RPC para funcionar correctamente. En cualquier caso, se usa mayormente en NFS. Si no lo necesita, elimínelo tal y como se explica en rpc.
In versions of the portmap package later than 5-5 you can actually have the portmapper installed but listening only on localhost (by modifying /etc/default/portmap)
12.1.1.14.4. What use is identd (port 113) for?
Identd service is an authentication service that identifies the owner of a specific TCP/IP connection to the remote server accepting the connection. Typically, when a user connects to a remote host, inetd on the remote host sends back a query to port 113 to find the owner information. It is often used by mail, FTP and IRC servers, and can also be used to track down which user in your local system is attacking a remote system.
There has been extensive discussion on the security of identd (See http://lists.debian.org/debian-security/2001/debian-security-200108/msg00297.html). In general, identd is more helpful on a multi-user system than on a single user workstation. If you don't have a use for it, disable it, so that you are not leaving a service open to the outside world. If you decide to firewall the identd port, please use a reject policy and not a deny policy, otherwise a connection to a server utilizing identd will hang until a timeout expires (see http://logi.cc/linux/reject_or_deny.php3).
12.1.1.14.5. I have services using port 1 and 6, what are they and how can I remove them?
If you have run the command netstat -an and receive:
  Active Internet connections (servers and established)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State
  PID/Program name
  raw        0      0 0.0.0.0:1               0.0.0.0:*               7
  -
  raw        0      0 0.0.0.0:6               0.0.0.0:*               7
  -
You are not seeing processes listening on TCP/UDP port 1 and 6. In fact, you are seeing a process listening on a raw socket for protocols 1 (ICMP) and 6 (TCP). Such behavior is common to both legitimate software like intrustion detection systems, such as iplogger and portsentry, but some trojans have also been known yo use them. If you have the mentioned packages simply remove them to close the port. If you do not, try netstat's -p (process) option to see which process is running these listeners.
12.1.1.14.6. I found the port XYZ open, can I close it?
Por supuesto que puede, usted puede ir dejando los portales abiertos en su sitio de política, fortaleciendo los servicios públicos disponibles para otros sistemas. Revise si estos son abiertos por inetd (observe Sección 3.5.2, “Disabling inetd or its services”) o por otros paquetes instalados y tómelo en medidas apropiadas (configure inetd, remueva el paquete, anule el funcionamiento en bootup...).
12.1.1.14.7. Will removing services from /etc/services help secure my box?
No, /etc/services solo suministra un mapping desde un nombre virtual a un acceso numérico dado, removiendo nombres desde (usualmente) donde no haya que impedir servicios al ser iniciados. Algunos demonios no podrán funcionar si /etc/services ha sido modificado, pero ésta no es la norma y no es la vía recomendable para hacerlo, observe disableserv.

12.1.1.15. Common security issues

12.1.1.15.1. ¡¡He perdido mi password y no puedo tener acceso al sistema!!
Usted necesita seguir unos pasos para recuperar su password y este depende desi usted ha aplicado o no el procedimiento para limitar el acceso a Lilo y BIOS.
Si usted ha limitado a ambos. Necesita desactivar las características de BIOS (hágalo solo desde el disco duro) antes de proceder, además, si usted olvida el password de BIOS, tendrá que abrir el sistema y eliminar la batería BIOS manualmente.
Once you have enabled booting from a CD-ROM or diskette enable, try the following:
  • inicie desde un disco de rescate e inicie el kernel.
  • desplácese hasta la consola virtual (Alt+F2)
  • monte el disco duro, en donde está su /root
  • edite (El disco de rescate Debian 2.2, viene con ae, Debian 3.0 viene con nano-tiny, el cual es similar a vi) /etc/shadow y modifique la línea:
    root:asdfjl290341274075:XXXX:X:XXXX:X::: (X=cualquier número)
    para:
    root::XXXX:X:XXXX:X:::
This will remove the forgotten root password, contained in the first colon separated field after the user name. Save the file, reboot the system and login with root using an empty password. Remember to reset the password. This will work unless you have configured the system more tightly, i.e. if you have not allowed users to have null passwords or not allowed root to login from the console.
Si usted ha introducido también estas características, usted necesitará entrar en el modo single. LILO no necesita ser limitado si usted ha hecho esto también, necesitará reiniciar lilo justo después que el administrador lo reajusta. Esto es totalmente difícil desde que su /etc/lilo.conf necesite ser atrapado por tener un / sistema de archivo, que es un disco de la memoria ram y no del verdadero disco duro.
Once LILO is unrestricted, try the following:
  • Presionar Alt, shift o la tecla Control, antes que el sistema BIOS finalice, usted debería obtener la entrada LILO.
  • Type linux single, linux init=/bin/sh or linux 1 at the prompt.
  • usted debería obtener una entrada a interfaz de comando en el modo singleuser (este solicitará la clave, aunque usted ya la conozca).
  • Re-mount read/write the root (/) partition, using the mount command.
      # mount -o remount,rw /
  • Cambiar la clave del superusuario con passwd (desde que usted sea el superusuario, no se le solicitará la clave anterior).

12.1.1.16. How do I accomplish setting up a service for my users without giving out shell accounts?

For example, if you want to set up a POP service, you don't need to set up a user account for each user accessing it. It's best to set up directory-based authentication through an external service (like Radius, LDAP or an SQL database). Just install the appropriate PAM library (libpam-radius-auth, libpam-ldap, libpam-pgsql or libpam-mysql), read the documentation (for starters, see Sección 4.11.1, “Uso de la autentificación: PAM”) and configure the PAM-enabled service to use the back end you have chosen. This is done by editing the files under /etc/pam.d/ for your service and modifying the
 
  auth   required    pam_unix_auth.so shadow nullok use_first_pass
to, for example, ldap:
  auth   required    pam_ldap.so
In the case of LDAP directories, some services provide LDAP schemas to be included in your directory that are required in order to use LDAP authentication. If you are using a relational database, a useful trick is to use the where clause when configuring the PAM modules. For example, if you have a database with the following table attributes:
  (user_id, user_name, realname, shell, password, UID, GID, homedir, sys, pop, imap, ftp)
By making the services attributes boolean fields, you can use them to enable or disable access to the different services just by inserting the appropriate lines in the following files:
  • /etc/pam.d/imap:where=imap=1.
  • /etc/pam.d/qpopper:where=pop=1.
  • /etc/nss-mysql*.conf:users.where_clause = user.sys = 1;.
  • /etc/proftpd.conf: SQLWhereClause "ftp=1".

12.1.2. My system is vulnerable! (Are you sure?)

12.1.2.1. Vulnerability assessment scanner X says my Debian system is vulnerable!

Many vulnerability assessment scanners give false positives when used on Debian systems, since they only use version checks to determine if a given software package is vulnerable, but do not really test the security vulnerability itself. Since Debian does not change software versions when fixing a package (many times the fix made for newer releases is back ported), some tools tend to think that an updated Debian system is vulnerable when it is not.
If you think your system is up to date with security patches, you might want to use the cross references to security vulnerability databases published with the DSAs (see Sección 7.2, “Avisos de seguridad de Debian”) to weed out false positives, if the tool you are using includes CVE references.

12.1.2.2. I've seen an attack in my system's logs. Is my system compromised?

A trace of an attack does not always mean that your system has been compromised, and you should take the usual steps to determine if the system is indeed compromised (see Capítulo 11, After the compromise (incident response)). Even if your system was not vulnerable to the attack that was logged, a determined attacker might have used some other vulnerability besides the ones you have detected.

12.1.2.3. I have found strange 'MARK' lines in my logs: Am I compromised?

You might find the following lines in your system logs:
  Dec 30 07:33:36 debian -- MARK --
  Dec 30 07:53:36 debian -- MARK --
  Dec 30 08:13:36 debian -- MARK --
This does not indicate any kind of compromise, and users changing between Debian releases might find it strange. If your system does not have high loads (or many active services), these lines might appear throughout your logs. This is an indication that your syslogd daemon is running properly. From syslogd(8):
       -m interval
              The syslogd logs a mark timestamp  regularly.   The
              default interval between two -- MARK -- lines is 20
              minutes.  This can be  changed  with  this  option.
              Setting the interval to zero turns it off entirely.

12.1.2.4. I found users using 'su' in my logs: Am I compromised?

Usted puede encontrar líneas en sus bitácoras como:
  Apr  1 09:25:01 server su[30315]: + ??? root-nobody
  Apr  1 09:25:01 server PAM_unix[30315]: (su) session opened for user nobody by (UID=0)
No se preocupe tanto, revise si esto se debe a un trabajo en funcionamiento a través de cron (usualmente con /etc/cron.daily/find o logrotate):
$ grep 25 /etc/crontab
25 6 * * * root test -e /usr/sbin/anacron || run-parts --report
/etc/cron.daily
$ grep nobody /etc/cron.daily/*
find:cd / || updatedb --localuser=nobody 2>/dev/null

12.1.2.5. I have found 'possible SYN flooding' in my logs: Am I under attack?

If you see entries like these in your logs:
  May 1 12:35:25 linux kernel: possible SYN flooding on port X. Sending cookies.
  May 1 12:36:25 linux kernel: possible SYN flooding on port X. Sending cookies.
  May 1 12:37:25 linux kernel: possible SYN flooding on port X. Sending cookies.
  May 1 13:43:11 linux kernel: possible SYN flooding on port X. Sending cookies.
Check if there is a high number of connections to the server using netstat, for example:
  linux:~# netstat -ant | grep SYN_RECV | wc -l
     9000
This is an indication of a denial of service (DoS) attack against your system's X port (most likely against a public service such as a web server or mail server). You should activate TCP syncookies in your kernel, see Sección 4.18.2, “Configuring syncookies”. Note, however, that a DoS attack might flood your network even if you can stop it from crashing your systems (due to file descriptors being depleted, the system might become unresponsive until the TCP connections timeout). The only effective way to stop this attack is to contact your network provider.

12.1.2.6. I have found strange root sessions in my logs: Am I compromised?

You might see these kind of entries in your /var/log/auth.log file:
  May 2 11:55:02 linux PAM_unix[1477]: (cron) session closed for user root
  May 2 11:55:02 linux PAM_unix[1476]: (cron) session closed for user root
  May 2 12:00:01 linux PAM_unix[1536]: (cron) session opened for user root by
  (UID=0)
  May 2 12:00:02 linux PAM_unix[1536]: (cron) session closed for user root
These are due to a cron job being executed (in this example, every five minutes). To determine which program is responsible for these jobs, check entries under: /etc/crontab, /etc/cron.d, /etc/crond.daily and root's crontab under /var/spool/cron/crontabs.

12.1.2.7. He sufrido una interrupción, ¿qué debo hacer?

There are several steps you might want to take in case of a break-in:
  • Check if your system is up to date with security patches for published vulnerabilities. If your system is vulnerable, the chances that the system is in fact compromised are increased. The chances increase further if the vulnerability has been known for a while, since there is usually more activity related to older vulnerabilities. Here is a link to http://www.sans.org/top20/.
  • Read this document, especially the Capítulo 11, After the compromise (incident response) section.
  • Ask for assistance. You might use the debian-security mailing list and ask for advice on how to recover/patch your system.
  • Notify your local http://www.cert.org (if it exists, otherwise you may want to consider contacting CERT directly). This might or might not help you, but, at the very least, it will inform CERT of ongoing attacks. This information is very valuable in determining which tools and attacks are being used by the blackhat community.

12.1.2.8. ¿Cómo puedo encontrar el origen de un ataque?

Observando las bitácoras (si ellas no han sido cambiadas), usando sistemas de detección de intrusión (observe intrusion-detect), traceroute, whois y herramientas similares (incluyendo análisis forense), usted puede encontrar un ataque a la fuente. La manera como usted debería reaccionar frente a esta información depende, solamente del uso apropiado que usted le de a la política de seguridad y que usted considere lo que es un ataque. ¿Es un scanner remoto un ataque? ¿Un ataque es una prueba de vulnerabilidad?

12.1.2.9. Cualquier programa en Debian es vulnerable ¿Qué debo hacer?

Tómese un momento. Primero, observe si la vulnerabilidad ha sido anunciada en listas de correo de seguridad pública (como Bugtraq) u otros foros, el equipo de seguridad Debian permanece actualizado con estas listas, de manera que ellos ya pueden estar enterados del problema. No ejecute ningunas acciones remotas si usted ya observa algún anuncio en http://security.debian.org.
If no information seems to be published, please send e-mail about the affected package(s), as well as a detailed description of the vulnerability (proof of concept code is also OK), to mailto:team@security.debian.org. This will get you in touch with Debian's security team.

12.1.2.10. El número de versión para un paquete indica que todavía estoy corriendo una versión vulnerable

En lugar de actualizar una nueva descarga, podemos fijar la seguridad en backport, a la versión que fue enviada en la descarga establecida. La razón de esto es asegurarnos que una descarga cambie posiblemente un poco algunas cosas o que se interrumpan repentinamente, como un resultado de la seguridad fija. Usted puede chequear si está corriendo una versión segura de un paquete, observando el paquete changelog o comparando su número de versión exacta (versión upstream -slash- descargar debian)el número de la versión exacta con la versión indicada en el Asesor de seguridad Debian.


[72] Por ejemplo, teniendo en cuenta los datos de Securityfocus, puede parecer que Windows NT es más seguro que Linux, lo que es una afirmación cuestionable. Después de todo, las distribuciones de Linux proporcionan habitualmente muchas más aplicaciones comparadas con Windows NT de Microsoft.
[73] For example, based on some data, it might seem that Windows NT is more secure than Linux, which is a questionable assertion. After all, Linux distributions usually provide many more applications compared to Microsoft's Windows NT. This counting vulnerabilities issues are better described in http://www.dwheeler.com/oss_fs_why.html#security by David A. Wheeler
[74] >Without diminishing the fact that some distributions, such as Red Hat or Mandrake, are also taking into account security in their standard installations by having the user select security profiles, or using wizards to help with configuration of personal firewalls.
[75] >Note that this is 'security by obscurity', and will probably not be worth the effort in the long term.
[76] Be careful, as this will traverse your whole system. If you have a lot of disk and partitions you might want to reduce it in scope.