Diferencia entre revisiones de «Configurar servidor desde cero»
De Wiki de BandaAncha.eu
(→Deshabilitando servicios) |
(rev) |
||
Línea 1: | Línea 1: | ||
− | + | ==SSH== | |
− | + | ===Autenticación con clave pública=== | |
− | + | Instalo putty-0.59-installer.exe desde http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html | |
− | + | Genero un par de claves. La privada la añado a Pageant y copio la publica. | |
+ | |||
+ | cd /root | ||
+ | mkdir .ssh | ||
+ | vi .ssh/authorized_keys # pego la clave pública y guardo | ||
+ | |||
+ | ===Configuración=== | ||
+ | |||
+ | vi /etc/ssh/ssh_config | ||
+ | |||
+ | ==Locate== | ||
+ | |||
+ | vi vi /etc/updatedb.conf # pongo DAILY_UPDATE=yes para que actualice la db una vez al día | ||
+ | updatedb | ||
+ | |||
+ | ==Yum== | ||
+ | |||
+ | yum update | ||
+ | |||
+ | ==Cambiar hostname== | ||
+ | |||
+ | vi /etc/hosts # levitico.vectrice.com | ||
+ | vi /etc/sysconfig/network # HOSTNAME=levitico.vectrice.com | ||
+ | # reiniciamos | ||
+ | shutdown -r now | ||
+ | # comprobamos | ||
+ | uname -a | ||
+ | |||
+ | ==NTP== | ||
+ | |||
+ | yum install ntp | ||
+ | crontab -e # añadimos 17 3,15 * * * /usr/sbin/ntpdate swisstime.ethz.ch 1>/dev/null | ||
+ | |||
+ | ==Cambiar password de root== | ||
+ | |||
+ | passwd root | ||
+ | |||
+ | ==Grub== | ||
+ | |||
+ | vi /boot/grub/menu.lst # modificamos timeout=2 para reducir el tiempo de espera del menú en el arranque | ||
+ | |||
+ | ==Consolas virtuales== | ||
+ | |||
+ | Reduzco su número a 3 | ||
+ | |||
+ | vi /etc/inittab | ||
+ | |||
+ | y comento las siguientes líneas | ||
+ | |||
+ | #4:2345:respawn:/sbin/mingetty tty4 | ||
+ | #5:2345:respawn:/sbin/mingetty tty5 | ||
+ | #6:2345:respawn:/sbin/mingetty tty6 | ||
+ | |||
+ | ==Deshabilitar SELinux== | ||
+ | |||
+ | vi /etc/selinux/config | ||
+ | |||
+ | y ponemos | ||
+ | |||
+ | SELINUX=disabled | ||
+ | |||
+ | ==Deshabilitando servicios== | ||
+ | |||
+ | [root@levitico ~]# chkconfig --list | grep 3:on | ||
+ | pcmcia 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | rpcgssd 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | isdn 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | cyrus-imapd 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | kudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | mydns 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | haldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | cpuspeed 0:off 1:on 2:on 3:on 4:on 5:on 6:off | ||
+ | mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | httpd 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | smartd 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | cups 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | portmap 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | rpcidmapd 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | irqbalance 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | messagebus 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | openibd 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | apmd 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | acpid 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | network 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | microcode_ctl 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ||
+ | rawdevices 0:off 1:off 2:off 3:on 4:on 5:on 6:off | ||
+ | |||
+ | # Common Unix Printing System | ||
+ | service cups stop | ||
+ | chkconfig --del cups | ||
+ | # automounts | ||
+ | service autofs stop | ||
+ | chkconfig --del autofs | ||
+ | # converts RPC program numbers into DARPA protocol port numbers. It must be running in order to make RPC calls | ||
+ | service portmap stop | ||
+ | chkconfig --del portmap | ||
+ | # Network File System Daemons | ||
+ | service rpcidmapd stop | ||
+ | chkconfig --del rpcidmapd | ||
+ | service nfslock stop | ||
+ | chkconfig --del nfslock | ||
+ | service rpcgssd stop | ||
+ | chkconfig --del rpcgssd | ||
+ | # Mounts/Unmounts all Network File Systems | ||
+ | service netfs stop | ||
+ | chkconfig --del netfs | ||
+ | |||
+ | * http://fedoranews.org/mediawiki/index.php/Which_Services_Can_I_Disable%3F | ||
+ | |||
+ | [[Categoría:Administración de un servidor dedicado]] | ||
+ | [[Categoría:Linux]] |
Revisión del 21:23 2 oct 2008
Contenido
SSH
Autenticación con clave pública
Instalo putty-0.59-installer.exe desde http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Genero un par de claves. La privada la añado a Pageant y copio la publica.
cd /root mkdir .ssh vi .ssh/authorized_keys # pego la clave pública y guardo
Configuración
vi /etc/ssh/ssh_config
Locate
vi vi /etc/updatedb.conf # pongo DAILY_UPDATE=yes para que actualice la db una vez al día updatedb
Yum
yum update
Cambiar hostname
vi /etc/hosts # levitico.vectrice.com vi /etc/sysconfig/network # HOSTNAME=levitico.vectrice.com # reiniciamos shutdown -r now # comprobamos uname -a
NTP
yum install ntp crontab -e # añadimos 17 3,15 * * * /usr/sbin/ntpdate swisstime.ethz.ch 1>/dev/null
Cambiar password de root
passwd root
Grub
vi /boot/grub/menu.lst # modificamos timeout=2 para reducir el tiempo de espera del menú en el arranque
Consolas virtuales
Reduzco su número a 3
vi /etc/inittab
y comento las siguientes líneas
#4:2345:respawn:/sbin/mingetty tty4 #5:2345:respawn:/sbin/mingetty tty5 #6:2345:respawn:/sbin/mingetty tty6
Deshabilitar SELinux
vi /etc/selinux/config
y ponemos
SELINUX=disabled
Deshabilitando servicios
[root@levitico ~]# chkconfig --list | grep 3:on pcmcia 0:off 1:off 2:on 3:on 4:on 5:on 6:off rpcgssd 0:off 1:off 2:off 3:on 4:on 5:on 6:off netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off isdn 0:off 1:off 2:on 3:on 4:on 5:on 6:off cyrus-imapd 0:off 1:off 2:on 3:on 4:on 5:on 6:off kudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:off mydns 0:off 1:off 2:off 3:on 4:on 5:on 6:off syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off haldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off cpuspeed 0:off 1:on 2:on 3:on 4:on 5:on 6:off mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off httpd 0:off 1:off 2:off 3:on 4:on 5:on 6:off atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off smartd 0:off 1:off 2:on 3:on 4:on 5:on 6:off anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off cups 0:off 1:off 2:on 3:on 4:on 5:on 6:off portmap 0:off 1:off 2:off 3:on 4:on 5:on 6:off rpcidmapd 0:off 1:off 2:off 3:on 4:on 5:on 6:off gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off irqbalance 0:off 1:off 2:off 3:on 4:on 5:on 6:off messagebus 0:off 1:off 2:off 3:on 4:on 5:on 6:off openibd 0:off 1:off 2:on 3:on 4:on 5:on 6:off apmd 0:off 1:off 2:on 3:on 4:on 5:on 6:off autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off acpid 0:off 1:off 2:off 3:on 4:on 5:on 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off microcode_ctl 0:off 1:off 2:on 3:on 4:on 5:on 6:off iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off rawdevices 0:off 1:off 2:off 3:on 4:on 5:on 6:off
# Common Unix Printing System service cups stop chkconfig --del cups # automounts service autofs stop chkconfig --del autofs # converts RPC program numbers into DARPA protocol port numbers. It must be running in order to make RPC calls service portmap stop chkconfig --del portmap # Network File System Daemons service rpcidmapd stop chkconfig --del rpcidmapd service nfslock stop chkconfig --del nfslock service rpcgssd stop chkconfig --del rpcgssd # Mounts/Unmounts all Network File Systems service netfs stop chkconfig --del netfs