Páginas

lunes, 31 de octubre de 2016

Slackware Puerto Serie

Cambiar fuente de alimentación del firewall. 

OpenBSD Soekris Router

Especificaciones de la fuente:

Switching AC/DC Power Adapter
I/P: AC 100-240V 50/60Hz 0.35A
O/P: DC 12V, 1.5A

Después de cambiar la fuente de alimentación del firewall (Soekris) vamos a conectar el cable usb serie null modem al portátil para iniciar el dispositivo de forma adecuada.

# cu -l /dev/ttyUSB0 -s 19200


Presionamos las teclas Crtl + p

 > boot
boot> stty com0 19200
boot> set tty com0
boot> Intro







No olvide comprobar que su archivo /etc/resolv.conf esta configurado correctamente
# cat /etc/resolv.conf
search linux.bcn
nameserver 192.168.3.1

Conexión ssh al firewall


Una vez tenemos nuestro firewall en marcha configuramos nuestra máquina con una dirección IP perteneciente a la misma red y entrar vía ssh.
# ifconfig eth0 192.168.3.7 netmask 255.255.255.128
# route add default gw 192.168.3.1

La configuracion del servidor ssh en el firewall OpenBSD solo acepta conexiones desde usuario sin privilegios:
$ ssh 192.168.3.1

Eric Hameleers
Slackware docs

OpenBSD es genial!.

domingo, 23 de octubre de 2016

Slackware 14.2 KDE

Instalar Slackware 14.2 y actualizar kde 4.14.3 a kde 5 plasma 64 bit uefi
Hardware : procesador Intel Braswell, 8 gb de ram, disco duro ssd 120 GB

Slackware Live Edition

El programa setup2hd, incluido en el live dvd, es un instalador de Slackware modificado que le guiará a través de los conocidos menús de configuración e instalará el contenido de Slackware Live Edition en su disco duro. Se puede ejecutar desde su sesión X y seguir interactuando con Internet mientras se instala Slackware.

Compatibilidad con System V

Compatibilidad del sistema V init se introdujo en Slackware 7.0. Muchas otras distribuciones de Linux hacen uso de este estilo en vez del estilo BSD. Básicamente cada nivel de ejecución se da un subdirectorio para los scripts de init, mientras que el estilo BSD brinda un script de inicio para cada nivel de ejecución.

El script rc.sysvinit buscará cualquier scripts de inicio System V que tenga en /etc/rc.d y utilizarlos, si es adecuado el nivel de ejecución.

Al ejecutar del slackdvd de instalación  lo primero es elegir el teclado querty/es.map (español España).

Particionado con cfdisk
Justo después de crear las particiones con cfdisk es importante asegurarse que la partición sda1 tiene el formato correcto. No es suficiente con solo indicar que el type es Efi System.
# mkfs.vfat /dev/sda1



Una vez creadas las particiones el resto del proceso es muy intuitivo y no explico porque no contempla dificultad alguna.

Continua la instalación  tecleando desde la linea de comando
# setup

El resto de la instalación es muy intuitivo. Al final elegimos las opciones por defecto para el escritorio kde e incluimos kdei que el paquete de idiomas de kde.

locales

/etc/profile.d/lang.sh

Ver idiomas disponibles
# locale -a

No copie la salida literal de locale -a, no tendrá soporte unicode.

Lenguaje es España lang.sh

# nano -w /etc/profile.d/lang.sh
export LANG="es_ES.UTF-8"
export LC_MESSAGES="es_ES.UTF-8"
export LC_CTYPE="es_ES@euro"
export LC_COLLATE="es_ES@euro"
export LC_TIME="es_ES.UTF-8"
export LC_NUMERIC="es_ES.UTF-8"
export LC_MONETARY="es_ES@euro"
export LC_PAPER="es_ES.UTF-8"
export LC_TELEPHONE="es_ES.UTF-8"
export LC_ADDRESS="es_ES.UTF-8"
export LC_MEASUREMENT="es_ES.UTF-8"
export LC_NAME="es_ES.UTF-8"


Existen buenas razones por las que Slackware no activa unicode por defecto:
# unicode_stop
# unicode_start

Ver actual fuente de consola
# showconsolefont

Ubicación de las fuentes:
# ls /usr/share/kbd/consolefonts.

Para elegir una fuente de consola tecleamos en la terminal: 
# setconsolefont

Alternativamente puede utilizar el archivo rc.font
# cat -w /etc/rc.d/rc.font
#!/bin/sh
setfont -v lat9-16.psf.gz

