Introduccion:
Instalar el escritorio KDE4.
Requerimientos:
* FreeBSD instalado
* The X Window System instalado
* Conexion a Internet
* Leer este tutorial
El proceso:
Actualizar el arbol de ports
# portsnap update
Agregar los parametros recomendados en /etc/make.conf
# edit /etc/make.conf
Agregamos las siguientes lineas
# FreeBSD versions earlier than 10.X require this line
# http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/pkgng-intro.html
#
WITH_PKGNG=yes
Instalar el meta-port kde4
# cd /usr/ports/x11/kde4
# make config-recursive
kde 4.10.5_1
[ ] KDEACCESSIBILITY Accessibility applications
[ ] KDEADMIN Administration utilities
[ ] KDEARTWORK Additional screensavers and wallpapers
[ ] KDEBINDINGS Bindings for programming languages
[ ] KDEEDU Entertaining, educational programs
[ ] KDEGAMES Collection of games
[ ] KDEGRAPHICS Graphics utilities
[ ] KDEMULTIMEDIA Multimedia applications
[ ] KDENETWORK Network-related programs
[ ] KDEPLASMA Extra plasmoids and plugins for Plasma
[ ] KDESDK Software development kit
[ ] KDETOYS Miscellaneous small applications
[ ] KDEUTILS Set of generic utilities
[ ] KDEWEBDEV Web development environment
───────────────── PIM ─────────────────
( ) KDEPIM Personal information management
( ) KDEPIM44 KDE-Pim 4.4 (legacy version)
Yo desactivo todo ya que solo quiero KDE4 sin adicionales (EDU, GAMES, etc.), pero se pueden instalar si los desea dejando todo por defecto.
Los ports "KDEACCESSIBILITY", "KDEADMIN", etc., los puedo dejar por defecto ya que en el meta-port kde4 los desactive y no se instalaran (si se desea instalar EDU, GAMES, etc., tambien se dejan por defecto).
Los demas ports necesarios para kde4 tambien se dejan las opciones por defecto.
Nota:
Si tengo problemas con los cambios al meta-port kde4, puedo borrar los ajustes que hice para dejarlo como estaba por defecto e iniciar los ajustes nuevamente con el comando # rm -rf /var/db/ports/*
# make install clean
KDE requiere montar /proc para hacerlo editamos /etc/fstab
# edit /etc/fstab
Agregamos las siguientes lineas
# KDE requires the /proc mounted
proc /proc procfs rw 0 0
Montamos manualmente para no tener que reiniciar
# mount -a
Crear el archivo que iniciara kde4 en el home del usuario, que en nuestro ejemplo se llama John Doe y su home es john
# echo '# KDE' > /home/john/.xinitrc
# echo 'exec /usr/local/bin/startkde' >> /home/john/.xinitrc
# echo 'setxkbmap -option "terminate:ctrl_alt_bksp"' >> /home/john/.xinitrc
# echo '# UTF-8' >> /home/john/.xinitrc
# echo 'export LC_ALL=en_US.UTF-8' >> /home/john/.xinitrc
# echo 'export LANGUAGE=en_US.UTF-8' >> /home/john/.xinitrc
# echo 'export LANG=en_US.UTF-8' >> /home/john/.xinitrc
Para iniciar kde4 desde el usuario John Doe, usamos
$ startx
2014/02/06
The X Window System
Introduccion:
Instalar The X Window System en FreeBSD.
Requerimientos:
* FreeBSD instalado
* Conexion a Internet
* Leer este tutorial
El proceso:
Actualizar el arbol de ports
# portsnap update
Agregar los parametros recomendados en /etc/make.conf
# edit /etc/make.conf
Agregamos las siguientes lineas
# Installing KMS Ports
# https://wiki.freebsd.org/Graphics#Ports
#
WITH_NEW_XORG=yes
WITH_GALLIUM=yes # Needed for Radeon cards, but doesn't harm with Intel devices.
#
# FreeBSD versions earlier than 10.X require this line
# http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/pkgng-intro.html
#
WITH_PKGNG=yes
Instalar el port xorg
# cd /usr/ports/x11/xorg
# make config-recursive
xorg-apps 7.7
(dejo todo como esta por defecto)
xorg-drivers 7.7
[X] MOUSE Install mouse input driver
[X] KEYBOARD Install keyboard input driver
desactivo todo y solo dejo estos tres activados
python27-2.7.6_1 (todo por defecto)
libdrm-2.4.17_1 (todo por defecto)
xterm-300 (todo por defecto)
pixman-0.30.2 (tod por defecto)
xf86-video-radeonhd-1.3.0_5 (tod por defecto)
libxml2-2.8.0_3 (todo por defecto)
m4-1.4.17,1 (todo por defecto)
perl5-5.16.3_4 (todo por defecto)
png-1.5.17 (todo por defecto)
freetype2-2.5.0.1 (todo por defecto)
dejavu-2.34 (todo por defecto)
xorg-server-1.7.7_11,1 (todo por defecto)
libcheck-0.9.11 (todo por defecto)
libxslt-1.1.28_1 (todo por defecto)
hal-0.5.14_22 (todo por defecto)
xkeyboard-config-2.9_1 (todo por defecto)
policykit-0.9_6 (todo por defecto)
docbook-xsl-1.76.1_1 (todo por defecto)
glib-2.36.3_1 (todo por defecto)
pcre-8.33 (todo por defecto)
polkit-0.105_1 (todo por defecto)
unzip-6.0_1 (todo por defecto)
xmlcatmgr-2.2 (todo por defecto)
docbook-1.4_1 (todo por defecto)
dbus-1.6.12 (todo por defecto)
libffi-3.0.13 (todo por defecto)
docbook-5.0_1 (todo por defecto)
cairo-1.10.2_6,2 (todo por defecto)
# make install clean
Agregar estas lineas para cargar al inicio
# echo '# X11 Configuration' >> /etc/rc.conf
# echo 'hald_enable="YES"' >> /etc/rc.conf
# echo 'dbus_enable="YES"' >> /etc/rc.conf
Iniciarlo complementos (start|stop|restart)
# /usr/local/etc/rc.d/dbus start
# /usr/local/etc/rc.d/hald start
Crear el archivo xorg.conf.new basico
# rehash
# Xorg -configure
Editar el archivo con los parametros para el monitor
# edit /root/xorg.conf.new
En mi caso tengo este monitor
http://support.dell.com/support/edocs/systems/1907FP/en/about.htm#Specifications
En la seccion "Monitor" le agregamos HorizSync, VertRefresh y Option "DPMS"
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
HorizSync 30-81
VertRefresh 56-76
Option "DPMS"
EndSection
En la seccion "Screen" solo dejamos Depth 24 y Modes "1280x1024"
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1280x1024"
EndSubSection
EndSection
Probamos nuestro archivo para ver si funciona bien
# Xorg -config /root/xorg.conf.new -retro
Esto inicia las X, para pararlo
Ctrl+Alt+F1 y usamos Ctrl+C
Nota:
En mi caso con una tarjeta Nvidia, no carga las X, pero luego con el driver de nvidia todo funciona bien.
Copiar el archivo al lugar correcto con el nombre final
# cp /root/xorg.conf.new /etc/X11/xorg.conf
Instalar el driver de Nvidia
# cd /usr/ports/x11/nvidia-driver
# make config-recursive
nvidia-driver-319.32
[ ] ACPI_PM ACPI_PM Power Management support
[X] DOCS Build and/or install documentation
[ ] LINUX Linux compatibility support
[ ] WBINVD Flush CPU caches directly with WBINVD
<OK>
# make install clean
Cargar manualmente el modulo
# kldload nvidia
Agregar estas lineas para cargar al inicio
# echo '# NVIDIA Driver' >> /boot/loader.conf
# echo 'nvidia_load="YES"' >> /boot/loader.conf
Editar el archivo para usar el driver nvidia en lugar de nv
# edit /etc/X11/xorg.conf
cambiar la linea original
Driver "nv"
por
Driver "nvidia"
Instalar el port mesa-demos para poder usar glxgears y glxinfo
# cd /usr/ports/graphics/mesa-demos
# make install clean
Otros ports relacionados con NVIDIA
x11/nvidia-settings
x11/nvidia-xconfig
Instalar The X Window System en FreeBSD.
Requerimientos:
* FreeBSD instalado
* Conexion a Internet
* Leer este tutorial
El proceso:
Actualizar el arbol de ports
# portsnap update
Agregar los parametros recomendados en /etc/make.conf
# edit /etc/make.conf
Agregamos las siguientes lineas
# Installing KMS Ports
# https://wiki.freebsd.org/Graphics#Ports
#
WITH_NEW_XORG=yes
WITH_GALLIUM=yes # Needed for Radeon cards, but doesn't harm with Intel devices.
#
# FreeBSD versions earlier than 10.X require this line
# http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/pkgng-intro.html
#
WITH_PKGNG=yes
Instalar el port xorg
# cd /usr/ports/x11/xorg
# make config-recursive
xorg-apps 7.7
(dejo todo como esta por defecto)
xorg-drivers 7.7
[X] MOUSE Install mouse input driver
[X] KEYBOARD Install keyboard input driver
desactivo todo y solo dejo estos tres activados
python27-2.7.6_1 (todo por defecto)
libdrm-2.4.17_1 (todo por defecto)
xterm-300 (todo por defecto)
pixman-0.30.2 (tod por defecto)
xf86-video-radeonhd-1.3.0_5 (tod por defecto)
libxml2-2.8.0_3 (todo por defecto)
m4-1.4.17,1 (todo por defecto)
perl5-5.16.3_4 (todo por defecto)
png-1.5.17 (todo por defecto)
freetype2-2.5.0.1 (todo por defecto)
dejavu-2.34 (todo por defecto)
xorg-server-1.7.7_11,1 (todo por defecto)
libcheck-0.9.11 (todo por defecto)
libxslt-1.1.28_1 (todo por defecto)
hal-0.5.14_22 (todo por defecto)
xkeyboard-config-2.9_1 (todo por defecto)
policykit-0.9_6 (todo por defecto)
docbook-xsl-1.76.1_1 (todo por defecto)
glib-2.36.3_1 (todo por defecto)
pcre-8.33 (todo por defecto)
polkit-0.105_1 (todo por defecto)
unzip-6.0_1 (todo por defecto)
xmlcatmgr-2.2 (todo por defecto)
docbook-1.4_1 (todo por defecto)
dbus-1.6.12 (todo por defecto)
libffi-3.0.13 (todo por defecto)
docbook-5.0_1 (todo por defecto)
cairo-1.10.2_6,2 (todo por defecto)
# make install clean
Agregar estas lineas para cargar al inicio
# echo '# X11 Configuration' >> /etc/rc.conf
# echo 'hald_enable="YES"' >> /etc/rc.conf
# echo 'dbus_enable="YES"' >> /etc/rc.conf
Iniciarlo complementos (start|stop|restart)
# /usr/local/etc/rc.d/dbus start
# /usr/local/etc/rc.d/hald start
Crear el archivo xorg.conf.new basico
# rehash
# Xorg -configure
Editar el archivo con los parametros para el monitor
# edit /root/xorg.conf.new
En mi caso tengo este monitor
http://support.dell.com/support/edocs/systems/1907FP/en/about.htm#Specifications
En la seccion "Monitor" le agregamos HorizSync, VertRefresh y Option "DPMS"
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
HorizSync 30-81
VertRefresh 56-76
Option "DPMS"
EndSection
En la seccion "Screen" solo dejamos Depth 24 y Modes "1280x1024"
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1280x1024"
EndSubSection
EndSection
Probamos nuestro archivo para ver si funciona bien
# Xorg -config /root/xorg.conf.new -retro
Esto inicia las X, para pararlo
Ctrl+Alt+F1 y usamos Ctrl+C
Nota:
En mi caso con una tarjeta Nvidia, no carga las X, pero luego con el driver de nvidia todo funciona bien.
Copiar el archivo al lugar correcto con el nombre final
# cp /root/xorg.conf.new /etc/X11/xorg.conf
Instalar el driver de Nvidia
# cd /usr/ports/x11/nvidia-driver
# make config-recursive
nvidia-driver-319.32
[ ] ACPI_PM ACPI_PM Power Management support
[X] DOCS Build and/or install documentation
[ ] LINUX Linux compatibility support
[ ] WBINVD Flush CPU caches directly with WBINVD
<OK>
# make install clean
Cargar manualmente el modulo
# kldload nvidia
Agregar estas lineas para cargar al inicio
# echo '# NVIDIA Driver' >> /boot/loader.conf
# echo 'nvidia_load="YES"' >> /boot/loader.conf
Editar el archivo para usar el driver nvidia en lugar de nv
# edit /etc/X11/xorg.conf
cambiar la linea original
Driver "nv"
por
Driver "nvidia"
Instalar el port mesa-demos para poder usar glxgears y glxinfo
# cd /usr/ports/graphics/mesa-demos
# make install clean
Otros ports relacionados con NVIDIA
x11/nvidia-settings
x11/nvidia-xconfig
2014/01/23
FreeBSD 10.0
Introduccion:
Instalar FreeBSD 10.0-RELEASE AMD64
Requerimientos:
* Conexion a Internet
* Disco de instalacion de FreeBSD
* Leer este tutorial
Tutoriales:
En recientes versiones de FreeBSD, luego de la instalacion, podemos configurar parametros mediante el comando
# bsdconfig
Instalar FreeBSD 10.0-RELEASE AMD64
Requerimientos:
* Conexion a Internet
* Disco de instalacion de FreeBSD
* Leer este tutorial
Tutoriales:
http://docs.freebsd.org/doc/6.3-RELEASE/usr/share/doc/handbook/portsnap.html
El proceso:
Iniciar el equipo con el disco de FreeBSD
FreeBSD Installer
Welcome
Welcome to FreeBSD! Would you
like to begin an installation
or use the live CD?
<Install>
FreeBSD Installer
--------------------------------------------------------------------------------------------------------------------
Keymap Selection
The system console driver for FreeBSD defaults to standard "US"
keyboard map. Other keymaps can be chosen below.
>>> Continue wiht default keymap <- Cuando mi teclado es en English
O me desplazo para abajo hasta el idioma correcto
( ) Latin American
( ) Spanish ISO-8859-1
Luego de estar en el idioma correcto (Latin American o Spanish ISO-8859-1)
<Select>
>>> Continue wiht spanish.kbd/latinamerican.kbd keymap
<Select>
Set Hostname
Please choose a hostname for this machine.
If you are running on managed network, please
ask your network administrator for an appropriate
name.
freebsd.example.com
<OK>
Distribution Select
Choose optional system components to
install:
[ * ] doc Additional documentation
[ ] games Games (fortune, etc.)
[ ] lib32 32-bit compatibility libraries
[ * ] ports Ports tree
[ * ] src System source code
<OK>
Partitioning
How would you like topartition your disk?
<Manuall>
<OK>
Partition Editor
Create partitions for FreeBSD. No changes will be
made until you select Finish.
ada0 298 GB (none)
GPT GUID Partition Table
<OK>
<OK>
<Create>
Type: freebsd-boot
Size: 512K
Mountpoint:
Label:
<OK>
<Create>
Type: freebsd-ufs
Size: 16GB
Mountpoint: /
Label: exrootfs
<OK>
<Create>
Type: freebsd-swap
Size: 32GB
Mountpoint:
Label: exswap
<OK>
<Create>
Type: freebsd-ufs
Size: 64GB
Mountpoint: /var
Label: exvarfs
<OK>
<Create>
Type: freebsd-ufs
Size: 16GB
Mountpoint: /tmp
Label: extmpfs
<OK>
<Create>
Type: freebsd-ufs
Size: XXGB <- lo que quede disponible
Mountpoint: /usr
Label: exusrfs
<OK>
ada0 298 GB GPT
ada0p1 512 kb freebsd-boot
ada0p2 16.0 GB freebsd-ufs /
ada0p3 32.0 GB freebsd-swap none
ada0p4 64.0 GB freebsd-ufs /var
ada0p5 16.0 GB freebsd-ufs /tmp
ada0p6 XX.0 GB freebsd-ufs /usr
<Finish>
Confirmation
Your changes will now written to disk. If you
have chosen to overwrite existing data, it will
be PERMANENTLY ERASED. Are you sure you want to
commit your changes?
<Commit>
(inicia particionado e instalacion)
FreeBSD Installer
--------------------------------------------------------------------------------------------------------------------
Please select a password for the system management account (root):
Changing local password for root
New Password: ********
Retype New Password: ********
Network Configuration
Please select a network interface to configure:
em0 Intel(R) PRO/1000 Legacy Network Connection 1.0.3
em1 Intel(R) PRO/1000 Legacy Network Connection 1.0.3
em2 Intel(R) PRO/1000 Legacy Network Connection 1.0.3
em3 Intel(R) PRO/1000 Legacy Network Connection 1.0.3
<OK>
Network Configuration
Would you like to
configure IPv4 for this
interface?
<Yes>
Network Configuration
Would you like to use
DHCP to configure this
interface?
<No>
Network Configuration
Static Network Interface Configuration
IP Address 192.168.0.2
Subnet Mask 255.255.255.0
Default Router 192.168.0.1
<OK>
Network Configuration
Would you like to
configure IPv6 for this
interface?
<Yes>
Network Configuration
Would you like to try
stateless address
autoconfiguration
(SLAAC)?
<Yes>
Network Configuration
Resolver Configuration
Search example.com
IPv6 DNS #1 2001:4860:4860::8888
IPv6 DNS #2 2001:4860:4860::8844
IPv4 DNS #1 8.8.8.8
IPv4 DNS #2 8.8.4.4
<OK>
Nota:
En nuestro caso estamos usando los DNS publicos de Google (IPv4 8.8.8.8 8.8.4.4 IPv6 2001:4860:4860::8888 2001:4860:4860::8844), mas informacion aqui https://developers.google.com/speed/public-dns/
Select local or UTC (Greenwich Mean Time) clock
Is this machine´s CMOS clock set to UTC? If it is set to local time,
or you don´t know, please choose NO here!
<No>
Time Zone Selector
Select a region
2 America -- North and South
Countries in America -- North and South
14 Colombia
<OK>
Does the abbreviation `COT´ look reasonable?
<Yes>
System Configuration
Choose the services you would like to be started at boot:
[*] sshd Secure shell daemon
[ ] moused PS/2 mouse pointer on console
[ ] ntpd Synchronize system and network time
[ ] powerd Adjust CPU frequency dynamically
[*] dumpdev Enable kernel crash dumps to /var/crash
<OK>
Add User Accounts
Would you like to add
users to the installed
system now?
<Yes>
FreeBSD Installer
==================
Add Users
Username: john
Full name: John Doe
Uid (Leave empty for default):
Login group [john]:
Login group is john. Invite john into other groups? []:
Shell (sh csh tcsh nologin) [sh]:
Home directory [/home/john]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a randon password? (yes/no) [no]:
Enter password: ********
Enter password again: ********
Lock out the account after creation? [no]:
Username : john
Password : ********
Full Name : John Doe
Uid : 1001
Class :
Groups : john
Home : /home/john
Home Mode :
Shell : /bin/sh
Locked : no
OK? (yes/no) : yes
adduser: INFO : Successfully added (john) to the user database.
Add another user? (yes/no): no
Goodbye!
Final Configuration
Setup of your FreeBSD system is nearly complete. You can now
modify your configuration choices. After this screen, you will
have an opportunity to make more complex changes using a shell
Exit Apply configuration and exit installer
<OK>
Manual Configuration
The installation is now finished.
Before exiting the installer, would
you like to open a shell in the new
system to make any final manual
modification?
<No>
Complete
Installation of FreeBSD
complete! Would you like
to reboot into the
installed system now?
<Reboot>
(retirar el CD/DVD/USB en el reinicio para iniciar desde el disco duro)
Aplicar los ultimos parches
# freebsd-update fetch
# freebsd-update install
Actualizar el arbol de ports
# portsnap fetch extract
# portsnap fetch update
Finalmente reiniciamos
# reboot
Eso es todo, al iniciar tenemos nuestro FreeBSD funcionando!
Es buen momento para hacer que FreeBSD este con archivos actualizados, para esto agregamos en /etc/crontab las lineas asi:
# echo '# Actualizaciones para FreeBSD' >> /etc/crontab
# echo '00 06 * * * root /usr/sbin/freebsd-update cron' >> /etc/crontab
# echo '# Actualizaciones arbol de ports' >> /etc/crontab
# echo '00 06 * * * root /usr/sbin/portsnap -I cron update' >> /etc/crontab
Iniciar el equipo con el disco de FreeBSD
FreeBSD Installer
Welcome
Welcome to FreeBSD! Would you
like to begin an installation
or use the live CD?
<Install>
FreeBSD Installer
--------------------------------------------------------------------------------------------------------------------
Keymap Selection
The system console driver for FreeBSD defaults to standard "US"
keyboard map. Other keymaps can be chosen below.
>>> Continue wiht default keymap <- Cuando mi teclado es en English
O me desplazo para abajo hasta el idioma correcto
( ) Latin American
( ) Spanish ISO-8859-1
Luego de estar en el idioma correcto (Latin American o Spanish ISO-8859-1)
<Select>
>>> Continue wiht spanish.kbd/latinamerican.kbd keymap
<Select>
Set Hostname
Please choose a hostname for this machine.
If you are running on managed network, please
ask your network administrator for an appropriate
name.
freebsd.example.com
<OK>
Distribution Select
Choose optional system components to
install:
[ * ] doc Additional documentation
[ ] games Games (fortune, etc.)
[ ] lib32 32-bit compatibility libraries
[ * ] ports Ports tree
[ * ] src System source code
<OK>
Partitioning
How would you like topartition your disk?
<Manuall>
<OK>
Partition Editor
Create partitions for FreeBSD. No changes will be
made until you select Finish.
ada0 298 GB (none)
GPT GUID Partition Table
<OK>
<OK>
<Create>
Type: freebsd-boot
Size: 512K
Mountpoint:
Label:
<OK>
<Create>
Type: freebsd-ufs
Size: 16GB
Mountpoint: /
Label: exrootfs
<OK>
<Create>
Type: freebsd-swap
Size: 32GB
Mountpoint:
Label: exswap
<OK>
<Create>
Type: freebsd-ufs
Size: 64GB
Mountpoint: /var
Label: exvarfs
<OK>
<Create>
Type: freebsd-ufs
Size: 16GB
Mountpoint: /tmp
Label: extmpfs
<OK>
<Create>
Type: freebsd-ufs
Size: XXGB <- lo que quede disponible
Mountpoint: /usr
Label: exusrfs
<OK>
ada0 298 GB GPT
ada0p1 512 kb freebsd-boot
ada0p2 16.0 GB freebsd-ufs /
ada0p3 32.0 GB freebsd-swap none
ada0p4 64.0 GB freebsd-ufs /var
ada0p5 16.0 GB freebsd-ufs /tmp
ada0p6 XX.0 GB freebsd-ufs /usr
<Finish>
Confirmation
Your changes will now written to disk. If you
have chosen to overwrite existing data, it will
be PERMANENTLY ERASED. Are you sure you want to
commit your changes?
<Commit>
(inicia particionado e instalacion)
FreeBSD Installer
--------------------------------------------------------------------------------------------------------------------
Please select a password for the system management account (root):
Changing local password for root
New Password: ********
Retype New Password: ********
Network Configuration
Please select a network interface to configure:
em0 Intel(R) PRO/1000 Legacy Network Connection 1.0.3
em1 Intel(R) PRO/1000 Legacy Network Connection 1.0.3
em2 Intel(R) PRO/1000 Legacy Network Connection 1.0.3
em3 Intel(R) PRO/1000 Legacy Network Connection 1.0.3
<OK>
Network Configuration
Would you like to
configure IPv4 for this
interface?
<Yes>
Network Configuration
Would you like to use
DHCP to configure this
interface?
<No>
Network Configuration
Static Network Interface Configuration
IP Address 192.168.0.2
Subnet Mask 255.255.255.0
Default Router 192.168.0.1
<OK>
Network Configuration
Would you like to
configure IPv6 for this
interface?
<Yes>
Network Configuration
Would you like to try
stateless address
autoconfiguration
(SLAAC)?
<Yes>
Network Configuration
Resolver Configuration
Search example.com
IPv6 DNS #1 2001:4860:4860::8888
IPv6 DNS #2 2001:4860:4860::8844
IPv4 DNS #1 8.8.8.8
IPv4 DNS #2 8.8.4.4
<OK>
Nota:
En nuestro caso estamos usando los DNS publicos de Google (IPv4 8.8.8.8 8.8.4.4 IPv6 2001:4860:4860::8888 2001:4860:4860::8844), mas informacion aqui https://developers.google.com/speed/public-dns/
Select local or UTC (Greenwich Mean Time) clock
Is this machine´s CMOS clock set to UTC? If it is set to local time,
or you don´t know, please choose NO here!
<No>
Time Zone Selector
Select a region
2 America -- North and South
Countries in America -- North and South
14 Colombia
<OK>
Does the abbreviation `COT´ look reasonable?
<Yes>
System Configuration
Choose the services you would like to be started at boot:
[*] sshd Secure shell daemon
[ ] moused PS/2 mouse pointer on console
[ ] ntpd Synchronize system and network time
[ ] powerd Adjust CPU frequency dynamically
[*] dumpdev Enable kernel crash dumps to /var/crash
<OK>
Add User Accounts
Would you like to add
users to the installed
system now?
<Yes>
FreeBSD Installer
==================
Add Users
Username: john
Full name: John Doe
Uid (Leave empty for default):
Login group [john]:
Login group is john. Invite john into other groups? []:
Shell (sh csh tcsh nologin) [sh]:
Home directory [/home/john]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a randon password? (yes/no) [no]:
Enter password: ********
Enter password again: ********
Lock out the account after creation? [no]:
Username : john
Password : ********
Full Name : John Doe
Uid : 1001
Class :
Groups : john
Home : /home/john
Home Mode :
Shell : /bin/sh
Locked : no
OK? (yes/no) : yes
adduser: INFO : Successfully added (john) to the user database.
Add another user? (yes/no): no
Goodbye!
Final Configuration
Setup of your FreeBSD system is nearly complete. You can now
modify your configuration choices. After this screen, you will
have an opportunity to make more complex changes using a shell
Exit Apply configuration and exit installer
<OK>
Manual Configuration
The installation is now finished.
Before exiting the installer, would
you like to open a shell in the new
system to make any final manual
modification?
<No>
Complete
Installation of FreeBSD
complete! Would you like
to reboot into the
installed system now?
<Reboot>
(retirar el CD/DVD/USB en el reinicio para iniciar desde el disco duro)
Aplicar los ultimos parches
# freebsd-update fetch
# freebsd-update install
Actualizar el arbol de ports
# portsnap fetch extract
# portsnap fetch update
Finalmente reiniciamos
# reboot
Eso es todo, al iniciar tenemos nuestro FreeBSD funcionando!
Es buen momento para hacer que FreeBSD este con archivos actualizados, para esto agregamos en /etc/crontab las lineas asi:
# echo '# Actualizaciones para FreeBSD' >> /etc/crontab
# echo '00 06 * * * root /usr/sbin/freebsd-update cron' >> /etc/crontab
# echo '# Actualizaciones arbol de ports' >> /etc/crontab
# echo '00 06 * * * root /usr/sbin/portsnap -I cron update' >> /etc/crontab
Con
esas lineas se ejecutan procesos a las 06:00 horas y la ultima parte "cron" hace un aleatorio entre 1 y 3600 segundos para no saturar el servidor
remoto.
Para sincronizar manualmente nuestro arbol de ports
# portsnap update
Activamos el auto chequeo de los discos en caso que no se apague bien o por algun bloqueo
# echo '# Verificar con FSCK' >> /etc/rc.conf
# echo 'fsck_y_enable="YES"' >> /etc/rc.conf
# echo 'background_fsck="NO"' >> /etc/rc.conf
# echo '#background_fsck_delay="60"' >> /etc/rc.conf
Si luego queremos ajustar parametros de la instalacion:
# edit /etc/rc.conf
hostname="freebsd.example.com"
ifconfig_em0=" inet 192.168.0.2 netmask 255.255.255.0"
defaultrouter="192.168.0.1"
ifconfig_em0_ipv6="inet6 accept_rtadv"
ssh_ennable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
# Ajustar el idioma del teclado (solo activar una, si ninguna esta activa queda en English)
#keymap="spanish.iso.kbd"
keymap="latinamerican.kbd"
# edit /etc/resolv.conf
search example.com
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
nameserver 8.8.8.8
nameserver 8.8.4.4
# edit /etc/hosts
::1 localhost localhost.my.domain
127.0.0.1 localhost localhost.my.domain
Para apagar nuestro FreeBSD instalado, usamos el comando:
# shutdown -h now
(con las nuevas boards puede apretar el boton de power e inicia el apagado)
Para reiniciarlo
# shutdown -r now
Parametros recomendados para /etc/make.conf
# edit /etc/make.conf
Agregamos las siguientes lineas
# CUPS-Related Ports
# https://wiki.freebsd.org/Ports/Options/OptionsNG#What_users_need_to_know
# http://lists.freebsd.org/pipermail/freebsd-ports/2013-June/084148.html
#
OPTIONS_SET=CUPS
#
# Qt 4 can be built with optional supporin for:
# - Common UNIX Printing System (CUPS)
# - Network Audio System (NAS)
# - Qt style that renders using GTK (QGTKSTYLE)
#
QT4_OPTIONS= CUPS NAS QGTKSTYLE
#
# Installing KMS Ports
# https://wiki.freebsd.org/Graphics#Ports
#
WITH_NEW_XORG=yes
#
# FreeBSD versions earlier than 10.X require this line
# http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/pkgng-intro.html
#
WITH_PKGNG=yes
#
# Depurar errores en los ports
#
#CMAKE_VERBOSE=yes
#MAKE_JOBS_UNSAFE=yes
Instalar nuestro primer port llamado portmaster (en FreeBSD 10.0 ya viene instalado, pero lo dejare de ejemplo)
# cd /usr/ports/ports-mgmt/portmaster
# make install clean
Limpiar los fuentes descargados en /usr/ports/distfiles de ports que ya no tenemos instalados
# portmaster -y --clean-distfiles
Otros comandos utiles
# make -C /usr/ports/ports-mgmt/portmaster config
# cd /usr/ports/ports-mgmt/portmaster && make showconfig
Si queremos eliminar todos los ports instalados
# rm -rf /usr/local/* /var/db/pkg /compat/linux
Si queremos eliminar todos los cambios que hicimos en un port
# rm /var/db/ports/nombreport/options
Si queremos eliminar todos los cambios que hicimos en todos los ports
# rm -rf /var/db/ports/*
Quien es John Doe? http://en.wikipedia.org/wiki/John_Doe
Para hacer la instalacion en un RAID1 http://www.unix.ck.ua/content/sozdaem-programmnyi-raid1-freebsd-90
Nota:
FreeBSD envia automaticamente reportes de estado al usuario root y solo los vemos si iniciamos localmente con este usuario, pero podemos hacer que estos reportes sean enviados a una cuenta en otro lugar, por ejemplo a nuestra cuenta en Gmail, para hacer esto debemos:
# edit /etc/mail/aliases
Buscamos una linea que dice
# root: me@my.domain
Y luego de esa creamos una nueva con nuestro mail
root: micorreo@gmail.com
Guardamos los cambios en el editor y ejecutamos el comando
# cd /etc/mail && make
Si root tiene un monton de correos, los podemos eliminar con
# cat /dev/null > /var/mail/root
FreeBSD nos permite conectar por SSH a nuestro servidor, pero por seguridad no se puede hacer con el usuario root, entonces primero nos conectamos con el usuario john y luego podemos usar el comando su para subir a root, pero para que john pueda subir, hay que darle permisos a este usuario, para esto
# edit /etc/group
y la linea original
wheel:*:0:root
la dejamos asi
wheel:*:0:root, john
Guardamos cambios y ya podemos conectarnos, ejemplo desde otro equipo con FreeBSD desde el terminal
$ ssh john@IPMISERVIDOR
Password: ******** <- la clave del usuario john
$
Para subir a root escribimos su
$ su
Password: ******** <- la clave del usuario root
freebsd #
En caso de tener un bloqueo en el equipo, podemos usar el siguiente comando:
# kgdb /boot/kernel/kernel.symbols /var/crash/vmcore.0
(kgdb) backtrace <- luego escribimos esto y damos enter
Activar UTF-8 "Alternately, the superuser" (si tenemos acceso a root)
Ver las localizaciones disponibles
$ locale -a | grep '\.UTF-8$'
# edit /etc/login.conf
Modificar esta seccion de modo que quede asi:
default:\
:passwd_format=sha512:\
:copyright=/etc/COPYRIGHT:\
:welcome=/etc/motd:\
:setenv=MAIL=/var/mail/$,BLOCKSIZE=K,LC_COLLATE=C:\
:path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin ~/bin:\
:nologin=/var/run/nologin:\
:cputime=unlimited:\
:datasize=unlimited:\
:stacksize=unlimited:\
:memorylocked=64K:\
:memoryuse=unlimited:\
:filesize=unlimited:\
:coredumpsize=unlimited:\
:openfiles=unlimited:\
:maxproc=unlimited:\
:sbsize=unlimited:\
:vmemoryuse=unlimited:\
:swapuse=unlimited:\
:pseudoterminals=unlimited:\
:priority=0:\
:ignoretime@:\
:umask=022:\
:charset=UTF-8:\
:lang=en_US.UTF-8:
Mire con atencion, las partes en rojo es lo que debemos agregar (,LC_COLLATE=C, \, :charset=UTF-8:\ y :lang=en_US.UTF-8:)
Aplicar los cambios
# cap_mkdb /etc/login.conf
Verificar, cerrar la sesion del usuario, entrar de nuevo y verificar con este comando
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=
Ajustar el volumen de salida de FreeBSD
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/sound-setup.html
$ mixer -s vol 100
Para dejarlo permanentemente al 100 a nivel de driver
# echo '# Setting Default Values for Mixer Channels' >> /boot/device.hints
# echo 'hint.pcm.0.vol="100"' >> /boot/device.hints
Para sincronizar manualmente nuestro arbol de ports
# portsnap update
Activamos el auto chequeo de los discos en caso que no se apague bien o por algun bloqueo
# echo '# Verificar con FSCK' >> /etc/rc.conf
# echo 'fsck_y_enable="YES"' >> /etc/rc.conf
# echo 'background_fsck="NO"' >> /etc/rc.conf
# echo '#background_fsck_delay="60"' >> /etc/rc.conf
Si luego queremos ajustar parametros de la instalacion:
# edit /etc/rc.conf
hostname="freebsd.example.com"
ifconfig_em0=" inet 192.168.0.2 netmask 255.255.255.0"
defaultrouter="192.168.0.1"
ifconfig_em0_ipv6="inet6 accept_rtadv"
ssh_ennable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
# Ajustar el idioma del teclado (solo activar una, si ninguna esta activa queda en English)
#keymap="spanish.iso.kbd"
keymap="latinamerican.kbd"
# edit /etc/resolv.conf
search example.com
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
nameserver 8.8.8.8
nameserver 8.8.4.4
# edit /etc/hosts
::1 localhost localhost.my.domain
127.0.0.1 localhost localhost.my.domain
Para apagar nuestro FreeBSD instalado, usamos el comando:
# shutdown -h now
(con las nuevas boards puede apretar el boton de power e inicia el apagado)
Para reiniciarlo
# shutdown -r now
Parametros recomendados para /etc/make.conf
# edit /etc/make.conf
Agregamos las siguientes lineas
# CUPS-Related Ports
# https://wiki.freebsd.org/Ports/Options/OptionsNG#What_users_need_to_know
# http://lists.freebsd.org/pipermail/freebsd-ports/2013-June/084148.html
#
OPTIONS_SET=CUPS
#
# Qt 4 can be built with optional supporin for:
# - Common UNIX Printing System (CUPS)
# - Network Audio System (NAS)
# - Qt style that renders using GTK (QGTKSTYLE)
#
QT4_OPTIONS= CUPS NAS QGTKSTYLE
#
# Installing KMS Ports
# https://wiki.freebsd.org/Graphics#Ports
#
WITH_NEW_XORG=yes
#
# FreeBSD versions earlier than 10.X require this line
# http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/pkgng-intro.html
#
WITH_PKGNG=yes
#
# Depurar errores en los ports
#
#CMAKE_VERBOSE=yes
#MAKE_JOBS_UNSAFE=yes
Instalar nuestro primer port llamado portmaster (en FreeBSD 10.0 ya viene instalado, pero lo dejare de ejemplo)
# cd /usr/ports/ports-mgmt/portmaster
# make install clean
Limpiar los fuentes descargados en /usr/ports/distfiles de ports que ya no tenemos instalados
# portmaster -y --clean-distfiles
Otros comandos utiles
# make -C /usr/ports/ports-mgmt/portmaster config
# cd /usr/ports/ports-mgmt/portmaster && make showconfig
Si queremos eliminar todos los ports instalados
# rm -rf /usr/local/* /var/db/pkg /compat/linux
Si queremos eliminar todos los cambios que hicimos en un port
# rm /var/db/ports/nombreport/options
Si queremos eliminar todos los cambios que hicimos en todos los ports
# rm -rf /var/db/ports/*
Quien es John Doe? http://en.wikipedia.org/wiki/John_Doe
Para hacer la instalacion en un RAID1 http://www.unix.ck.ua/content/sozdaem-programmnyi-raid1-freebsd-90
Nota:
FreeBSD envia automaticamente reportes de estado al usuario root y solo los vemos si iniciamos localmente con este usuario, pero podemos hacer que estos reportes sean enviados a una cuenta en otro lugar, por ejemplo a nuestra cuenta en Gmail, para hacer esto debemos:
# edit /etc/mail/aliases
Buscamos una linea que dice
# root: me@my.domain
Y luego de esa creamos una nueva con nuestro mail
root: micorreo@gmail.com
Guardamos los cambios en el editor y ejecutamos el comando
# cd /etc/mail && make
Si root tiene un monton de correos, los podemos eliminar con
# cat /dev/null > /var/mail/root
FreeBSD nos permite conectar por SSH a nuestro servidor, pero por seguridad no se puede hacer con el usuario root, entonces primero nos conectamos con el usuario john y luego podemos usar el comando su para subir a root, pero para que john pueda subir, hay que darle permisos a este usuario, para esto
# edit /etc/group
y la linea original
wheel:*:0:root
la dejamos asi
wheel:*:0:root, john
Guardamos cambios y ya podemos conectarnos, ejemplo desde otro equipo con FreeBSD desde el terminal
$ ssh john@IPMISERVIDOR
Password: ******** <- la clave del usuario john
$
Para subir a root escribimos su
$ su
Password: ******** <- la clave del usuario root
freebsd #
En caso de tener un bloqueo en el equipo, podemos usar el siguiente comando:
# kgdb /boot/kernel/kernel.symbols /var/crash/vmcore.0
(kgdb) backtrace <- luego escribimos esto y damos enter
Activar UTF-8 "Alternately, the superuser" (si tenemos acceso a root)
Ver las localizaciones disponibles
$ locale -a | grep '\.UTF-8$'
# edit /etc/login.conf
Modificar esta seccion de modo que quede asi:
default:\
:passwd_format=sha512:\
:copyright=/etc/COPYRIGHT:\
:welcome=/etc/motd:\
:setenv=MAIL=/var/mail/$,BLOCKSIZE=K,LC_COLLATE=C:\
:path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin ~/bin:\
:nologin=/var/run/nologin:\
:cputime=unlimited:\
:datasize=unlimited:\
:stacksize=unlimited:\
:memorylocked=64K:\
:memoryuse=unlimited:\
:filesize=unlimited:\
:coredumpsize=unlimited:\
:openfiles=unlimited:\
:maxproc=unlimited:\
:sbsize=unlimited:\
:vmemoryuse=unlimited:\
:swapuse=unlimited:\
:pseudoterminals=unlimited:\
:priority=0:\
:ignoretime@:\
:umask=022:\
:charset=UTF-8:\
:lang=en_US.UTF-8:
Mire con atencion, las partes en rojo es lo que debemos agregar (,LC_COLLATE=C, \, :charset=UTF-8:\ y :lang=en_US.UTF-8:)
Aplicar los cambios
# cap_mkdb /etc/login.conf
Verificar, cerrar la sesion del usuario, entrar de nuevo y verificar con este comando
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=
Ajustar el volumen de salida de FreeBSD
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/sound-setup.html
$ mixer -s vol 100
Para dejarlo permanentemente al 100 a nivel de driver
# echo '# Setting Default Values for Mixer Channels' >> /boot/device.hints
# echo 'hint.pcm.0.vol="100"' >> /boot/device.hints
Poner a Beastie, la mascota de FreeBSD
# edit /boot/loader.conf
# Devil worship in loader logo
loader_logo="beastie"
loader_logo="beastie"
En recientes versiones de FreeBSD, luego de la instalacion, podemos configurar parametros mediante el comando
# bsdconfig
2013/12/13
OpenVPN
Introducion:
Configurar el servicio de OpenVPN en nuestro equipo, para saltar los bloqueos geograficos de algunos servicios en Interntet (Netflix, Google Play Store), seguridad o por simple curiosidad de ver como funciona una VPN.
Existen varias opciones para VPN, puede ver una comparacion muy buena donde se ve claramente que OpenVPN es la mejor PPTP vs L2TP vs OpenVPN.
24/04/2014: Se actualizan los archivos de configuracion debido a un comunicado oficial de OpenVPN referente al "Heartbleed bug" https://medium.com/p/686bb0851387, tambien ya hay dos archivos para usar indistintamente.
Requerimientos:
* Comprar el servicio de VPN en blackVPN (que funciona con tun)
* Un equipo con algun Sistema Operativo compatible (Android, FreeBSD, GNU/Linux, OS X y Windows)
* Leer este manual
Manuales consultados:
http://openvpn.net/index.php/open-source/documentation/manuals.html
https://www.blackvpn.com/howto/save-username-and-password-in-openvpn
http://code.google.com/p/tunnelblick/wiki/UsingTunnelblick
El proceso:
Comprar el servicio de VPN de blackVPN, un magnifico proveedor que encontre, con un muy buen precio, sin limites en el trafico (muy importante si queremos ver contenidos multimedia de por ejemplo Netflix) y que funciona sin tener que hacer ajustes complicados (por que en Android usar tap es un problema y la mayoria de servicios de VPN requieren tab).
Entrar a blackVPN y comprar el servicio llamado 'SINGLE SERVER', que consiste en poder conectar solo a uno de los servidores y que es suficiente, en nuestro ejemplo usare el de USA (US), yo compre '1 Mont 5 USA USA TV/audio'.
Al terminar de hacer la compra, recibiremos los datos de usuario y clave, guardarlos bien ya que son los datos que pondremos en auth.txt.
Descargar los archivos de configuracion de VPN de blackVPN
Entramos a *SUPPORT/HELP y Downloads.
En este lugar buscamos el archivo en la seccion 'Separate country files for OpenVPN by ARNE SCHWABE on Android 4.x' llamado US – USA: blackvpn_usa.ovpn, lo descargamos en nuestro equipo.
En mi caso le hice algunos ajustes, basicamente actualizacion de algunas lineas que daban 'Warning' o que estaban 'Deprecated' y le agregue la linea a un archivo llamado 'auth.txt' donde meto el login y password.
Ejemplo archivo .ovpn para Android con la autenticacion mediante el archivo 'auth.txt':
#------------------------------contenido archivo .ovpn inicio------------------------------
# Activar solo una de las siguientes lineas!
#auth-user-pass
#auth-user-pass auth.txt
auth-user-pass /sdcard/BlackVPN/auth.txt
#auth-user-pass "C:\\Archivos de programa\\OpenVPN\\config\\auth.txt"
#auth-user-pass "C:\\Program Files\\OpenVPN\\config\\auth.txt"
#auth-user-pass "C:\\Archivos de programa (x86)\\OpenVPN\\config\\auth.txt"
#auth-user-pass "C:\\Program Files (x86)\\OpenVPN\\config\\auth.txt"
remote westcoast.vpn.blackvpn.com 443 udp
client
dev tun
fast-io
persist-key
persist-tun
nobind
pull
comp-lzo
tls-client
key-method 2
#tls-remote usa
ns-cert-type server
<ca>
-----BEGIN CERTIFICATE-----
<- Aqui falta el contenido CERTIFICATE
-----END CERTIFICATE-----
</ca>
key-direction 1
<tls-auth>
-----BEGIN OpenVPN Static key V1-----
<- Aqui falta el contenido KEY
-----END OpenVPN Static key V1-----
</tls-auth>
cipher AES-256-CBC
#txqueuelen 486
sndbuf size 1655368
rcvbuf size 1655368
auth SHA512
hand-window 37
mssfix 1400
verb 3
mute 10
# Nota:
# Si usa Windows para crear el archivo auth.txt, use el WORDPAD en lugar del NOTEPAD!
#------------------------------contenido archivo .ovpn fin------------------------------
Descargue el archivo completo (que incluye el contenido CERTIFICATE y KEY, que no puse en el .ovpn de ejemplo) de Google Drive
Archivo 'auth.txt':
Este archivo contiene en la primera linea el usuario y en la segunda la clave (he notado que si se crea en Windows usando el NOTEPAD queda malo, si usa Windows use el WORDPAD), ejemplo
b1234567 <- primera linea el usuario
xYz1234 <- segunda linea la clave
Equipos con Android, usando un explorador de archivos como 'ES File Explorer File Manager' de ESS APP Group, creamos la carpeta BlackVPN en /sdcard y metemos el archivo blackvpn_usa.ovpn y auth.txt en ese lugar, la ruta al archivo auth.txt se especifica asi:
#auth-user-pass
auth-user-pass /sdcard/BlackVPN/auth.txt
Equipos con sistemas tipo Unix, como FreeBSD o GNU/Linux, la ruta al archivo auth.txt se especifica asi:
#auth-user-pass
auth-user-pass auth.txt
Meta ambos archivos blackvpn_usa.ovpn y auth.txt en la carpeta del programa openvpn, por ejemplo en el caso de FreeBSD la ruta es /usr/local/etc/openvpn/
En OS X actualmente el cliente Tunnelblick 3.3 (build 3518) no puede leer usuario y clave desde un archivo auth.txt
Equipos con Windows (ajuste la ruta segun el idioma y si es a 64-bit o 32-bit), la ruta al archivo auth.txt se especifica asi:
#auth-user-pass
auth-user-pass "C:\\Program Files (x86)\\OpenVPN\\config\\auth.txt"
Por favor mire que tenemos que usar " " y \\ para la ruta en Windows!
Tambien hay que activar la linea
dev-node openvpn
Descargar el programa VPN para nuestro equipo segun el Sistema Operativo que tenga
- Android (ver instruccion)
Use 'OpenVPN for Android' de Arne Schwabe mediante la Google Play Store
- FreeBSD (ver instruccion)
Use 'OpenVPN' mediante el port /usr/ports/security/openvpn
- GNU/Linux (ver instruccion)
Use 'OpenVPN' mediante el sistema de paquetes que tenga su distribucion (RPM, APT, YasT)
- Mac OS X (ver instruccion)
Use 'Tunnelblick'
- Windows (ver instruccion)
Use 'OpenVPN'
Instrucciones:
Abrir OpenVPN for Android
Usando el icono de la carpeta, entre a sdcard / BlackVPN
Toque el archivo blackvpn_usa.ovpn
Select
Click en el diskette para guardar
Para conectar
Abrir OpenVPN for Android
En la pestaña Profile seleccione blackvpn_USA
* I trust this application.
OK
# portsnap update
# make -C /usr/ports/security/openvpn config
[x] PW_SAVE Interactive passwords may be read from a file
# cd /usr/ports/security/openvpn && make install clean
# echo '# OpenVPN' >> /etc/rc.conf
# echo 'openvpn_enable="YES"' >> /etc/rc.conf
# echo 'openvpn_if="tun"' >> /etc/rc.conf
# echo 'openvpn_flags=""' >> /etc/rc.conf
# echo 'openvpn_configfile="/usr/local/etc/openvpn/blackvpn_usa.ovpn"' >> /etc/rc.conf
# echo 'openvpn_dir="/usr/local/etc/openvpn"' >> /etc/rc.conf
# kldload if_tap
# echo '# OpenVPN' >> /boot/loader.conf
# echo 'if_tap_load="YES"' >> /boot/loader.conf
# touch /var/log/openvpn-status.log
# chmod 0777 /var/log/openvpn-status.log
# mkdir /usr/local/etc/openvpn
# edit /usr/local/etc/openvpn/blackvpn_usa.ovpn
pegamos el contenido del archivo .ovpn, salimos del editor y guardamos (Esc a a)
# echo 'status /var/log/openvpn-status.log' >> /usr/local/etc/openvpn/blackvpn_usa.ovpn
# touch /usr/local/etc/openvpn/auth.txt
# echo 'b1234567' >> /usr/local/etc/openvpn/auth.txt
# echo 'xYz1234' >> /usr/local/etc/openvpn/auth.txt
Para depurar errores usar
# tail -f /var/log/messages
# tail -f /var/log/openvpn-status.log
Para conectar
# /usr/local/etc/rc.d/openvpn start|stop
Finder / Applications / Utilities / Terminal
$ mkdir -p ~/Library/Application\ Support/Tunnelblick/Configurations/blackvpn.tblk/Contents/Resources/
$ touch ~/Library/Application\ Support/Tunnelblick/Configurations/blackvpn.tblk/Contents/Resources/config.ovpn
$ vi ~/Library/Application\ Support/Tunnelblick/Configurations/blackvpn.tblk/Contents/Resources/config.ovpn
tecla i para poder editar
pegar el contenido del archivo .ovpn
salir del editor vi (Esc :wq)
Para conectar
Finder / Application / Tunnelblick
esto pone un icono en la parte superior derecha (junto a la hora), dar click
Connect blackvpn
Al instalar OpenVPN en Windows, busque en conexiones de red una conexion nueva llamada 'Conexion de area local N' que debemos renombrar a 'openvpn', para identificarla mire la que en sus propiedades dice Conectar usando: 'TAP-Windows Adapter V9'
Meta ambos archivos blackvpn_usa.ovpn y auth.txt en la carpeta del programa openvpn, por ejemplo en el caso de Windows 7 a 64-bit la ruta es C:\Program Files (x86)\OpenVPN\config\
En el archivo blackvpn_usa.ovpn verifique la ruta al archivo auth.txt
auth-user-pass "C:\\Program Files (x86)\\OpenVPN\\config\\auth.txt"
Para conectar
Inicio / Todos los programas / OpenVPN / OpenVPN GUI
esto pone un icono en la parte inferior derecha (junto a la hora), dar click derecho en el y conectar
Configurar el servicio de OpenVPN en nuestro equipo, para saltar los bloqueos geograficos de algunos servicios en Interntet (Netflix, Google Play Store), seguridad o por simple curiosidad de ver como funciona una VPN.
Existen varias opciones para VPN, puede ver una comparacion muy buena donde se ve claramente que OpenVPN es la mejor PPTP vs L2TP vs OpenVPN.
24/04/2014: Se actualizan los archivos de configuracion debido a un comunicado oficial de OpenVPN referente al "Heartbleed bug" https://medium.com/p/686bb0851387, tambien ya hay dos archivos para usar indistintamente.
Requerimientos:
* Comprar el servicio de VPN en blackVPN (que funciona con tun)
* Un equipo con algun Sistema Operativo compatible (Android, FreeBSD, GNU/Linux, OS X y Windows)
* Leer este manual
Manuales consultados:
http://openvpn.net/index.php/open-source/documentation/manuals.html
https://www.blackvpn.com/howto/save-username-and-password-in-openvpn
http://code.google.com/p/tunnelblick/wiki/UsingTunnelblick
El proceso:
Comprar el servicio de VPN de blackVPN, un magnifico proveedor que encontre, con un muy buen precio, sin limites en el trafico (muy importante si queremos ver contenidos multimedia de por ejemplo Netflix) y que funciona sin tener que hacer ajustes complicados (por que en Android usar tap es un problema y la mayoria de servicios de VPN requieren tab).
Entrar a blackVPN y comprar el servicio llamado 'SINGLE SERVER', que consiste en poder conectar solo a uno de los servidores y que es suficiente, en nuestro ejemplo usare el de USA (US), yo compre '1 Mont 5 USA USA TV/audio'.
Al terminar de hacer la compra, recibiremos los datos de usuario y clave, guardarlos bien ya que son los datos que pondremos en auth.txt.
Descargar los archivos de configuracion de VPN de blackVPN
Entramos a *SUPPORT/HELP y Downloads.
En este lugar buscamos el archivo en la seccion 'Separate country files for OpenVPN by ARNE SCHWABE on Android 4.x' llamado US – USA: blackvpn_usa.ovpn, lo descargamos en nuestro equipo.
En mi caso le hice algunos ajustes, basicamente actualizacion de algunas lineas que daban 'Warning' o que estaban 'Deprecated' y le agregue la linea a un archivo llamado 'auth.txt' donde meto el login y password.
Ejemplo archivo .ovpn para Android con la autenticacion mediante el archivo 'auth.txt':
#------------------------------contenido archivo .ovpn inicio------------------------------
# Activar solo una de las siguientes lineas!
#auth-user-pass
#auth-user-pass auth.txt
auth-user-pass /sdcard/BlackVPN/auth.txt
#auth-user-pass "C:\\Archivos de programa\\OpenVPN\\config\\auth.txt"
#auth-user-pass "C:\\Program Files\\OpenVPN\\config\\auth.txt"
#auth-user-pass "C:\\Archivos de programa (x86)\\OpenVPN\\config\\auth.txt"
#auth-user-pass "C:\\Program Files (x86)\\OpenVPN\\config\\auth.txt"
remote westcoast.vpn.blackvpn.com 443 udp
client
dev tun
fast-io
persist-key
persist-tun
nobind
pull
comp-lzo
tls-client
key-method 2
#tls-remote usa
ns-cert-type server
<ca>
-----BEGIN CERTIFICATE-----
<- Aqui falta el contenido CERTIFICATE
-----END CERTIFICATE-----
</ca>
key-direction 1
<tls-auth>
-----BEGIN OpenVPN Static key V1-----
<- Aqui falta el contenido KEY
-----END OpenVPN Static key V1-----
</tls-auth>
cipher AES-256-CBC
#txqueuelen 486
sndbuf size 1655368
rcvbuf size 1655368
auth SHA512
hand-window 37
mssfix 1400
verb 3
mute 10
# Nota:
# Si usa Windows para crear el archivo auth.txt, use el WORDPAD en lugar del NOTEPAD!
#------------------------------contenido archivo .ovpn fin------------------------------
Descargue el archivo completo (que incluye el contenido CERTIFICATE y KEY, que no puse en el .ovpn de ejemplo) de Google Drive
Archivo 'auth.txt':
Este archivo contiene en la primera linea el usuario y en la segunda la clave (he notado que si se crea en Windows usando el NOTEPAD queda malo, si usa Windows use el WORDPAD), ejemplo
b1234567 <- primera linea el usuario
xYz1234 <- segunda linea la clave
Equipos con Android, usando un explorador de archivos como 'ES File Explorer File Manager' de ESS APP Group, creamos la carpeta BlackVPN en /sdcard y metemos el archivo blackvpn_usa.ovpn y auth.txt en ese lugar, la ruta al archivo auth.txt se especifica asi:
#auth-user-pass
auth-user-pass /sdcard/BlackVPN/auth.txt
Equipos con sistemas tipo Unix, como FreeBSD o GNU/Linux, la ruta al archivo auth.txt se especifica asi:
#auth-user-pass
auth-user-pass auth.txt
Meta ambos archivos blackvpn_usa.ovpn y auth.txt en la carpeta del programa openvpn, por ejemplo en el caso de FreeBSD la ruta es /usr/local/etc/openvpn/
En OS X actualmente el cliente Tunnelblick 3.3 (build 3518) no puede leer usuario y clave desde un archivo auth.txt
Equipos con Windows (ajuste la ruta segun el idioma y si es a 64-bit o 32-bit), la ruta al archivo auth.txt se especifica asi:
#auth-user-pass
auth-user-pass "C:\\Program Files (x86)\\OpenVPN\\config\\auth.txt"
Por favor mire que tenemos que usar " " y \\ para la ruta en Windows!
Tambien hay que activar la linea
dev-node openvpn
Descargar el programa VPN para nuestro equipo segun el Sistema Operativo que tenga
- Android (ver instruccion)
Use 'OpenVPN for Android' de Arne Schwabe mediante la Google Play Store
- FreeBSD (ver instruccion)
Use 'OpenVPN' mediante el port /usr/ports/security/openvpn
- GNU/Linux (ver instruccion)
Use 'OpenVPN' mediante el sistema de paquetes que tenga su distribucion (RPM, APT, YasT)
- Mac OS X (ver instruccion)
Use 'Tunnelblick'
- Windows (ver instruccion)
Use 'OpenVPN'
Instrucciones:
- Instruccion Android
Abrir OpenVPN for Android
Usando el icono de la carpeta, entre a sdcard / BlackVPN
Toque el archivo blackvpn_usa.ovpn
Select
Click en el diskette para guardar
Para conectar
Abrir OpenVPN for Android
En la pestaña Profile seleccione blackvpn_USA
* I trust this application.
OK
- Instruccion FreeBSD
# portsnap update
# make -C /usr/ports/security/openvpn config
[x] PW_SAVE Interactive passwords may be read from a file
# cd /usr/ports/security/openvpn && make install clean
# echo '# OpenVPN' >> /etc/rc.conf
# echo 'openvpn_enable="YES"' >> /etc/rc.conf
# echo 'openvpn_if="tun"' >> /etc/rc.conf
# echo 'openvpn_flags=""' >> /etc/rc.conf
# echo 'openvpn_configfile="/usr/local/etc/openvpn/blackvpn_usa.ovpn"' >> /etc/rc.conf
# echo 'openvpn_dir="/usr/local/etc/openvpn"' >> /etc/rc.conf
# kldload if_tap
# echo '# OpenVPN' >> /boot/loader.conf
# echo 'if_tap_load="YES"' >> /boot/loader.conf
# touch /var/log/openvpn-status.log
# chmod 0777 /var/log/openvpn-status.log
# mkdir /usr/local/etc/openvpn
# edit /usr/local/etc/openvpn/blackvpn_usa.ovpn
pegamos el contenido del archivo .ovpn, salimos del editor y guardamos (Esc a a)
# echo 'status /var/log/openvpn-status.log' >> /usr/local/etc/openvpn/blackvpn_usa.ovpn
# touch /usr/local/etc/openvpn/auth.txt
# echo 'b1234567' >> /usr/local/etc/openvpn/auth.txt
# echo 'xYz1234' >> /usr/local/etc/openvpn/auth.txt
Para depurar errores usar
# tail -f /var/log/messages
# tail -f /var/log/openvpn-status.log
Para conectar
# /usr/local/etc/rc.d/openvpn start|stop
- Instruccion GNU/Linux
- Instruccion OS X
Finder / Applications / Utilities / Terminal
$ mkdir -p ~/Library/Application\ Support/Tunnelblick/Configurations/blackvpn.tblk/Contents/Resources/
$ touch ~/Library/Application\ Support/Tunnelblick/Configurations/blackvpn.tblk/Contents/Resources/config.ovpn
$ vi ~/Library/Application\ Support/Tunnelblick/Configurations/blackvpn.tblk/Contents/Resources/config.ovpn
tecla i para poder editar
pegar el contenido del archivo .ovpn
salir del editor vi (Esc :wq)
Para conectar
Finder / Application / Tunnelblick
esto pone un icono en la parte superior derecha (junto a la hora), dar click
Connect blackvpn
- Instruccion Windows
Al instalar OpenVPN en Windows, busque en conexiones de red una conexion nueva llamada 'Conexion de area local N' que debemos renombrar a 'openvpn', para identificarla mire la que en sus propiedades dice Conectar usando: 'TAP-Windows Adapter V9'
Meta ambos archivos blackvpn_usa.ovpn y auth.txt en la carpeta del programa openvpn, por ejemplo en el caso de Windows 7 a 64-bit la ruta es C:\Program Files (x86)\OpenVPN\config\
En el archivo blackvpn_usa.ovpn verifique la ruta al archivo auth.txt
auth-user-pass "C:\\Program Files (x86)\\OpenVPN\\config\\auth.txt"
Para conectar
Inicio / Todos los programas / OpenVPN / OpenVPN GUI
esto pone un icono en la parte inferior derecha (junto a la hora), dar click derecho en el y conectar
2013/10/11
VSFTPD
Introducion:
Instalar VSFTPD en FreeBSD
En nuestro caso el servicio permitira subir archivos mediante un usuario y clave, pero no permitira conexiones anonimas.
Requerimientos:
* Conexion a Internet
* FreeBSD instalado
* Leer este manual
El proceso:
Actualizar el arbol de ports
(ya se debe hacer mediante portsnap)
Instalar el port de VSFTPD
# whereis vsftpd
vsftpd: /usr/ports/ftp/vsftpd
# cd /usr/ports/ftp/vsftpd
# make install clean
...
===> Registering installation for vsftpd-3.0.2
El contenidos de los archivos es:
# egrep -v '#|^ *$' /usr/local/etc/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
ftpd_banner=Welcome to Alpha FTP service.
chroot_local_user=YES
listen=YES
secure_chroot_dir=/usr/local/share/vsftpd/empty
background=YES
pasv_min_port=49152
pasv_max_port=65535
Para que el servicio inicie con el servidor
# edit /etc/rc.conf
Agregar
vsftpd_enable="YES"
Iniciar el servicio
# /usr/local/etc/rc.d/vsftpd start
Crear el usuario para las transferencias
# adduser
Username: invitadoftp
Full name: invitadoftp
Uid (Leave empty for default):
Login group [invitadoftp]:
Login group is invitadoftp. Invite invitadoftp into other groups? []:
Login class [default]:
Shell (sh csh tcsh nologin) [sh]: nologin
Home directory [/home/invitadoftp]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
Username : invitadoftp
Password : laclavesecreta
Full Name : invitadoftp
Uid : 1120
Class :
Groups : invitadoftp
Home : /home/invitadoftp
Home Mode :
Shell : /usr/sbin/nologin
Locked : no
OK? (yes/no): yes
adduser: INFO: Successfully added (invitadoftp) to the user database.
Add another user? (yes/no): no
Goodbye!
Asignar el directorio creado al usuario root
# chown root /home/invitadoftp
Quitarle el permiso de escribir al usuario
# chmod -w /home/invitadoftp
Crear un directorio llamado pub dentro
# mkdir /home/invitadoftp/pub
Darle permisos de escritura en el directorio pub
# chmod -R 777 /home/invitadoftp/pub
En el firewall hay que abrir los puertos necesarios, un ejemplo para PF (en nuestro caso estamos abriendo el puerto 21 y un rango desde 49152 hasta 65535)
# PF "Self-Protecting" an FTP Server (passive)
pass in on $ext_if proto tcp from any to any port { ftp, > 49151 } \
keep state
Para verificar que nuestro servidor ftp funciona, lo podemos hacer de dos formas:
Ejemplo 1
En el mismo servidor usando el Shell Unix
$ ftp invitadoftp@localhost
...
Ejemplo 2
Desde otro equipo hacia el servidor por Internet, ejemplo desde un Shell Unix (en el caso de que tenga algun *unix)
$ ftp invitadoftp@IPDELSERVIDOR
Connected to IPDELSERVIDOR.
220 Welcome to Alpha FTP service.
331 Please specify the password.
Password: laclavesecreta
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
229 Entering Extended Passive Mode (|||54611|).
150 Here comes the directory listing.
drwxrwxrwx 2 1010 1010 97 Oct 21 15:50 pub
226 Directory send OK.
ftp> quit
221 Goodbye.
$
Continuando con el ejemplo 2, si este equipo tiene un Windows, desde el DOS
C:\>ftp IPDELSERVIDOR
Si queremos que el directorio no tenga archivos o carpetas con mas de 7 dias
Creamos un script
# edit /usr/home/backups/scripts/script-del-old.sh
que se veria asi, use este comando para verlo # cat /usr/home/backups/scripts/script-del-old.sh
#! /bin/sh
# Archivos
find /usr/home/invitadoftp/pub -type f -mtime +1w -exec rm {} \;
# Carpetas (indispensable la opcion "-depth 1" o borrara pub si esta vacia)
find /usr/home/invitadoftp/pub -depth 1 -type d -empty -mtime +1w -exec rmdir {} \;
Le damos permisos de ejecucion
# chmod +x /usr/home/backups/scripts/script-del-old.sh
Y en cron ponemos la linea
00 01 * * * root /usr/home/backups/scripts/script-del-old.sh
Con esto ejecutamos diariamente una busqueda todos los dias a las 01 de la manana de los
archivos y carpetas vacias de mas de una semana o 7 dias y los borramos.
Otro ejemplo aun mas elaborado del script seria asi, use este comando para verlo # cat /usr/home/backups/scripts/script-del-old.sh
#! /bin/sh
# Archivos
find /usr/home/invitadoftp/pub -type f -mtime +1w > /tmp/listfiles.txt
rm `cat /tmp/listfiles.txt`
mail -s "Archivos borrados del FTP" login@gmail.com < /tmp/listfiles.txt
rm /tmp/listfiles.txt
# Carpetas
find /usr/home/invitadoftp/pub -depth 1 -type d -empty -mtime +1w > /tmp/listdirectories.txt
rmdir `cat /tmp/listdiries.txt`
mail -s "Carpetas borradas del FTP" login@gmail.com < /tmp/listdiries.txt
rm /tmp/listdiries.txt
Instalar VSFTPD en FreeBSD
En nuestro caso el servicio permitira subir archivos mediante un usuario y clave, pero no permitira conexiones anonimas.
Requerimientos:
* Conexion a Internet
* FreeBSD instalado
* Leer este manual
El proceso:
Actualizar el arbol de ports
(ya se debe hacer mediante portsnap)
Instalar el port de VSFTPD
# whereis vsftpd
vsftpd: /usr/ports/ftp/vsftpd
# cd /usr/ports/ftp/vsftpd
# make install clean
...
===> Registering installation for vsftpd-3.0.2
El contenidos de los archivos es:
# egrep -v '#|^ *$' /usr/local/etc/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
ftpd_banner=Welcome to Alpha FTP service.
chroot_local_user=YES
listen=YES
secure_chroot_dir=/usr/local/share/vsftpd/empty
background=YES
pasv_min_port=49152
pasv_max_port=65535
Para que el servicio inicie con el servidor
# edit /etc/rc.conf
Agregar
vsftpd_enable="YES"
Iniciar el servicio
# /usr/local/etc/rc.d/vsftpd start
Crear el usuario para las transferencias
# adduser
Username: invitadoftp
Full name: invitadoftp
Uid (Leave empty for default):
Login group [invitadoftp]:
Login group is invitadoftp. Invite invitadoftp into other groups? []:
Login class [default]:
Shell (sh csh tcsh nologin) [sh]: nologin
Home directory [/home/invitadoftp]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
Username : invitadoftp
Password : laclavesecreta
Full Name : invitadoftp
Uid : 1120
Class :
Groups : invitadoftp
Home : /home/invitadoftp
Home Mode :
Shell : /usr/sbin/nologin
Locked : no
OK? (yes/no): yes
adduser: INFO: Successfully added (invitadoftp) to the user database.
Add another user? (yes/no): no
Goodbye!
Asignar el directorio creado al usuario root
# chown root /home/invitadoftp
Quitarle el permiso de escribir al usuario
# chmod -w /home/invitadoftp
Crear un directorio llamado pub dentro
# mkdir /home/invitadoftp/pub
Darle permisos de escritura en el directorio pub
# chmod -R 777 /home/invitadoftp/pub
En el firewall hay que abrir los puertos necesarios, un ejemplo para PF (en nuestro caso estamos abriendo el puerto 21 y un rango desde 49152 hasta 65535)
# PF "Self-Protecting" an FTP Server (passive)
pass in on $ext_if proto tcp from any to any port { ftp, > 49151 } \
keep state
Para verificar que nuestro servidor ftp funciona, lo podemos hacer de dos formas:
Ejemplo 1
En el mismo servidor usando el Shell Unix
$ ftp invitadoftp@localhost
...
Ejemplo 2
Desde otro equipo hacia el servidor por Internet, ejemplo desde un Shell Unix (en el caso de que tenga algun *unix)
$ ftp invitadoftp@IPDELSERVIDOR
Connected to IPDELSERVIDOR.
220 Welcome to Alpha FTP service.
331 Please specify the password.
Password: laclavesecreta
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
229 Entering Extended Passive Mode (|||54611|).
150 Here comes the directory listing.
drwxrwxrwx 2 1010 1010 97 Oct 21 15:50 pub
226 Directory send OK.
ftp> quit
221 Goodbye.
$
Continuando con el ejemplo 2, si este equipo tiene un Windows, desde el DOS
C:\>ftp IPDELSERVIDOR
Si queremos que el directorio no tenga archivos o carpetas con mas de 7 dias
Creamos un script
# edit /usr/home/backups/scripts/script-del-old.sh
que se veria asi, use este comando para verlo # cat /usr/home/backups/scripts/script-del-old.sh
#! /bin/sh
# Archivos
find /usr/home/invitadoftp/pub -type f -mtime +1w -exec rm {} \;
# Carpetas (indispensable la opcion "-depth 1" o borrara pub si esta vacia)
find /usr/home/invitadoftp/pub -depth 1 -type d -empty -mtime +1w -exec rmdir {} \;
Le damos permisos de ejecucion
# chmod +x /usr/home/backups/scripts/script-del-old.sh
Y en cron ponemos la linea
00 01 * * * root /usr/home/backups/scripts/script-del-old.sh
Con esto ejecutamos diariamente una busqueda todos los dias a las 01 de la manana de los
archivos y carpetas vacias de mas de una semana o 7 dias y los borramos.
Otro ejemplo aun mas elaborado del script seria asi, use este comando para verlo # cat /usr/home/backups/scripts/script-del-old.sh
#! /bin/sh
# Archivos
find /usr/home/invitadoftp/pub -type f -mtime +1w > /tmp/listfiles.txt
rm `cat /tmp/listfiles.txt`
mail -s "Archivos borrados del FTP" login@gmail.com < /tmp/listfiles.txt
rm /tmp/listfiles.txt
# Carpetas
find /usr/home/invitadoftp/pub -depth 1 -type d -empty -mtime +1w > /tmp/listdirectories.txt
rmdir `cat /tmp/listdiries.txt`
mail -s "Carpetas borradas del FTP" login@gmail.com < /tmp/listdiries.txt
rm /tmp/listdiries.txt
2013/03/06
Migrar de CVSup/csup a portsnap
Tradicionalmente se usaba csup en un comando como este
# csup -h cvsup15.us.FreeBSD.org -g -L 2 /usr/share/examples/cvsup/ports-supfile
para mantener actualizado nuestro arbol de ports en FreeBSD, pero se anuncia que por el 28 de Febrero del 2013, se migrara de CVS, CVsup y csup al nuevo portsnap.
Para migrar en los FreeBSD que ya teniamos nuestro arbol de ports de la forma antigua...
Cuando hemos instalado una gran cantidad de ports, el directorio /usr/ports/distfiles esta lleno de archivos fuentes que no queremos perder, le hacemos una copia
# cp -r /usr/ports/distfiles /home/
# cp -r /usr/ports/packages /home/
Ahora borraremos el viejo arbol de ports
# rm -rf /usr/ports
Ya podemos iniciar trabajo con portsnap
La primera vez que vamos a usar portsnap hay que descargar un snapshot del arbol de ports y descomprimirlo en /usr/ports
# portsnap fetch extract
Luego para mantener nuestro arbol de ports actualizado, se ejecuta el comando
# portsnap fetch update
El Handbook
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html, y mas especificamente en http://www.freebsd.org/cgi/man.cgi?query=portsnap&sektion=8 dice que se debe poner la linea asi:
00 06 * * * root /usr/sbin/portsnap cron
Pero no me hace nada!
Otro sitio https://bitdrop.st0w.com/2009/05/18/setting-up-a-new-freebsd-server-for-easy-maintenance recomienda que es mejor con otros datos, pero tampoco funciona.
00 06 * * * root /usr/sbin/portsnap update cron
Y esta ultima si funciona!
Por ultimo tenemos que volver a copiar nuestra carpeta distfiles que copiamos en /home y borrarla al terminar
# cp -r /home/distfiles /usr/ports/
# cp -r /home/packages /usr/ports/
# rm -rf /home/distfiles
# rm -rf /home/packages
# csup -h cvsup15.us.FreeBSD.org -g -L 2 /usr/share/examples/cvsup/ports-supfile
para mantener actualizado nuestro arbol de ports en FreeBSD, pero se anuncia que por el 28 de Febrero del 2013, se migrara de CVS, CVsup y csup al nuevo portsnap.
Para migrar en los FreeBSD que ya teniamos nuestro arbol de ports de la forma antigua...
Cuando hemos instalado una gran cantidad de ports, el directorio /usr/ports/distfiles esta lleno de archivos fuentes que no queremos perder, le hacemos una copia
# cp -r /usr/ports/distfiles /home/
# cp -r /usr/ports/packages /home/
Ahora borraremos el viejo arbol de ports
# rm -rf /usr/ports
Ya podemos iniciar trabajo con portsnap
La primera vez que vamos a usar portsnap hay que descargar un snapshot del arbol de ports y descomprimirlo en /usr/ports
# portsnap fetch extract
Luego para mantener nuestro arbol de ports actualizado, se ejecuta el comando
# portsnap fetch update
El Handbook
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html, y mas especificamente en http://www.freebsd.org/cgi/man.cgi?query=portsnap&sektion=8 dice que se debe poner la linea asi:
00 06 * * * root /usr/sbin/portsnap cron
Pero no me hace nada!
Otro sitio https://bitdrop.st0w.com/2009/05/18/setting-up-a-new-freebsd-server-for-easy-maintenance recomienda que es mejor con otros datos, pero tampoco funciona.
00 06 * * * root /usr/sbin/portsnap update cron
Y esta ultima si funciona!
Por ultimo tenemos que volver a copiar nuestra carpeta distfiles que copiamos en /home y borrarla al terminar
# cp -r /home/distfiles /usr/ports/
# cp -r /home/packages /usr/ports/
# rm -rf /home/distfiles
# rm -rf /home/packages
2013/03/04
Samba4 AD/DC
Escenario:
FreeBSD 9.1 + Samba 4 (Bind99, SAMBA_INTERNAL) + Bind99 (actualizado desde el DHCP) + DHCP
Resultado:
Funciona!
Manuales consultados:
http://wiki.samba.org/index.php/Samba_AD_DC_HOWTO
http://www.whitneytechnologies.com/?p=422
http://fraterneo.blogspot.com/2012/12/como-configurar-un-controlador-de.html
http://www.freebsd.org/doc/handbook/kerberos5.html
http://www.rjsystems.nl/en/2100-dns-discovery-kerberos.php
http://es.wikipedia.org/wiki/Kerberos
http://www.bind9.net/manuals
http://albertolarripa.com/?p=1530
http://www.semicomplete.com/articles/dynamic-dns-with-dhcp
http://forums.freebsd.org/showthread.php?t=33849
http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/DNSDHCP.html
http://lani78.wordpress.com/2012/07/23/make-your-dhcp-server-dynamically-update-your-dns-records-on-ubuntu-12-04-precise-pangolin
Parametros de red:
hostname="samdom.example.com"
keymap="spanish.iso.kbd"
#ifconfig_em0="DHCP"
ifconfig_em0="inet 192.168.2.101 netmask 255.255.255.0"
defaultrouter="192.168.2.1"
ifconfig_em1="inet 192.168.1.1 netmask 255.255.255.0"
ipv6_activate_all_interfaces="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
sshd_enable="YES"
Particionado del disco SATA:
ada0 931GB GPT
ada0p1 512kB freebsd-boot
ada0p2 16GB freebsd-ufs / exrootfs
ada0p3 32GB freebsd-swap none exswap
ada0p4 64GB freebsd-ufs /var exvarfs
ada0p5 16GB freebsd-ufs /tmp extmpfs
ada0p6 803GB freebsd-ufs /usr exusrfs
Claves en el FreeBSD:
root / 123
PORTS
Descargar el arbol de ports "fetch", se descomprime "extract" (se ejecuta la primera vez)
# portsnap fetch extract
Ahora para manterner el arbol de ports actualizado, se ejecuta siempre
# portsnap fetch update
Esta ultima linea se puede agregar al cron para que diario actualice los ports, en /etc/crontab se agrega una linea como esta
00 06 * * * root /usr/sbin/portsnap fetch update >/dev/null 2>&1
ACLS
# cat /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/ada0p2 / ufs rw 1 1
/dev/ada0p3 none swap sw 0 0
/dev/ada0p4 /var ufs rw 2 2
/dev/ada0p5 /tmp ufs rw 2 2
/dev/ada0p6 /usr ufs rw 2 2
# cat /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/ada0p2 / ufs rw,acls 1 1
/dev/ada0p3 none swap sw 0 0
/dev/ada0p4 /var ufs rw,acls 2 2
/dev/ada0p5 /tmp ufs rw,acls 2 2
/dev/ada0p6 /usr ufs rw,acls 2 2
# reboot
Configurar las opciones de Bind99
# cd /usr/ports/dns/bind99
# make config
Options for bind99 9.9.2.1
[ ] FIXED_RRSET Enable fixed rrset ordering
[ ] IDN International Domain Names
[*] IPV6 IPv6 protocol
[ ] LARGE_FILE 64-bit file support
[*] LINKS Create conf file symlinks in /usr/local
[*] REPLACE_BASE Replace base BIND with this version <-MARCAR ESTA OPCION!
[ ] RPZRRL_PATCH RPZ improvements + RRL patch (experimental)
[ ] RPZ_NSDNAME Enable RPZ NSDNAME policy records
[ ] RPZ_NSIP Enable RPZ NSIP trigger rules
[ ] SIGCHASE dig/host/nslookup will do DNSSEC validation
[*] SSL Build with OpenSSL (Required for DNSSEC)
[*] THREADS Threading support
[*] XML Support for xml statistics output
[ ] DLZ_POSTGRESQL G(DLZ): DLZ Postgres driver
[ ] DLZ_POSTGRESQL G(DLZ): DLZ Postgres driver
[ ] DLZ_MYSQL G(DLZ): DLZ MySQL driver (no threading)
[ ] DLZ_BDB G(DLZ): DLZ BDB driver
[ ] DLZ_LDAP G(DLZ): DLZ LDAP driver
[ ] DLZ_FILESYSTEM G(DLZ): DLZ filesystem driver
[ ] DLZ_STUB G(DLZ): DLZ stub driver
< OK >
Instalar Samba4
# cd /usr/ports/net/samba4
# make config
Options for samba4 4.0.3
[*] ACL_SUPPORT File system ACL support
[*] ADS Active Directory support
[*] AIO_SUPPORT Asyncronous IO support
[ ] AVAHI Zeroconf via Avahi <- DESACTIVAR ESTA OPCION!
[*] CUPS CUPS printing system
[*] DEBUG With debug information in the binaries
[ ] DEVELOPER With development support
[*] DNSUPDATE Dynamic DNS update(require ADS)
[ ] EXP_MODULES Experimental modules
[*] FAM_SUPPORT File Alteration Monitor support
[*] LDAP LDAP support
[ ] MANPAGES Build and/or install manual pages
[*] PAM_SMBPASS PAM authentication via passdb backends
[*] PTHREADPOOL Pthread pool
[*] QUOTAS Disk quota support
[*] SWAT SWAT WebGUI
[*] SYSLOG Syslog support
[*] UTMP UTMP accounting support
[*] WINBIND WinBIND support
[ ] NSUPDATE S(DNS): Use internal DNS with NSUPDATE utility <- DESACTIVAR ESTA OPCION!
[ ] BIND98 S(DNS): Use bind98 as a DNS server frontend
[*] BIND99 S(DNS): Use bind99 as a DNS server frontend <- MARCAR ESTA OPCION!
< OK >
# make config-recursive
(todos los otros ports los dejo por defecto)
# make install clean
Nota:
El port de Samba4 con la opcion [*] BIND99 instalara bind99, por eso
primero configuramos las opciones
de bind99 [*] REPLACE_BASE
# rndc-confgen -a -c /etc/namedb/rndc.conf -k rndc-key -b 256
wrote key file "/etc/namedb/rndc.conf"
# cat /etc/namedb/rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "zvuOE1XeVBUXZa12LTUDEAgZaH3cVFZp+GiObzuAB5c=";
};
# edit /etc/namedb/named.conf
options {
// All file and path names are relative to the chroot directory,
// if any, and should be fully qualified.
directory "/etc/namedb/working";
pid-file "/var/run/named/pid";
dump-file "/var/dump/named_dump.db";
statistics-file "/var/stats/named.stats";
...
listen-on { 127.0.0.1; 192.168.1.1; };
...
forwarders {
8.8.8.8;
8.8.4.4;
};
...
//zone "example.com" { type master; file "/etc/namedb/master/empty.db"; }; <- COMENTAR ESTA LINEA!
...
controls {
inet 127.0.0.1 allow { localhost; } keys { rndc-key; };
};
// Take this from the /etc/namedb/rndc.conf file
key "rndc-key" {
algorithm hmac-md5;
secret "zvuOE1XeVBUXZa12LTUDEAgZaH3cVFZp+GiObzuAB5c=";
};
zone "example.com" {
type master;
allow-update { key "rndc-key"; };
allow-transfer { localhost; 192.168.1.1; };
file "/etc/namedb/dynamic/example.com";
};
zone "1.168.192.in-addr.arpa" {
type master;
allow-update { key "rndc-key"; };
allow-transfer { localhost; 192.168.1.1; };
file "/etc/namedb/dynamic/1.168.192.in-addr.arpa";
};
# edit /etc/namedb/dynamic/example.com
$TTL 3600 ; 1 hour default TTL
example.com. IN SOA samdom.example.com. admin.example.com. (
2013021701 ; Serial
10800 ; Refresh (3 hours)
3600 ; Retry (1 hour)
604800 ; Expire (1 week)
300 ; Negative Response TTL (5 minutes)
)
; DNS Servers
IN NS samdom.example.com.
; MX Records
;IN MX 10 mx.example.com.
;IN MX 20 mail.example.com.
IN A 192.168.1.1
; Machine Names
localhost IN A 127.0.0.1
samdom IN A 192.168.1.1
kerberos IN A 192.168.1.1
ldap IN A 192.168.1.1
; Aliases
;
;_kerberos._udp IN SRV 01 00 88 kerberos.example.com.
;_kerberos._tcp IN SRV 01 00 88 kerberos.example.com.
;_kpasswd._udp IN SRV 01 00 464 kerberos.example.com.
;_kerberos-adm._tcp IN SRV 01 00 749 kerberos.example.com.
;_kerberos IN TXT EXAMPLE.COM
;
;_ldap._tcp IN SRV 01 00 389 ldap.example.com.
;_ldap._udp IN SRV 01 00 88 ldap.example.com.
¡Atencion!
Aunque las entradas son correctas para _kerberos y _ldap, como Samba usa sus propios pero consulta a Bind, si las dejo activas causan problemas.
# edit /etc/namedb/dynamic/1.168.192.in-addr.arpa
$TTL 3600 ; 1 hour default TTL
1.168.192.in-addr.arpa. IN SOA samdom.example.com. admin.example.com. (
2013021701 ; Serial
10800 ; Refresh (3 hours)
3600 ; Retry (1 hour)
604800 ; Expire (1 week)
300 ; Negative Response TTL (5 minutes)
)
; DNS Servers
IN NS samdom.example.com.
; Machine IPs
1 IN PTR samdom.example.com.
1 IN PTR kerberos.example.com.
# edit /etc/rc.conf
# Bind
named_enable="YES"
named_chrootdir=""
# /etc/rc.d/named start
# edit /etc/resolv.conf
search example.com
domain EXAMPLE.COM
nameserver 127.0.0.1
#nameserver 8.8.8.8
#nameserver 8.8.4.4
# nslookup samdom
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: samdom.example.com
Address: 192.168.1.1
# nslookup kerberos
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: kerberos.example.com
Address: 192.168.1.1
Instalar isc-dhcp42-server
# cd /usr/ports/net/isc-dhcp42-server
# make config
Options for isc-dhcp42-server 4.2.4_2
[ ] BIND_SYMBOLS Enable BIND internal symbol table
[*] IPV6 IPv6 protocol
[ ] LDAP LDAP support
[*] LDAP_SSL Support LDAP over SSL/TLS
[ ] PARANOIA Enable support for chroot
< OK >
# make config-recursive
# make install clean
# rm /usr/local/etc/dhcpd.conf
# edit /usr/local/etc/dhcpd.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd PRIMARY
#
option domain-name "example.com";
option domain-name-servers 192.168.1.1;
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# ad-hoc DNS update scheme - set to "none" to disable dynamic DNS updates.
ddns-updates on;
ddns-update-style interim;
ddns-domainname "example.com";
allow client-updates;
# Take this from the /etc/namedb/rndc.conf file
key "rndc-key" {
algorithm hmac-md5;
secret "zvuOE1XeVBUXZa12LTUDEAgZaH3cVFZp+GiObzuAB5c=";
}
zone example.com. {
primary 192.168.1.1;
key rndc-key;
}
zone 1.168.192.in-addr.arpa. {
primary 192.168.1.1;
key rndc-key;
}
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
option netbios-name-servers 192.168.1.1;
option netbios-node-type 8;
option time-offset -18000; # Bogota GMT -5.0 Hours => -5x60x60 = -18000 Seconds
option ntp-servers 192.168.1.1;
option time-servers 192.168.1.1;
# Dinamics
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.110;
option routers 192.168.1.1;
option broadcast-address 192.168.1.255;
}
# ifconfig em1 inet 192.168.1.1 netmask 255.255.255.0 up
# edit /etc/rc.conf
ifconfig_em1=" inet 192.168.1.1 netmask 255.255.255.0"
# DHCP Server
dhcpd_enable="YES"
dhcpd_flags="-q"
dhcpd_conf="/usr/local/etc/dhcpd.conf"
dhcpd_ifaces="em1"
dhcpd_withumask="022"
# /usr/local/etc/rc.d/isc-dhcpd start
Instalar cups-base
# cd /usr/ports/print/cups-base
# make config
Dejo todo por defecto
# make config-recursive
Dejo todo por defecto
# make install clean
# edit /etc/rc.conf
# CUPS
cupsd_enable="YES"
# /usr/local/etc/rc.d/cupsd start
Editamos el archivo y le agregamos la parte "options"
# edit /etc/namedb/rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "zvuOE1XeVBUXZa12LTUDEAgZaH3cVFZp+GiObzuAB5c=";
};
options {
default-server 127.0.0.1;
default-key rndc-key;
};
# rndc status
version: 9.9.2-P1
CPUs found: 2
worker threads: 2
UDP listeners per interface: 2
number of zones: 99
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running
# /usr/local/bin/samba-tool domain provision
Realm [EXAMPLE.COM]: EXAMPLE.COM
Domain [EXAMPLE]: EXAMPLE
Server Role (dc, member, standalone) [dc]: dc
DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]: SAMBA_INTERNAL
DNS forwarder IP address (write 'none' to disable forwarding) [127.0.0.1]: 192.168.1.1
Administrator password:
Retype password:
Looking up IPv4 addresses
More than one IPv4 address found. Using 192.168.1.1
Looking up IPv6 addresses
No IPv6 address will be assigned
Setting up share.ldb
Setting up secrets.ldb
Setting up the registry
Setting up the privileges database
Setting up idmap db
Setting up SAM db
Setting up sam.ldb partitions and settings
Setting up sam.ldb rootDSE
Pre-loading the Samba 4 and AD schema
Adding DomainDN: DC=example,DC=com
Adding configuration container
Setting up sam.ldb schema
Setting up sam.ldb configuration data
Setting up display specifiers
Modifying display specifiers
Adding users container
Modifying users container
Adding computers container
Modifying computers container
Setting up sam.ldb data
Setting up well known security principals
Setting up sam.ldb users and groups
Setting up self join
Adding DNS accounts
Creating CN=MicrosoftDNS,CN=System,DC=example,DC=com
Creating DomainDnsZones and ForestDnsZones partitions
Populating DomainDnsZones and ForestDnsZones partitions
Setting up sam.ldb rootDSE marking as synchronized
Fixing provision GUIDs
A Kerberos configuration suitable for Samba 4 has been generated at /var/db/samba4/private/krb5.conf
Once the above files are installed, your Samba4 server will be ready to use
Server Role: active directory domain controller
Hostname: samdom
NetBIOS Domain: EXAMPLE
DNS Domain: example.com
DOMAIN SID: S-1-5-21-3981277467-4260322419-4091201666
# cp /var/db/samba4/private/krb5.conf /etc/
# cat /etc/krb5.conf
[libdefaults]
default_realm = EXAMPLE.COM
dns_lookup_realm = false
dns_lookup_kdc = true
# edit /etc/rc.conf
# NTP
ntpd_enable="YES"
ntpd_config="/etc/ntp.conf"
# edit /etc/ntp.conf
server 0.pool.ntp.org prefer
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
driftfile /var/db/ntp.drift
# /etc/rc.d/ntpd start
Starting ntpd.
# edit /etc/rc.conf
# Samba4
samba4_enable="YES"
samba4_config="/usr/local/etc/smb4.conf"
winbindd_enable="YES"
# testparm /usr/local/etc/smb4.conf
Load smb config files from /usr/local/etc/smb4.conf
max_open_files: increasing sysctl_max (11095) to minimum Windows limit (16384)
rlimit_max: increasing rlimit_max (11095) to minimum Windows limit (16384)
Processing section "[netlogon]"
Processing section "[sysvol]"
Loaded services file OK.
Server role: ROLE_ACTIVE_DIRECTORY_DC
Press enter to see a dump of your service definitions
[global]
workgroup =EXAMPLE
realm = example.com
server role = active directory domain controller
passdb backend = samba_dsdb
dns forwarder = 192.168.1.1
rpc_server:tcpip = no
rpc_daemon:spoolssd = embedded
rpc_server:spoolss = embedded
rpc_server:winreg = embedded
rpc_server:ntsvcs = embedded
rpc_server:eventlog = embedded
rpc_server:srvsvc = embedded
rpc_server:svcctl = embedded
rpc_server:default = external
idmap config * : backend = tdb
create mask = 0777
directory mask = 0777
map archive = No
map readonly = no
store dos attributes = Yes
vfs objects = dfs_samba4, acl_xattr
[netlogon]
path = /var/db/samba4/sysvol/example.com/scripts
read only = No
[sysvol]
path = /var/db/samba4/sysvol
read only = No
Para solucionar el error de
max_open_files: increasing sysctl_max (11095) to minimum Windows limit (16384)
rlimit_max: increasing rlimit_max (11095) to minimum Windows limit (16384)
# edit /boot/loader.conf
# Samba
kern.maxfiles="20480"
ESTE PASO ES IMPORTANTISIMO, SI NO SE EJECUTA NO ENTRAREMOS AL DOMINIO DESDE LOS CLIENTES!
# /usr/local/sbin/samba4 -i -M single -d 4 &
# killall samba4
# /usr/local/etc/rc.d/samba4 start
# kinit administrator@EXAMPLE.COM
administrator@example.com's Password: miclave123
# klist
Credentials cache: FILE:/tmp/krb5cc_0
Principal: administrator@EXAMPLE.COM
Issued Expires Principal
Feb 24 02:13:50 Feb 24 12:13:50 krbtgt/EXAMPLE.COM@EXAMPLE.COM
# net rpc join -S samdom -Uadministrator
Enter administrator's password: miclave123
Joined domain EXAMPLE.
# smbclient -L localhost -U%
Domain=[EXAMPLE] OS=[Unix] Server=[Samba 4.0.3]
Sharename Type Comment
--------- ---- -------
netlogon Disk
sysvol Disk
IPC$ IPC IPC Service (Samba 4.0.3)
Domain=[EXAMPLE] OS=[Unix] Server=[Samba 4.0.3]
Server Comment
--------- -------
Workgroup Master
--------- -------
# /usr/local/bin/smbclient //localhost/netlogon -UAdministrator'' -c 'ls'
Enter Administrator's password: miclave123
Domain=[EXAMPLE] OS=[Unix] Server=[Samba 4.0.3]
. D 0 Sun Feb 24 02:01:16 2013
.. D 0 Sun Feb 24 02:01:23 2013
63332 blocks of size 65536. 54255 blocks available
# samba-tool dns query 127.0.0.1 example.com @ ALL
Password for [administrator@EXAMPLE.COM]:
Name=, Records=4, Children=0
SOA: serial=1, refresh=900, retry=600, expire=86400, ns=samdom.example.com., email=hostmaster.example.com. (flags=600000f0, serial=1, ttl=3600)
NS: samdom.example.com. (flags=600000f0, serial=1, ttl=900)
A: 192.168.1.1 (flags=600000f0, serial=1, ttl=900)
A: 192.168.2.101 (flags=600000f0, serial=110, ttl=900)
Name=_msdcs, Records=0, Children=0
Name=_sites, Records=0, Children=1
Name=_tcp, Records=0, Children=4
Name=_udp, Records=0, Children=2
Name=DomainDnsZones, Records=0, Children=2
Name=ForestDnsZones, Records=0, Children=2
Name=samdom, Records=2, Children=0
A: 192.168.1.1 (flags=f0, serial=1, ttl=900)
A: 192.168.2.101 (flags=f0, serial=110, ttl=900)
# wbinfo -u
Administrator
Guest
krbtgt
# wbinfo -g
Enterprise Read-Only Domain Controllers
Domain Admins
Domain Users
Domain Guests
Domain Computers
Domain Controllers
Schema Admins
Enterprise Admins
Group Policy Creator Owners
Read-Only Domain Controllers
DnsUpdateProxy
TEST DNS
# host -t SRV _ldap._tcp.example.com
_ldap._tcp.example.com has SRV record 0 100 389 samdom.example.com.
# host -t SRV _ldap._tcp.example.com
_ldap._tcp.example.com has SRV record 0 100 389 samdom.example.com.
# host -t A ldap.example.com
ldap.example.com has address 192.168.1.1
# host -t SRV _kerberos._tcp.example.com
_kerberos._tcp.example.com has SRV record 1 0 88 kerberos.example.com.
# host -t SRV _kerberos._udp.example.com
_kerberos._udp.example.com has SRV record 1 0 88 kerberos.example.com.
# host -t SRV _kpasswd._udp.example.com
_kpasswd._udp.example.com has SRV record 1 0 464 kerberos.example.com.
# host -t SRV _kerberos-adm._tcp.example.com
_kerberos-adm._tcp.example.com has SRV record 1 0 749 kerberos.example.com.
¡Atencion!
Al inactivar las lineas referentes a _kerberos y _ldap las consultas no se resuelven.
# host -t A samdom.example.com
samdom.example.com has address 192.168.1.1
Crear un usuario
# samba-tool user add miguel
New Password: miclave123
Retype Password: miclave123
User 'miguel' created successfully
Verificar el usuario creado
# wbinfo --name-to-sid miguel
S-1-5-21-1013221894-234835428-3392388920-1103 SID_USER (1)
# reboot
Compartir impresoras
# edit /usr/local/etc/smb4.conf
[printers]
comment = All Printers
path = /var/spool/samba
browseable = No
guest ok = Yes
printable = Yes
use client driver = Yes
default devmode = Yes
;show add printer wizard = no # Para no mostrar el asistente de impresoras
Para que los clientes Windows puedan consultar en el servidor que sirve
las impresoras en busca de drivers, debemos crear el directorio.
# mkdir -p /var/db/samba4/printer-drivers/{COLOR,IA64,W32ALPHA,W32MIPS,W32PPC,W32X86,WIN40,x64}
# edit /usr/local/etc/smb4.conf
[print$]
comment = Printer Drivers
path = /var/db/samba4/printer-drivers
browseable = yes
guest ok = no
read only = yes
write list = root
Compartir carpetas y bloquear algunas extensiones peligrosas
# mkdir /home/tmp
# mkdir /home/tmp
# edit /usr/local/etc/smb4.conf
[tmp]
comment = Temporary file space
path = /home/tmp
valid users = %U
public = no
writable = no
browseable = yes
printable = no
# Las siguientes lineas generan problemas si uso ACLS, dejar inactivas!
# create mask = 0777
# directory mask = 0777
# force create mode = 0777
# force directory mode = 0777
# force user = nobody
# force group = nobody
write list = %U
# Bloqueo de algunos archivos por extencion
veto files = /*.reg/*.com/*.scr/*.cmd/*.exe/*.pif/*.bat/*.{*}/
delete veto files = yes
Remote Server Administration Tools for Windows 7 with Service Pack 1 (SP1)
http://www.microsoft.com/en-us/download/details.aspx?id=7887
1 Instalar Remote Server Administration Tools for Windows 7 with Service Pack 1 (SP1)
2 Inicio / Panel de control / Programas / Activar o desactivar las caracteristicas de Windows
(se abre ventanita)
3 - Herramientas de administracion de funciones
- Herramientas de AD DS y AD LDS
- Herramientas de AD DS
* Centro de administracion de Active Directory
* Herramientas de linea de comandos y complementos de AD DS
4 Aceptar
5 Wind + R
dsa.msc
Nota:
Para poder entrar a administrar el dominio mediante el comand dsa.msc, hay que estar logueado como el usuario administrator / miclave123 para poder ver los datos.
Nota:
Mejor usar # rndc-confgen > /root/dhcp_updater.key
named.conf
key "rndc-key" {
algorithm hmac-md5;
secret "+VsrLah1EEr+HKRTGRJyWA==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
dhcpd.conf
# Take this from the /etc/namedb/rndc.conf file
key "rndc-key" {
algorithm hmac-md5;
secret "+VsrLah1EEr+HKRTGRJyWA==";
};
Una nota muy importante en caso de querer editar manualmente los archivos del DNS http://forums.freebsd.org/showthread.php?t=33849
"Note about editing dynamic zones manually
If you have to edit the zone files of dynamic zones manually while the DNS server is running, you’ll have to freeze the zones with # rndc freeze <myzone> before editing and unfreeze them with # rndc thaw <myzone> after editing. This is because named(8) has internal state information and external journal files attached to dynamic zones that have to be kept in sync with the zone files."
FreeBSD 9.1 + Samba 4 (Bind99, SAMBA_INTERNAL) + Bind99 (actualizado desde el DHCP) + DHCP
Resultado:
Funciona!
Manuales consultados:
http://wiki.samba.org/index.php/Samba_AD_DC_HOWTO
http://www.whitneytechnologies.com/?p=422
http://fraterneo.blogspot.com/2012/12/como-configurar-un-controlador-de.html
http://www.freebsd.org/doc/handbook/kerberos5.html
http://www.rjsystems.nl/en/2100-dns-discovery-kerberos.php
http://es.wikipedia.org/wiki/Kerberos
http://www.bind9.net/manuals
http://albertolarripa.com/?p=1530
http://www.semicomplete.com/articles/dynamic-dns-with-dhcp
http://forums.freebsd.org/showthread.php?t=33849
http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/DNSDHCP.html
http://lani78.wordpress.com/2012/07/23/make-your-dhcp-server-dynamically-update-your-dns-records-on-ubuntu-12-04-precise-pangolin
Parametros de red:
hostname="samdom.example.com"
keymap="spanish.iso.kbd"
#ifconfig_em0="DHCP"
ifconfig_em0="inet 192.168.2.101 netmask 255.255.255.0"
defaultrouter="192.168.2.1"
ifconfig_em1="inet 192.168.1.1 netmask 255.255.255.0"
ipv6_activate_all_interfaces="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
sshd_enable="YES"
Particionado del disco SATA:
ada0 931GB GPT
ada0p1 512kB freebsd-boot
ada0p2 16GB freebsd-ufs / exrootfs
ada0p3 32GB freebsd-swap none exswap
ada0p4 64GB freebsd-ufs /var exvarfs
ada0p5 16GB freebsd-ufs /tmp extmpfs
ada0p6 803GB freebsd-ufs /usr exusrfs
Claves en el FreeBSD:
root / 123
PORTS
Descargar el arbol de ports "fetch", se descomprime "extract" (se ejecuta la primera vez)
# portsnap fetch extract
Ahora para manterner el arbol de ports actualizado, se ejecuta siempre
# portsnap fetch update
Esta ultima linea se puede agregar al cron para que diario actualice los ports, en /etc/crontab se agrega una linea como esta
00 06 * * * root /usr/sbin/portsnap fetch update >/dev/null 2>&1
ACLS
# cat /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/ada0p2 / ufs rw 1 1
/dev/ada0p3 none swap sw 0 0
/dev/ada0p4 /var ufs rw 2 2
/dev/ada0p5 /tmp ufs rw 2 2
/dev/ada0p6 /usr ufs rw 2 2
# cat /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/ada0p2 / ufs rw,acls 1 1
/dev/ada0p3 none swap sw 0 0
/dev/ada0p4 /var ufs rw,acls 2 2
/dev/ada0p5 /tmp ufs rw,acls 2 2
/dev/ada0p6 /usr ufs rw,acls 2 2
# reboot
Configurar las opciones de Bind99
# cd /usr/ports/dns/bind99
# make config
Options for bind99 9.9.2.1
[ ] FIXED_RRSET Enable fixed rrset ordering
[ ] IDN International Domain Names
[*] IPV6 IPv6 protocol
[ ] LARGE_FILE 64-bit file support
[*] LINKS Create conf file symlinks in /usr/local
[*] REPLACE_BASE Replace base BIND with this version <-MARCAR ESTA OPCION!
[ ] RPZRRL_PATCH RPZ improvements + RRL patch (experimental)
[ ] RPZ_NSDNAME Enable RPZ NSDNAME policy records
[ ] RPZ_NSIP Enable RPZ NSIP trigger rules
[ ] SIGCHASE dig/host/nslookup will do DNSSEC validation
[*] SSL Build with OpenSSL (Required for DNSSEC)
[*] THREADS Threading support
[*] XML Support for xml statistics output
[ ] DLZ_POSTGRESQL G(DLZ): DLZ Postgres driver
[ ] DLZ_POSTGRESQL G(DLZ): DLZ Postgres driver
[ ] DLZ_MYSQL G(DLZ): DLZ MySQL driver (no threading)
[ ] DLZ_BDB G(DLZ): DLZ BDB driver
[ ] DLZ_LDAP G(DLZ): DLZ LDAP driver
[ ] DLZ_FILESYSTEM G(DLZ): DLZ filesystem driver
[ ] DLZ_STUB G(DLZ): DLZ stub driver
< OK >
Instalar Samba4
# cd /usr/ports/net/samba4
# make config
Options for samba4 4.0.3
[*] ACL_SUPPORT File system ACL support
[*] ADS Active Directory support
[*] AIO_SUPPORT Asyncronous IO support
[ ] AVAHI Zeroconf via Avahi <- DESACTIVAR ESTA OPCION!
[*] CUPS CUPS printing system
[*] DEBUG With debug information in the binaries
[ ] DEVELOPER With development support
[*] DNSUPDATE Dynamic DNS update(require ADS)
[ ] EXP_MODULES Experimental modules
[*] FAM_SUPPORT File Alteration Monitor support
[*] LDAP LDAP support
[ ] MANPAGES Build and/or install manual pages
[*] PAM_SMBPASS PAM authentication via passdb backends
[*] PTHREADPOOL Pthread pool
[*] QUOTAS Disk quota support
[*] SWAT SWAT WebGUI
[*] SYSLOG Syslog support
[*] UTMP UTMP accounting support
[*] WINBIND WinBIND support
[ ] NSUPDATE S(DNS): Use internal DNS with NSUPDATE utility <- DESACTIVAR ESTA OPCION!
[ ] BIND98 S(DNS): Use bind98 as a DNS server frontend
[*] BIND99 S(DNS): Use bind99 as a DNS server frontend <- MARCAR ESTA OPCION!
< OK >
# make config-recursive
(todos los otros ports los dejo por defecto)
# make install clean
Nota:
El port de Samba4 con la opcion [*] BIND99 instalara bind99, por eso
primero configuramos las opciones
de bind99 [*] REPLACE_BASE
# rndc-confgen -a -c /etc/namedb/rndc.conf -k rndc-key -b 256
wrote key file "/etc/namedb/rndc.conf"
# cat /etc/namedb/rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "zvuOE1XeVBUXZa12LTUDEAgZaH3cVFZp+GiObzuAB5c=";
};
# edit /etc/namedb/named.conf
options {
// All file and path names are relative to the chroot directory,
// if any, and should be fully qualified.
directory "/etc/namedb/working";
pid-file "/var/run/named/pid";
dump-file "/var/dump/named_dump.db";
statistics-file "/var/stats/named.stats";
...
listen-on { 127.0.0.1; 192.168.1.1; };
...
forwarders {
8.8.8.8;
8.8.4.4;
};
...
//zone "example.com" { type master; file "/etc/namedb/master/empty.db"; }; <- COMENTAR ESTA LINEA!
...
controls {
inet 127.0.0.1 allow { localhost; } keys { rndc-key; };
};
// Take this from the /etc/namedb/rndc.conf file
key "rndc-key" {
algorithm hmac-md5;
secret "zvuOE1XeVBUXZa12LTUDEAgZaH3cVFZp+GiObzuAB5c=";
};
zone "example.com" {
type master;
allow-update { key "rndc-key"; };
allow-transfer { localhost; 192.168.1.1; };
file "/etc/namedb/dynamic/example.com";
};
zone "1.168.192.in-addr.arpa" {
type master;
allow-update { key "rndc-key"; };
allow-transfer { localhost; 192.168.1.1; };
file "/etc/namedb/dynamic/1.168.192.in-addr.arpa";
};
# edit /etc/namedb/dynamic/example.com
$TTL 3600 ; 1 hour default TTL
example.com. IN SOA samdom.example.com. admin.example.com. (
2013021701 ; Serial
10800 ; Refresh (3 hours)
3600 ; Retry (1 hour)
604800 ; Expire (1 week)
300 ; Negative Response TTL (5 minutes)
)
; DNS Servers
IN NS samdom.example.com.
; MX Records
;IN MX 10 mx.example.com.
;IN MX 20 mail.example.com.
IN A 192.168.1.1
; Machine Names
localhost IN A 127.0.0.1
samdom IN A 192.168.1.1
kerberos IN A 192.168.1.1
ldap IN A 192.168.1.1
; Aliases
;
;_kerberos._udp IN SRV 01 00 88 kerberos.example.com.
;_kerberos._tcp IN SRV 01 00 88 kerberos.example.com.
;_kpasswd._udp IN SRV 01 00 464 kerberos.example.com.
;_kerberos-adm._tcp IN SRV 01 00 749 kerberos.example.com.
;_kerberos IN TXT EXAMPLE.COM
;
;_ldap._tcp IN SRV 01 00 389 ldap.example.com.
;_ldap._udp IN SRV 01 00 88 ldap.example.com.
¡Atencion!
Aunque las entradas son correctas para _kerberos y _ldap, como Samba usa sus propios pero consulta a Bind, si las dejo activas causan problemas.
# edit /etc/namedb/dynamic/1.168.192.in-addr.arpa
$TTL 3600 ; 1 hour default TTL
1.168.192.in-addr.arpa. IN SOA samdom.example.com. admin.example.com. (
2013021701 ; Serial
10800 ; Refresh (3 hours)
3600 ; Retry (1 hour)
604800 ; Expire (1 week)
300 ; Negative Response TTL (5 minutes)
)
; DNS Servers
IN NS samdom.example.com.
; Machine IPs
1 IN PTR samdom.example.com.
1 IN PTR kerberos.example.com.
# edit /etc/rc.conf
# Bind
named_enable="YES"
named_chrootdir=""
# /etc/rc.d/named start
# edit /etc/resolv.conf
search example.com
domain EXAMPLE.COM
nameserver 127.0.0.1
#nameserver 8.8.8.8
#nameserver 8.8.4.4
# nslookup samdom
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: samdom.example.com
Address: 192.168.1.1
# nslookup kerberos
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: kerberos.example.com
Address: 192.168.1.1
Instalar isc-dhcp42-server
# cd /usr/ports/net/isc-dhcp42-server
# make config
Options for isc-dhcp42-server 4.2.4_2
[ ] BIND_SYMBOLS Enable BIND internal symbol table
[*] IPV6 IPv6 protocol
[ ] LDAP LDAP support
[*] LDAP_SSL Support LDAP over SSL/TLS
[ ] PARANOIA Enable support for chroot
< OK >
# make config-recursive
# make install clean
# rm /usr/local/etc/dhcpd.conf
# edit /usr/local/etc/dhcpd.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd PRIMARY
#
option domain-name "example.com";
option domain-name-servers 192.168.1.1;
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# ad-hoc DNS update scheme - set to "none" to disable dynamic DNS updates.
ddns-updates on;
ddns-update-style interim;
ddns-domainname "example.com";
allow client-updates;
# Take this from the /etc/namedb/rndc.conf file
key "rndc-key" {
algorithm hmac-md5;
secret "zvuOE1XeVBUXZa12LTUDEAgZaH3cVFZp+GiObzuAB5c=";
}
zone example.com. {
primary 192.168.1.1;
key rndc-key;
}
zone 1.168.192.in-addr.arpa. {
primary 192.168.1.1;
key rndc-key;
}
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
option netbios-name-servers 192.168.1.1;
option netbios-node-type 8;
option time-offset -18000; # Bogota GMT -5.0 Hours => -5x60x60 = -18000 Seconds
option ntp-servers 192.168.1.1;
option time-servers 192.168.1.1;
# Dinamics
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.110;
option routers 192.168.1.1;
option broadcast-address 192.168.1.255;
}
# ifconfig em1 inet 192.168.1.1 netmask 255.255.255.0 up
# edit /etc/rc.conf
ifconfig_em1=" inet 192.168.1.1 netmask 255.255.255.0"
# DHCP Server
dhcpd_enable="YES"
dhcpd_flags="-q"
dhcpd_conf="/usr/local/etc/dhcpd.conf"
dhcpd_ifaces="em1"
dhcpd_withumask="022"
# /usr/local/etc/rc.d/isc-dhcpd start
Instalar cups-base
# cd /usr/ports/print/cups-base
# make config
Dejo todo por defecto
# make config-recursive
Dejo todo por defecto
# make install clean
# edit /etc/rc.conf
# CUPS
cupsd_enable="YES"
# /usr/local/etc/rc.d/cupsd start
Editamos el archivo y le agregamos la parte "options"
# edit /etc/namedb/rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "zvuOE1XeVBUXZa12LTUDEAgZaH3cVFZp+GiObzuAB5c=";
};
options {
default-server 127.0.0.1;
default-key rndc-key;
};
# rndc status
version: 9.9.2-P1
CPUs found: 2
worker threads: 2
UDP listeners per interface: 2
number of zones: 99
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running
# /usr/local/bin/samba-tool domain provision
Realm [EXAMPLE.COM]: EXAMPLE.COM
Domain [EXAMPLE]: EXAMPLE
Server Role (dc, member, standalone) [dc]: dc
DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]: SAMBA_INTERNAL
DNS forwarder IP address (write 'none' to disable forwarding) [127.0.0.1]: 192.168.1.1
Administrator password:
Retype password:
Looking up IPv4 addresses
More than one IPv4 address found. Using 192.168.1.1
Looking up IPv6 addresses
No IPv6 address will be assigned
Setting up share.ldb
Setting up secrets.ldb
Setting up the registry
Setting up the privileges database
Setting up idmap db
Setting up SAM db
Setting up sam.ldb partitions and settings
Setting up sam.ldb rootDSE
Pre-loading the Samba 4 and AD schema
Adding DomainDN: DC=example,DC=com
Adding configuration container
Setting up sam.ldb schema
Setting up sam.ldb configuration data
Setting up display specifiers
Modifying display specifiers
Adding users container
Modifying users container
Adding computers container
Modifying computers container
Setting up sam.ldb data
Setting up well known security principals
Setting up sam.ldb users and groups
Setting up self join
Adding DNS accounts
Creating CN=MicrosoftDNS,CN=System,DC=example,DC=com
Creating DomainDnsZones and ForestDnsZones partitions
Populating DomainDnsZones and ForestDnsZones partitions
Setting up sam.ldb rootDSE marking as synchronized
Fixing provision GUIDs
A Kerberos configuration suitable for Samba 4 has been generated at /var/db/samba4/private/krb5.conf
Once the above files are installed, your Samba4 server will be ready to use
Server Role: active directory domain controller
Hostname: samdom
NetBIOS Domain: EXAMPLE
DNS Domain: example.com
DOMAIN SID: S-1-5-21-3981277467-4260322419-4091201666
# cp /var/db/samba4/private/krb5.conf /etc/
# cat /etc/krb5.conf
[libdefaults]
default_realm = EXAMPLE.COM
dns_lookup_realm = false
dns_lookup_kdc = true
# edit /etc/rc.conf
# NTP
ntpd_enable="YES"
ntpd_config="/etc/ntp.conf"
# edit /etc/ntp.conf
server 0.pool.ntp.org prefer
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
driftfile /var/db/ntp.drift
# /etc/rc.d/ntpd start
Starting ntpd.
# edit /etc/rc.conf
# Samba4
samba4_enable="YES"
samba4_config="/usr/local/etc/smb4.conf"
winbindd_enable="YES"
# testparm /usr/local/etc/smb4.conf
Load smb config files from /usr/local/etc/smb4.conf
max_open_files: increasing sysctl_max (11095) to minimum Windows limit (16384)
rlimit_max: increasing rlimit_max (11095) to minimum Windows limit (16384)
Processing section "[netlogon]"
Processing section "[sysvol]"
Loaded services file OK.
Server role: ROLE_ACTIVE_DIRECTORY_DC
Press enter to see a dump of your service definitions
[global]
workgroup =EXAMPLE
realm = example.com
server role = active directory domain controller
passdb backend = samba_dsdb
dns forwarder = 192.168.1.1
rpc_server:tcpip = no
rpc_daemon:spoolssd = embedded
rpc_server:spoolss = embedded
rpc_server:winreg = embedded
rpc_server:ntsvcs = embedded
rpc_server:eventlog = embedded
rpc_server:srvsvc = embedded
rpc_server:svcctl = embedded
rpc_server:default = external
idmap config * : backend = tdb
create mask = 0777
directory mask = 0777
map archive = No
map readonly = no
store dos attributes = Yes
vfs objects = dfs_samba4, acl_xattr
[netlogon]
path = /var/db/samba4/sysvol/example.com/scripts
read only = No
[sysvol]
path = /var/db/samba4/sysvol
read only = No
Para solucionar el error de
max_open_files: increasing sysctl_max (11095) to minimum Windows limit (16384)
rlimit_max: increasing rlimit_max (11095) to minimum Windows limit (16384)
# edit /boot/loader.conf
# Samba
kern.maxfiles="20480"
ESTE PASO ES IMPORTANTISIMO, SI NO SE EJECUTA NO ENTRAREMOS AL DOMINIO DESDE LOS CLIENTES!
# /usr/local/sbin/samba4 -i -M single -d 4 &
# killall samba4
# /usr/local/etc/rc.d/samba4 start
# kinit administrator@EXAMPLE.COM
administrator@example.com's Password: miclave123
# klist
Credentials cache: FILE:/tmp/krb5cc_0
Principal: administrator@EXAMPLE.COM
Issued Expires Principal
Feb 24 02:13:50 Feb 24 12:13:50 krbtgt/EXAMPLE.COM@EXAMPLE.COM
# net rpc join -S samdom -Uadministrator
Enter administrator's password: miclave123
Joined domain EXAMPLE.
# smbclient -L localhost -U%
Domain=[EXAMPLE] OS=[Unix] Server=[Samba 4.0.3]
Sharename Type Comment
--------- ---- -------
netlogon Disk
sysvol Disk
IPC$ IPC IPC Service (Samba 4.0.3)
Domain=[EXAMPLE] OS=[Unix] Server=[Samba 4.0.3]
Server Comment
--------- -------
Workgroup Master
--------- -------
# /usr/local/bin/smbclient //localhost/netlogon -UAdministrator'' -c 'ls'
Enter Administrator's password: miclave123
Domain=[EXAMPLE] OS=[Unix] Server=[Samba 4.0.3]
. D 0 Sun Feb 24 02:01:16 2013
.. D 0 Sun Feb 24 02:01:23 2013
63332 blocks of size 65536. 54255 blocks available
# samba-tool dns query 127.0.0.1 example.com @ ALL
Password for [administrator@EXAMPLE.COM]:
Name=, Records=4, Children=0
SOA: serial=1, refresh=900, retry=600, expire=86400, ns=samdom.example.com., email=hostmaster.example.com. (flags=600000f0, serial=1, ttl=3600)
NS: samdom.example.com. (flags=600000f0, serial=1, ttl=900)
A: 192.168.1.1 (flags=600000f0, serial=1, ttl=900)
A: 192.168.2.101 (flags=600000f0, serial=110, ttl=900)
Name=_msdcs, Records=0, Children=0
Name=_sites, Records=0, Children=1
Name=_tcp, Records=0, Children=4
Name=_udp, Records=0, Children=2
Name=DomainDnsZones, Records=0, Children=2
Name=ForestDnsZones, Records=0, Children=2
Name=samdom, Records=2, Children=0
A: 192.168.1.1 (flags=f0, serial=1, ttl=900)
A: 192.168.2.101 (flags=f0, serial=110, ttl=900)
# wbinfo -u
Administrator
Guest
krbtgt
# wbinfo -g
Enterprise Read-Only Domain Controllers
Domain Admins
Domain Users
Domain Guests
Domain Computers
Domain Controllers
Schema Admins
Enterprise Admins
Group Policy Creator Owners
Read-Only Domain Controllers
DnsUpdateProxy
TEST DNS
# host -t SRV _ldap._tcp.example.com
_ldap._tcp.example.com has SRV record 0 100 389 samdom.example.com.
# host -t SRV _ldap._tcp.example.com
_ldap._tcp.example.com has SRV record 0 100 389 samdom.example.com.
# host -t A ldap.example.com
ldap.example.com has address 192.168.1.1
# host -t SRV _kerberos._tcp.example.com
_kerberos._tcp.example.com has SRV record 1 0 88 kerberos.example.com.
# host -t SRV _kerberos._udp.example.com
_kerberos._udp.example.com has SRV record 1 0 88 kerberos.example.com.
# host -t SRV _kpasswd._udp.example.com
_kpasswd._udp.example.com has SRV record 1 0 464 kerberos.example.com.
# host -t SRV _kerberos-adm._tcp.example.com
_kerberos-adm._tcp.example.com has SRV record 1 0 749 kerberos.example.com.
¡Atencion!
Al inactivar las lineas referentes a _kerberos y _ldap las consultas no se resuelven.
# host -t A samdom.example.com
samdom.example.com has address 192.168.1.1
Crear un usuario
# samba-tool user add miguel
New Password: miclave123
Retype Password: miclave123
User 'miguel' created successfully
Verificar el usuario creado
# wbinfo --name-to-sid miguel
S-1-5-21-1013221894-234835428-3392388920-1103 SID_USER (1)
# reboot
Compartir impresoras
# edit /usr/local/etc/smb4.conf
[printers]
comment = All Printers
path = /var/spool/samba
browseable = No
guest ok = Yes
printable = Yes
use client driver = Yes
default devmode = Yes
;show add printer wizard = no # Para no mostrar el asistente de impresoras
Para que los clientes Windows puedan consultar en el servidor que sirve
las impresoras en busca de drivers, debemos crear el directorio.
# mkdir -p /var/db/samba4/printer-drivers/{COLOR,IA64,W32ALPHA,W32MIPS,W32PPC,W32X86,WIN40,x64}
# edit /usr/local/etc/smb4.conf
[print$]
comment = Printer Drivers
path = /var/db/samba4/printer-drivers
browseable = yes
guest ok = no
read only = yes
write list = root
Compartir carpetas y bloquear algunas extensiones peligrosas
# mkdir /home/tmp
# mkdir /home/tmp
# edit /usr/local/etc/smb4.conf
[tmp]
comment = Temporary file space
path = /home/tmp
valid users = %U
public = no
writable = no
browseable = yes
printable = no
# Las siguientes lineas generan problemas si uso ACLS, dejar inactivas!
# create mask = 0777
# directory mask = 0777
# force create mode = 0777
# force directory mode = 0777
# force user = nobody
# force group = nobody
write list = %U
# Bloqueo de algunos archivos por extencion
veto files = /*.reg/*.com/*.scr/*.cmd/*.exe/*.pif/*.bat/*.{*}/
delete veto files = yes
Remote Server Administration Tools for Windows 7 with Service Pack 1 (SP1)
http://www.microsoft.com/en-us/download/details.aspx?id=7887
1 Instalar Remote Server Administration Tools for Windows 7 with Service Pack 1 (SP1)
2 Inicio / Panel de control / Programas / Activar o desactivar las caracteristicas de Windows
(se abre ventanita)
3 - Herramientas de administracion de funciones
- Herramientas de AD DS y AD LDS
- Herramientas de AD DS
* Centro de administracion de Active Directory
* Herramientas de linea de comandos y complementos de AD DS
4 Aceptar
5 Wind + R
dsa.msc
Nota:
Para poder entrar a administrar el dominio mediante el comand dsa.msc, hay que estar logueado como el usuario administrator / miclave123 para poder ver los datos.
Nota:
Mejor usar # rndc-confgen > /root/dhcp_updater.key
named.conf
key "rndc-key" {
algorithm hmac-md5;
secret "+VsrLah1EEr+HKRTGRJyWA==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
dhcpd.conf
# Take this from the /etc/namedb/rndc.conf file
key "rndc-key" {
algorithm hmac-md5;
secret "+VsrLah1EEr+HKRTGRJyWA==";
};
Una nota muy importante en caso de querer editar manualmente los archivos del DNS http://forums.freebsd.org/showthread.php?t=33849
"Note about editing dynamic zones manually
If you have to edit the zone files of dynamic zones manually while the DNS server is running, you’ll have to freeze the zones with # rndc freeze <myzone> before editing and unfreeze them with # rndc thaw <myzone> after editing. This is because named(8) has internal state information and external journal files attached to dynamic zones that have to be kept in sync with the zone files."
Subscribe to:
Posts (Atom)

