Zentyal Forum, Linux Small Business Server
International => Spanish => Topic started by: juaniki on August 20, 2014, 11:27:41 am
-
Hola chicos
desde hace tiempo uso zentyal como servidor vpn. la verdad que funciona muy bien y a las maravillas, pero me gustaría añadirle aún más seguridad (bueno también viene impuesto desde arriba...)
el caso es que tenemos controladores de dominio y active directory en w. server 2008 r2 y me gustaría que cuando se haga la conexión desde openvpn, se validen, además de certificado, las credenciales de usuario de AD
Alguien lo ha hecho?
¿cómo se debería hacer esto?
gracias de antemano
-
Hola:
Tienes un modulo de openvpn que permite la validación contra un LDAP, ahora bien deberás crear un stub para poder añadir las claves de configuración implicadas.
Tienes más información aqui:
https://code.google.com/p/openvpn-auth-ldap/wiki/Configuration
-
gracias por tu respuesta
no te he entendido con eso del stab y añadir las claves
podrías , por favor, explicármelo??
gracias
-
Hola: Te aconsejo leer la documentacion oficial al respecto:
https://wiki.zentyal.org/wiki/Es/3.5/Desarrollo_y_usos_avanzados#Stubs
Un saludo
-
ok gracias...
no me había dado cuenta de qué era los stub, pero ya lo había utilizado para openvpn ;)
voy a echarle un vistazo a eso que comentas de la autenticación
-
dónde se guardan los certificados de openvpn??
necesito para configurar esta parte...
# TLS CA Certificate File
TLSCACertFile /usr/local/etc/ssl/ca.pem
# TLS CA Certificate Directory
TLSCACertDir /etc/ssl/certs
# Client Certificate and key
# If TLS client authentication is required
TLSCertFile /usr/local/etc/ssl/client-cert.pem
TLSKeyFile /usr/local/etc/ssl/client-key.pem
gracias de antemano
-
Hola:
De memoria no lo recuerdo pero sospecho que habra dos posibilidades:
1) se copian al directorio de openvpn (/etc/openvpn/)
2) se leen directamnete de /var/lib/zentyal/CA
En cualquier caso eso ya deberia estar generado en la configuración estandar
-
gracias
y donde tengo que poner la línea de plugin siguiente??
#plugin /usr/lib/openvpn/plugin/lib/openvpn-auth-ldap.so “/etc/openvpn/auth/lda$
esto es para que openvpn la acepte el plugin
si lo añado al fichero /usr/share/zentyal/stubs/openvpn/openvpn.conf.mas openvpn no arranca quedando en estado "detenido"
gracias
-
Hola:
2 cosas:
1) nunca edites los stubs directamente, en su lugar crea el directorio /etc/zentyal/stubs/<modulo> y copia ahi el stub a personalizar y edita ahi ese fichero
2) Me huelo algun tema de permisos respecto a ese plugin, has revisado los logs de openvpn en /var/log/openvpn, o has probado a iniciar openvpn en modo no daemon (en foreground)?
-
gracias por tus consejos
ya lo tengo todo montado, cuando intento hacer login con un usario de un grupo determinado me falla, dándome el siguiente error
AUTH-PAM: BACKGROUND: user 'rodrigj' failed to authenticate: Authentication fail ure
Fri Aug 22 10:22:23 2014 10.30.113.2:47304 PLUGIN_CALL: POST /usr/lib/openvpn/op envpn-plugin-auth-pam.so/PLUGIN_AUTH_USER_PASS_VERIFY status=1
Fri Aug 22 10:22:23 2014 10.30.113.xx:47304 PLUGIN_CALL: plugin function PLUGIN_A UTH_USER_PASS_VERIFY failed with status 1: /usr/lib/openvpn/openvpn-plugin-auth- pam.so
Fri Aug 22 10:22:23 2014 10.30.113.2:47304 TLS Auth Error: Auth Username/Passwor d verification failed for peer
ldap.conf
root@gstzentyal:/var/lib/zentyal/CA/certs# cat /etc/openvpn/auth/ldap.conf
<LDAP>
# LDAP server URL
URL ldap://miip
# Bind DN (If your LDAP server doesn't support anonymous binds)
# BindDN uid=Manager,ou=People,dc=example,dc=com
# Bind Password
# Password SecretPassword
# Network timeout (in seconds)
Timeout 15
# Enable Start TLS
#TLSEnable yes
TLSEnable no
# Follow LDAP Referrals (anonymously)
FollowReferrals yes
# TLS CA Certificate File
#TLSCACertFile /usr/local/etc/ssl/ca.pem
TLSCACertFile /var/lib/zentyal/CA/certs/07CEASDDBD98.pem
# TLS CA Certificate Directory
TLSCACertDir /var/lib/zentyal/CA/certs/
# Client Certificate and key
# If TLS client authentication is required
# TLSKeyFile /var/lib/zentyal/CA/keys/Juan.pem
# TLSCertFile /var/lib/zentyal/CA/keys/07CE9398A73E3B8E.pem
# Cipher Suite
# The defaults are usually fine here
# TLSCipherSuite ALL:!ADH:@STRENGTH
</LDAP>
<Authorization>
# Base DN
BaseDN "OU=Users,OU=Accounts,OU=COMPANY,DC=gst,DC=local"
# User Search Filter
#SearchFilter "(&(uid=%u)(accountStatus=active))"
SearchFilter "sAMAccountName=%u"
# Require Group Membership
RequireGroup yes
# Add non-group members to a PF table (disabled)
#PFTable ips_vpn_users
<Group>
BaseDN "OU=Users,OU=Accounts,OU=COMPANY,DC=gst,DC=local"
#BaseDN "ou=Groups,dc=example,dc=com"
#SearchFilter "(|(cn=developers)(cn=artists))"
MemberAttribute uniqueMember
# Add group members to a PF table (disabled)
#PFTable ips_vpn_eng
</Group>
</Authorization>
cuando uso el adm del dominio si me conecta correctamente
los dn son los correctos
-
Sospecho que es pq no has definido un BIND DN and PW (Zentyal hasta donde se no soporta bind anonimo al LDAP /Samba)
# Bind DN (If your LDAP server doesn't support anonymous binds)
# BindDN uid=Manager,ou=People,dc=example,dc=com
# Bind Password
# Password SecretPassword
-
voy a probar a ver....
-
nada...igual
con el usario adminsitrador
iFri Aug 22 11:21:12 2014 10.30.113.2:36905 PLUGIN_CALL: POST /usr/lib/openvpn/openvpn-plugin-auth-pam.so/PLUGIN_AUTH_USER_PASS_VERIFY status=0
Fri Aug 22 11:21:12 2014 10.30.113.2:36905 TLS: Username/Password authentication succeeded for username 'administrador'
gracias por tu ayuda
-
me acabo de dar cuenta que me está validando con los usuarios locales de zentyal en lugar de los usuarios del active directory
-
sigo atrancado por aquí...
me está validando contra los usuarios del S.O en lugar del A.D
-
Hola :
Parece que este tirando de pam, más que de LDAP, como dices solo se me ocurre revisar los logs de openvpn a ver si encuentras algun mensaje que te de la pista de por que pase eso....
Otra opcion sería habilitar PAM para los usuarios del LDAP pero es posible que no desees hacer tal cosa
-
eso está haciendo
he buscado el fichero openvpn-auth-ldap.so pero no se encuentra en el servidor??
¿dónde está realmente?
eso se puede descargar?
gracias de antemano
-
Hola:
Creo que el paquete que necesitas es openvpn-auth-ldap:
Package: openvpn-auth-ldap
Priority: extra
Section: universe/net
Installed-Size: 171
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Alberto Gonzalez Iniesta <agi@inittab.org>
Architecture: amd64
Version: 2.0.3-5.1
Depends: libc6 (>= 2.4), libldap-2.4-2 (>= 2.4.7), libobjc3 (>= 4.2.1), openvpn (>= 2)
Filename: pool/universe/o/openvpn-auth-ldap/openvpn-auth-ldap_2.0.3-5.1_amd64.deb
Size: 46784
MD5sum: a045776f9e4e98f6c380a7fccce98e4c
SHA1: 3f8826fdd2ecd8e01588b5f38d56d8de4124cbc1
SHA256: 34bd8a7b4f5b1c8094d70a2d40eb498ec12b07fc975b044568d7185e5a8b9aed
Description-en: OpenVPN LDAP authentication module
A plugin that implements username/password authentication via
LDAP for OpenVPN 2.x. It features:
.
* Simple Apache-style configuration file.
* LDAP group-based access restrictions.
* Will authenticate against any LDAP server that supports LDAP
simple binds -- including Active Directory.
Description-md5: e1e09ddd84686d578add3979f29be545
Homepage: http://code.google.com/p/openvpn-auth-ldap/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
-
gracias por tu pronta contestación
me da error de autenticacion....
este es el log
Fri Aug 22 13:34:26 2014 WARNING: file '/var/lib/zentyal/CA/private/vpn-GSTOpenVpn.pem' is group or others accessible
Fri Aug 22 13:34:26 2014 Socket Buffers: R=[163840->131072] S=[163840->131072]
Fri Aug 22 13:34:26 2014 TUN/TAP device tap0 opened
Fri Aug 22 13:34:26 2014 TUN/TAP TX queue length set to 100
Fri Aug 22 13:34:26 2014 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Fri Aug 22 13:34:26 2014 /sbin/ip link set dev tap0 up mtu 1500
Fri Aug 22 13:34:26 2014 /sbin/ip addr add dev tap0 10.99.1.1/24 broadcast 10.99.1.255
Fri Aug 22 13:34:26 2014 GID set to nogroup
Fri Aug 22 13:34:26 2014 UID set to nobody
Fri Aug 22 13:34:26 2014 UDPv4 link local (bound): [AF_INET]10.30.113.64:1194
Fri Aug 22 13:34:26 2014 UDPv4 link remote: [undef]
Fri Aug 22 13:34:26 2014 MULTI: multi_init called, r=256 v=256
Fri Aug 22 13:34:26 2014 IFCONFIG POOL: base=10.99.1.2 size=253, ipv6=0
Fri Aug 22 13:34:26 2014 ifconfig_pool_read(), in='JuanAntonioRodriguezGST,10.99.1.2', TODO: IPv6
Fri Aug 22 13:34:26 2014 succeeded -> ifconfig_pool_set()
Fri Aug 22 13:34:26 2014 IFCONFIG POOL LIST
Fri Aug 22 13:34:26 2014 JuanAntonioRodriguezGST,10.99.1.2
Fri Aug 22 13:34:26 2014 Initialization Sequence Completed
Fri Aug 22 13:34:50 2014 10.30.113.2:18397 TLS: Initial packet from [AF_INET]10.30.113.2:18397, sid=de1444a3 5dff6686
AUTH-PAM: BACKGROUND: user 'rodrigj' failed to authenticate: Authentication failure
Fri Aug 22 13:34:51 2014 10.30.113.2:18397 PLUGIN_CALL: POST /usr/lib/openvpn/openvpn-plugin-auth-pam.so/PLUGIN_AUTH_USER_PASS_VERIFY status=1
Fri Aug 22 13:34:51 2014 10.30.113.2:18397 PLUGIN_CALL: plugin function PLUGIN_AUTH_USER_PASS_VERIFY failed with status 1: /usr/lib/openvpn/openvpn-plugin-auth-pam.so
Fri Aug 22 13:34:51 2014 10.30.113.2:18397 TLS Auth Error: Auth Username/Password verification failed for peer
Fri Aug 22 13:34:51 2014 10.30.113.2:18397 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 2048 bit RSA
Fri Aug 22 13:34:51 2014 10.30.113.2:18397 [JuanAntonioRodriguezGST] Peer Connection Initiated with [AF_INET]10.30.113.2:18397
Fri Aug 22 13:34:54 2014 10.30.113.2:18397 PUSH: Received control message: 'PUSH_REQUEST'
Fri Aug 22 13:34:54 2014 10.30.113.2:18397 Delayed exit in 5 seconds
Fri Aug 22 13:34:54 2014 10.30.113.2:18397 SENT CONTROL [JuanAntonioRodriguezGST]: 'AUTH_FAILED' (status=1)
Fri Aug 22 13:35:00 2014 10.30.113.2:18397 SIGTERM[soft,delayed-exit] received, client-instance exiting
Fri Aug 22 13:49:27 2014 event_wait : Interrupted system call (code=4)
Fri Aug 22 13:49:27 2014 Closing TUN/TAP interface
Fri Aug 22 13:49:27 2014 /sbin/ip addr del dev tap0 10.99.1.1/24
RTNETLINK answers: Operation not permitted
Fri Aug 22 13:49:27 2014 Linux ip addr del failed: external program exited with error status: 2
Fri Aug 22 13:49:27 2014 PLUGIN_CLOSE: /usr/lib/openvpn/openvpn-plugin-auth-pam.so
AUTH-PAM: Error signaling background process to exit
Fri Aug 22 13:49:27 2014 SIGTERM[hard,] received, process exiting
Fri Aug 22 13:50:54 2014 OpenVPN 2.3.2 i686-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [eurephia] [MH] [IPv6] built on Feb 4 2014
Fri Aug 22 13:50:54 2014 PLUGIN_INIT: POST /usr/lib/openvpn/openvpn-plugin-auth-pam.so '[/usr/lib/openvpn/openvpn-plugin-auth-pam.so] [/etc/openvpn/auth/ldap.conf]' intercepted=PLUGIN_AUTH_USER_PASS_VERIFY
me sigues echando una mano por favor'? gracias
-
Hola :
No veo rastros de openvpn-auth-ldap
Revisa que este incluido en la config y elimina cualquier llamada al fichero de pam
-
esa es mi configuración que tengo....
#plugin /usr/lib/openvpn/plugin/lib/openvpn-auth-ldap.so "/etc/openvpn/auth/ldap.conf"
plugin /usr/lib/openvpn/openvpn-auth-ldap.so "/etc/openvpn/auth/ldap.conf"
#plugin /usr/lib/openvpn/openvpn-plugin-auth-pam.so "/etc/openvpn/auth/ldap.conf"
#plugin auth-user-pass-verify /etc/openvpn/auth/autorizacion.py via-file
#script-security 3 execve
#auth-user-pass-verify /etc/openvpn/auth/ldap_perl.pl via-env
-
Y cual es la salida de dpkg -L openvpn-auth-ldap
-
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/openvpn-auth-ldap
/usr/share/doc/openvpn-auth-ldap/examples
/usr/share/doc/openvpn-auth-ldap/examples/auth-ldap.conf
/usr/share/doc/openvpn-auth-ldap/README
/usr/share/doc/openvpn-auth-ldap/copyright
/usr/share/doc/openvpn-auth-ldap/changelog.Debian.gz
/usr/lib
/usr/lib/openvpn
/usr/lib/openvpn/openvpn-auth-ldap.so
-
Perfecto, entiendo que las modificaciones en la config de OpenVPN las has realizado a través de un stub, cierto?
Si ejecutas sudo service zentyal openvpn cual es la salida que te da?
-
Tue Aug 26 16:43:39 2014 10.30.113.2:20873 PUSH: Received control message: 'PUSH_REQUEST'
Tue Aug 26 16:43:39 2014 10.30.113.2:20873 Delayed exit in 5 seconds
Tue Aug 26 16:43:39 2014 10.30.113.2:20873 SENT CONTROL [JuanAntonioRodriguezGST]: 'AUTH_FAILED' (status=1)
Tue Aug 26 16:43:39 2014 10.30.113.2:20873 TLS Error: local/remote TLS keys are out of sync: [AF_INET]10.30.113.2:20873
Tue Aug 26 16:43:40 2014 10.30.113.2:20873 TLS Error: local/remote TLS keys are out of sync: [AF_INET]10.30.113.2:20873
Tue Aug 26 16:43:41 2014 10.30.113.2:20873 TLS Error: local/remote TLS keys are out of sync: [AF_INET]10.30.113.2:20873
Tue Aug 26 16:43:44 2014 10.30.113.2:20873 SIGTERM[soft,delayed-exit] received, client-instance exiting
^C
...........log..hay un error tls......
root@gstzentyal:/usr/share/zentyal/stubs/openvpn# sudo service zentyal openvpn
Usage: /etc/init.d/zentyal start|stop|restart
/etc/init.d/zentyal <module> start|stop|status|enabled|restart
root@gstzentyal:/usr/share/zentyal/stubs/openvpn# sudo service zentyal openvpn status
Zentyal: status module openvpn: [ RUNNING ]
-
Y en el log si intentas conectar ahora un usuario?
-
root@gstzentyal:/usr/share/zentyal/stubs/openvpn# tail -0f /var/log/openvpn/GSTOpenVpn.log
0Tue Aug 26 16:56:08 2014 10.30.113.2:2638 TLS: Initial packet from [AF_INET]10.30.113.2:2638, sid=901565eb b7805597
Tue Aug 26 16:56:08 2014 10.30.113.2:2638 CRL CHECK OK: C=34, ST=Sevilla, L=sevilla, O=AutoridadCertificadoraGST, CN=Certificado de Autoridad AutoridadCertificadoraGST
Tue Aug 26 16:56:08 2014 10.30.113.2:2638 VERIFY OK: depth=1, C=34, ST=Sevilla, L=sevilla, O=AutoridadCertificadoraGST, CN=Certificado de Autoridad AutoridadCertificadoraGST
Tue Aug 26 16:56:08 2014 10.30.113.2:2638 CRL CHECK OK: C=34, ST=Sevilla, L=sevilla, O=AutoridadCertificadoraGST, CN=JuanAntonioRodriguezGST
Tue Aug 26 16:56:08 2014 10.30.113.2:2638 VERIFY OK: depth=0, C=34, ST=Sevilla, L=sevilla, O=AutoridadCertificadoraGST, CN=JuanAntonioRodriguezGST
Unable to enable STARTTLS: Connect error
LDAP connect failed.
Tue Aug 26 16:56:08 2014 10.30.113.2:2638 PLUGIN_CALL: POST /usr/lib/openvpn/openvpn-auth-ldap.so/PLUGIN_AUTH_USER_PASS_VERIFY status=1
Tue Aug 26 16:56:08 2014 10.30.113.2:2638 PLUGIN_CALL: plugin function PLUGIN_AUTH_USER_PASS_VERIFY failed with status 1: /usr/lib/openvpn/openvpn-auth-ldap.so
Tue Aug 26 16:56:08 2014 10.30.113.2:2638 TLS Auth Error: Auth Username/Password verification failed for peer
Tue Aug 26 16:56:08 2014 10.30.113.2:2638 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 2048 bit RSA
Tue Aug 26 16:56:08 2014 10.30.113.2:2638 [JuanAntonioRodriguezGST] Peer Connection Initiated with [AF_INET]10.30.113.2:2638
Tue Aug 26 16:56:10 2014 10.30.113.2:2638 PUSH: Received control message: 'PUSH_REQUEST'
Tue Aug 26 16:56:10 2014 10.30.113.2:2638 Delayed exit in 5 seconds
Tue Aug 26 16:56:10 2014 10.30.113.2:2638 SENT CONTROL [JuanAntonioRodriguezGST]: 'AUTH_FAILED' (status=1)
Tue Aug 26 16:56:12 2014 10.30.113.2:47896 TLS: Initial packet from [AF_INET]10.30.113.2:47896, sid=44263da9 3b9518f1
Tue Aug 26 16:56:15 2014 10.30.113.2:2638 SIGTERM[soft,delayed-exit] received, client-instance exiting
-
I your user called "JuanAntonioRodriguezGST" ? Perhaps you could try with a shorter username?
-
ese es el nombre del certificado JuanAntonioRodriguezGST
-
Entonces lo unico que se me ocurre es un error con la DN. Te sugiero comprobarlo a través de ldapsearch o similar
-
desesperado estoy pues.....
-
mi fichero ldap.conf , parte, es el siguiente:
# Enable Start TLS
TLSEnable yes
# TLSEnable no
# Follow LDAP Referrals (anonymously)
FollowReferrals yes
# TLS CA Certificate File
#TLSCACertFile /usr/local/etc/ssl/ca.pem
TLSCACertFile /var/lib/zentyal/CA/certs/07CE9398A73E3B8D.pem
# TLS CA Certificate Directory
TLSCACertDir /var/lib/zentyal/CA/certs/
# Client Certificate and key
# If TLS client authentication is required
TLSKeyFile /var/lib/zentyal/CA/keys/JuanAntonioRodriguezGST.pem
TLSCertFile /var/lib/zentyal/CA/keys/07CE9398A73E3B8E.pem
no sé muy bien si eso está bien puesto......
-
POR FIN FUNCIONA
DEL LDPA.CONF he eliminado el tema referente a los certificados y funciona!!!
gracias por todo!!!!!!!!
-
Por favor añade [RESUELTO] Al titulo del hilo si esta solucionado
Gracias