Guide how to join OpenMediaVault 3.x in an Active Directory domain

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Guide how to join OpenMediaVault 3.x in an Active Directory domain

      Description

      With this guide you are able to join a Windows domain (Either a Windows domain controller, either a Samba 4 domain controller) with your OpenMediaVault server.

      This is a new method to join a domain with sssd instead of Winbind. It is much more easy to setup, and is more reliable than winbind.

      However there is a drawback: if SSSD chooses himself UID and GID, the numbers seems to high to be available in OMV's UI. If the Directory provides UID and GID set by the administrator, and low enough (10000 for example), OMV is able to show them.

      This is currently a BETA, I successfully configured a fresh install of OMV 3 with these steps.

      Requirements
      • OpenMediaVault 3.0.83 or higher
      • A Samba 4 domain controller with uid and gid properties set for users and groups


      OMV Configuration

      Network settings

      • Check IP configuration
      Use the web UI to setup a fixed IP address, and a hostname with a domain name matching your domain.

      Open a terminal (locally ot with SSH) and check the hostname configuration of your OpenMediaVault.

      Shell-Script

      1. root@my-server:~# hostname -s
      2. my-server
      3. root@my-server:~# hostmane -d
      4. domain.com
      5. root@my-server:~# cat /etc/hostname
      6. my-server
      7. root@my-server:~# cat /etc/hosts
      8. 127.0.0.1 localhost
      9. 127.0.1.1 my-server.domain.com my-server
      10. # The following lines are desirable for IPv6 capable hosts
      11. ::1 localhost ip6-localhost ip6-loopback
      12. ff02::1 ip6-allnodes
      13. ff02::2 ip6-allrouters
      Display All


      The first command allows you to check the server has the expected name. It may be whatever you want.
      The second command checks the suffix of your hostname. It must match the domain name of your domain controller.
      The third command checks that /etc/hostname matches your hostname. If it does not matches hostname -s, then update it.

      Packages installation
      Now install the requred packages to install and use SSSD.

      Shell-Script

      1. root@my-server:~# apt-get install sssd realmd policykit-1 packagekit adcli
      2. root@my-server:~# realm discover -v domain.com
      3. root@my-server:~# realm -v join domain.com -U administrator --membership-software=adcli

      apt-get install sssd and required packages
      realm discover checks you can find your domain controller
      realm join .. well .. joins your domain. You need a specify the login of a administrator account, and the process will ask you its password. Some additional packages will be automatically installed.

      SSSD is running, you need to stop and reset its cache to tweak it.

      Configure SSSD

      Shell-Script

      1. service sssd stop
      2. sss_cache -E
      3. rm /var/lib/sss/db/*

      Check /etc/sssd/sssd.conf and switch use_fully_qualified_names to False. This allows you to authenticate without specifying your domain.

      Read the Mapping algorithm paragraph of SSSD to determine if you want ldap_id_mapping or not. Either reading this page: linux.die.net/man/5/sssd-ad or either by reading it from OMV terminal.

      Source Code

      1. man sssd-ad

      If you want to disable ID mapping and use POSIX attributes in your AD, change also ldap_id_mapping to False. Doing this requires you set up uid and gid for all your users and groups in your directory.

      If you want to show your users in the OpenMediaVault web interface, you need to add at the bottonm of section [domain/domain.com] the parameter enumerate = True. However this is NOT recommended because it will slow down the server and generate network traffic with your domain controller. If you got a lot of users, you should consider keep its default value (False) and configure permissions with setfacl. The same issue occurs with Winbind, so it is useless to prefer Winbind to workaround this problem.

      Customize override_homedir to set the path containing your users home directories. You will bind a subtree of a filesystem here in next steps. This means this subtree will be available in 2 paths in OMV's filesystem.

      Here is an example of /etc/sssd/sssd.conf

      Source Code: /etc/sssd/sssd.conf

      1. [sssd]
      2. domains = domain.com
      3. config_file_version = 2
      4. services = nss, pam
      5. [domain/domain.com]
      6. ad_domain = domain.com
      7. krb5_realm = DOMAIN.COM
      8. realmd_tags = manages-system joined-with-samba
      9. cache_credentials = True
      10. id_provider = ad
      11. krb5_store_password_if_offline = True
      12. default_shell = /bin/bash
      13. # Enable the following line to manage UID and GID
      14. #ldap_id_mapping = False
      15. use_fully_qualified_names = False
      16. override_homedir = /home/domain.com/users/%u
      17. # fallback_homedir is actually useless, but I prefer keep it,
      18. # if I need to do something with override_homedir
      19. fallback_homedir = /home/domain.com/users/%u
      20. access_provider = ad
      21. #enumerate = True
      Display All

      Restart SSSD.

      Source Code

      1. service sssd start

      The command realm also updates /etc/nsswitch to use sssd as a source. You do not need to update it yourself, but here is an example of what you should read in this file. Notice the word sss is added in some lines.

      Source Code

      1. # /etc/nsswitch.conf
      2. #
      3. # Example configuration of GNU Name Service Switch functionality.
      4. # If you have the `glibc-doc-reference' and `info' packages installed, try:
      5. # `info libc "Name Service Switch"' for information about this file.
      6. passwd: compat sss
      7. group: compat sss
      8. shadow: compat sss
      9. hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
      10. networks: files
      11. protocols: db files
      12. services: db files sss
      13. ethers: db files
      14. rpc: db files
      15. netgroup: nis sss
      Display All

      Now sssd is up to date and running, try to find an existing user

      Source Code

      1. getent passwd johndoe
      2. johndoe:*:10000:10000:johndoe:/home/DOMAIN/johndoe:/bin/bash

      Enable mkhomedir
      create the file /usr/share/pam-configs/my_mkhomedir with the following content:

      Source Code

      1. Name: Activate mkhomedir
      2. Default: yes
      3. Priority: 900
      4. Session-Type: Additional
      5. Session:
      6. required pam_mkhomedir.so umask=0077 skel=/etc/skel

      Umask argument for mkhomedir didn't worked for me. pam_umask.so seems be a better option. Create the file /usr/share/pam-configs/umask with the following:

      Source Code

      1. Name: Activate umask
      2. Default: yes
      3. Priority: 800
      4. Session-Type: Additional
      5. Session:
      6. optional pam_umask.so umask=0077

      Run the command pam-auth-update, enable Activate mkhomedir and Activate umask.

      Configure Home directories

      In the OMV UI, open the users administration panel. Assuming you got at least one shared folder defined, choose the tab Settings and enable user home directories. Choose a device and set the path /users to store them. This path is important for the next step.

      Find the mounted data volume you want to use for your home directories. In this example, this is the last line. The path after "on" will be re-used to bind mount the volume in /home/domain.com.


      Shell-Script

      1. mount
      2. ( ... snip ... )
      3. tmpfs on /etc/machine-id type tmpfs (ro,relatime,size=100844k,mode=755)
      4. systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=23,pgrp=1,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=9415)
      5. debugfs on /sys/kernel/debug type debugfs (rw,relatime)
      6. mqueue on /dev/mqueue type mqueue (rw,relatime)
      7. hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
      8. fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
      9. tmpfs on /tmp type tmpfs (rw,relatime)
      10. rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
      11. binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
      12. /dev/sdb1 on /srv/dev-disk-by-id-scsi-0QEMU_QEMU_HARDDISK_drive-scsi1-part1 type ext4 (rw,noexec,relatime,data=ordered,jqfmt=vfsv0,usrjquota=aquota.user,grpjquota=aquota.group)
      Display All

      Edit /etc/fstab and bind mount your share to /home/domain.com. The line must be added after # <<< [openmediavault]. This is ensures it will not be overwritten when you edit OpenMediaVault's configuration.

      Source Code

      1. /srv/dev-disk-by-id-scsi-0QEMU_QEMU_HARDDISK_drive-scsi1-part1 /home/domain.com none bind 0 2

      Go in SMB/CIFS configuration, and enable SMB/CIFS.
      Set the Workgroup field to DOMAIN (uppercase, and match the word before the first dot of your domain name). Enable user home directories, and add the following on your extra options:

      Source Code

      1. password server = *
      2. realm = DOMAIN.COM
      3. dedicated keytab file = FILE:/etc/krb5.keytab
      4. kerberos method = dedicated keytab
      5. security = ads
      6. allow trusted domains = yes
      7. template shell = /bin/bash
      8. template homedir = /home/domain.com/users/%U
      9. # Performance improvements
      10. socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
      11. client ntlmv2 auth = yes
      12. client use spnego = yes
      13. obey pam restrictions = yes
      Display All
      Save and apply changes.

      :!: Read this post if you're under windows 8 to try a performance enhancement : forums.openmediavault.org/view…f=3&t=1493&p=24413#p24366

      :!: This step is not required
      If you wish to view your AD users and groups in OMV webinterface include UIDs and GIDs into non-system users and groups in /etc/login.defs. Find UID_MAX and change UID_MAX and GID_MAX. You need to choose a value higher than the highest UID and GID you can find in your directory. Here are the default values.

      Source Code: /etc/login.defs

      1. UID_MAX 60000
      2. GID_MAX 60000
      Editing AD users and groups using the OMV webinterface will fail because they are not stored in /etc/passwd and /etc/group .


      You should now be able to browse your home dir and shares if any with a user managed by your Directory server, from a workstation enrolled with SSSD. To setup SSSD on a workstation, do the same as this guide, and don't setup Samba (because it will probably not share files itself, thanks to OMV).
      My wiki : http://howto-it.dethegeek.eu.org

      = latest setup =
      proxmox VE 5 hypervisor back to my good C2D setup
      guests : OpenWRT (VM), OMV 3 (VM), Samba 4 domain controller (LXC)
      OMV alive since 2011 I guess : never crashed, always upgraded : stronger than my hard drives.

      Searching for a P2P online storage solution : must be open source, client side encrypted, quota supprt. Tahoe LAFS is the nearest, but is lacking quota. Would be perfect to build a OMV based, anonymous online storage for backups

      The post was edited 13 times, last by dethegeek: fix credation of homedir ().

    • Thanks. I had not found realmd. Looks like it fills in most info in sssd.conf. Should help making a plugin for 3.x or inclusion in 4.0. Bugtracker target version

      Seems you test against a samba AD? In my thread it has been tested against a few windows versions. It would be nice if people could test against other types of directory services. Maybe we are scaring them off by putting AD in the titles. LOL sssd should work with many types of directory service.

      Thanks again
      If you make it idiot proof, somebody will build a better idiot.
    • Hi

      SSSD is compatible with a LDAP but I did not experienced it. The tool realmd will detect the type of directory and configure sssd the correct way, so your plugin will probably not need to do specialized things depending on the type of directory.
      My wiki : http://howto-it.dethegeek.eu.org

      = latest setup =
      proxmox VE 5 hypervisor back to my good C2D setup
      guests : OpenWRT (VM), OMV 3 (VM), Samba 4 domain controller (LXC)
      OMV alive since 2011 I guess : never crashed, always upgraded : stronger than my hard drives.

      Searching for a P2P online storage solution : must be open source, client side encrypted, quota supprt. Tahoe LAFS is the nearest, but is lacking quota. Would be perfect to build a OMV based, anonymous online storage for backups
    • I was not able to get realm to join a windows ad. Must be something I am missing. I modified a script to automate joining a widows ad. SHould be easy to adapt to your guide also. Active Directory / LDAP Revisited

      Might also like to update to systemd restarts etc. systemctl stop sssd.service && rm /var/lib/sss/db/* && rm /var/log/sssd/* && systemctl start sssd.service && systemctl status sssd.service
      If you make it idiot proof, somebody will build a better idiot.
    • Hi @dohn

      Did you tried realm discover your.domain.com to see how it is detected ?
      My wiki : http://howto-it.dethegeek.eu.org

      = latest setup =
      proxmox VE 5 hypervisor back to my good C2D setup
      guests : OpenWRT (VM), OMV 3 (VM), Samba 4 domain controller (LXC)
      OMV alive since 2011 I guess : never crashed, always upgraded : stronger than my hard drives.

      Searching for a P2P online storage solution : must be open source, client side encrypted, quota supprt. Tahoe LAFS is the nearest, but is lacking quota. Would be perfect to build a OMV based, anonymous online storage for backups
    • Hi @dohn

      I think I could give a try to check compatibility of my guide against a Windows 2008 server. I don't have later version. At least this would be a start.

      I'm tempted to begin writing a plugin to join a domain. Did you begin a plugin or are you sticking to a shell script ?
      My wiki : http://howto-it.dethegeek.eu.org

      = latest setup =
      proxmox VE 5 hypervisor back to my good C2D setup
      guests : OpenWRT (VM), OMV 3 (VM), Samba 4 domain controller (LXC)
      OMV alive since 2011 I guess : never crashed, always upgraded : stronger than my hard drives.

      Searching for a P2P online storage solution : must be open source, client side encrypted, quota supprt. Tahoe LAFS is the nearest, but is lacking quota. Would be perfect to build a OMV based, anonymous online storage for backups
    • Hi

      I began to find some resource to learn how to write a plugin for OMV. As many people seems to use OMV as a domain member having such plugin is a must.

      Moreover I would like to have a plugin to manage backups with BorgBackup.

      So, it is time to me to consider contributing now.

      @ryecoaaron

      Can you share the URL of your repository ?
      My wiki : http://howto-it.dethegeek.eu.org

      = latest setup =
      proxmox VE 5 hypervisor back to my good C2D setup
      guests : OpenWRT (VM), OMV 3 (VM), Samba 4 domain controller (LXC)
      OMV alive since 2011 I guess : never crashed, always upgraded : stronger than my hard drives.

      Searching for a P2P online storage solution : must be open source, client side encrypted, quota supprt. Tahoe LAFS is the nearest, but is lacking quota. Would be perfect to build a OMV based, anonymous online storage for backups
    • dethegeek wrote:

      Can you share the URL of your repository ?
      Right now it isn't much different than the openmediavault-ldap plugin but here ya go - github.com/ryecoaaron/openmediavault-sssd
      omv 4.0.11 arrakis | 64 bit | 4.13 backports kernel | omvextrasorg 4.1.0
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please don't PM for support... Too many PMs!
    • ryecoaaron wrote:

      dethegeek wrote:

      Can you share the URL of your repository ?
      Right now it isn't much different than the openmediavault-ldap plugin but here ya go - github.com/ryecoaaron/openmediavault-sssd
      Thanks for starting work on a plugin. I would like to contribute but have no idea how to build it from github. I searched but was unable to find a tutorial. I just need to know what I need to get started building the package and what is a good editor would be. I will do it in a vm for this purpose only.

      Thanks
      If you make it idiot proof, somebody will build a better idiot.
    • The following will build the .deb which you install with dpkg

      Source Code

      1. apt-get install build-essential debhelper devscripts fakeroot git libfile-fcntllock-perl quilt
      2. git clone https://github.com/ryecoaaron/openmediavault-sssd.git
      3. cd openmediavault-sssd
      4. fakeroot debian/rules clean binary
      omv 4.0.11 arrakis | 64 bit | 4.13 backports kernel | omvextrasorg 4.1.0
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please don't PM for support... Too many PMs!