Slackpkg
Es una herramienta para instalar o actualizar paquetes a través de una red,  desde un espejo de Slackware.
 
Instalar Slackpkg desde el SlackDVD
# cd /mnt/cdrom/slackware64/np/
# installpkg slackpkg-2.82.1-noarch-3.txz

Abrir el archivo mirrors y utilizar el mas cercano, descomentando la linea correspondiente, p.e
# PORTUGAL (PT)
http://darkstar.ist.utl.pt/pub/slackware/slackware64-14.2/

# nano /etc/slackpkg/mirrors

# slapkpg update gpg
# slackpkg update

Archivo de configuracion slackpkg

# sed -e '/^[ ]*#/d' -e '/^$/d' /etc/slackpkg/slackpkg.conf
TEMP=/sda6/var/cache/packages
WORKDIR=/var/lib/slackpkg
WGETFLAGS="--passive-ftp"
DELALL=on
CHECKMD5=on
CHECKGPG=on
CHECKSIZE=on
PRIORITY=( patches %PKGMAIN extra pasture testing )
POSTINST=on
ONLY_NEW_DOTNEW=off
ONOFF=on
DOWNLOAD_ALL=off
DIALOG=on
BATCH=off
DEFAULT_ANSWER=n
USE_INCLUDES=on
SPINNING=on
DIALOG_MAXARGS=139000

Archivo blacklist. Incluye los paquetes que no deben ser actualizados.

#/d' -e '/^$/d' /etc/slackpkg/blacklist    
#xorg-server
#kernel-firmware
#kernel-generic
#kernel-generic-smp
#kernel-headers
#kernel-huge
#kernel-huge-smp
#kernel-modules
#kernel-modules-smp
#kernel-source

Instalar slackpkg+ Descargar desde 
https://sourceforge.net/projects/slackpkgplus/ 
$ cd Download/
# installpkg slackpkg+-1.7.0-noarch-4mt.txz

Ejemplo del archivo de configuracion slackpkgg+

# sed -e '/^[ ]*#/d' -e '/^$/d' /etc/slackpkg/slackpkgplus.conf
SLACKPKGPLUS=on
VERBOSE=1
ALLOW32BIT=off
USEBL=1
WGETOPTS="--timeout=20 --tries=2"
SEARCH_CLOG_INPARENT=on
CACHEUPDATE=off
GREYLIST=on
SENSITIVE_SEARCH=on
WW_FILE_SEARCH=on
SHOWORDER=package
DETAILED_INFO=none
STRICTGPG=on
PKGS_PRIORITY=( ktown )
TAG_PRIORITY=off
REPOPLUS=( slackpkgplus alien alien_restricted )
MIRRORPLUS['slackpkgplus']=http://slakfinder.org/slackpkg+/
MIRRORPLUS['alien']=http://bear.alienbase.nl/mirrors/people/alien/sbrepos/14.2/x86_64/
MIRRORPLUS['alien_restricted']=http://bear.alienbase.nl/mirrors/people/alien/restricted_sbrepos/14.2/x86_64/
MIRRORPLUS['slackpkgplus']=http://slakfinder.org/slackpkg+/
MIRRORPLUS['ktown']=http://alien.slackbook.org/ktown/14.2/5/x86_64/

El sistema verifica la firma GPG de cada paquete (por defecto), slackpkg.conf
CHECKGPG=on

Como se utiliza el manejador de paquetes slackpkg?
bash-4.3# slackpkg help

slackpkg - version 2.81 / slackpkg+ 1.7.0

Usage:  slackpkg update [gpg]           download and update files and 
                                        package indexes
        slackpkg check-updates          check if there is any news on
                                        Slackware's ChangeLog.txt
        slackpkg install package        download and install packages 
        slackpkg upgrade package        download and upgrade packages
        slackpkg reinstall package      same as install, but for packages 
                                        already installed
        slackpkg remove package         remove installed packages
        slackpkg clean-system           remove all packages which are not 
                                        present in the official Slackware 
                                        package set. Good to keep the house
                                        in order
        slackpkg upgrade-all            sync all packages installed in your 
                                        machine with the selected mirror. This
                                        is the correct way to upgrade all of 
                                        your machine.
        slackpkg install-new            install packages which are added to
                                        the official Slackware package set.
                                        Run this if you are upgrading to another
                                        Slackware version or using current.
        slackpkg blacklist              Blacklist a package. Blacklisted
                                        packages cannot be upgraded, installed,
                                        or reinstalled by slackpkg
        slackpkg download               Only download (do not install) a package
        slackpkg info package           Show package information 
                                        (works with only ONE package)
        slackpkg search package         Search packages that have a
                                        selected name
        slackpkg file-search file       Search for a specific file in the
                                        entire package collection
        slackpkg new-config             Search for new configuration files and
                                        ask to user what to do with them.
        slackpkg generate-template      Create a template with all 
                                        official Slackware packages installed 
                                        in your machine.
        slackpkg install-template       Install selected template.
        slackpkg remove-template        Remove selected template. Be careful.
        slackpkg help                   Show this screen. 


