Commit Graph

285 Commits

Author SHA1 Message Date
Sumit Bose
7b45e33400 ipa-pwd-extop: do not use dn until it is really set
https://fedorahosted.org/freeipa/ticket/3539
2013-04-02 09:39:28 -04:00
Alexander Bokovoy
cc56723151 ipasam: add enumeration of UPN suffixes based on the realm domains
PASSDB API in Samba adds support for specifying UPN suffixes. The change
in ipasam will allow to pass through list of realm domains as UPN suffixes
so that Active Directory domain controller will be able to recognize
non-primary UPN suffixes as belonging to IPA and properly find our KDC
for cross-realm TGT.

Since Samba already returns primary DNS domain separately, filter it out
from list of UPN suffixes.

Also enclose provider of UPN suffixes into #ifdef to support both
Samba with and without pdb_enum_upn_suffixes().

Part of https://fedorahosted.org/freeipa/ticket/2848
2013-03-29 13:45:50 +01:00
Martin Kosek
13b1028ac8 Remove build warnings
Fix rpm build warnings report in Fedora 19 build.

https://fedorahosted.org/freeipa/ticket/3500
2013-03-29 08:59:36 +01:00
Sumit Bose
aa2ed2d3c8 Add support for cmocka C-Unit Test framework
cmocka is a more advanced unit test framework for C-code than the
currently used check framework. This patch adds configure checks and
makefile variables so that new unit tests can use cmocka.

Fixes https://fedorahosted.org/freeipa/ticket/3434
2013-03-28 16:11:24 +01:00
Martin Kosek
b5b040e68f Configure ipa_dns DS plugin on install and upgrade
The plugin is configured unconditionally (i.e. does not check if
IPA was configured with DNS) as the plugin is needed on all
replicas to prevent objectclass violations due to missing SOA
serial in idnsZone objectclass. The violation could happen if just
one replica configured DNS and added a new zone.

https://fedorahosted.org/freeipa/ticket/3347
2013-03-22 14:31:22 +01:00
Petr Spacek
952a7ac9f5 Add 389 DS plugin for special idnsSOASerial attribute handling
Default value "1" is added to replicated idnsZone objects
if idnsSOASerial attribute is missing.

https://fedorahosted.org/freeipa/ticket/3347

Signed-off-by: Petr Spacek <pspacek@redhat.com>
2013-03-22 14:31:22 +01:00
Rob Crittenden
797baef1a4 Fix lockout of LDAP bind.
There were several problems:

- A cut-n-paste error where the wrong value was being considered when
  an account was administratively unlocked.
- An off-by-one error where LDAP got one extra bind attempt.
- krbPwdPolicyReference wasn't being retrieved as a virtual attribute so
  only the global_policy was used.
- The lockout duration wasn't examined in the context of too many failed
  logins so wasn't being applied properly.
- Lockout duration wasn't used properly so a user was effectively unlocked
  when the failure interval expired.
- krbLastFailedAuth and krbLoginFailedCount are no longer updated past
  max failures.

https://fedorahosted.org/freeipa/ticket/3433
2013-03-21 15:44:53 -04:00
Martin Kosek
dcc6f13a58 Use new 389-ds-base cleartext password API
The way how unhashed password is stored in the entry was changed in
389-ds-base-1.3.0, it is now stored in an entry extension rather than
in a magic attribute unhashed#user#password. New API using an entry
extension was introduced. ipa-pwd-extop should take advantage of the
new API as the old one will be removed in 389-ds-base-1.3.1.

https://fedorahosted.org/freeipa/ticket/3439
2013-03-13 14:06:38 -04:00
Petr Viktorin
91606e6679 Change DNA magic value to -1 to make UID 999 usable
Change user-add's uid & gid parameters from autofill to optional.
Change the DNA magic value to -1.

For old clients, which will still send 999 when they want DNA
assignment, translate the 999 to -1. This is done via a new
capability, optional_uid_params.

Tests included

https://fedorahosted.org/freeipa/ticket/2886
2013-03-11 17:07:07 +01:00
Tomas Babej
8d432353cc Perform secondary rid range overlap check for local ranges only
Any of the following checks:
  - overlap between primary RID range and secondary RID range
  - overlap between secondary RID range and secondary RID range

is performed now only if both of the ranges involved are local
domain ranges.

https://fedorahosted.org/freeipa/ticket/3391
2013-03-11 13:55:43 +01:00
Sumit Bose
efd4d80827 Add unit test for get_authz_data_types()
https://fedorahosted.org/freeipa/ticket/2960
2013-03-08 10:46:00 +01:00
Sumit Bose
4e3468211e ipa-kdb: add PAC only if requested
Instead of always adding a PAC to the Kerberos ticket the global default
for the authorization data and the authorization data of the service
entry is evaluated and the PAC is added accordingly.

