POSIX IDs and IPA
Local domain range
IPA is an identity management solution that allows to centrally define users and groups. As it operates in Linux environments, the users and groups are defined with a name and a POSIX ID (a numeric value), that are used for access control: each file belongs to a user and a group identified by their POSIX ID, sudo rules evaluation relies on POSIX IDs and so on.
When users and groups are created inside IPA, they can either be created with a provided id or the admin can let IPA assign an id. The range from which the ids can be picked is defined at the IPA level and is represented by a local ID range visible with the
ipa idrange-find command:
[root@server ~]# ipa idrange-find --------------- 1 range matched --------------- Range name: IPA.TEST_id_range First Posix ID of the range: 936000000 Number of IDs in the range: 200000 Range type: local domain range ---------------------------- Number of entries returned 1 ----------------------------
During the first IPA server installation, this ID range can either be provided through a base ID number (
—idstart) and a max ID (
—id max), or be picked randomly by the installer.
In the above example, the users and groups will get assigned IDs starting from 936000000, up to 936000000 + 200000 (not included).
When the ID range is depleted, the admin can extend the possible ID numbers by defining additional local ranges (
ipa idrange-add --type ipa-local).
Other types of ranges
When IPA has configured a trust with an Active Directory forest, the users and groups defined in AD also need to have a POSIX ID for access control performed on IPA side. There are 2 different situations:
- if AD has been extended with Identity Management for UNIX, and is also storing a
gidNumberfor each user, and a
gidNumberfor each group, then IPA can directly re-use the POSIX IDs stored on AD side. The trust is established with a range type “Active Directory domain with POSIX attributes” (
- If AD doesn’t store POSIX IDs, IPA maps the unique SID value from AD users and groups to a POSIX ID based on settings defined for the trust. The trust is established with a range type “Active Directory domain” (
ipa-ad-trust) and sets the first POSIX ID for the mapping.
As a summary, IPA manages 3 different types of ID ranges:
- local domain
- active directory domain
- active directory domain with POSIX attributes
In any case, the various ranges must not overlap in order to guarantee that an ID corresponds to a unique user or group.
Next available ID
DNA range plugin
During the first server installation, the local ID range is set and defines the range from which IDs get picked for new IPA users and groups. This local ID range is used for the whole IPA deployment.
The server is then configured with the DNA range plugin (Dynamic Number Assignment), that provides a mechanism to automatically assign IDs but also ensure existing IDs are not re-used. The implementation is simple to understand: the DNA plugin stores the next available ID and assigns the IDs sequentially.
The existing DNA ranges can be seen using
ipa-replica-manage dnarange-show. If the command is run when there is a single server, the output looks like the following:
[root@server ~]# ipa-replica-manage dnarange-show server.ipa.test: 936000000-936199999
The DNA range on the first server starts from the same value as the local domain ID range , and ends on first POSIX ID + number of IDs – 1. When the first user gets created, he is assigned a POSIX ID, and the DNA range plugin increments the next available value:
[root@server ~]# ipa user-add idmuser1 --first idm --last user1 ... [root@server ~]# ipa-replica-manage dnarange-show server.ipa.test: 936000002-936199999
The above output shows that the available range has shrinked due to the new user taking one ID. Note that the first ID (936000000) is reserved for the admin user.
Splitting ranges between replicas
When additional servers (replicas) are set up, it is important to make sure that a given ID is not assigned at the same time by 2 different replicas to different users/groups. In order to avoid this type of conflict, each replica is also configured with the DNA range plugin (dynamic number assignment).
[root@server ~]# ipa-replica-manage dnarange-show server.ipa.test: 936000002-936199999 replica.ipa.test: No range set
The above command shows that the replica hasn’t created yet any user or group and didn’t request any DNA range. But as soon as the replica needs to assign an ID, it communicates with the server and grabs a sub-range:
[root@replica ~]# ipa user-add idmuser2 --first idm --last user2 ... [root@replica ~]# ipa-replica-manage dnarange-show server.ipa.test: 936000002-936100499 replica.ipa.test: 936100501-936199999
The output shows that server.ipa.test abandoned part of its range to replica.ipa.test. From now on, server.ipa.test will be able to assign IDs up to 936100499, while replica.ipa.test will assign IDs starting from 936100501 (he assigned 936100500 to the new user).
The DNA range is configured locally to each replica, in a part of the configuration that is not replicated. The DNA range records the next available ID and the max available ID. Remember, the DNA range is constantly evolving: as soon as a replica assigns an ID to a new user, the next available ID is incremented and the range shrinks over time.
It is important to make sure that DNA ranges are not overlapping, and that each DNA range fits into local ID ranges.
Issues can happen when a replica doesn’t have any assigned DNA range and fails to grab a range when it needs to (for instance because the only other server he knows is down).
In this case, manual remediation is possible using ldapmodify, by editing the DNA range plugin configuration on the replica. The DNA range plugin configuration can be seen within the following LDAP entry:
[root@replica ~]# ldapsearch -LLL -D "cn=directory manager" -W -o ldif-wrap=no -b "cn=Posix IDs,cn=Distributed Numeric Assignment Plugin,cn=plugins,cn=config" dnaMaxValue dnaNextValue Enter LDAP Password: dn: cn=Posix IDs,cn=Distributed Numeric Assignment Plugin,cn=plugins,cn=config dnaMaxValue: 936199999 dnaNextValue: 936100501
Note that the DNA range plugin has different values on each replica, and the ranges must not overlap and must not include already assigned IDs.
Another type of issue arises when the ID ranges are depleted. In this case, a new local id range can be added with a new range of values.
The official documentation contains a whole chapter related to Adjusting ID ranges manually and is a recommended read. I would also like to point to Rob’s blog “FreeIPA and no DNA range” for more details.