Ubuntu Active Directory Integration Guide
Ubuntu Active Directory Integration Guide
January 2024
Executive Summary
Microsoft Active Directory is a widely-deployed directory service that is commonly
used for identity management and authentication across the enterprise. Its
ubiquity makes it a fixture of the IT landscape. As a result, interoperability with
Active Directory is often a necessity when deploying services based on non-
Microsoft operating systems.
System Security Services Daemon (SSSD) and ADSys are tools whose purpose
is precisely to ease integration of non-Microsoft operating systems into an
existing Active Directory architecture. SSSD automates a number of settings that
previously required time-consuming and error-prone manual configuration, while
ADSys enables system administrators to manage and control Ubuntu Desktop
clients from a central Microsoft Active Directory. Together these tools enable
integration of Ubuntu with Active Directory quick and painless as it takes the
guesswork out of the process.
The extended Active Directory integration through the use of ADSys is only
available through an active Ubuntu Pro subscription, while basic integration with
Active Directory is still freely available.
Privilege management
Certificate autoenrollment
2
Table of contents
Executive Summary 1
Extended Features with Ubuntu Pro Desktop 2
Introduction 5
Overview 5
Intended audience 5
Overview of SSSD 6
Advantages of SSSD 7
Overview of ADSys 8
ADSys: Active Directory Group Policy integration 8
Supported releases 8
3
Setting up ADSys 31
Get ADsys through Ubuntu Pro 31
Enabling Ubuntu Pro 31
Installing ADSys 31
Active Directory Setup 31
Ubuntu administrative template generations 32
Deployment of ADM files on the Active Directory server 32
Best Practices 40
SSSD 40
External authentication 40
Offline login 40
System Keytab 40
ADSys 41
Troubleshooting SSSD 42
Logs and debug level 42
Cache management 42
Conclusion 43
Further reading 44
4
Introduction
Overview
This whitepaper discusses the use of System Security Services Daemon (SSSD)
and the extended Active Directory features (ADSys) on Ubuntu 22.04 LTS. We
will demonstrate how an Ubuntu desktop can be configured to enable Active
Directory users to login using SSSD and how ADSys implements host configuration
via Active Directory and Group Policy Objects (GPO). We will also cover the new
Active Directory script execution feature, which enables an administrator to take
their powers to new levels.
The overview sections explain what SSSD, ADSys, and its companion tools are, and
briefly presents its architecture with an eye toward understanding how it fulfils its
functions in Ubuntu.
We will take an in-depth look at ADsys, its setup process, and how its features can
be used to unlock some of the familiar Windows desktop management commands
on ubuntu.
Finally, we present some best practices, troubleshooting, and further reading for
the ever curious administrator.
Intended audience
This whitepaper has been written with Windows system administrators new
to Ubuntu in mind. We assume a basic level of knowledge of administering
Ubuntu, including the ability to use a command-line shell, understanding of sudo
as a means for privilege escalation and the ability to use a text editor to edit
configuration files.
5
Overview of SSSD
The purpose of System Security Services Daemon (SSSD) is to simplify integration
of non-Microsoft systems (Linux in particular) into Microsoft Active Directory.
It is a collection of daemons (long-running system services) that handle
authentication, authorisation, and user and group information from a variety
of network providers. Its purpose is to act as a gateway to Microsoft domains
for authentication and identity resolution of users, and to provide consistent
mapping of users and groups. It basically enables Microsoft domain users and
groups to appear to be local on the non-Microsoft system. This is very useful in a
number of scenarios.
• Active Directory
• LDAP
• Kerberos
To integrate these remote sources as sources of local users and groups on Linux,
recognised as valid users, including group membership, requires a fair bit of effort.
The Name Service Switch (NSS) framework needs to be configured to resolve users
and groups. The Pluggable Authentication Module (PAM) stack similarly needs
to be configured to funnel authentication requests. SSSD consolidates all these
operations in a consistent suite of tools and delivers a clean configuration for the
common use-case in a few easy steps.
SSSD, through a PAM module, provides a generic mechanism for system services
on Ubuntu to validate user’s credentials against Active Directory. This preempts
the need to keep multiple redundant authentication databases by centralising
user accounts management, and enables organisations to make full use of their
existing Active Directory infrastructure and know-how when deploying Ubuntu.
Once SSSD is installed and configured, users from the Active Directory will appear
as if they are local to the Ubuntu system. User attributes that are standard in Unix/
Linux but not present in Active Directory are either generated on the fly (i.e; the
numerical user ID), or through configuration directive (home directory location
and preferred user shell.) In the same manner, groups from the Active Directory
will also appear to be regular Unix groups. This is achieved through a Name Service
Switch (NSS) module, a mechanism that is standard across all Linux distributions.
The SSSD tool suite provides command-line tools to manage the services. The
command-line tools ‘realm’ makes joining an Active Directory domain very
straightforward and provides various sanity checks on the Ubuntu computer’s
configuration - more on that later. Under the hood, SSSD is running several
daemons called sssd, sssd_pam, sssd_nss, etc for each service it provides. The
SSSD service provides a service control architecture for starting and stopping all
sssd daemons and drivers based on dependencies. The sssd daemon itself is
managed using a standard systemd unit.
6
Advantages of SSSD
• No software to install on the Active Directory, and no change to its
configuration required.
• Centralised authentication use for existing users and groups when deploying
Ubuntu, no need to maintain a duplicate user database.
• Unix user and group IDs are coherent across all machines running SSSD, no need
to maintain an ID map.
7
Overview of ADSys
ADSys: Active Directory Group Policy integration
ADSys is the Active Directory Group Policy client for Ubuntu. It provides system
administrators the ability to manage and control Ubuntu Desktop clients from
a central Microsoft Active Directory. The project contains everything you need
to integrate Ubuntu into your Active Directory, including .admx and .adml
template files.
There are multiple policy managers for different types of settings. As of now,
only a dconf manager is available for Linux.
The role of ADSys is solely the configuration of the host via Active Directory.
Authentication of the users, the initial security policy of the “Default Domain
Policy”, and creation of the home directory are still the responsibility of SSSD
and PAM.
Once an Ubuntu client is configured, Active Directory Group Policies are applied on
boot for the machine and at login time for each user, then refreshed periodically.
It is composed of 2 parts:
• The command line interface - adsysctl - controls the daemon and its status.
Supported releases
ADSys is supported on Ubuntu starting from 22.04.2 LTS, and tested with Windows
Server 2019.
Ubuntu supports Active Directory Domain Services and Azure Active Directory
Domain Services. Azure Active Directory (AAD) is not yet supported on an LTS
release, but on the roadmap (No ETA at the moment).
8
Setting up Active Directory
On the Active Directory server you have to verify that you have an account with
enough privileges to join a machine to a domain, that the Active Directory service
and the DNS are configured and operational, and that the user accounts have been
added to the directory.
Administrative privileges
You will need an account with sufficient privileges to add the Ubuntu computers
to the Active Directory. Typically, this would be an account member of the Domain
Administrator group (such as the ubiquitous Administrator account), although this
can vary according to your Active Directory configuration.
Another setup is to run the DHCP on the same server as Active Directory and the
DNS. By doing so, DNS records will be updated when a DHCP lease is given.
From above, we see that there are different configurations possible to run the
services and it will all depend on the setup of your own organisation.
9
Then verify that the reverse lookup is configured properly with host:
Or dig:
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;[Link].[Link]. IN PTR
;; ANSWER SECTION:
[Link].[Link]. 0 IN PTR ad-desktop-1.
[Link].
Alternatively, we can rely on the join procedure to update the DNS records for us.
SSSD will attempt to do so, and it will work as long as hostname -f returns a fully
qualified hostname (FQDN).
10
Organisational Units
If your Active Directory domain is divided into organisational units (OU), you will
need to determine into which OUs you want to join the Ubuntu computers. In this
whitepaper, for the sake of simplicity, the structure of the directory will be flat and
we will not make use of OUs.
Windows Server 2019 Active Directory Administrative Center - List of test users
11
Joining Ubuntu to an Active Directory domain
There are 2 ways to join an Ubuntu client to an AD domain:
Who are you?: Be sure to check the box “Use Active Directory”
Configure Active Directory: Enter the address of the Active Directory controller
and credentials of the user allowed to add machines to the domain.
In order to set and resolve the host name properly, you must enter the Fully
Qualified Domain Name (FQDN) of the machine in the field “Your computer’s
name”. For example, “[Link]” instead of only the host
name “ad-desktop-1”.
By default, there is no default domain configured in SSSD. You have to enter the
full user name with one of the forms `USER@DOMAIN` or `DOMAIN/USER`. To log
in as a user of the domain, press the link “Not listed?” in the greeter. Then enter
the username followed by the password.
All of this (default domain, default path for home directories, default shell, etc.) is
configurable in /etc/sssd/[Link].
Once configured, SSSD will retrieve the credentials and the initial security policy
of the “Default Domain Policy”. Then the user can authenticate their Ubuntu login
against an Active Directory server.
12
Preparing Ubuntu Desktop for SSSD Setup
On Ubuntu’s side, besides a correct network setup and a user with administrative
privileges, you’ll need to ensure that time is synchronised with the Active Directory
controller and host name resolution is working.
Administrative privileges
As is usual in Ubuntu, all examples of commands requiring super-user
(administrative) privileges in the text have been prefixed with sudo. You are not
expected to have access to the root account (it is disabled by default on Ubuntu),
but you are expected to have a user account member of the admin group, who is
allowed to escalate privileges using the sudo command. The first user account,
created during installation, is a member of the admin group in question. In our
case, this user is called, quite simply, ubuntu.
Network settings
Using SSSD obviously requires network connectivity to the Active Domain
Controller. While it is possible to use SSSD on a machine configured for dynamic
IP addressing using DHCP, our example will assume fixed IP settings with a single
network interface for the sake of simplicity.
If a firewall is mitigating IP connectivity between the Ubuntu machine and the Active
Directory Controller, you will need to ensure that the required ports are open for
connection between the Active Directory Controller and the Ubuntu machines.
Depending on the topology of the network, this is the list of ports and protocols
used and that must be open in order for SSSD to operate successfully. These ports
must be open between each client and every domain controller of the domain:
ubuntu@ad-desktop-1:~$ hostname -f
[Link]
SSSD will attempt to update the DNS record for this hostname right after the
join succeeds, and will keep it up-to-date if the IP changes. But it’s important that
hostname -f returns the fully qualified domain name for that to work.
13
Time synchronisation
The Kerberos protocol, used internally by Active Directory for authentication, is
sensitive to clock skew between computers participating in a Kerberos domain. The
default clock skew tolerance is 300 seconds (five minutes). If the Ubuntu machine
and the Active Directory Controller clock drift apart for more than five minutes,
authentication against the Active Directory controller will systematically fail.
In our case, it is not desirable to have the Ubuntu machine synchronise time with
an outside source, as this source may differ from the Active Directory Controller.
Hence, the default NTP server needs to be changed to one of the ADC. Since
Ubuntu 16.04 LTS, Ubuntu, by default, uses timedatectl / timesyncd (which
are part of systemd). It replaces most of ntpdate / ntp.
The current status of time and time configuration via timedatectl and timesyncd
can be checked with timedatectl status:
# timedatectl status
Local time: Mon 2020-09-14 [Link] CEST
Universal time: Mon 2020-09-14 [Link] UTC
RTC time: Mon 2020-09-14 [Link]
Time zone: Europe/Paris (CEST, +0200)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Via timedatectl an administrator can control the timezone, how the system clock
should relate to the hwclock and if permanent synchronisation should be enabled
or not. See man timedatectl for more details.
The nameserver to fetch time for timedatectl and timesyncd from can be specified
in /etc/systemd/[Link] and additional config files can be stored in /
etc/systemd/[Link].d/. The entries for NTP= and FallbackNTP= are
space separated lists. See man [Link] for more.
timesyncd will generally do the right thing keeping your time in sync, and chrony
will help with more complex cases.
[Time]
NTP=[Link]
FallbackNTP=[Link]
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048
Setting up SSSD
To install the packages, open a terminal (from an Ubuntu Desktop press CTRL+ALT+T
or Super then type terminal and select the terminal application), update the
indices of the repository to make sure the latest version will be installed:
If all goes well it will return without any error. You can verify that it is correctly
installed with the standard apt command and check that the version numbers of
the installed and candidate packages match:
15
Packages
500 [Link] focal-updates/main amd64
Packages
100 /var/lib/dpkg/status
adcli:
Installed: 0.9.0-1
Candidate: 0.9.0-1
Version table:
*** 0.9.0-1 500
500 [Link] focal/universe amd64
Packages
500 [Link] focal-updates/main amd64
Packages
100 /var/lib/dpkg/status
Joining a domain
Once the SSSD suite packages are installed, you can proceed to a first verification
to ensure it can contact the domain with the command realm. Realmd is the tool
to manage enrollment in Active Directory and more generally Kerberos Realms.
It is used to discover and join domains and perform domain integration and
configure SSSD to connect to the domain.
16
required-package: sssd-tools
required-package: sssd
required-package: libnss-sss
required-package: libpam-sss
required-package: adcli
required-package: samba-common-bin
Note in the output that ‘configured: no’. We can now join the domain and
configure SSSD with the join command or realm:
You can substitute ‘[Link]’ for your own domain name, and
‘Administrator’ for an account with sufficient privileges to join computers in
your domain with the -U flag. man realm, realm -h, and realm <command> -h
provide all the details about this command.
/etc/sssd/
├── conf.d
└── [Link]
Here is the default configuration file generated when a client has successfully
joined a domain:
[sssd]
domains = [Link]
config_file_version = 2
services = nss, pam
[domain/[Link]]
default_shell = /bin/bash
ad_server = [Link]
krb5_store_password_if_offline = True
cache_credentials = True
krb5_realm = [Link]
realmd_tags = manages-system joined-with-adcli
id_provider = ad
fallback_homedir = /home/%u@%d
ad_domain = [Link]
use_fully_qualified_names = True
ldap_id_mapping = True
access_provider = ad
• cache_credentials: With this set to True, the credentials will be cached and
the users will be allowed to login even if the machine is disconnected from
the network.
What the realm tool didn’t do for us is setup pam_mkhomedir (this should be
fixed with Bug #1894135 “Enable homedir creation” : Bugs : realmd package :
Ubuntu), so that network users can get a home directory automatically when they
login. This remaining step can be done by running the following command:
Alternatives to SSSD
If, for some reason, SSSD is not suitable for your environment, there are
other options that can help you integrate Ubuntu into Active Directory for
authentication and identity management.
Unix user and group accounts require a certain number of attributes that are not
present by default in Active Directory. Starting with Windows Server 2003 R2, the
Active Directory schema have been extended to include attributes conforming to
RFC 2307 - ‘An Approach for Using LDAP as a Network Information Service’, which
defines the LDAP attributes required by Unix and Unix-like system, such as Ubuntu.
A role service, Identity Management for UNIX, is available in Active Directory to
extend functionalities precisely for that purpose. From there on, Active Directory
can be used as a store of Unix users and groups as is, without the help of third-
party tools. This approach may prove more flexible than using SSSD, at the cost of
being more management heavy.
On the Active Directory side, RFC2307 attributes of users and groups would need
to be set and managed. While installing the Identity Management for UNIX role
service extends the Active Directory Users and Computers MMC snap-in to expose
these attributes and allows for setting their value manually, a large deployment
will certainly need some sort of tool to automate the process. This needs to be
taken into consideration.
Plain winbind
Winbind includes PAM and NSS modules to authenticate and resolve users and
groups to an Active Directory. It is generally used alongside Samba for file sharing
services, where it exposes Windows domain users as local Unix users.
Its use, however, is not restricted to Samba: it would also work well with any
services that use NSS and PAM for user management.
18
One of winbind’s tasks is to keep a mapping of Unix numerical user and group
ID for Windows users and groups. By default, winbind assigns Unix uid and gid
sequentially as users and groups are being looked up. The result is, obviously,
rather random and will vary from one machine running winbind to another. This
will pose a problem if your infrastructure requires Unix and Unix-like machines to
share a coherent uid and gid namespace; that would be the case if, for example,
you were to share files using the Unix-native NFS protocol. Fortunately, winbind
can be configured to use a so-called idmap backend that can be shared among
multiple winbind instances. The job of these idmap backends is to store the
Windows SID to Unix id mapping, ensuring that users and groups ID are consistent
across all machines using the same backend. For example, such an idmap could
ensure that the Active Directory user WARTHOGS\bob has a user ID 13897 on
both server ubuntusrv1 and ubuntusrv2, making file permissions manageable and
consistent when files are being shared between the two. Various idmap backends
are available, and winbind can also be configured to derive Unix ID algorithmically
based on the Windows RID.
It is worth noting that realmd can also use winbind with the command line option
--client-software=winbind
If you wish to learn more about winbind, the best reference remains the Official
Samba How to and reference guide at:
[Link]
19
Verifying proper domain operations
Whether the Ubuntu system was joined to Active Directory at install time or
afterwards with SSSD, you may want to check that the Ubuntu server is listed in
Computers in the Active Directory Administrative Centre.
On the Ubuntu computer, you can use the realm command (provided by the
realmd package) to confirm that it has indeed joined the domain by querying SSSD
with the realm command, for example:
# realm list
[Link]
type: kerberos
realm-name: [Link]
domain-name: [Link]
configured: kerberos-member
server-software: active-directory
client-software: sssd
required-package: sssd-tools
required-package: sssd
required-package: libnss-sss
required-package: libpam-sss
required-package: adcli
required-package: samba-common-bin
login-formats: %U@[Link]
login-policy: allow-realm-logins
The output shows that the domain is now ‘configured’, and displays additional
information like the login format. This is the format we will use to log into the
machine or identify remote accounts on Active Directory.
Next, verify that users from the domain can be resolved using the getent
command, for example, using this format we can retrieve the entry for a user:
The getent command is used to query NSS databases. In the above case, we ask
getent to query the password (passwd) database for the ‘linda@warthogs.
biz’ entry. The entry format is the same as is used in the /etc/passwd system
20
user database, except the entry is not actually from /etc/passwd; it is pulled from
Active Directory. You may also use getent to resolve a group entry, as below:
Notice that both users and groups from Active Directory are suffixed with the
domain name according to the usual convention NAME@DOMAIN.
Other standard tools can be used to list the groups a user is a member of,
for example:
# groups bob@[Link]
bob@[Link] : domain users@[Link] marketing@[Link]
Note
If you just changed the group membership of a user, it may be a while before
sssd notices due to caching. If it is taking too long, you can manually stop the
service, delete the cache, and restart the service.
sssctl is one of these utilities. From the man page, it “provides a simple and unified
way to obtain information about SSSD status, such as active server, auto-discovered
servers, domains and cached objects. In addition, it can manage SSSD data files for
troubleshooting in such a way that is safe to manipulate while SSSD is running”.
To use sssctl, sssd must be running and the InfoPipe responder must be enabled.
21
The InfoPipe responder is enabled in /etc/sssd/[Link] by adding it to the
list of services:
[sssd]
domains = [Link]
config_file_version = 2
services = nss, pam, ifp
Then you can restart sssd and verify the status of sssd with systemctl:
sssctl provides a set of commands to check the status of the domain and list
users and groups.
Active servers:
AD Global Catalog: [Link]
AD Domain Controller: [Link]
22
• user-checks: Print information about a user and check authentication
In this whitepaper, we won’t cover the other commands. These commands are
documented in the help of sssctl.
With this tool you can directly manage domain users and groups, domain
Group Policy, domain sites, DNS services, domain replication and other critical
domain functions.
Like sssctl, samba-tools provides a set of commands to check the status of the
domain and list users and groups:
23
Domain : [Link]
Netbios domain : WARTHOGS
DC name : [Link]
DC netbios name : ADC01
Server site : Default-First-Site-Name
Client site : Default-First-Site-Name
Note the syntax used to indicate the host. It uses an LDAP URI instead of just the
domain or the address of the domain controller.
24
objectClass: user
objectClass: computer
cn: AD-DESKTOP-1
distinguishedName: CN=AD-DESKTOP-1,CN=Computers,DC=warthogs,DC=biz
[...]
operatingSystem: pc-linux-gnu
dNSHostName: ad-desktop-1
[...]
Finally samba-tool, without any arguments, lists the available commands and -h
with any command displays the subcommands and the help for that subcommand.
User authentication
You can test authentication by using login and an Active Directory user:
# login
ad-desktop-1 login: bob@[Link]
Password:********
Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.4.0-48-generic x86_64)
* Documentation: [Link]
* Management: [Link]
* Support: [Link]
25
0 updates can be installed immediately.
0 of these updates are security updates.
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in
the individual files in /usr/share/doc/*/copyright.
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in
the individual files in /usr/share/doc/*/copyright.
If you used SSSD to connect the Ubuntu system to AD, then the home directory
isn’t automatically created for you, as mentioned earlier. In this case, since it is the
first login and the home directory doesn’t exist yet, we can see the output of the
mkhomedir PAM module that indicates the creation of the directory.
If however you joined the Ubuntu system to AD at installation time, you will
already have a home directory.
Remote connection can be tested with an SSH server running on the system. We
can simply open an SSH connection to ‘localhost’ using an Active Directory
user, for example:
# ssh linda@[Link]@[Link]
The authenticity of host ‘[Link]
([Link])’ can’t be established.
ECDSA key fingerprint is
SHA256:NaOHo8x+mUw4DwxCwGVQuKT0GszZFZZ5qTCYyYhHAFM.
Are you sure you want to continue connecting (yes/no/
[fingerprint])? yes
Warning: Permanently added ‘[Link].
biz,[Link]’ (ECDSA) to the list of known hosts.
linda@[Link]@[Link]’s password:
Creating directory ‘/home/linda@[Link]’.
Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.4.0-48-generic x86_64)
* Documentation: [Link]
* Management: [Link]
* Support: [Link]
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in
the individual files in /usr/share/doc/*/copyright.
26
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
linda@[Link]@ad-desktop-1:~$
Note the double ‘@’ syntax in the connection string. The first @ is for the user@
domain and the second @ is for the user@ssh_server.
As for the login command, the mkhomedir PAM module indicates that the home
directory has been created for user ’linda’.
From the above, we can see that we were able to establish an SSH connection
using the credentials of an Active Directory user, confirming the ability to
authenticate to the Active Directory. The whoami and id commands further
confirm that resolving users and groups work as expected. We have finished
testing the installation.
$ whoami
linda@[Link]
$
$ id
uid=1899001103(linda@[Link]) gid=1899000513(domain
users@[Link]) groups=1899000513(domain users@warthogs.
biz),1899001134(marketing@[Link])
$
$ groups
domain users@[Link] marketing@[Link]
Last, you can verify that a user can authenticate with a graphical interface from
GDM. On the login screen the list of users includes the local users, in our example
‘Ubuntu’, and the list of Active Directory users which have already logged in at
least once, in our example, ‘Linda Ubuntu’ and ‘Tina Ubuntu’ .
27
User ‘Tina’ is not listed and wants to log into this machine. She selects “Not
Listed?” to display a login prompt and enter her username followed by the
domain name.
We can now allow the administrator of the Active Directory controller to have
administrator privileges on the machines controlled by this controller . In Ubuntu, it
means all privileges to run sudo commands to the group administrator .
For instance, if we want to grant admin privileges on the Ubuntu machines to the
$ id Administrator@[Link]
uid=1899000500(administrator@[Link])
gid=1899000513(domain users@[Link])
28
groups=1899000513(domain users@[Link]),
1899000512(domain admins@[Link]),
1899000572(denied rodc password replication group@warthogs.
biz),
1899000520(group policy creator owners@[Link]),
1899000519(enterprise admins@[Link]),
1899000518(schema admins@[Link])
The command returns 6 records. In our example, the Active Directory admin group
we are interested in is “domain admins@[Link]”. Granting sudo access to
the group is accomplished by adding the group to /etc/sudoers and allowing it
to run any command.
root@ad-desktop-1:~# visudo
[the default editor opens /etc/sudoers]
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
“%domain admins@[Link]” ALL=(ALL) ALL
Note
There are double quotes around the domain name to protect the space
in the name of the group. It is recommended to use visudo to edit the
sudoers file and avoid any mistake when entering AD group names that
may contain spaces.
Now the administrator of the Active Directory controller can run any command
with sudo.
29
Note
• override_shell: Override the login shell for all users. Alternatively, default_
shell can be used if none is returned during lookup.
sssd must be restarted with ’systemctl restart sssd’ for the changes to this
file to take effect.
At this point we have working logins via GDM, the console or a remote shell like
ssh, bash is set as the default shell, and the home directory structure matches
standard user directories.
Leaving a domain
To remove your Ubuntu Desktop machine from the domain simply run the
following command:
If there is no error printed, then we successfully left the domain. We can then
confirm that the machine really left the domain with:
30
Setting up ADSys
Get ADsys through Ubuntu Pro
You need an active Ubuntu Pro subscription and a system already joined to Active
Directory to run ADsys and perform the actions enabled by the tools. Please refer
to the previous sections to perform these steps.
Note
Subscriptions are not just for enterprise customers. Anyone can get a
personal subscription for free on up to 5 machines, or 50 if you are an official
Ubuntu Community member.
Installing ADSys
ADSys facilitates the use of some advanced Active Directory management features
and it is not currently installed by default. This must be done manually by the
local administrator of the machine. To do so, log in on first boot, update the
repositories and install ADSys with the following commands:
• Namespace conflicts
• Forward vs backward slashes
• Lets the administrator know exactly what settings are supported on which
client version.
Note
31
Ubuntu administrative template generations
ADSys ships with pre-built Active Directory administrative templates that you can
install on your Active Directory server. You will find two flavours of them:
Those are the 2 files that must be copied onto your Active Directory server.
You can find the latest version of those files in a dedicated directory of the
upstream repository. Note that not all of the keys may be supported by our local
ADSys installation. Only the templates generated by the adysctl that match the
version of your client.
32
Enabling ADsys management features
Adsys enables system administrators to configure and use the following Active
Directory functionalities on Ubuntu Desktop, using a similar experience as the one
available on Windows.
Similar to Windows, we offer both user and computer policies, which can be
accessed by navigating to the Ubuntu administrative template section of Active
Directory. GPO rules can have the traditional enabled, disabled and not configured
states and their precedence follows the same, default Active Directory constructs,
(machine policies take precedence over user ones).
The settings are applied to the relevant users on the client and they can be
overwritten only by local machine administrators.
For more information on how to configure and use GPOs with Ubuntu, please
refer to the dedicated section of the ADsys documentation.
Privilege management
The Admin privilege manager enables you to grant or revoke superuser privileges
for the default local user, and Active Directory users and groups.
By default members of the local sudo group are administrators on the machine.
If the local User setting is set to Disabled the sudo group members are not
considered administrators on the client. This means that only valid Active Directory
users are able to log in to the machine.
For more information on how to perform privilege management and remove local
sudoers please refer to the dedicated section of the ADsys documentation.
33
Remote script execution
The remote script execution functionality allows the execution of shell scripts or
any supported binary on the target machine (including Powershell if the relevant
package is installed on Ubuntu). Active Directory can be configured to execute the
script on behalf of the client or by impersonating other users.
To be executed, the scripts have to be copied in the Active Directory sysvol folder
and they are specific per distribution. To expose a new version to the system it is
also necessary to create an appropriate [Link] file, and make sure it is updated
every time a new version of the script is available. This can be done manually or
through a daemon.
Once in the folder, scripts can be enabled or disabled by navigating to the relevant
Computer Scripts or User Scripts folder on the Ubuntu administrative templates,
depending on whether you want them to tie them to the machine (startup/
shutdown) or the users (login/logoff).
It is important that, like in Windows, the script sessions are transactional, meaning
that whenever the machine boots up and connects to the domain controller it
will download the latest available version of the script. However, if a new version
becomes available throughout the session it will not be executed until the next
reboot/login.
For more information on how to configure and operate the remote script
execution feature please refer to the dedicated section of the ADsys documentation.
You can find more information on how to develop AppArmor profiles in the
following documentation article.
34
For more information on how to enforce custom AppArmor profiles using Active
Directory, PAM module configuration and parsing behaviours please refer to the
dedicated section of the ADsys documentation.
The mount process for these mounts is triggered at the moment a user logs in.
System mounts are handled by systemd through unit files and happen at root level.
Therefore, users do not have control over the mounting / unmounting process.
All protocols supported by the mount command should work out of the box.
However, the only tested ones are smb, ftp and nfs.
The backends for the protocols smb and nfs are automatically enabled when
installing the adsys package. In order to enable the backend for ftp mounts, the
user must install the recommended curlftpfs package. This behaviour is tested on
Ubuntu and might differ on other Linux distributions.
For more information on how to mount and manage network shares please refer
to the dedicated section of the ADsys documentation.
For more information on how to configure and manage proxy settings using Active
Directory refer to the dedicated section of the ADsys documentation.
Certificate autoenrollment
Active Directory Certificate Services provides customizable services for issuing and
managing digital certificates used in software security systems that employ public
key technologies.
The digital certificates that AD CS provides can be used to encrypt and digitally
sign electronic documents and messages. These digital certificates can be used for
authentication of computer, user, or device accounts on a network.
35
Unlike the other ADSys policy managers which are configured in the special
Ubuntu section provided by the ADMX files (Administrative Templates), settings
for certificate auto-enrollment are configured in the Microsoft GPO tree:
This feature relies on the certmonger and cepces packages respectively to monitor/
update certificates and communicate with Active Directory Certificate Services.
For more information on how to configure and manage certificates using Active
Directory refer to the dedicated section of the ADsys documentation.
36
The adsys Daemon and Client
Socket Activation
The ADSys daemon is started on demand by systemd’s socket activation and only
runs when it’s required. It will gracefully shutdown after idling for a short period of
time (by default 120 seconds).
Configuration
ADSys doesn’t ship a configuration file by default. However, such a file can be
created to modify the behaviour of the daemon and the client.
37
Configuration common between service and client
• socket: Path of the unix socket for communication between clients and daemon.
This can be overridden by the --socket option. Defaults to /run/[Link]
(monitored by systemd for socket activation).
• service_timeout: Time in seconds without any active request before the service
exits. This can be overridden by the --timeout option. Defaults to 120 seconds.
• ad_server: Active directory LDAP server to contact. This overrides the field
ad_server from /etc/[Link]. This can be overridden by the
--ad-server option.
• ad_domain: Active directory domain to use for the machine and users, if not
provided. This overrides the field ad_domain from /etc/[Link]. This can be
overridden by the --ad-domain option.
• cache_dir: The cache directory contains the policy files downloaded from an
Active Directory server and the rules currently applied to the machine and
users. This can be overridden by the --cache-dir option. Defaults to /var/
cache/adsys/.
• run_dir: The run directory contains the links to the kerberos tickets for the
machine and the active users. This can be overridden by the --run-dir option.
Defaults to /run/adsys/.
Only privileged users have access to this information. As with any other command,
the verbosity can be increased with -v flags (it’s independent of the daemon or
client current verbosity). More flags increases the verbosity further, up to 3.
38
Do not hesitate to use the shell completion and the help subcommands to
get more information about various commands.
Authorisations
ADSys uses a privilege mechanism based on polkit to manage authorisations.
Many commands require elevated privileges to be executed. If the adsys client
is executed with insufficient privileges to execute a command, the user will be
prompted to enter its password. If allowed, then the command will be executed or
denied otherwise.
As a general rule, favour shell completion and the help command for discovering
various parts of the adsysctl user interface. It will help you by completing
subcommands, flags, users and even chapters of the offline documentation:
$ adsysctl doc
Table of Contents
1. [Welcome] ADSys: Active Directory Group Policy Integration
2. [Prerequisites] Prerequisites and Installation
[...]
39
Best Practices
SSSD
It’s important to keep a few things in mind when considering the security of such
an authentication solution.
External authentication
Offline login
There are many options to control the behaviour of offline logins. The most
important ones are:
System Keytab
When joining a domain, encryption keys are stored in the system keytab file
located in /etc/[Link]:
~$ sudo klist -k
Keytab name: FILE:/etc/[Link]
KVNO Principal
-----------------------------------
5 AD-DESKTOP-1$@[Link]
5 AD-DESKTOP-1$@[Link]
5 AD-DESKTOP-1$@[Link]
5 host/AD-DESKTOP-1@[Link]
5 host/AD-DESKTOP-1@[Link]
5 host/AD-DESKTOP-1@[Link]
40
5 RestrictedKrbHost/AD-DESKTOP-1@[Link]
5 RestrictedKrbHost/AD-DESKTOP-1@[Link]
5 RestrictedKrbHost/AD-DESKTOP-1@[Link]
~$
These are secrets which identify the host and its services with the Active Directory
controller, and can be treated as such. The filesystem permissions are by default
0600 and owner and group are root.
ADSys
Some group policies are directly managed by SSSD. For those, ADSys is not
involved at all. This is the case of the Security Settings. Additionally, there are
many Security Settings as defined in Windows and not managed by ADSys but still
partially supported through SSSD.
41
Troubleshooting SSSD
Logs and debug level
SSSD’s log files are located in /var/log/sssd/. There is one log file per service (pam,
nss, sssd itself, ...). Increasing debug level is a way to collect useful information in
these log files and help understand what is going on.
There are 2 ways to increase SSSD’s debug level. First, on the fly, with sssctl. For
example to set it to level 6 run:
# sssctl debug-level 6
The second way is to add it to the configuration file then restart sssd. In the
configuration file, you can set a different debug level for each service. For
example:
[sssd]
domains = [Link]
config_file_version = 2
services = nss, pam, ifp
[nss]
debug_level=6
[pam]
debug_level=6
[domain/[Link]]
debug_level=6
default_shell = /bin/bash
[...]
The sssctl method doesn’t make the setting persistent but has the advantage of
not having to restart the service.
Cache management
Caching is useful to speed things up, but it can get in the way big time when
troubleshooting. It’s useful to be able to remove the cache while chasing down a
problem. This can also be done with the sssctl tool from the sssd-tools package.
Or expire everything:
There are both free and paid-for options to make the integration of Active
Directory straightforward and manageable. Depending on your IT policy
requirements, the time you have to commit to a solution and the expertise of your
team your business should be able to achieve a good level of integration.
43
Further reading
SSSD reference documentation
• SSSD - System Security Services Daemon
IETF RFC 2307 - An Approach for Using LDAP as a Network Information Service
• For directory administrator interested in knowing the exact purpose of all
LDAP attributes used by NSS. [Link]
Kerberos Explained
• A dated but excellent article on Microsoft’s implementation of the Kerberos
protocol. The explanations are platform-agnostic.
[Link]
Active Directory
There is an assumed knowledge of Active Directory setup and operations, for
which Microsoft has developed an abundance of documentation:
• Active Directory Domain Services: [Link]
server/identity/ad-ds/active-directory-domain-services
• GPO management:
[Link]
create-and-manage-central-store
ADSys
• All of the ADSys documentation is included in adsysctl doc but can also be
found online: [Link]
Every effort has been made by Canonical to ensure the accuracy of this document but
Canonical disclaims, to the extent possible at law, any liability for any error or omission.
© Canonical Limited 2024. Ubuntu and associated logos are registered trademarks
of Canonical Ltd., all rights reserved. All other trademarks are the properties of their
respective owners. Any information contained in this document may change without notice
and Canonical is not held responsible for any such changes.
© Canonical Limited 2024. Ubuntu, Kubuntu, Canonical and their associated logos are the registered trademarks of Canonical Ltd.
All other trademarks are the properties of their respective owners. Any information referred to in this document may change
without notice and Canonical will not be held responsible for any such changes.
Canonical Limited, Registered in Isle of Man, Company number 110334C, Registered Office: 2nd Floor, Clarendon House, Victoria
Street, Douglas IM1 2LN, Isle of Man, VAT Registration: GB 003 2322 47
Configuring SSSD on an Ubuntu system involves several primary steps. First, you must install the SSSD package using the appropriate package manager. Next, configure the network settings, hostname resolution, and time synchronization to ensure the system can communicate properly with the Active Directory domain. You will also need to prepare the Ubuntu desktop by verifying administrative privileges and setting up the necessary configuration files. After configuring these preliminary settings, join the Ubuntu system to the desired Active Directory domain, typically using the 'realm' command. Once joined, create or ensure the presence of a home directory for the Active Directory user either through configuration options or PAM modules like 'mkhomedir'. Finally, verify the setup using commands like 'realm list' and 'getent' to ensure users are properly authenticated and their data from Active Directory is accessible .
ADSys extends Active Directory management capabilities on Ubuntu systems by implementing host configuration via Active Directory and Group Policy Objects (GPOs), similar to features available on Windows systems. It enables system administrators to use GPOs for managing dconf settings on Ubuntu, apply computer and user policies, and configure settings like privilege management, remote script execution, managing AppArmor profiles, and attaching network shares. ADsys also supports certificate autoenrollment and provides an experience comparable to Windows, making it easier for administrators to manage Ubuntu environments in Active Directory-centric workflows .
SSSD configurations can be customized in several ways to fit organizational needs when integrating with Active Directory. This includes setting the 'default_domain_suffix' to streamline user logins, configuring 'override_homedir' to designate custom home directory paths, and 'override_shell' to specify default shells for new users. Additionally, SSSD configurations can handle domain-specific policies by modifying the /etc/sssd/sssd.conf file, which should be secure with root:root ownership and permission 0600 to ensure SSSD operates correctly. These customizations allow organizations to conform user environments to specific standards and requirements while providing a seamless integration with Active Directory .
To verify a proper Active Directory domain join on an Ubuntu system using SSSD, several tools and methods can be employed. Using the 'realm list' command provides confirmation that the Ubuntu system is recognized as a member of the Active Directory domain. Next, the 'getent passwd' and 'getent group' commands can resolve details about users and groups from Active Directory, ensuring they are properly integrated. For further troubleshooting, the 'sssctl' utility from the sssd-tools package offers additional insights into the SSSD status, server discoveries, and cached objects, which can help in diagnosing issues related to domain membership and operations .
The GPO system in ADSys ensures consistent policy application across Ubuntu systems by managing both user and computer policies, similar to the Windows environment. Policies are applied on boot for computer settings, on login for user settings, and periodically at configurable intervals (default of 90 minutes) for active clients. This regular policy refresh ensures that any changes made at the Active Directory level are propagated to Ubuntu clients, maintaining policy consistency. Moreover, the use of administrative templates tailored for Ubuntu by ADSys facilitates structured deployment and management of policies aligned with Active Directory constructs .
The use of administrative templates (ADM) file diversity impacts the setup and management of Ubuntu systems within Active Directory by allowing administrators to tailor policies to different versions of Ubuntu, differentiating between Long Term Supported (LTS) and non-LTS releases. This approach helps ensure compatibility and avoids potential configuration conflicts that may arise from feature disparities between Ubuntu versions. By maintaining separate templates, administrators can apply specific policies that are appropriate for each release, thereby optimizing the management of Ubuntu systems and increasing policy accuracy and effectiveness .
The 'mkhomedir' PAM module plays a crucial role during the integration of an Ubuntu system into an Active Directory environment by automatically creating a user's home directory on their first login. This is especially important if the Ubuntu system has been joined to the Active Directory post-installation, as it ensures that a newly authenticated Active Directory user has a personalized environment upon their first access. Without this module, administrators would need to manually create home directories, which could complicate the user experience and system management .
Key challenges in automating policy refresh include ensuring Ubuntu systems have the proper configuration to connect and synchronize with Active Directory, managing potential conflicts between Ubuntu and Windows policy settings, and ensuring network stability for continuous domain integration. Solutions involve configuring GPOs to account for both user and machine policies and setting a regular refresh interval to avoid manual updates. Additionally, administrators should ensure Ubuntu systems have the latest ADM files and are correctly registered with both ADSys and Active Directory to ensure accurate and timely policy applications .
The recommended practices for administering sudo permissions with Active Directory on Ubuntu systems involve editing the /etc/sudoers file to include Active Directory groups, using 'visudo' to prevent syntax errors. For instance, you can add the line '%domain admins@warthogs.biz ALL=(ALL) ALL' to grant sudo privileges to members of the 'domain admins' group. Enclosing the group name with double quotes prevents issues with spaces in the name. Optionally, a specific Ubuntu-focused group can be created, such as 'UbuntuAdmins', to manage sudo privileges distinctly within Active Directory environments. This practice enhances security and simplifies management across multiple systems .
Using plain winbind or NSS/PAM configured for LDAP and Kerberos might be preferred over SSSD in scenarios where a lighter weight software stack is desirable or if specific network authentication requirements exist that align better with winbind or NSS/PAM. These alternatives can offer simpler configurations in systems where full SSSD capabilities are not necessary, such as when resource constraints are a concern or when an environment is running legacy systems that currently rely on these methods for Active Directory integration. Additionally, some specific security policies or organizational practices might require these alternatives despite the advanced features that SSSD offers .