Giter Site home page Giter Site logo

guadaltech / ansible-gnulinux-domain-controller Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 6.0 162 KB

GNU/Linux domain controller, alternative to Windows domain controller - Bind9 + LDAP + Kerberos + SSSD

Makefile 3.86% Shell 71.60% HTML 24.54%
ansible ubuntu ldap kerberos sssd

ansible-gnulinux-domain-controller's Introduction

BLK Domain Controller

Server
  • BLK (Bind9/LDAP/Kerberos)
Client
  • GNU/Linux (SSSD)
  • Mac OS
  • Windows

Usage

Test with Vagrant

Install all:

make vagrant-deploy

Destroy all:

make vagrant-destroy

Install in production

Install all:

make install

Uninstall all:

make uninstall

Manage users

Script blksmanager

Script in node Kerberos

Usage BLKS Manager
Options:

  -m <MODE> (add_user, delete_user)
  -l [HOST LDAP]
  -a <ADMIN LDAP>
  -w <ADMIN LDAP PASSWORD>
  -x [HOSTNAME]
  -u [USERNAME]
  -p [USERNAME PASSWD]
  -g <GID>
  -d <DOMAIN>
  -e [PWEXPIRE]
  -k [KEYTAB FILE]

Example add User:
blksmanager -m add_user -l [HOST LDAP] -a (ADMIN_LDAP) -w (ADMIN_PASS_LDAP) -u (USER) -p (USER_PASSWD) -g (USER_GID_LDAP) -d (DOMAIN) -e [PWEXPIRE] -k [KEYTAB FILE]

Example delete User:
blksmanager -m delete_user -l [HOST LDAP] -a (ADMIN_LDAP) -w (ADMIN_PASS_LDAP) -u (USER) -d (DOMAIN) -k [KEYTAB FILE]

Example add Host:
blksmanager -m add_host -l [HOST LDAP] -a (ADMIN_LDAP) -w (ADMIN_PASS_LDAP) -x (HOSTNAME) -d (DOMAIN)

Example delete Host:
blksmanager -m delete_host -l [HOST LDAP] -a (ADMIN_LDAP) -w (ADMIN_PASS_LDAP) -x (HOSTNAME) -d (DOMAIN)

Example add user to Host:
blksmanager -m add_user_to_host -l [HOST LDAP] -a (ADMIN_LDAP) -w (ADMIN_PASS_LDAP) -x (HOSTNAME) -u (USER) -d (DOMAIN)

Example delete user to Host:
blksmanager -m delete_user_to_host -l [HOST LDAP] -a (ADMIN_LDAP) -w (ADMIN_PASS_LDAP) -x (HOSTNAME) -u (USER) -d (DOMAIN)

Add user simple:

blksmanager -m add_user -a admin -w admin_pass -u user1 -p user1 -g 5000 -d example.com 

Add user with password expire time: or this link

blksmanager -m add_user -a admin -w admin_pass -u user1 -p User1234567890@ -g 5000 -e "90 days" -d example.com 

Add Host

Control of which users can logging in to which computers: inventory/local/group_vars/all/sssd.yml

  • enable: access_provider: ldap
  • disable: access_provider: krb5
blksmanager -m add_host -a admin -w admin_pass -x usuario-desk -d example.com

Add User to host

blksmanager -m add_user_to_host -a admin -w admin_pass -x usuario-desk -u user1 -d example.com

Delete user:

blksmanager -m delete -a admin -w admin_pass -u user1 -d example.com

Manual

Add User:

ldapadd -D "cn=admin, dc=example,dc=com" -w admin_pass << EOF
dn: uid=user,ou=People,dc=example,dc=com
objectClass: top
objectClass: posixAccount
objectClass: inetOrgPerson
objectClass: person
uid: user
sn: user
givenName: user
cn: user
displayName: user
uidNumber: 1005
gidNumber: 5000
gecos: user
loginShell: /bin/bash
homeDirectory: /home/user
EOF
kadmin.local -q "add_principal [email protected]"
kinit [email protected]

Option 1:

kadmin.local -q "ktadd -norandkey [email protected]"

Option 2:

kadmin.local -q "xst -norandkey [email protected]"

Test User:

kinit -kt /etc/krb5.keytab user
getent passwd user
id user
login user

Delete User:

ldapdelete -x -D "cn=admin,dc=example,dc=com" 'uid=user,ou=People,dc=example,dc=com' -w admin_pass
kadmin.local -q "delete_principal [email protected]"
kdestroy
rm -f /etc/krb5.keytab 

ERRORS

Links of interest

ERROR: Decrypt integrity check failed

Option 1: Possible incorrect password. Did you export the principal with norandkey? By default ktadd exports changes the key to a random one. Can you loging with kinit [email protected]?

Example:

kadmin.local -q "ktadd -norandkey [email protected]"
kinit [email protected]

Ansible

Do not use, automated in makefile.

Execution:

ansible-playbook -i inventory/local/hosts.ini --become --become-user=root ansible.yml -v --limit all

Install vars:

main_setup: true
bind9_setup: true
ldap_setup: true
kerberos_setup: true
sssd_setup: true

Unistall vars:

main_uninstall: false
bind9_uninstall: false
ldap_uninstall: false
kerberos_uninstall: false

BONUS

LDAP example tree:

Guides:

Debug:

Clean manual:

apt-get remove -y bind9 --purge && rm -rf /etc/bind \
&& apt-get remove -y \
  krb5-kdc \
  krb5-admin-server \
  krb5-kdc-ldap \
  krb5-config \
  ldap-utils \
  krb5-user --purge && rm -rf /etc/krb5kdc \
&& apt-get remove -y \
  slapd \
  ldap-utils \
  nslcd \
  libnss-ldapd \
  sudo-ldap --purge && rm -rf /etc/ldap && rm -rf /var/lib/ldap \
&& apt-get autoremove -y \
&& apt-get install sudo -y \
&& echo 'nameserver 8.8.8.8' > /etc/resolv.conf

Authors

ansible-gnulinux-domain-controller's People

Contributors

juanjoselopezroldan avatar tedezed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.