https://fedorahosted.org/freeipa/ticket/2960
2013-03-08 10:46:00 +01:00
Sumit Bose
3eb64f0a5c ipa-kdb: Read ipaKrbAuthzData with other principal data
The ipaKrbAuthzData LDAP attribute is read together with the other data
of the requestedprincipal and the read value(s) are stored in the e-data
of the entry for later use.

https://fedorahosted.org/freeipa/ticket/2960
2013-03-08 10:46:00 +01:00
Sumit Bose
d5216d5428 ipa-kdb: Read global defaul ipaKrbAuthzData
The ipaKrbAuthzData LDAP attribute is read from the ipaConfig object
and the read value(s) are stored in the ipadb context.

https://fedorahosted.org/freeipa/ticket/2960
2013-03-08 10:46:00 +01:00
Sumit Bose
15cc21cce9 Revert "MS-PAC: Special case NFS services"
This reverts commit 5269458f55.

With the implementation of https://fedorahosted.org/freeipa/ticket/2960
a special hardcoded handling of NFS service tickets is not needed
anymore.
2013-03-08 10:46:00 +01:00
Sumit Bose
d10c043e92 ipa-pwd: Unchecked return value ipapwd_chpwop()
Fixes https://fedorahosted.org/freeipa/ticket/3427
2013-02-28 12:33:28 +01:00
Sumit Bose
99ff913b89 ipa-extdom: Double-free in ipa_extdom_common.c
Fixes https://fedorahosted.org/freeipa/ticket/3426
2013-02-28 12:32:43 +01:00
Sumit Bose
11b20bdc82 ipa-lockout: Wrong sizeof argument in ipa_lockout.c
Fixes https://fedorahosted.org/freeipa/ticket/3425
2013-02-28 12:31:54 +01:00
Sumit Bose
29ddcf3bcb ipa-kdb: Dereference after null check in ipa_kdb_mspac.c
A wrong logic was used to check ipactx.

Fixes https://fedorahosted.org/freeipa/ticket/3424
2013-02-28 12:31:02 +01:00
Sumit Bose
caa218b6b8 ipa-sam: Array compared against 0 in ipasam_set_trusted_domain()
ipa_mspac_well_known_sids is a globally defined array so the check was
always true.

Fixes https://fedorahosted.org/freeipa/ticket/3423
2013-02-28 12:27:51 +01:00
Sumit Bose
db1a07b7f2 ipa-kdb: Uninitialized scalar variable in ipadb_reinit_mspac()
There was a code path where ret was used instead of kerr to save a
return value.

Fixes https://fedorahosted.org/freeipa/ticket/3422
2013-02-28 12:27:07 +01:00
Sumit Bose
5582c9ca63 ipa-kdb: remove unused variable 2013-02-28 12:26:28 +01:00
Alexander Bokovoy
1c68c3edff ipasam: use base scope when fetching domain information about own domain
Since we use associatedDomain attribute to store information about UPN suffixes
and our own domain, searching subtree is going to return more than one entry.
Limit search for own domain by base scope as we only need to fetch our own
domain information here, not UPN suffixes.

Required for https://fedorahosted.org/freeipa/ticket/2945
2013-02-19 14:16:19 +02:00
sbose
3f8778890e ipa-kdb: Free talloc autofree context when module is closed
Currently kdb5kdc crashes on exit if the ipadb KDB modules is loaded and trusts
are configured. The reason is the talloc autofree context which get initialised
during the ndr_push_union_blob() call. On exit the KDC module is unloaded an
later on atexit() tries to free the context, but all related symbols are
already unloaded with the module.

This patch frees the talloc autofree context during the cleanup routine of the
module. Since this is called only at exit and not during normal operations this
is safe even if other KDC plugins use the talloc autofree context, e.g. via
some Samba libraries, as well.

Fixes https://fedorahosted.org/freeipa/ticket/3410
2013-02-14 10:11:26 +01:00
Martin Kosek
dfad4396ff ipa-kdb: fix retry logic in ipadb_deref_search
This function retried an LDAP search when the result was OK due to
flawed logic of retry detection (ipadb_need_retry function which
returns true when we need retry and not 0).

https://fedorahosted.org/freeipa/ticket/3413
2013-02-14 10:09:52 +01:00
Martin Kosek
93ea8a6ac3 ipa-kdb: remove memory leaks
All known memory leaks caused by unfreed allocated memory or unfreed
LDAP results (which should be also done after unsuccessful searches)
are fixed.