Antes de utilizar slackpkg ejecutamos:
# slackpkg update gpg
# slackpkg update && slackpkg update

instalar iptables y nmap desde SlackDVD
# cd /run/media/carles/SlackDVD/slackware64/n

# installpkg iptables-1.6.0-x86_64-2.txz

# installpkg nmap-7.12-x86_64-1.txz

Generar reglas de Firewall fácil. Adaptado para Slackware.
Archivo de configuración de iptables /etc/rc.d/rc.firewall chmod +x /etc/rc.d/rc.firewall (ejecutable)
############################################
SYSCTL="/sbin/sysctl -w" 
IPT="/usr/sbin/iptables"
IPTS="/usr/sbin/iptables-save"
IPTR="/usr/sbin/iptables-restore"
INET_IFACE="eth0"
LO_IFACE="lo"
LO_IP="127.0.0.1"
if [ "$1" = "save" ]
then
 echo -n "Saving firewall to /etc/sysconfig/iptables ... "
 $IPTS > /etc/sysconfig/iptables
 echo "done"
 exit 0
elif [ "$1" = "restore" ]
then
 echo -n "Restoring firewall from /etc/sysconfig/iptables ... "
 $IPTR < /etc/sysconfig/iptables
 echo "done"
 exit 0
fi
echo "Loading kernel modules ..."
/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe ip_nat_ftp
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_conntrack_irc
if [ "$SYSCTL" = "" ]
then
    echo "1" > /proc/sys/net/ipv4/tcp_syncookies
else
    $SYSCTL net.ipv4.tcp_syncookies="1"
fi
if [ "$SYSCTL" = "" ]
then
    echo "1" > /proc/sys/net/ipv4/conf/all/rp_filter
else
    $SYSCTL net.ipv4.conf.all.rp_filter="1"
fi
if [ "$SYSCTL" = "" ]
then
    echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
else
    $SYSCTL net.ipv4.icmp_echo_ignore_broadcasts="1"
fi
if [ "$SYSCTL" = "" ]
then
    echo "0" > /proc/sys/net/ipv4/conf/all/accept_source_route
else
    $SYSCTL net.ipv4.conf.all.accept_source_route="0"
fi
if [ "$SYSCTL" = "" ]
then
    echo "1" > /proc/sys/net/ipv4/conf/all/secure_redirects
else
    $SYSCTL net.ipv4.conf.all.secure_redirects="1"
fi
if [ "$SYSCTL" = "" ]
then
    echo "1" > /proc/sys/net/ipv4/conf/all/log_martians
else
    $SYSCTL net.ipv4.conf.all.log_martians="1"
fi
echo "Flushing Tables ..."
$IPT -P INPUT ACCEPT
$IPT -P FORWARD ACCEPT
$IPT -P OUTPUT ACCEPT
$IPT -t nat -P PREROUTING ACCEPT
$IPT -t nat -P POSTROUTING ACCEPT
$IPT -t nat -P OUTPUT ACCEPT
$IPT -t mangle -P PREROUTING ACCEPT
$IPT -t mangle -P OUTPUT ACCEPT
$IPT -F
$IPT -t nat -F
$IPT -t mangle -F
$IPT -X
$IPT -t nat -X
$IPT -t mangle -X
if [ "$1" = "stop" ]
then
 echo "Firewall completely flushed!  Now running with no firewall."
 exit 0
fi
$IPT -P INPUT DROP
$IPT -P OUTPUT DROP
$IPT -P FORWARD DROP
echo "Create and populate custom rule chains ..."
$IPT -N bad_packets
$IPT -N bad_tcp_packets
$IPT -N icmp_packets
$IPT -N udp_inbound
$IPT -N udp_outbound
$IPT -N tcp_inbound
$IPT -N tcp_outbound
$IPT -A bad_packets -p ALL -m conntrack --ctstate INVALID -j LOG \
    --log-prefix "Invalid packet: "
