Ubuntu:Edgy Sp/Security
From
Current revision as of 19:23, 17 December 2006
Seguridad
Qué cosas básicas necesito saber sobre seguridad en mi Ubuntu
- Lea #Notas Generales
- Asegúrese de que el disco duro es el primero en la secuencia de arranque de la BIOS
- Para prevenir que intrusos utilicen el CD de Instalación de Linux, que les permitiría conseguir acceso de usuario root
- Para prevenir que intrusos utilicen un Live CD de Linux (p.ej. UBUNTU/KNOPPIX/MEPIS), que les permitiría destruir/explorar/compartir todo el disco duro
- Para prevenir que intrusos instalen otro Sistema Operativo
- Asegúrese de que hay un password para la BIOS
- Para prevenir que intrusos cambien la secuencia de arranque de la BIOS
- Asegúrese de que el ordenador está ubicado en un lugar seguro
- Para prevenir que intrusos saquen el disco duro, que les permitiría destruir/explorar/compartir todo el disco duro desde otro ordenador
- Para prevenir que intrusos saquen la batería de la placa del ordenador, que resetearía el password de la BIOS
- Asegúrese de que los passwords utilizados en el sistema no pueden ser fácilmente adivinados
- Para prevenir que intrusos traspasen el archivo del password utilizando ataques de fuerza bruta (p.ej. con el programa John the Ripper)
- Cree sus passwords con una longitud mínima de 8 caracteres
- Cree sus passwords mezclando caracteres y números, minúsculas y mayúsculas
- No cree sus passwords sólo con una palabra o sólo con una combinación típica de palabras de los diccionarios de los idiomas más usados (inglés, alemán, francés, castellano...)
- Asegúrese de que el control de edición interactiva para el menú GRUB está desactivado
- Para prevenir que intrusos modifiquen los argumentos de arranque del kernel, que les permitiría tener acceso de usuario root
- Lea #Cómo desactivar todo control de edición interactivo para el menú GRUB
- Asegúrese de que el listado histórico está desactivado en el modo consola
- Para prevenir que intrusos vean comandos utilizados previamente
- Lea #Cómo desactivar el listado histórico en el modo consola
- Asegúrese de que Ctrl+Alt+Supr está desactivado en el modo consola
- Para prevenir que los intrusos reinicien el sistema sin permiso en el modo consola
- Lea #Cómo desactivar Ctrl+Alt+Supr para reiniciar el ordenador en modo consola
- Asegúrese de que la opción interactiva está establecida para quitar, copiar y mover achivos/carpetas en modo consola
- Para prevenir borrados/sobreescrituras accidentales de archivos/carpetas
- Lea #Cómo activar el aviso antes del borrado/sobreescritura de archivos/carpetas en modo consola
- Para el uso diario, inicie sesión como usuario normal
- Para prevenir borrados/modificaciones accidentales de archivos/carpeatas del sistema
- Lea #Cómo añadir/editar/borrar usuarios en el sistema
- Desactive la cuenta de usuario root; utilice "sudo" en su lugar
- Para reducir la cantidad de tiempo pasado con privilegios de root, y por tanto el riesgo de ejecutar un comando como root inadvertidamente
- "sudo" proporciona una pista de auditoría más útil (/var/log/auth.log)
- Lea #Cómo deshabilitar la cuenta del usuario root
- Instale un Firewall
- Un firewall no garantiza seguridad pero en muchos entornos es la primera línea de defensa contra ataques por red
- Lea #Cómo instalar el Firewall (Firestarter)
- Realice un test de vulnerabilidad
- Nessus es una gran herramienta diseñada para automatizar el testeo y descubrimiento de problemas de seguridad conocidos
- Lea #Cómo instalar el Vulnerability Scanner (Nessus)
How to disable all interactive editing control for GRUB menu
- Read #General Notes
- Run This:
grub-md5-crypt
Password: Retype password: $1$tumnZ1$xB/shuXs7MlawZXkLiBDV/
- Backup your current configuration file
sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup gksudo gedit /boot/grub/menu.lst
- Find this section
... ## password ['--md5'] passwd # If used in the first section of a menu file, disable all interactive editing # control (menu entry editor and command-line) and entries protected by the # command 'lock' # e.g. password topsecret # password --md5 $1$tumnZ1$xB/shuXs7MlawZXkLiBDV/ # password topsecret ...
- Add the following line below it
password --md5 $1$tumnZ1$xB/shuXs7MlawZXkLiBDV/ (encrypted password above)
- Find the section(s) that look like this (note the 'recovery mode' and the word 'single'):
... title Ubuntu, kernel 2.6.10-5-386 (recovery mode) root (hd0,1) kernel /boot/vmlinuz-2.6.10-5-386 root=/dev/hda2 ro single initrd /boot/initrd.img-2.6.10-5-386 savedefault boot ...
- Add lock between the title and root lines:
... title Ubuntu, kernel 2.6.10-5-386 (recovery mode) lock root (hd0,1) ...
- Save the edited file
This will make it so your grub console will require a password to edit the lines, and the recovery modes won't work unless the password is typed. To access the other grub options at the menu, follow the instructions at the bottom of the screen. It will be something like pressing p and typing your password.
How to disable history listing in Console mode
- Read #General Notes
- From Gentoo Wiki:
rm -f .bash_history gedit ~/.bash_profile
- Add the following:
export HISTFILESIZE=4 unset HISTFILE=5 # Change this to a reasonable number of lines to save, I like to save only 100. export HISTSIZE=1 # Ignores duplicate lines next to each other export HISTCONTROL=ignoredups
This will disable Bash history for the user, retaining keystroke history and recall to use while limiting recall history to 100 lines. This will also not record duplicate lines next to each other.
How to disable Ctrl+Alt+Del from restarting computer in Console mode
- Read #General Notes
sudo cp /etc/inittab /etc/inittab_backup gksudo gedit /etc/inittab
- Find this line
... ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now ...
- Replace with the following line
#ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
- Save the edited file
sudo telinit q
How to enable prompt before removal/overwritten of files/folders in Console mode
- Read #General Notes
sudo cp /etc/bash.bashrc /etc/bash.bashrc_backup gksudo gedit /etc/bash.bashrc
- Append the following lines at the end of file
alias rm='rm -i' alias cp='cp -i' alias mv='mv -i'
- Save the edited file
How to setup a LoJack system for your laptop
- Read #General Notes
- Read #How to add extra repositories
- Read #How to assign Hostname to local machine with dynamic IP using free DynDNS service
What: Quote from Wikipedia: "LoJack is an aftermarket vehicle tracking system that allows cars to be tracked by police after being stolen. The manufacturer claims a 90% recovery rate. The name "LoJack" is a play on the word "hijack," meaning the theft of a vehicle through force."
Why: If your laptop is ever stolen and connected to the Internet. You will be able to find out from what IP it connects to the Internet from and contact the authorities.
How:
- Get a free dynamic IP account from one of the many providers. Here we will use DynDNS.
- Install ddclient. In the section #How to assign Hostname to local machine with dynamic IP using free DynDNS service we installed the package ipcheck, here we prefer to use ddclient because it can get the IP from an external source on the Internet instead of getting it from a network adapter.
sudo apt-get install ddclient
- Edit the configuration file /etc/ddclient.conf using you fevorite text editor (emacs, gedit, kedit or even vi)
sudo emacs /etc/ddclient.conf
- Make it look like this:
# Configuration file for ddclient generated by debconf # # /etc/ddclient.conf pid=/var/run/ddclient.pid protocol=dyndns2 use=web server=members.dyndns.org login=YourNameHere password='YourPasswordHere' YourHostNameHere.gotmyip.com
- NOTE:
- * Make sure that you use the web IP detection method.
- * Specify your own user id instead of the place holder YourNameHere.
- * Specify your own password instead of the place holder YourPasswordHere, make sure to surround it with single quotes.
- * The last line should specify the hostname you registered with the dynamic IP service.
- You can now start the ddclient daemon, or wait until your next reboot.
sudo /etc/init.d/ddclient start
- The hostname you registered with your dynamic IP service should be updated. You can test it with the ping command:
ping YourHostNameHere.gotmyip.com
- Even if your laptop has a firewall that prevents pings the hostname should resolve to the IP of the network gateway that your laptop is connected to.
- Now all that is left is for someone to steal your laptop.....
References:
BlogMarks
del.icio.us
digg
Fark
Furl
Newsvine
reddit
Segnalo
Simpy
Slashdot
smarking
Spurl
Wists
