martes, 14 de febrero de 2012

LINUX-SEC: Colocar passwd al grub

Al colocar una password al grub, se impide el ingreso al sistema a través de la consola de grub. De esta forma se protegen archivos escenciales para el sistema, como son el shadow.

Generar una pass encriptada con el utilitario grub-md5-crypt

[root@localhost ~]# grub-md5-crypt 
Password: 
Retype password: 
$1$TGtQH0$r20iylhu88Amhv53AGblH0
[root@localhost ~]# 

alojar la passwd dentro del archivo /etc/grub.conf: esta tecnica permite generar la paswd e imprimirla dentro del archivo grub.conf en caso de no contar con una interfaz grafica como xterm.

[root@localhost ~]# grub-md5-crypt >> /etc/grub.conf 
ingresar la passwd + enter
ingresar denuevo la passwd + enter

Revisar el archivo grub.conf
[root@localhost ~]# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sistema/raiz
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-128.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/sistema/raiz
        initrd /initrd-2.6.18-128.el5.img
Password: 
Retype password: 
$1$5otQH0$Y2fL3OcDy1zQNWCirhU4n.
[root@localhost ~]# 

Acomodar la passwd para que quede de la siguiente forma:
[root@localhost ~]# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sistema/raiz
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
Password --md5 = $1$5otQH0$Y2fL3OcDy1zQNWCirhU4n.
title CentOS (2.6.18-128.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/sistema/raiz
        initrd /initrd-2.6.18-128.el5.img
[root@localhost ~]# 



No hay comentarios:

Publicar un comentario