marcotuna / go-ldap-ovpn

GoLang Tool for OpenVPN User Authentication from LDAP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go LDAP OpenVPN

GoLang Tool for OpenVPN User Authentication from LDAP

How to use?

OpenVPN contains the auth-user-pass-verify method which allows to call an external tool to perform authentication validation

Download the go-ldap-ovpn and place it in a folder where the openvpn service has permissions to execute it.

auth-user-pass-verify "/etc/openvpn/scripts/go-ldap-ovpn -config /etc/openvpn/scripts/vpn.toml" via-env

Create the configuration file where it will contain the ldap connection details. The following example connects to the Jumpcloud LDAP as a Service and looks for users that belong to the group VPN-USER

[ldap]
uri = "ldaps://ldap.jumpcloud.com:636"
host = "ldap.jumpcloud.com"
port = 636
bind_dn = "uid=service,ou=Users,o=ORGANIZATION_ID,dc=jumpcloud,dc=com"
bind_password = "PASSWORD"
user_base = "ou=Users,o=ORGANIZATION_ID,dc=jumpcloud,dc=com"
user_dn = "uid=%s,ou=Users,o=ORGANIZATION_ID,dc=jumpcloud,dc=com"
user_uid="uidNumber"
filter="(&(objectClass=inetOrgPerson)(|(uid=%s)))"
attribute_username="uid"
attribute_name="givenName"
attribute_surname="sn"
attribute_mail="mail"
attributes_in_bind=true
group_enabled=true
group_dn="ou=Users,o=ORGANIZATION_ID,dc=jumpcloud,dc=com"
group_filter="(&(objectClass=groupOfNames)(|(cn=VPN-USER)))"
group_member_uid="member"

[log]
# Can be "console" and "file", default is "console"
# Use comma to separate multiple modes, e.g. "console, file"
mode = "console"
# Either "Trace", "Info", "Warn", "Error", "Fatal", default is "Trace"
level = "Trace"

This file was saved as vpn.toml but can be any desired name.

About

GoLang Tool for OpenVPN User Authentication from LDAP

License:Apache License 2.0


Languages

Language:Go 88.3%Language:Makefile 10.0%Language:Dockerfile 1.7%