$IPT -A bad_packets -p ALL -m conntrack --ctstate INVALID -j DROP
$IPT -A bad_packets -p tcp -j bad_tcp_packets
$IPT -A bad_packets -p ALL -j RETURN
$IPT -A bad_tcp_packets -p tcp ! --syn -m conntrack --ctstate NEW -j LOG \
    --log-prefix "New not syn: "
$IPT -A bad_tcp_packets -p tcp ! --syn -m conntrack --ctstate NEW -j DROP
$IPT -A bad_tcp_packets -p tcp --tcp-flags ALL NONE -j LOG \
    --log-prefix "Stealth scan: "
$IPT -A bad_tcp_packets -p tcp --tcp-flags ALL NONE -j DROP
$IPT -A bad_tcp_packets -p tcp --tcp-flags ALL ALL -j LOG \
    --log-prefix "Stealth scan: "
$IPT -A bad_tcp_packets -p tcp --tcp-flags ALL ALL -j DROP
$IPT -A bad_tcp_packets -p tcp --tcp-flags ALL FIN,URG,PSH -j LOG \
    --log-prefix "Stealth scan: "
$IPT -A bad_tcp_packets -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP
$IPT -A bad_tcp_packets -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j LOG \
    --log-prefix "Stealth scan: "
$IPT -A bad_tcp_packets -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP
$IPT -A bad_tcp_packets -p tcp --tcp-flags SYN,RST SYN,RST -j LOG \
    --log-prefix "Stealth scan: "
$IPT -A bad_tcp_packets -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
$IPT -A bad_tcp_packets -p tcp --tcp-flags SYN,FIN SYN,FIN -j LOG \
    --log-prefix "Stealth scan: "
$IPT -A bad_tcp_packets -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
$IPT -A bad_tcp_packets -p tcp -j RETURN
$IPT -A icmp_packets --fragment -p ICMP -j LOG \
    --log-prefix "ICMP Fragment: "
$IPT -A icmp_packets --fragment -p ICMP -j DROP
$IPT -A icmp_packets -p ICMP -s 0/0 --icmp-type 8 -j DROP
$IPT -A icmp_packets -p ICMP -s 0/0 --icmp-type 11 -j ACCEPT
$IPT -A icmp_packets -p ICMP -j RETURN
$IPT -A udp_inbound -p UDP -s 0/0 --destination-port 137 -j DROP
$IPT -A udp_inbound -p UDP -s 0/0 --destination-port 138 -j DROP
$IPT -A udp_inbound -p UDP -s 0/0 --source-port 67 --destination-port 68 \
     -j ACCEPT
$IPT -A udp_inbound -p UDP -j RETURN
$IPT -A udp_outbound -p UDP -s 0/0 -j ACCEPT
$IPT -A tcp_inbound -p TCP -j RETURN
$IPT -A tcp_outbound -p TCP -s 0/0 -j ACCEPT
echo "Process INPUT chain ..."
$IPT -A INPUT -p ALL -i $LO_IFACE -j ACCEPT
$IPT -A INPUT -p ALL -j bad_packets
$IPT -A INPUT -p ALL -d 224.0.0.1 -j DROP
$IPT -A INPUT -p ALL -i $INET_IFACE -m conntrack --ctstate ESTABLISHED,RELATED \
     -j ACCEPT
$IPT -A INPUT -p TCP -i $INET_IFACE -j tcp_inbound
$IPT -A INPUT -p UDP -i $INET_IFACE -j udp_inbound
$IPT -A INPUT -p ICMP -i $INET_IFACE -j icmp_packets
$IPT -A INPUT -m pkttype --pkt-type broadcast -j DROP
$IPT -A INPUT -m limit --limit 3/minute --limit-burst 3 -j LOG \
    --log-prefix "INPUT packet died: "
echo "Process FORWARD chain ..."
echo "Process OUTPUT chain ..."
$IPT -A OUTPUT -p icmp -m conntrack --ctstate INVALID -j DROP
$IPT -A OUTPUT -p ALL -s $LO_IP -j ACCEPT
$IPT -A OUTPUT -p ALL -o $LO_IFACE -j ACCEPT
$IPT -A OUTPUT -p ALL -o $INET_IFACE -j ACCEPT
$IPT -A OUTPUT -m limit --limit 3/minute --limit-burst 3 -j LOG \
    --log-prefix "OUTPUT packet died: "
echo "Load rules for nat table ..."
echo "Load rules for mangle table ..."
###############################################