https://fedorahosted.org/freeipa/ticket/3413
2013-02-14 10:09:48 +01:00
Martin Kosek
994e2cda39 ipa-sam: Fill SID blacklist when trust is added
Fill incoming and outgoing trust LDAP entry with default SID
blacklist value.

https://fedorahosted.org/freeipa/ticket/3289
2013-02-12 10:37:52 +01:00
Martin Kosek
827ea50566 ipa-kdb: read SID blacklist from LDAP
SIDs in incoming MS-PAC were checked and filtered with a fixed list of
well-known SIDs. Allow reading the SID blacklist from LDAP
(ipaNTSIDBlacklistIncoming and ipaNTSIDBlacklistOutgoing) and add the list
to mspac adtrust structure. Use the hardcoded SID list only if the LDAP
SID list is not configured.

LIMITATION: SID blacklist list is not used yet.

https://fedorahosted.org/freeipa/ticket/3289
2013-02-12 10:37:47 +01:00
Martin Kosek
e08307d3fa ipa-kdb: reinitialize LDAP configuration for known realms
ipa-kdb did not reinitialize trusted domain configuration when it
was loaded to ipa-kdb. However, admin then would have to restart
krb5kdc if he wanted to apply the change to running krb5kdc service.

Run ipadb_reinit_mspac unconditionally every time when trusted domain
is loaded. Among the already configured 1 minute grace time, also
add a quick check if there is at least one configured trusted domain
before reinitializing the mspac structure.

https://fedorahosted.org/freeipa/ticket/3289
2013-02-12 10:37:28 +01:00
Martin Kosek
ce90a4538b ipa-kdb: avoid ENOMEM when all SIDs are filtered out
When all SIDs in info3.sids structure were filtered out, we tried
to talloc_realloc to zero memory size. talloc_realloc then returned
NULL pointer and filter_login_info returned with ENOMEM.

The code now rather frees the SID array and set info3.sidcount to
correct value.
2013-02-12 10:37:23 +01:00
Martin Kosek
e234edc995 ipa-kdb: add sentinel for LDAPDerefSpec allocation
Without sentinel in place, ldap_create_deref_control_value executed
an invalid read in unallocated memory.
2013-02-12 10:37:13 +01:00
Tomas Babej
0e8a329048 Prevent integer overflow when setting krbPasswordExpiration
Since in Kerberos V5 are used 32-bit unix timestamps, setting
maxlife in pwpolicy to values such as 9999 days would cause
integer overflow in krbPasswordExpiration attribute.

