1. Overview of authentication methods in Foreman
Foreman includes native support for authentication with a username and password. If you require additional methods of authentication, configure your Foreman server to use an external authentication source.
Username and password | Single sign-on (SSO) | One-time password (OTP) | Time-based one-time password (TOTP) | PIV cards | Additional details | |
---|---|---|---|---|---|---|
Active Directory (direct integration) |
Yes |
Yes |
No |
No |
No |
Configuring Kerberos SSO for Active Directory users in Foreman |
FreeIPA |
Yes (Linux and Active Directory users) |
Yes (Linux users only) |
No |
No |
No |
|
LDAP |
Yes |
No |
No |
No |
No |
Configuring an LDAP server as an external identity provider for Foreman |
2. Accessing Foreman
After Foreman has been installed and configured, use a browser to log in to the Foreman web UI interface. From the Foreman web UI, you can manage and monitor your Foreman infrastructure.
2.1. Logging in to the Foreman web UI
Use the web user interface to log in to Foreman for further configuration.
-
Access Foreman server using a web browser pointed to the fully qualified domain name:
https://foreman.example.com/
-
Enter the user name and password created during the configuration process. If a user was not created during the configuration process, the default user name is admin.
-
If you have problems logging in, you can reset the password. For more information, see Resetting the administrative user password.
2.2. Resetting the administrative user password
Use the following procedures to reset the administrative password to randomly generated characters or to set a new administrative password.
-
To reset the administrative user password:
-
Log in to the base operating system where Foreman server is installed.
-
Enter the following command to reset the password:
# foreman-rake permissions:reset Reset to user: admin, password: qwJxBptxb7Gfcjj5
-
Use this password to reset the password in the Foreman web UI.
-
Edit the
~/.hammer/cli.modules.d/foreman.yml
file on Foreman server to add the new password:# vi ~/.hammer/cli.modules.d/foreman.yml
NoteUnless you update the
~/.hammer/cli.modules.d/foreman.yml
file, you cannot use the new password with Hammer CLI.
-
-
To set a new administrative user password
-
Log in to the base operating system where Foreman server is installed.
-
To set the password, enter the following command:
# foreman-rake permissions:reset password=new_password
-
Edit the
~/.hammer/cli.modules.d/foreman.yml
file on Foreman server to add the new password:# vi ~/.hammer/cli.modules.d/foreman.yml
NoteUnless you update the
~/.hammer/cli.modules.d/foreman.yml
file, you cannot use the new password with Hammer CLI.
-
2.3. Setting a custom message on the Foreman web UI login page
You can change the default text on the login page to a custom message you want your users to see every time they access the page. For example, your custom message might be a warning required by your company.
-
In the Foreman web UI, navigate to Administer > Settings, and click the General tab.
-
Enter your custom message in the Login page footer text field.
-
Click Submit.
-
Log out of the Foreman web UI and verify that the custom message is now displayed on the login page.
3. Configuring Kerberos SSO with FreeIPA in Foreman
FreeIPA is an open-source identity management solution that provides centralized authentication, authorization, and account management services. With Foreman, you can integrate Foreman server with your existing FreeIPA server to enable FreeIPA users to authenticate to Foreman.
With your FreeIPA server configured as an external identity provider, users defined in FreeIPA can log in to Foreman with their FreeIPA credentials. If cross-forest trust is configured between FreeIPA and Active Directory, Active Directory users can also log in to Foreman.
FreeIPA users can log in using the following methods:
-
Username and password
-
Kerberos single sign-on
When cross-forest trust is configured between FreeIPA and Active Directory, Active Directory users can log in to Foreman with their user principal name (UPN) and password.
For information about FreeIPA, including its cross-forest trust functionality, see Red Hat Enterprise Linux 9 Planning Identity Management and Red Hat Enterprise Linux 9 Installing Identity Management.
3.1. Enrolling Foreman server in a FreeIPA domain
Create a host entry for your Foreman server system in the FreeIPA LDAP and configure the system to be a client in your FreeIPA domain.
-
An existing FreeIPA server
-
FreeIPA user account with privileges to enroll new FreeIPA hosts
-
On the FreeIPA server:
-
Create a host entry for the Foreman server system.
For more information, see Red Hat Enterprise Linux 9 Managing IdM users, groups, hosts, and access control rules.
-
Create an entry for the HTTP service for Foreman server. This enables access to the keytab file by creating a service principal for your Foreman server.
For more information on creating a service entry in FreeIPA, see Red Hat Enterprise Linux 9 Managing IdM users, groups, hosts, and access control rules.
-
-
On your Foreman server, configure the system as client in the FreeIPA domain. This includes ensuring that the system meets the necessary prerequisites, installing the necessary packages, and running the
ipa-client-install
utility.For more information, see Red Hat Enterprise Linux 9 Installing Identity Management.
NoteTo install packages on your Foreman server, use the
foreman-installer
utility. -
Ensure that the hostname is set to the fully qualified domain name (FQDN); the short name is not sufficient:
# hostname foreman.example.com
Otherwise,
foreman-installer
cannot generate the right principal name that is needed to join the realm.
-
On your Foreman server, check that you are able to resolve a user defined on the FreeIPA server. For example, to check the
admin
user that FreeIPA creates by default:$ id admin
On the FreeIPA server, a user named admin who has administrative privileges on the FreeIPA server prepares a host entry for the Foreman server system:
-
Authenticate as the FreeIPA admin user:
# kinit admin
-
Optional: Verify that you have authenticated successfully:
# klist
-
Create a host entry from the command line. Specify that you want to use a random password for the enrollment.
# ipa host-add --random foreman-server.example.com -------------------------------------------------- Added host "foreman-server.example.com" -------------------------------------------------- Host name: foreman-server.example.com Random password: W5YpARl=7M.n Password: True Keytab: False Managed by: freeipa-server.example.com
-
Enable access to the keytab file by creating a service principal for your Foreman server:
# ipa service-add HTTP/foreman-server.example.com
On the Foreman server system, a user with Foreman administrative privileges enrolls the system into the FreeIPA domain:
-
Install the FreeIPA client packages:
# apt install ipa-client
-
Configure the Foreman server system a client in FreeIPA by using the random password produced by
ipa host-add
in a previous step:# ipa-client-install --password 'W5YpARl=7M.n'
-
Verify that you are able to resolve the FreeIPA
admin
user from your Foreman server:$ id admin
3.2. Configuring the FreeIPA authentication source on Foreman server
Enable FreeIPA users to access Foreman by configuring FreeIPA as an authentication provider on your Foreman server.
-
Foreman server running on a system that is enrolled in the FreeIPA domain.
-
Enable access for your preferred login method:
-
To enable access to the Foreman web UI only:
# foreman-installer \ --foreman-ipa-authentication true
-
To enable access to the Foreman web UI and the Foreman API, including Hammer CLI:
# foreman-installer \ --foreman-ipa-authentication-api true \ --foreman-ipa-authentication true
WarningEnabling access to both the Foreman web UI and the Foreman API poses a security risk. After the FreeIPA user enters
kinit
to receive a Kerberos ticket-granting ticket (TGT), an attacker might obtain an API session. The attack is possible even if the user did not previously enter the Foreman login credentials anywhere, for example in the browser. -
To disable external authentication with FreeIPA, reset the options. For example, to disable access to the Foreman API and Hammer CLI:
# foreman-installer --reset-foreman-ipa-authentication-api
-
-
If your Foreman server runs in an IPv6-only network and also runs on Enterprise Linux 9.6 and earlier or Enterprise Linux 10.0, set the
lookup_family_order
option in the[domain/freeipa-server.example.com]
section of the/etc/sssd/sssd.conf
file:[domain/freeipa-server.example.com] lookup_family_order = ipv6_only
If the DNS name of the IdM server can be translated to both an IPv4 and IPv6 address but the IPv4 address is not accessible, SSSD requires
lookup_family_order
to translate the DNS name correctly. Without the option, IdM users are unable to usekinit
to authenticate to Foreman.
-
Log in to Foreman web UI by entering the credentials of a user defined in FreeIPA.
3.3. Configuring host-based access control for FreeIPA users logging in to Foreman
You can use host-based access control (HBAC) rules to manage access control within your FreeIPA domain. In FreeIPA, HBAC rules define which users can access which hosts and which services can be used to gain access.
For example, you can configure HBAC on the FreeIPA server to limit access to Foreman server only to selected users or user groups. By configuring a HBAC rule in the FreeIPA domain, you can ensure Foreman does not create database entries for users who should not have access.
-
FreeIPA user account with privileges to configure HBAC rules
-
On the FreeIPA server, configure HBAC control. For more information, see Red Hat Enterprise Linux 9 Managing IdM users, groups, hosts, and access control rules.
-
Create a HBAC service for Foreman server.
-
Create a new HBAC rule to define the required access control. Add the following FreeIPA entities to the HBAC rule:
-
The HBAC service for Foreman server
-
The Foreman server host
-
The users or user groups to whom you want to grant access
-
-
Make sure the default FreeIPA
allow_all
rule is disabled.
-
-
On your Foreman server, load the host-based access control rules from FreeIPA:
# foreman-installer --foreman-pam-service foreman-prod
-
Log in to the Foreman web UI as a user defined in FreeIPA.
-
If the user is included in the HBAC rule, Foreman web UI will grant access.
-
If the user is not included in the HBAC rule, Foreman web UI will not grant access.
-
On the FreeIPA server, a user with administrative privileges configures a HBAC rule to allow selected users access to Foreman server:
-
Authenticate as the user with privileges required to configure HBAC rules:
$ kinit admin
-
Optional: Verify that you have authenticated successfully:
$ klist
-
Create a new HBAC service named
foreman-prod
:$ ipa hbacsvc-add foreman-prod
-
Create a new HBAC rule:
$ ipa hbacrule-add allow-foreman-prod
-
Add the following FreeIPA entities to the HBAC rule:
-
The
foreman-prod
HBAC service:$ ipa hbacrule-add-service allow-foreman-prod --hbacsvcs=foreman-prod
-
The Foreman server host:
$ ipa hbacrule-add-host allow-foreman-prod --hosts=foreman.example.com
-
The users or user groups to whom you want to grant access:
$ ipa hbacrule-add-user allow-foreman-prod --user=ipa-user
-
-
Optional: Verify the status of the rule:
$ ipa hbacrule-find foreman-prod $ ipa hbactest --user=ipa-user --host=foreman.example.com --service=foreman-prod
-
Disable the default
allow_all
rule:
$ ipa hbacrule-disable allow_all
On Foreman server, a Foreman administrator re-runs foreman-installer to load the host-based access control rules from FreeIPA:
# foreman-installer --foreman-pam-service foreman-prod
3.4. Configuring Hammer CLI to accept FreeIPA credentials
Configure the Foreman Hammer CLI tool to use FreeIPA to authenticate users.
-
You have enabled FreeIPA access to the Foreman API. For more information, see Configuring the FreeIPA authentication source on Foreman server.
-
Open the
~/.hammer/cli.modules.d/foreman.yml
file on your Foreman server and update the list offoreman
parameters:-
To enforce session usage, enable
:use_sessions:
::foreman: :use_sessions: true
With this configuration, you will need to initiate an authentication session manually with
hammer auth login negotiate
. -
Alternatively, to enforce session usage and also negotiate authentication by default:
:foreman: :default_auth_type: 'Negotiate_Auth' :use_sessions: true
With this configuration, Hammer will negotiate authentication automatically when you enter the first
hammer
command.
-
3.5. Logging in to Hammer CLI with FreeIPA credentials
Authenticate to the Foreman Hammer CLI with your FreeIPA username and password.
-
You have configured Hammer CLI to accept FreeIPA credentials. For more information, see Configuring Hammer CLI to accept FreeIPA credentials in Installing Foreman Server nightly on Debian/Ubuntu.
-
Authenticate as a user defined in FreeIPA to obtain a Kerberos ticket-granting ticket (TGT):
$ kinit FreeIPA_user
WarningIf you enabled access to the Foreman API and the Foreman web UI when you were configuring FreeIPA as the authentication provider for Foreman, an attacker might now obtain an API session after the user receives the Kerberos TGT. The attack is possible even if the user did not previously enter the Foreman login credentials anywhere, for example in the browser.
-
If Hammer is not configured to negotiate authentication, initiate an authentication session manually:
$ hammer auth login negotiate
NoteIf you destroy the active Kerberos ticket, for example with
kdestroy
, you will still be logged in to Hammer. To log out, enterhammer auth logout
.
-
Use any
hammer
command to check that the system does not ask you to authenticate. For example:$ hammer host list
3.6. Logging in to the Foreman web UI with FreeIPA credentials in Mozilla Firefox
You can use Mozilla Firefox to log in to the Foreman web UI with your FreeIPA credentials.
Use the latest stable Mozilla Firefox browser.
-
You have FreeIPA authentication configured in your Foreman environment. For more information, see Configuring Kerberos SSO with FreeIPA in Foreman.
-
The host on which you are using Mozilla Firefox is a client in the FreeIPA domain.
-
Your Mozilla Firefox is configured for Single Sign-On (SSO).
-
To log in with a Kerberos ticket granting ticket (TGT):
-
Obtain the Kerberos TGT:
$ kinit user Password for user@EXAMPLE.COM:
-
In Mozilla Firefox, go to the URL of your Foreman server.
-
You are logged in automatically.
-
-
To log in with your username and password:
-
In your browser address bar, enter the URL of your Foreman server.
-
Enter your username and password.
-
3.7. Logging in to the Foreman web UI with FreeIPA credentials in Chrome
You can use Chrome to log in to the Foreman web UI with your FreeIPA credentials.
Use the latest stable Chrome browser.
-
You have FreeIPA authentication configured in your Foreman environment. For more information, see Configuring Kerberos SSO with FreeIPA in Foreman.
-
The host on which you are using Chrome is a client in the FreeIPA domain.
-
To use Kerberos authentication to log in:
-
Enable the Chrome browser to use Kerberos authentication:
$ google-chrome --auth-server-whitelist="*.example.com" --auth-negotiate-delegate-whitelist="*.example.com"
NoteInstead of allowlisting the whole domain, you can also allowlist a specific Foreman server.
-
Obtain the Kerberos ticket-granting ticket (TGT):
$ kinit user Password for user@EXAMPLE.COM:
-
In Chrome, go to the URL of your Foreman server.
-
You are logged in automatically.
-
-
To use username and password to log in:
-
In your browser address bar, enter the URL of your Foreman server.
-
Enter your username and password.
-
3.8. Configuring a cross-forest trust between FreeIPA and Active Directory for Foreman
When your FreeIPA deployment includes a cross-forest trust with Active Directory (AD), configure host-based access control (HBAC) and the System Security Services Daemon (SSSD) to enable AD users to log in to Foreman.
-
An existing FreeIPA server with a cross-forest trust with AD established. For more information, see Red Hat Enterprise Linux 9 Installing trust between IdM and AD.
-
On your FreeIPA server:
-
Enable HBAC:
-
Create an external group and add the AD group to it.
-
Add the new external group to a POSIX group.
-
Use the POSIX group in a HBAC rule.
-
-
-
On your FreeIPA server and all replicas in your FreeIPA topology, configure SSSD to transfer additional attributes of AD users:
-
Add the AD user attributes to the nss and domain sections in
/etc/sssd/sssd.conf
. For example:[domain/EXAMPLE.com] ... krb5_store_password_if_offline = True ldap_user_extra_attrs=email:mail, lastname:sn, firstname:givenname [nss] user_attributes=+email, +firstname, +lastname [ifp] allowed_uids = ipaapi, root user_attributes=+email, +firstname, +lastname
-
Clear the SSSD cache:
-
Stop SSSD:
# systemctl stop sssd
-
Clear the cache:
# sss_cache -E
-
Start SSSD:
# systemctl start sssd
-
-
Verify the AD attributes value by using the
dbus-send
command on your Foreman server and on your FreeIPA server. Make sure that both outputs match.# dbus-send --print-reply --system --dest=org.freedesktop.sssd.infopipe /org/freedesktop/sssd/infopipe org.freedesktop.sssd.infopipe.GetUserAttr string:ad-user@ad-domain array:string:email,firstname,lastname
-
4. Configuring Kerberos SSO for Active Directory users in Foreman
If the base system of your Foreman server is connected directly to Active Directory (AD), you can configure AD as an external authentication source for Foreman. Direct AD integration means that a Linux system is joined directly to the AD domain where the identity is stored.
AD users can log in using the following methods:
-
Username and password
-
Kerberos single sign-on
Note
|
You can also connect your Foreman deployment to AD in the following ways:
|
4.1. Configuring the Active Directory authentication source on Foreman server
Enable Active Directory (AD) users to access Foreman by configuring the corresponding authentication provider on your Foreman server.
-
The base system of your Foreman server must be joined to an Active Directory (AD) domain. To enable AD users to sign in with Kerberos single sign-on, use the System Security Services Daemon (SSSD) and Samba services to join the base system to the AD domain:
Install the following packages on Foreman server:
# apt install adcli krb5-workstation oddjob-mkhomedir oddjob realmd samba-winbind-clients samba-winbind samba-common-tools samba-winbind-krb5-locator sssd
Specify the required software when joining the AD domain:
# realm join AD.EXAMPLE.COM --membership-software=samba --client-software=sssd
For more information on direct AD integration, see Connecting RHEL systems directly to AD using Samba Winbind.
-
Define AD realm configuration in a location where foreman-installer expects it:
-
Create a directory named
/etc/ipa/
:# mkdir /etc/ipa/
-
Create the
/etc/ipa/default.conf
file with the following contents to configure the Kerberos realm for the AD domain:[global] realm = AD.EXAMPLE.COM
-
-
Configure the Apache keytab for Kerberos connections:
-
Update the
/etc/samba/smb.conf
file with the following settings to configure how Samba interacts with AD:[global] workgroup = AD.EXAMPLE realm = AD.EXAMPLE.COM kerberos method = system keytab security = ads
-
Add the Kerberos service principal to the keytab file at
/etc/httpd/conf/http.keytab
:# KRB5_KTNAME=FILE:/etc/httpd/conf/http.keytab net ads keytab create HTTP -U Administrator -s /etc/samba/smb.conf
NoteThe
net ads keytab create
command was introduced in Samba version 4.21.1. If your system uses an earlier version of Samba, use thenet ads keytab add
command.
-
-
Configure the System Security Services Daemon (SSSD) on your Foreman server:
-
Configure the AD access control provider to evaluate and enforce Group Policy Object (GPO) access control rules for the
foreman
PAM service. In the[domain/ad.example.com]
section of your/etc/sssd/sssd.conf
file, set thead_gpo_access_control
andad_gpo_map_service
options as follows:[domain/ad.example.com] ad_gpo_access_control = enforcing ad_gpo_map_service = +foreman
For more information on GPOs, see How SSSD interprets GPO access control rules in Integrating RHEL systems directly with Windows Active Directory (RHEL 9).
-
If your Foreman server runs in an IPv6-only network and also runs on RHEL 9.6 and earlier or RHEL 10.0, set the
lookup_family_order
option in the[domain/ad.example.com]
section of the/etc/sssd/sssd.conf
file:[domain/ad.example.com] lookup_family_order = ipv6_only
If the DNS name of the AD server can be translated to both an IPv4 and IPv6 address but the IPv4 address is not accessible, SSSD requires
lookup_family_order
to translate the DNS name correctly. Without the option, AD users are unable to usekinit
to authenticate to Foreman. -
Restart SSSD:
# systemctl restart sssd
-
-
Enable the authentication source:
# foreman-installer --foreman-ipa-authentication true
-
To verify that AD users can log in to Foreman by entering their credentials, log in to Foreman web UI at https://foreman.example.com. Enter the user name in the user principal name (UPN) format, for example:
ad_user@AD.EXAMPLE.COM
. -
To verify that AD users can authenticate by using Kerberos single sign-on:
-
Obtain a Kerberos ticket-granting ticket (TGT) on behalf of an AD user:
$ kinit ad_user@AD.EXAMPLE.COM
-
Verify user authentication by using your TGT:
$ curl -k -u : --negotiate https://foreman.example.com/users/extlogin <html><body>You are being <a href="foreman.example.com/hosts">redirected</a>.</body></html>
-
-
Connecting to the AD LDAP can sometimes fail with an error such as the following appearing in the logs:
Authentication failed with status code: { "error": { "message": "ERF77-7629 [Foreman::LdapException]: Error while connecting to 'server.com' LDAP server at 'ldap.example.com' during authentication ([Net::LDAP::Error]: Connection reset by peer - SSL_connect)" } }
If you see this error, verify which cipher is used for the connection:
# openssl s_client -connect ldap.example.com:636
If the
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
cipher is used, disable it on either the Foreman server side or on the AD side. TheTLS_DHE_RSA_WITH_AES_256_GCM_SHA384
cipher is known to cause incompatibilities.
5. Configuring an LDAP server as an external identity provider for Foreman
Lightweight Directory Access Protocol (LDAP) is a set of open protocols used to access centrally stored information over a network. With Foreman, you can use one or multiple LDAP directories for external authentication.
Note
|
While you can configure the LDAP server integrated with FreeIPA as an external authentication source, FreeIPA users will not be able to log in by using single sign-on. Instead, consider configuring FreeIPA as an external identity provider. For more information, see Configuring Kerberos SSO with FreeIPA in Foreman. |
Important
|
Users cannot use both FreeIPA and LDAP as an authentication method. After a user authenticates by using one of these methods, they cannot use the other method. To change the authentication method for a user, remove the automatically created user from Foreman. |
5.1. Configuring TLS for secure LDAP
If Foreman uses TLS to establish a secure LDAP connection (LDAPS), you must obtain the CA certificates of your LDAP server and add them to the trusted CA list on the base operating system of your Foreman server.
If your LDAP server uses a certificate chain with intermediate certificate authorities, you must obtain all root and intermediate certificates and add them to the trusted CA list.
-
Obtain the CA certificate from the LDAP Server:
-
If you use Active Directory Certificate Services, export the Enterprise PKI CA Certificate using the Base64 encoded X.509 format. See How to configure Active Directory authentication with
TLS
on Foreman for information on creating and exporting a CA certificate from an Active Directory server. -
Download the LDAP server certificate to a temporary location on the Foreman server, such as
/tmp/example.crt
. You will remove the certificate when finished.Foreman only accepts the
.crt
file extension for certificates in PEM ASCII format.
-
-
Add the LDAP server certificate to the system truststore:
-
Import the certificate:
# cp /tmp/example.crt /usr/local/share/ca-certificates
-
Update the certificate authority truststore:
# update-ca-certificates
-
-
Delete the downloaded LDAP certificate from the temporary location on your Foreman server.
5.2. Configuring Foreman to use LDAP
Configure an LDAP authentication source to enable users to log in to Foreman with their existing LDAP credentials.
-
Your LDAP server complies with the RFC 2307 schema.
-
Your user account has the following permissions:
-
view_authenticators
,create_authenticators
,edit_authenticators
-
view_locations
,assign_locations
-
view_organizations
,assign_organizations
-
-
On your Foreman server, enable the Network Information System (NIS) service so that SELinux does not block outgoing LDAP connections:
# setsebool -P nis_enabled on
-
In the Foreman web UI, navigate to Administer > Authentication Sources.
-
From the LDAP menu, select Create.
-
On the LDAP server tab, enter the details of your LDAP server.
For TLS encrypted connections, select LDAPS to enable encryption.
-
On the Account tab, enter the account information and domain name details. For more information, see the following sections:
-
On the Attribute mappings tab, map LDAP attributes to Foreman attributes.
-
On the Locations tab, select the locations you want Foreman to assign to users created from the LDAP authentication source. These locations are available to users after they log in for the first time.
-
On the Organizations tab, select the organizations you want Foreman to assign to users created from the LDAP authentication source. These locations are available to users after they log in for the first time.
-
Click Submit.
-
If you did not select Automatically Create Accounts In Foreman on the Account tab, create user accounts manually. For more information, see Creating a User in Administering Foreman.
-
If you selected Automatically Create Accounts In Foreman, LDAP users can now log in to Foreman using their LDAP accounts and passwords.
-
After users log in for the first time, the Foreman administrator must assign roles to them manually. For more information about assigning appropriate roles to user accounts, see Assigning Roles to a User in Administering Foreman.
5.3. Example settings for LDAP connections
This example uses a dedicated service account called redhat that has bind, read, and search permissions on the user and group entries.
-
Account Username: DOMAIN\redhat
-
Account password: P@ssword
-
Base DN: DC=example,DC=COM
-
Login name attribute: userPrincipalName
-
First name attribute: givenName
-
Last name attribute: sn
-
Email address attribute: mail
-
Photo attribute: thumbnailPhoto
The userPrincipalName
attribute allows the use of whitespace in usernames. The sAMAccountName
attribute, which provides backwards compatibility with legacy Microsoft systems, does not allow the use of whitespace in usernames.
This example uses a dedicated service account called redhat that has bind, read, and search permissions on the user and group entries.
-
Account Username: uid=redhat,cn=users,cn=accounts,dc=example,dc=com
-
Base DN: dc=example,dc=com
-
Groups Base DN: cn=groups,cn=accounts,dc=example,dc=com
-
Login name attribute: uid
-
First name attribute: givenName
-
Last name attribute: sn
-
Email address attribute: mail
This example uses a dedicated service account called redhat that has bind, read, and search permissions on the user and group entries.
-
Account Username: uid=redhat,ou=users,dc=example,dc=com
-
Base DN: dc=example,dc=com
-
Groups Base DN: cn=employee,ou=userclass,dc=example,dc=com
-
Login name attribute: uid
-
First name attribute: givenName
-
Last name attribute: sn
-
Email address attribute: mail
5.4. Example LDAP filters
You are using the following LDAP directory structure:
DC=Domain,DC=Example | |----- CN=Users | |----- CN=Group1 |----- CN=Group2 |----- CN=User1 |----- CN=User2 |----- CN=User3
Group membership is defined as follows:
-
Group1
includes usersUser1
andUser3
-
Group2
includes usersUser2
andUser3
For example, you can define the following search filters:
Search result (users) | Filter |
---|---|
User1 |
(distinguishedName=cn=User1,cn=Users,dc=domain,dc=example) |
User1, User3 |
(memberOf=cn=Group1,cn=Users,dc=domain,dc=example) |
User2, User3 |
(memberOf=cn=Group2,cn=Users,dc=domain,dc=example) |
User1, User2, User3 |
(|(memberOf=cn=Group1,cn=Users,dc=domain,dc=example)(memberOf=cn=Group2,cn=Users,dc=domain,dc=example)) |
User1, User2, User3 |
(memberOf:1.2.840.113556.1.4.1941:=cn=Users,dc=domain,dc=example) |
Because group Users
is a nested group that contains groups Group1
and Group2
, the filter must include memberOf:1.2.840.113556.1.4.1941:=
before the nested group name. This enables you to filter all users from the nested group.
6. Important user and group account information for Active Directory accounts
All user and group accounts must be local accounts. This is to ensure that there are no authentication conflicts between local accounts on your Foreman server and accounts in your Active Directory domain.
Your system is not affected by this conflict if your user and group accounts exist in both /etc/passwd
and /etc/group
files.
For example, to check if entries for puppet
, www-data
, foreman
and foreman-proxy
groups exist in both /etc/passwd
and /etc/group
files, enter the following commands:
# grep 'puppet\|www-data\|foreman\|foreman-proxy' /etc/passwd /etc/group
7. Configuring external user groups
Foreman does not associate external users with their user group automatically. You must create a user group with the same name as in the external source on Foreman. Members of the external user group then automatically become members of the Foreman user group and receive the associated permissions.
The configuration of external user groups depends on the type of external authentication.
To assign additional permissions to an external user, add this user to an internal user group that has no external mapping specified. Then assign the required roles to this group.
-
If you use an LDAP server, configure Foreman to use LDAP authentication. For more information, see Configuring an LDAP server as an external identity provider for Foreman.
When using external user groups from an LDAP source, you cannot use the
$login
variable as a substitute for the account user name. You must use either an anonymous or dedicated service user. -
If you use a FreeIPA or AD server, configure Foreman to use FreeIPA or AD authentication. For more information, see Configuring authentication for Foreman users.
-
Ensure that at least one external user authenticates for the first time.
-
Retain a copy of the external group names you want to use. To find the group membership of external users, enter the following command:
# id username
-
In the Foreman web UI, navigate to Administer > User Groups, and click Create User Group.
-
Specify the name of the new user group. Do not select any users to avoid adding users automatically when you refresh the external user group.
-
Click the Roles tab and select the roles you want to assign to the user group. Alternatively, select the Administrator checkbox to assign all available permissions.
-
Click the External groups tab, then click Add external user group, and select an authentication source from the Auth source drop-down menu.
Specify the exact name of the external group in the Name field.
-
Click Submit.
8. Refreshing external user groups for LDAP using CLI
To set the LDAP source to synchronize user group membership automatically on user login, in the Auth Source page, select the Usergroup Sync option. If this option is not selected, LDAP user groups are refreshed automatically through a scheduled cron job synchronizing the LDAP Authentication source every 30 minutes by default.
If the user groups in the LDAP Authentication source change in the lapse of time between scheduled tasks, the user can be assigned to incorrect external user groups. This is corrected automatically when the scheduled task runs.
-
On your Foreman server, refresh your LDAP source:
# foreman-rake ldap:refresh_usergroups
9. Refreshing external user groups for LDAP using Foreman web UI
To set the LDAP source to synchronize user group membership automatically on user login, in the Auth Source page, select the Usergroup Sync option. If this option is not selected, LDAP user groups are refreshed automatically through a scheduled cron job synchronizing the LDAP Authentication source every 30 minutes by default.
If the user groups in the LDAP Authentication source change in the lapse of time between scheduled tasks, the user can be assigned to incorrect external user groups. This is corrected automatically when the scheduled task runs.
Use this procedure to refresh the LDAP source manually.
-
In the Foreman web UI, navigate to Administer > Usergroups and select a user group.
-
On the External Groups tab, click Refresh to the right of the required user group.
10. Refreshing external user groups for FreeIPA or AD
External user groups based on FreeIPA or AD are refreshed only when a group member logs in to Foreman. It is not possible to alter user membership of external user groups in the Foreman web UI, such changes are overwritten on the next group refresh.