Colorear la salida de ls:
$ cat .bashrc
alias ls="ls --color"
alias ll="ls -l --color"

Lo copiamos a root
# cp .bashrc /root/


Instalar un paquete con slackpkg
# slackpkg install chromium


Instalar LibreOffice es
# slackpkg search libreoffice

# slackpkg install libreoffice-5.2.1 libreoffice-l10n-es-5.2.1 libreoffice-dict-es-5.2.1

# slackpkg install webcore-fonts-installer

Instalar flashplayer-plugin
# slackpkg install flashplayer-plugin


Crear la base de datos de slocate
# slocate -u

Redirigir errores salida standard para omitir en pantalla

# find / -iname xinitrc 2>/dev/null


Antes de realizar un update-all ver los cambios en el archivo Changelog.txt
# slackpkg check-updates

Actualizar el sistema
# slackpkg upgrade-all

Como hemos actualizado el kernel el sistema nos pregunta si queremos actualizar lilo, le decimos que no porque nuestro sistema es uefi y utiliza elilo.

$ vim /etc/fstab


Ejecutar eliloconfig (si no lo hace no arrancara el sistema con el nuevo kernel)
# eliloconfig

# slackpkg check-updates

No news... is good news

Esto quiere decir que no hay cambios en ChangeLog.txt

Manejador de new config files de Slackware:


Alternativamente podemos utilizar find para encontrar los archivos .new
# find /etc/ *.new
blacklist.new
mirrors.new

Actualizar KDE 5 Plasma
Un proceso sencillo gracias al trabajo de Eric Hameleers alias alienbob y documentado en el archivo README o README.html. Es el archivo que Eric Hameleers (alienbob) mantiene actualizado. Las cosas que pueden cambiar estarán en el README del día que realice la actualización.

Imprescindible no estar ejecutando KDE o cualquier entorno X. Haga un cierre de sesion (log out) y cambie al nivel de ejecución (runlevel) 3 tecleando init 3 si esta en runlevel 4 (grafical login). Luego ejecute los camandos del archivo README desde la consola.

Dicho esto, hago un resumen de la actualización que yo he realizado en octubre del 2016.

Si inicia con startx (/etc/inittab):

 These are the default runlevels in Slackware:
#   0 = halt
#   1 = single user mode
#   2 = unused (but configured the same as runlevel 3)
#   3 = multiuser mode (default Slackware runlevel)
#   4 = X11 with KDM/GDM/XDM (session managers)
#   5 = unused (but configured the same as runlevel 3)
#   6 = reboot

# Default runlevel. (Do not set to 0 or 6)
id:3:initdefault:

Actualizar KDE 5 Plasma desde KDE 4.14.3

# removepkg /var/log/packages/*-4.14.3-*
# removepkg libkscreen
# removepkg kscreen
# removepkg kactivities
# removepkg kde-workspace
# removepkg libmm-qt
# removepkg libnm-qt
# removepkg plasma-nm
#removepkg polkit-kde-agent-1
# removepkg polkit-kde-kcmodules-1
# removepkg kdeconnect-kde
# removepkg kdepimlibs

Más fácil aún es la utilización de Slackpkg y antes deseleccionar los paquetes que quiere conservar (Amarok, Calligra, k3b, etc):
# slackpkg remove kde

Descargar los archivos precompilados necesarios utilizando rsync (Alternativamente puede utilzar lftp)
Necesito los paquetes x86_64 por tanto excluyo los x86, no olvide el punto final
$ mkdir alien
$ cd alien
$ rsync -av --exclude=x86 rsync://alien.slackbook.org/alien/ktown/current/5 .


$ pwd
/home/carles/alien
$ ls
$ README  README.html   x86_64

Ejecutar estos comando como root. Slackware 64-bit:

# upgradepkg --reinstall --install-new x86_64/deps/*.t?z
# upgradepkg --reinstall --install-new x86_64/deps/telepathy/*.t?z
# upgradepkg --reinstall --install-new x86_64/kde/*/*.t?z

Para instalar el paquete de idioma español
# upgradepkg --install-new x86_64/kdei/kde-l10n-es-16.08.0-noarch-1alien.txz

Si tiene el paquete de idioma instalado
# upgradepkg x86_64/kdei/*.t?z

Procesar los "*.new" archivos con
# slackpkg new-config

Por  último y no menos importante tiene que ejecutar 'xwmconfig'
# xwmconfig
y seleccione 'xinitrc.plasma' como su session desktop.


Reiniciar
user name: carles
password
# startx

slackware-live-edition

Unix es genial!.