3913 Commits
Author SHA1 Message Date
Florence Blanc-Renaud 9b09e9b724 ipa-migrate: avoid KeyError before attributes are normalized
The ipa-migrate tool reads the content of the source LDAP server
and processes the entries. When the entry is a tombstone it must be
discarded.

In order to detect if the entry is a tombstone, the code checks
if the objectclass attribute contains the value 'nsTombstone'.
The problem is that the key ('objectClass') is not normalized
and may either be 'objectclass' (all lowercase) or 'objectClass'.
Take both cases into account and avoid KeyError exception by
normalizing the attribute + looking for case-insensitive value.

Fixes: https://pagure.io/freeipa/issue/9910
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Mark Reynolds <mreynolds@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2026-01-13 16:22:49 +01:00
Anuja More f580f12e5b sysaccount_mod: Use object.__setattr__ to set allow_empty_update in exception handler
The error only happens in developer mode (when mode=developer instead of
mode=production in /etc/ipa/default.conf). Using object.__setattr__ bypasses
normal attribute assignment which fails in developer mode when trying to set
the class attribute allow_empty_update on an instance.

Signed-off-by: Anuja More <amore@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: PRANAV THUBE <pthube@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: PRANAV THUBE <pthube@redhat.com>
2025-12-16 11:16:34 -03:00
Carla Martinez f39acce911 Fix: Incorrect auth error message
There is a small bug in the server code that processes
the user-locked situation: while kinit reports `kinit:
Client's credentials have been revoked ...`, the code
expects `kinit: Clients credentials have been revoked ...`
(doesn't contain the apostrophe). By correcting the
message and adding the apostrophe the right message
should be displayed.

Fixes: https://pagure.io/freeipa/issue/9891
Signed-off-by: Carla Martinez <carlmart@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2025-12-09 20:53:28 +01:00
Antonio Torres 68cc47a3e4 eDNS: disable dnsconfd before configuring Unbound
If dnsconfd is kept enabled after we are done configuring Unbound for the
encrypted DNS setup, it might overwrite the configuration,
resulting in a broken setup. dnsconfd should be disabled prior to
configuring Unbound during the server/client install process.

Fixes: https://pagure.io/freeipa/issue/9859
Signed-off-by: Antonio Torres <antorres@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
2025-12-02 10:26:56 -05:00
Rafael Guterres Jeffman c98d1b819e ipa-idrange-fix: Fix typo when ID under 1000 is present.
Fixes: https://pagure.io/freeipa/issue/9885

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: David Hanina <dhanina@redhat.com>
2025-12-01 11:19:26 +01:00
Rob Crittenden ffb8fe3541 Don't assume the server has a CA service when issuing certificates
The hostname "localhost" was harcoded in pki_issue_certificate.
This worked for installations, even without a CA, because this
wasn't called for issuing those certificates.

It fails with ipa-pkinit-enable on a server without a CA because
only attempted the local server which lacks a CA.

Instead detect the CA based on the local capabilities and the
server list of available CAs, preferring the local server if it
has a CA.

Fixes: https://pagure.io/freeipa/issue/9879

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
2025-11-26 14:17:23 -05:00
Florence Blanc-Renaud 3e6b5b954b FIPS mode: openssl pkcs12 command needs -nomacver option
In FIPS mode, ipa server installation fails in a call to
openssl pkcs12 command because the PKCS12 MAC requires PKCS12KDF
which is not an approved FIPS algo.
The fix consists in passing the additional option -nomacver

Fixes: https://pagure.io/freeipa/issue/9878
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2025-11-20 15:40:37 -05:00
Rob Crittenden d424dc6dd2 Move some functions to installutils to be more independent
This is needed to avoid importing functions and static values
from cainstance.py and krainstance.py. Both import dsinstance.py
which imports lib389 and initializes things that don't work
well within the server API.

They are moved to installutils and ipalib.constants to be more
centralized and reduce imports.

Related: https://pagure.io/freeipa/issue/9738

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-19 16:50:37 -05:00
Rob Crittenden d322bbfb3f Detect the highest API version the remote server supports
There are deployed 11.7.0 servers that aren't yet configured
to expose the v2 API. This change will allow IPA to fall back
to the v1 API.

Related: https://pagure.io/freeipa/issue/9738

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-19 16:50:37 -05:00
Rob Crittenden f74ff21364 Refine restricting CA profiles to known subjects
Since renewal now occurs through IPA and not directly via
the CA, restrict the CA profiles to only those certificates
we know about and expect.

The RA Agent cert and the subsystem cert share the same profile
so there is another hoop to jump through in validating that
the subjects are valid and expected.

Since the code runs as ipaapi it does not have access to check
the run status of DS so skip in that case. If it fails, it fails.

Contributions from Fraser Tweedale <ftweedal@redhat.com>

Fixes: https://pagure.io/freeipa/issue/9738

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-19 16:50:37 -05:00
Rob Crittenden 1729aa4e66 Reduce the log level before calling PKI functions
This will reduce the output spam during an IPA server install.

Output like:

2025-06-13T22:17:05Z INFO Connecting to https://localhost:8443
2025-06-13T22:17:05Z INFO Getting PKI server info from /pki/v2/info

File-based logs are not affected.

Related: https://pagure.io/freeipa/issue/9738

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Signed-off-by: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-19 16:50:37 -05:00
Rob Crittenden 1c107542cf Retrieve all cert profiles from the CA with --all
Normally IPA only returns the locally-stored certificate profiles.
In order for certmonger to request CA subsystem certificates using
cert_request we need the full set of profiles. Return them all
when --all is provided and the requesting user has permission.

Related: https://pagure.io/freeipa/issue/9738

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-19 16:50:37 -05:00
Rob Crittenden e8425bd88d Configure renewals to use the IPA JSON API
certmonger defaults to using the PKI XML API for renewing
CA/KRA subsystem certificates. certmonger supports the
IPA API for renewals by providing --jsonrpc-url

The IPA API will forward requests to the CA via the
PKI python API. IPA will be RPC agnostic this way and
rely on the PKI python API to handle communication.

Fixes: https://pagure.io/freeipa/issue/9738

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-19 16:50:37 -05:00
Rob Crittenden 7a33bccabd Use PKIClient instead of deprecated PKIConnection
This is for calls to instantiate a SecurityDomainClient
to get version information.

Fixes: https://pagure.io/freeipa/issue/9738

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-19 16:50:37 -05:00
Rob Crittenden f5fc5e0fdf Remove the RestClient class
This is replaced by the APIClient class which uses the pki
python API instead of making direct REST API calls.

Fixes: https://pagure.io/freeipa/issue/9738

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-19 16:50:37 -05:00
Rob Crittenden 191aec5a52 Use the APIClient instead of direct REST calls for ACME
Drop the use of direct REST calls in favor of using the
APIClient based on the pki python API.

Fixes: https://pagure.io/freeipa/issue/9738

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-19 16:50:37 -05:00
Rob Crittenden 43f0284080 Replace REST with PKI python API for cert and LWCA
This reduces the reliance on specific REST/XML API in PKI and will
allow the pki client library to choose which RPC API(s) to use.
Add the new, versioned REST endpoint paths (v1, v2) to the httpd
configuration.

This needs additional refactoring once the certprofile
class is ported and the RestClient class can be dropped or
repurposed so some of the duplication can be re-centralized.

Also catch a bare Exception when we can't reach the local
server on port 443 in ipa-ca-install.  This is because
proxying isn't configured yet.  So catch that Exception and
try again with port 8443 like other exceptions.

Fixes: https://pagure.io/freeipa/issue/9738

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Signed-off-by: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-19 16:50:37 -05:00
Fraser Tweedale 8aea0fd900 Refactor installer cert issuance to use pki python lib
Update the installation code to use the pki python client library to
issue certificates.  This is instead of using the `pki` CLI program
and parsing its output strings.

As part of this change, decompose the `pki_issue_certificate`
function into two specialised functions, rather than a single
function with different "modes".  This makes the logic easier to
follow (and enables the refactor to be done incrementally).

Fixes: https://pagure.io/freeipa/issue/9738

Signed-off-by: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-19 16:50:37 -05:00
Rob Crittenden 5d55b4efb2 Add config option for RSA key size for HTTP, DS, PKINIT, RA certs
A new command-line option was added, --key-type-size, to define
the type of key to generate and the size of the key, or equivalent.

Only rsa is supported currently but this can be expanded easily if
additional key types are added. Placeholders have been added for
ec and ml-dsa key types but they are not yet supported.

There is also a config plugin option to modify this value. It does
NOT modify any certificates already issued. Changing it will only
apply to new replicas added.

Related: https://pagure.io/freeipa/issue/9738

Also add a test to verify installation key sizes.

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-19 16:50:37 -05:00
Rob Crittenden cdc8054453 Use the pki tool to bootstrap certificates during installation
We previously called out to certmonger to have it directly
obtain certificates from the CA. Instead use the CA-generated
/root/ca-admin.p12 certificate to authenticate using the pki
tool to generate the IPA RA certificate.

Then use that certificate to issue the DS, HTTP and KDC
certificates.

Fixes: https://pagure.io/freeipa/issue/9738

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-19 16:50:37 -05:00
Aleksandr Sharov e0b9ad0ae0 Correctly recognize OID 2.5.4.97, organizationIdentifier as a subject/issuer DN of the CA certificate
OID 2.5.4.97 added to the ATTR_NAME_BY_OID list, and cainstance during
2-step installation is re-fetching CA certificate and re-parsing OIDs
based on the list. Example:

cert issuer: <Name(C=CZ,2.5.4.97=LLCCZ-123456789,O=Corp,CN=ROOT)>
DN(cert issuer): CN=ROOT,O=Corp,organizationIdentifier=LLCCZ-123456789,C=CZ

Fixes: https://pagure.io/freeipa/issue/9866

Signed-off-by: Aleksandr Sharov <asharov@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: David Hanina <dhanina@redhat.com>
2025-11-13 11:23:45 +05:30
Alexander Bokovoy ec22295fed sysaccounts: extend permissions to include description and account lock
Security Architect role was supposed to manage sysaccount objects. But
since description attribute is missing from the list of the managed
permissions, the role is unable to modify 'description' field. Same for
nsAccountLock which needs an explicit ACI.

Fixes: https://pagure.io/freeipa/issue/9875

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
2025-11-12 17:16:48 +01:00
Alexander Bokovoy f2fc104f06 sysaccount: make sure nsaccountlock is always present
Commands sysaccount-enable/sysaccount-disable allow to lock/unlock the
account.  This is exposed via operational attribute `nsAccountLock`
which has to be explicitly requested to query the state. However, if
account wasn't explicitly disabled before, `nsAccountLock` will not be
returned by the LDAP server.

Ensure the nsaccountlock attribute is always retrieved, validated, and
normalized across sysaccount operations.

- Invoke validate_nsaccountlock in create and modify pre-callbacks to
  enforce valid values

- Invoke convert_nsaccountlock in create, modify, list, reset, and
  policy post-callbacks to normalize the nsaccountlock attribute and
  default to False in case it is absent.

Fixes: https://pagure.io/freeipa/issue/9842

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2025-11-11 14:44:00 +01:00
Florence Blanc-Renaud bd8288476f Backup-restore: backup krb5.conf.d snippet files
The installation of ipa server creates snippets in /etc/krb5.conf.d/
- freeipa-realm
- freeipa-server

Include these files in the backup

Fixes: https://pagure.io/freeipa/issue/9870
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2025-11-07 15:50:56 +01:00
Alexander Bokovoy 24e4fd5c0c Add system accounts (sysaccounts)
Introduce support for LDAP-based system accounts by adding a dedicated
sysaccount plugin with full CLI commands, extending role membership to
include system accounts, and providing warnings for passsync
configuration updates across servers, along with corresponding
documentation and tests.

New Features:

    Implement system accounts LDAP object with CLI commands for add,
delete, modify, find, show, enable, and disable.

Enhancements:

    Extend role and baseldap plugins to support sysaccount membership
and manage passsync managers with a ServerSysacctMgrUpdateRequired
warning.

Documentation:

    Add a design document for system accounts and regenerate API docs
for sysaccount commands and role membership.

Tests:

    Update existing role and service plugin tests to cover sysaccount
membership.

Fixes: https://pagure.io/freeipa/issue/9842

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
2025-11-03 17:18:05 -05:00
Alexander Bokovoy 7a6391f245 Require krb5.conf.d because we install snippets there
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
2025-11-03 10:07:30 +01:00
Alexander Bokovoy 890474ae3c krb5.conf templates: move IPA domain configuration into a separate snippet
Instead of modifying /etc/krb5.conf with all IPA realm configuration, follow
the practice of creating a separate config snippet file owned by IPA.

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
2025-11-03 10:07:30 +01:00
Alexander Bokovoy 166dbfb630 krb5.conf templates: remove Kerberos 4 support
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
2025-11-03 10:07:30 +01:00
Rob Crittenden 3b5caf9dbd Include the HSM token name when creating LWCAs
In order to generate the private key for a a LWCA (subca)
on an HSM the name of the subca needs to be the HSM token
name : name_of_subca, e.g. ipa_token:test.

This works fine now without any code changes but it requires
that admins always remember to include the prefix which is
unlikely (everyone makes mistakes). So do it for them if
an HSM is present and a token is not provided. We only support
one token at a time in IPA so for now this is sufficient.

One can also mix-and-match including the token and not.
For example you can run:

$ ipa ca-add test --subject cn=test
$ ipa ca-show ipa_token:test

It shouldn't be an issue if a lwca name contains a colon.

Fixes: https://pagure.io/freeipa/issue/9865

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
2025-10-27 18:20:45 -03:00
Rob Crittenden 9605ea9a0b Use Augeas when updating dbmodules in krb5.conf
This repalces the straight string parsing from IPAv3.0.0.

It should be much more robust and result in a valid
configuration file when complete. aug.save() will
assure that as it will raise an error otherwise.

This will handle the following cases:
 * db_library = ipadb.so : do nothing
 * db_library is missing, set to ipadb.so
 * db_library is something else, replace wih ipadb.so

Fixes: https://pagure.io/freeipa/issue/9862
Related: https://pagure.io/freeipa/issue/5913

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
2025-10-10 16:52:50 +05:30
Rob Crittenden 892fea881a Add support for libpwpolicy credit to password policy
We already have libpwquality plumbed in. The ask here was
to support the quality credits as well.

There are four credits: digits, uppers, lowers and others

These either count complexity towards satisfying the minimum
length or set the minimum number of a type allowed.

If any of the four credits is configured then it will cause
the password policy plugin to go through the libpwquality.

Reminder that libpwquality sets its own min password length
floor that should be overridden already.

If min_classes is set as well then that is still enforced.

Fixes: https://pagure.io/freeipa/issue/9835

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: David Hanina <dhanina@redhat.com>
2025-10-03 15:29:40 -04:00
David Hanina 563f20e2a4 Add info about modern webui
Adds a small information note, regarding launching modern webui with
redirect link.

Signed-off-by: David Hanina <dhanina@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2025-09-25 17:07:35 +02:00
Rob Crittenden 46b7c16be1 Don't let lack of subca in PKI prevent LDAP deletion
If a subCA only exists in LDAP then it couldn't be removed.

Allow the process to continue. It will fail in the same way if
it doesn't exist on both Dogtag and IPA.

Related: https://pagure.io/freeipa/issue/9738

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
2025-09-18 17:20:01 +02:00
Alexander Bokovoy 2f3c035e2b GetEntryFromLDIF: handle DNs case-insensitive
LDAP expects case-insensitive DNs, so modify LDIF parser to
compare DNs as case-insensitive strings and use case-preserving but
case-insensitive dictionary.

Fixes: https://pagure.io/freeipa/issue/9854

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
2025-09-18 13:29:32 +05:30
Alexander Bokovoy ae8e850708 dcerpc: Support Samba 4.23
Samba 4.23 ignores trust to PIM and 'within the forest' domains. It
didn't know what to do with them in past as well but starting with 4.23
the domain trust entries which have trust attributes with
LSA_TRUST_ATTRIBUTE_PIM_TRUST and LSA_TRUST_ATTRIBUTE_WITHIN_FOREST bits
set will be ignored.

FreeIPA did default to LSA_TRUST_ATTRIBUTE_WITHIN_FOREST for domains
stored with trusted attributes set to 0 or missing. This was behavior in
past for Samba as well. Since FreeIPA only supports forest trust and an
external trust, in both cases we should set explicit LSA trust attribute
bits:
 - LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE for the forest trust
 - LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE for the external trust

Fixes: https://pagure.io/freeipa/issue/9852

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Julien Rische <jrische@redhat.com>
2025-09-12 14:03:09 +02:00
Alexander Bokovoy 96c3d2d1ad dcerpc: make sure forest trust info structure version is 1
[MS-DRSR] 5.64 FOREST_TRUST_INFORMATION defines version of the
ForestTrustInfo structure as 1. We didn't set it so it was defaulting to
zero. Samba validates the version number and rejects ForestTrustInfo
structures from FreeIPA.

Make sure new structures are always set to version 1 and old strutures
fixed up to have version 1.

Fixes: https://pagure.io/freeipa/issue/9852

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Julien Rische <jrische@redhat.com>
2025-09-12 14:03:09 +02:00
Florence Blanc-Renaud c0994948b5 DNS over TLS: use system trust store
When a client or server is configured with DoT, the installer
creates /etc/unbound/conf.d/zzz-ipa.conf with
    tls-cert-bundle: /etc/pki/tls/certs/ca-bundle.crt

This certificate bundle does not exist any more in fedora 43+
(https://fedoraproject.org/wiki/Changes/droppingOfCertPemFile)
and the missing file prevents unbound service from starting.

The configuration should rather set
    tls-system-cert: yes
in order to rely on the systemwide trust store.

The upgrade is also handled by this change.

Fixes: https://pagure.io/freeipa/issue/9838
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2025-09-01 13:52:09 +02:00
Antonio Torres e6445b88ab dns: disable all previous Unbound configuration before deploying ours
Previous configuration from another packages might break our Unbound
setup. Rename the config files to disable them before deploying our
configuration.

Fixes: https://pagure.io/freeipa/issue/9814
Signed-off-by: Antonio Torres <antorres@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2025-07-29 17:14:45 +02:00
Stanislav Levin 7e436ff6fe install: make use of shared temp directory for hsm validation
During hsm validation temporary directory and files are prepared
by root in base temporary directory which can be private and
thereby not readable by anybody but root. The validation in its
turn, run some checks as pkiuser and fail to read not accessible
resources in such a case.

Hence, to make them available some shared place need to be used,
e.g. /tmp.

Fixes: https://pagure.io/freeipa/issue/9831
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2025-07-25 16:00:15 -04:00
Rafael Guterres Jeffman 9d7689f959 Use correct capitalization for GitHub and GitLab
The correct third party trademarks are GitHub and GitLab, and this is
the capitalization that needs to be used for documentation and messages,
when referring to each service.

Fixes: https://pagure.io/freeipa/issue/9811
Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2025-07-10 14:02:58 -04:00
Antonio Torres 76b3a342d5 dns: only overwrite resolv.conf during eDNS setup when needed
Don't overwrite resolv.conf if it already points to 127.0.0.1. This
ensures compatibility with read-only containers.

Fixes: https://pagure.io/freeipa/issue/9813
Signed-off-by: Antonio Torres <antorres@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2025-07-01 15:36:19 +02:00
Thomas Woerner 47626a950f Replica: Request cert for DoT before setting up bind
Deploying a replica with DNS support using an IPA server DNS with DoT
fails while setting up DNS over TLS. The request for the certificate for
DoT using IPA CA is done after the DNS server for the replica is configured.

The nameserver in /etc/resolv.conf has been changed to 127.0.0.1, but
unbound was not yet configured as a forwarder.

The solution is to move the cert request before the DNS server
configuration. The unbound config from the client deployment is still
working at that moment.

Fixes: https://pagure.io/freeipa/issue/9808
Signed-off-by: Thomas Woerner <twoerner@redhat.com>
Reviewed-By: Antonio Torres <antorres@redhat.com>
2025-06-26 12:08:50 +02:00
Thomas Woerner 0bc089681c ipaserver/install/dns.py: Allow to Turn off DNSSEC validation for unbound
Unbound is by default configured to do DNSSEC validation with the validator
module. The solution is to set module-config to "iterator".

When the server is built with EDNS client subnet support this should be
changed to "subnetcache iterator" according to the unbound man page.

Fixes: https://pagure.io/freeipa/issue/9805
Signed-off-by: Thomas Woerner <twoerner@redhat.com>
Reviewed-By: Antonio Torres <antorres@redhat.com>
Reviewed-By: Alexander Bokovoy <abbra@users.noreply.github.com>
2025-06-26 08:19:51 +02:00
Mark Reynolds 878b800e87 ipa-migrate - only remove repl state attribute options
Improve how we process attributes that might include replication state
data. Previously we only cared about ";binary" but there are other
attribute options that are used in IPA. Now we completely break down the
attribute into each option and rebuild it without any repl state options

Fixes: https://pagure.io/freeipa/issue/9784

Signed-off-by: Mark Reynolds <mreynolds@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2025-06-23 08:15:21 +02:00
Julien Rische fb12d9e14e Use ipaplatform tasks for krb5 enctypes
Provide the master key encryption type and the list of supported
encryption types as ipaplatform.<platform>.tasks methods. This allows
to generate the list at runtime based on the environment (e.g. FIPS) and
override the list depending of the platform.

3DES HMAC-SHA1 encryption type is now removed from supported encryption
types if it is present.

Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2025-06-20 17:24:23 +02:00
Rob Crittenden 6346ca71d7 Add token options to immutables for pki override
Setting the HSM options in a pki-override-file will
result in a successful installation but it affects the
storage of the token library path. It is stored as None.

We could also instead save the provided value from the
override but an override isn't necessary in this case
since IPA provides command-line options to enable it.

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
2025-06-20 16:30:04 +02:00
Florence Blanc-Renaud 5323b77013 ipa-idrange-fix: check that IPA server is installed
If ipa-idrange-fix is called on a system where the server is not configured,
it crashes with a Traceback when trying to access api.env.basedn.

Check that IPA server is configured before processing further

ipatests: add test launching ipa-idrange-fix on unconfigured server

Fixes: https://pagure.io/freeipa/issue/9809
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: David Hanina <dhanina@redhat.com>
2025-06-19 13:48:18 +02:00
Rob Crittenden 6b9400c135 Set krbCanonicalName=admin@REALM on the admin user
The admin must always own this name. If another entry has this
value set then remove it.

There is a uniqueness plugin for this attribute so the only two
possibilities are:

- no entry has this value set
- the admin user has this value set
- a different entry has the value set

Still, for robustness purposes, the upgrade plugin will handle
more entries.

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
2025-06-17 09:48:44 +02:00
David Hanina b36c163fe8 Warn when UID is out of local ID ranges
Provides simple warning when creating new user with uid out of
all local ranges, as this is the main culprit of breaking Kerberos, by
not generating ipantsecurityidentifier. We don't have to check for
user-mod, because modification never changes ipantsecurityidentifier.
We do not have to check groups, as groups are ignored for ipa without
AD trust. It's reasonable to revisit this in the future for group
creation and warn against groups out of ranges as well as
warn for users with groups without SID, in case AD trust is enabled.

Fixes: https://pagure.io/freeipa/issue/9781
Signed-off-by: David Hanina <dhanina@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
2025-06-03 15:46:56 +02:00
Florence Blanc-Renaud e4a3d46e89 ipa config-mod: fix internalerror when setting an empty ipaconfigstring
When ipa config-mod is called with --ipaconfigstring="", the command
fails with an InternalError.
This happens because the code added for 32bits uid did not properly
handle this case.

Same issue if ipa subid-stats is called with a null ipaconfigstring.

This commit now handles when ipaconfigstring is empty or None, and adds
a test.

Fixes: https://pagure.io/freeipa/issue/9794
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Francisco Trivino <ftrivino@redhat.com>
2025-05-27 09:33:13 +02:00