This would result into unpredictable behaviour such as users
not being able to log in after password expiration if password
policy was changed (#3114) or new users not being able to log
in at all (#3312).

The timestamp value is truncated to Jan 1, 2038 in ipa-kdc driver.

https://fedorahosted.org/freeipa/ticket/3312
https://fedorahosted.org/freeipa/ticket/3114
2013-02-08 15:54:21 +01:00
Alexander Bokovoy
32916d444b ipa-kdb: Support Windows 2012 Server
Windows 2012 Server changed procedure how KERB_VALIDATION_INFO ([MS-PAC]
section 2.5) is populated. Detailed description is available in [MS-KILE]
version 25.0 and above.

Refactor KERB_VALIDATION_INFO verification and ensure we filter out extra
SIDs in case they belong to our domain.

https://fedorahosted.org/freeipa/ticket/3231
2012-12-07 13:21:52 -05:00
Martin Kosek
6cb7441d15 Bump 389-ds-base minimum in our spec file
Our code needs both Requires and BuildRequires set to 389-ds-base
which supports transactions. Also add the requires to configure.ac.
2012-12-07 13:59:59 +01:00
Rob Crittenden
bf77679909 Password change in a transaction, ensure passwords are truly expired
Wrap the password change extop in a transaction.

Fix the case where a password is reset and then immediately used. If done
fast enough then the KDC may not detect that the password is expired and
grant access using the expired password rather than prompting for a reset.

https://fedorahosted.org/freeipa/ticket/1064
2012-12-07 10:30:33 +01:00
Rob Crittenden
146da1b326 Honor the kdb options disabling KDC writes in ipa_lockout plugin
Ther3 are two global ipaConfig options to disable undesirable writes that
have performance impact.

The "KDC:Disable Last Success" will disable writing back to ldap the last
successful AS Request time (successful kinit)

The "KDC:Disable Lockout" will disable completely writing back lockout
related data. This means lockout policies will stop working.

https://fedorahosted.org/freeipa/ticket/2734
2012-12-05 10:40:50 -05:00
Sumit Bose
c5e055ae00 Lookup the user SID in external group as well
Currently only the group SIDs from a PAC are used to find out about the
membership in local groups. This patch adds the user SID to the list.

Fixes https://fedorahosted.org/freeipa/ticket/3257
2012-11-30 16:39:07 -05:00
Simo Sorce
5269458f55 MS-PAC: Special case NFS services
The current Linux NFS server is severely limited when it comes to handling
kerberos tickets. Bsically any ticket bigger than 2k will cause it to fail
authentication due to kernel->userspace upcall interface restrictions.

Until we have additional support in IPA to indivdually mark principals to
opt out of getting PACs attached we always prevent PACs from being attached
to TGTs or Tickets where NFS is involved.
2012-11-30 16:30:10 -05:00
Rob Crittenden
f1f1b4e7f2 Enable transactions by default, make password and modrdn TXN-aware
The password and modrdn plugins needed to be made transaction aware
for the pre and post operations.

Remove the reverse member hoop jumping. Just fetch the entry once
and all the memberof data is there (plus objectclass).

Fix some unit tests that are failing because we actually get the data
now due to transactions.

Add small bit of code in user plugin to retrieve the user again
ala wait_for_attr but in the case of transactions we need do it only
once.

Deprecate wait_for_attr code.

Add a memberof fixup task for roles.

https://fedorahosted.org/freeipa/ticket/1263
https://fedorahosted.org/freeipa/ticket/1891
https://fedorahosted.org/freeipa/ticket/2056
https://fedorahosted.org/freeipa/ticket/3043
https://fedorahosted.org/freeipa/ticket/3191
https://fedorahosted.org/freeipa/ticket/3046
2012-11-21 14:55:12 +01:00
Alexander Bokovoy
2093007d4d ipasam: better Kerberos error handling in ipasam
If time is moved back on the IPA server, ipasam does not invalidate the
existing ticket.

https://fedorahosted.org/freeipa/ticket/3183
2012-11-21 13:18:26 +01:00
Tomas Babej
27a8f93178 Forbid overlapping primary and secondary rid ranges
Commands ipa idrange-add / idrange-mod no longer allows the user
to enter primary or secondary rid range such that has non-zero
intersection with primary or secondary rid range of another
existing id range, as this could cause collision.

Unit tests added to test_range_plugin.py

https://fedorahosted.org/freeipa/ticket/3086
2012-10-19 09:02:50 +02:00
Sumit Bose
89e315d639 extdom: handle INP_POSIX_UID and INP_POSIX_GID requests
Fixes https://fedorahosted.org/freeipa/ticket/3166
2012-10-18 10:57:54 +02:00
Sumit Bose
c1b922352f Fix various issues found by Coverity 2012-10-17 14:32:37 +02:00
Sumit Bose
70d7ec587a ipadb: reload trust information if domain is not known
Currently the data about trusted domains is read once at startup. If a
new trust is added the KDC must be restarted to know about the new
trust. This patch reloads the trust data if there is a request from an
unknown domain. To make DOS attacks a bit harder the data can be updated
only once in a minute.

Fixes https://fedorahosted.org/freeipa/ticket/3156
2012-10-09 10:28:11 +02:00
Sumit Bose
0575e68013 ipasam: generate proper SID for trusted domain object 2012-10-04 22:15:36 -04:00
Sumit Bose
58a99dd5ac Add SIDs for existing users and groups at the end of ipa-adtrust-install
Fixes https://fedorahosted.org/freeipa/ticket/3104
2012-10-04 22:15:36 -04:00
Sumit Bose
f5e839ef21 ipasam: add fallback primary group
https://fedorahosted.org/freeipa/ticket/2955
2012-10-04 22:15:36 -04:00
Sumit Bose
d491ba0289 ipasam: Fixes build with samba4 rc1 2012-09-14 16:50:52 +02:00
Rob Crittenden
71f9008906 Support the new Winsync POSIX API.
This will sync down the POSIX attributes from AD so we need to be careful
to not mess with them when they are already set. This includes
uidNumber, gidNumber, homeDirectory, loginShell and gecos.

http://port389.org/wiki/WinSync_Posix
http://port389.org/wiki/Windows_Sync_Plugin_API#Version_3_API_functions

https://fedorahosted.org/freeipa/ticket/3007
2012-09-06 14:29:14 +02:00
Sumit Bose
bd7f3e4b17 ipasam: replace trim_char() with trim_string() 2012-09-06 09:24:59 +02:00