Commit Graph

383 Commits

Author SHA1 Message Date
Martin Kosek
c41b782bc5 Revert "Check for password expiration in pre-bind"
This reverts commit bfdbd3b6ad.

Forceful validation of password expiration date in a BIND pre-callback
breaks LDAP password change extended operation as the password change
is only allowed via authenticated (bound) channel. Passwords could be
only changed via kadmin protocol. This change would thus break
LDAP-only clients and Web UI password change hook.

This patch will need to be revisited so that unauthenicated corner
cases are also revisited.

https://fedorahosted.org/freeipa/ticket/1539
2014-06-10 08:42:03 +02:00
Simo Sorce
bfdbd3b6ad Check for password expiration in pre-bind
If the password is expired fail a password bind.

Resolves: https://fedorahosted.org/freeipa/ticket/1539
Reviewed-By: Martin Kosek <mkosek@redhat.com>
Reviewed-By: Nathaniel McCallum <npmccallum@redhat.com>
2014-06-09 08:18:16 +02:00
Nalin Dahyabhai
16092c3907 Restore krbCanonicalName handling
When an entry has a krbCanonicalName, if KRB5_KDB_FLAG_ALIAS_OK is set,
rewrite the principal name to the canonical value, else error out,
instead of always returning an error if the requested name doesn't look
like the canonical one.

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

Reviewed-By: Nathaniel McCallum <npmccallum@redhat.com>
2014-05-30 09:48:05 +02:00
Nalin Dahyabhai
fabd5cd62f Accept any alias, not just the last value
If the entry's krbPrincipalName attribute is multi-valued, accept any of
the values, not just the last one we happen to examine.

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

Reviewed-By: Nathaniel McCallum <npmccallum@redhat.com>
2014-05-30 09:48:05 +02:00
Nathaniel McCallum
58f8ebf491 kdb: Don't provide password expiration when using only RADIUS
If the KDC doesn't use the FreeIPA password for authentication, then it is
futile to provide this information. Doing so will only confuse the user. It
also causes password change dialogues when the password is irrelevant.

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

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-05-22 16:46:01 +02:00
Tomas Babej
5d78cdf809 ipa-pwd-extop: Deny LDAP binds for accounts with expired principals
Adds a check for krbprincipalexpiration attribute to pre_bind operation
in ipa-pwd-extop dirsrv plugin. If the principal is expired, auth is
denied and LDAP_UNWILLING_TO_PERFORM along with the error message is
sent back to the client. Since krbprincipalexpiration attribute is not
mandatory, if there is no value set, the check is passed.

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

Reviewed-By: Simo Sorce <simo@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-05-05 18:50:01 +03:00
Tomas Babej
5e5d4818a1 ipa_range_check: Change range_check return values from int to range_check_result_t enum
Using integers for return values that are used for complex casing can be fragile
and typo-prone. Change range_check function to return range_check_result_t enum,
whose values properly describes each of the range_check results.

Part of: https://fedorahosted.org/freeipa/ticket/4137

Reviewed-By: Martin Kosek <mkosek@redhat.com>
2014-04-23 13:18:41 +02:00
Tomas Babej
91d68864d1 ipa_range_check: Fix typo when comparing strings using strcasecmp
Part of: https://fedorahosted.org/freeipa/ticket/4137

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-04-23 13:16:35 +02:00
Tomas Babej
6c8b40afb5 ipa_range_check: Do not fail when no trusted domain is available
When building the domain to forest root map, we need to take the case
of IPA server having no trusted domains configured at all. Do not abort
the checks, but return an empty map instead.

Part of: https://fedorahosted.org/freeipa/ticket/4137

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-04-23 13:16:35 +02:00
Tomas Babej
246e722b4f ipa_range_check: Make a new copy of forest_root_id attribute for range_info struct
Not making a new copy of this attribute creates multiple frees caused by multiple
pointers to the same forest_root_id from all the range_info structs for all the
domains belonging to given forest.

Part of: https://fedorahosted.org/freeipa/ticket/4137

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-04-23 13:16:34 +02:00
Tomas Babej
2c4d41221a ipa_range_check: Connect the new node of the linked list
Part of: https://fedorahosted.org/freeipa/ticket/4137

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-04-23 13:16:34 +02:00
Tomas Babej
2011392246 ipa_range_check: Use special attributes to determine presence of RID bases
The slapi_entry_attr_get_ulong which is used to get value of the RID base
attributes returns 0 in case the attribute is not set at all. We need
to distinguish this situation from the situation where RID base attributes
are present, but deliberately set to 0.

Otherwise this can cause false negative results of checks in the range_check
plugin.

Part of: https://fedorahosted.org/freeipa/ticket/4137

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-04-23 13:16:34 +02:00
Tomas Babej
218a261742 Extend ipa-range-check DS plugin to handle range types
The ipa-range-check plugin used to determine the range type depending
on the value of the attributes such as RID or secondary RID base. This
approached caused variety of issues since the portfolio of ID range
types expanded.

The patch makes sure the following rules are implemented:
    * No ID range pair can overlap on base ranges, with exception
      of two ipa-ad-trust-posix ranges belonging to the same forest
    * For any ID range pair of ranges belonging to the same domain:
        * Both ID ranges must be of the same type
        * For ranges of ipa-ad-trust type or ipa-local type:
            * Primary RID ranges can not overlap
        * For ranges of ipa-local type:
            * Primary and secondary RID ranges can not overlap
            * Secondary RID ranges cannot overlap

For the implementation part, the plugin was extended with a domain ID
to forest root domain ID mapping derivation capabilities.

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

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-04-08 14:23:18 +02:00
Tomas Babej
8d2b3fe7a7 ipa-range-check: Fix memory leaks when freeing range object
When cleaning the range_info struct, simple free of the struct
is not enough, we have to free contents of char pointers in the
struct as well.

https://fedorahosted.org/freeipa/ticket/4276
2014-04-08 14:23:18 +02:00
Tomas Babej
5a0d52b939 ipa-pwd-extop: Fix memory leak in ipapwd_pre_bind
We need to free the entry before returning from the function.

https://fedorahosted.org/freeipa/ticket/4295
2014-04-08 14:23:18 +02:00
Sumit Bose
c885bc3e49 extdom: do not return results from the wrong domain
Resolves: https://fedorahosted.org/freeipa/ticket/4264
Reviewed-By: Tomas Babej <tbabej@redhat.com>
2014-03-25 14:03:05 +01:00
Jason Woods
d6a7923f71 ipa-sam: cache gid to sid and uid to sid requests in idmap cache
Add idmap_cache calls to ipa-sam to prevent huge numbers of LDAP calls to the
directory service for gid/uid<->sid resolution.

Additionally, this patch further reduces number of queries by:
 - fast fail on uidNumber=0 which doesn't exist in FreeIPA,
 - return fallback group correctly when looking up user primary group as is
   done during init,
 - checking for group objectclass in case insensitive way

Patch by Jason Woods <devel@jasonwoods.me.uk>

Reviewed-by: Alexander Bokovoy <abokovoy@redhat.com>

https://fedorahosted.org/freeipa/ticket/4234
and
https://bugzilla.redhat.com/show_bug.cgi?id=1073829
https://bugzilla.redhat.com/show_bug.cgi?id=1074314

Reviewed-By: Sumit Bose <sbose@redhat.com>
2014-03-12 12:19:06 +01:00
Martin Kosek
740298d120 Avoid passing non-terminated string to is_master_host
When string is not terminated, queries with corrupted base may be sent
to LDAP:

... cn=ipa1.example.com<garbage>,cn=masters...

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

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-03-11 16:55:01 +01:00
Alexander Bokovoy
4048d412f2 ipa-kdb: do not fetch client principal if it is the same as existing entry
When client principal is the same as supplied client entry, don't fetch it
again.

Note that when client principal is not NULL, client entry might be NULL for
cross-realm case, so we need to make sure to not dereference NULL pointer here.

Also fix reverted condition for case when we didn't find the client principal
in the database, preventing a memory leak.

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

Reviewed-By: Sumit Bose <sbose@redhat.com>
2014-03-06 12:28:25 +01:00
Alexander Bokovoy
6b45ec3f31 fix filtering of subdomain-based trust users
https://fedorahosted.org/freeipa/ticket/4207

Reviewed-By: Simo Sorce <ssorce@redhat.com>
2014-03-05 10:40:39 +01:00
Alexander Bokovoy
f7955abdda ipa-kdb: make sure we don't produce MS-PAC in case of authdata flag cleared by admin
When admin clears authdata flag for the service principal, KDC will pass
NULL client pointer (service proxy) to the DAL driver.

Make sure we bail out correctly.

Reviewed-By: Tomáš Babej <tbabej@redhat.com>
Reviewed-By: Simo Sorce <ssorce@redhat.com>
2014-02-26 14:19:49 +01:00
Alexander Bokovoy
fb2eca8d1e ipa-kdb: in case of delegation use original client's database entry, not the proxy
https://fedorahosted.org/freeipa/ticket/4195

Reviewed-By: Tomáš Babej <tbabej@redhat.com>
Reviewed-By: Simo Sorce <ssorce@redhat.com>
2014-02-26 14:19:48 +01:00
Alexander Bokovoy
9a8f44c09e libotp: do not call internal search for NULL dn
Reviewed-By: Nathaniel McCallum <npmccallum@redhat.com>
2014-02-21 10:27:34 +01:00
Nathaniel McCallum
9f62d0c157 Teach ipa-pwd-extop to respect global ipaUserAuthType settings
https://fedorahosted.org/freeipa/ticket/4105

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-02-21 10:26:02 +01:00
Nathaniel McCallum
a51b07c275 Add OTP sync support to ipa-pwd-extop
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-02-21 10:26:02 +01:00
Nathaniel McCallum
49038cda9f Add OTP last token plugin
This plugin prevents the deletion or deactivation of the last
valid token for a user. This prevents the user from migrating
back to single factor authentication once OTP has been enabled.

Thanks to Mark Reynolds for helping me with this patch.

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-02-21 10:26:02 +01:00
Nathaniel McCallum
abb63ed9d1 Add HOTP support
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-02-21 10:26:02 +01:00
Nathaniel McCallum
b769d1c186 Add support to ipa-kdb for keyless principals
https://fedorahosted.org/freeipa/ticket/3779

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-02-19 10:15:36 +01:00
Nathaniel McCallum
93d99c92b3 Add libotp internal library for slapi plugins
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-02-14 16:03:25 +01:00
Nathaniel McCallum
5c299758b9 Enable building in C99 mode
C99 is supported on all compilers we target and
provides some useful features, including:
  * Standard struct initializers
  * Compound literals
  * For-loop declarations
  * Standard bool type
  * Variable arrays (use with caution)
  * Too many others to mention...

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-02-14 16:03:24 +01:00
Nathaniel McCallum
fd55da9a27 ipa-kdb: validate that an OTP user has tokens
This handles the case where a user is configured for OTP in ipaUserAuthType,
but the user has not yet created any tokens. Until the user creates tokens,
the user should still be able to log in via password. This logic already
exists in LDAP, but ipa-kdb needs to perform the same validation to know
what data to return to the KDC.

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

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2014-02-14 16:03:24 +01:00
Nathaniel McCallum
6c500ccf05 Move ipa-otpd socket directory
https://fedorahosted.org/freeipa/ticket/4167
Reviewed-By: Martin Kosek <mkosek@redhat.com>
2014-02-11 17:36:19 +01:00
Martin Kosek
b351b210be ipa-lockout: do not fail when default realm cannot be read
When ipa-lockout plugin is started during FreeIPA server installation,
the default realm may not be available and plugin should then not end
with failure.

Similarly to other plugins, start in degraded mode in this situation.
Operation is fully restored during the final services restart.

https://fedorahosted.org/freeipa/ticket/4085
2014-02-04 12:44:45 +01:00
Martin Kosek
d85e2c9a82 Fallback to global policy in ipa-lockout plugin
krbPwdPolicyReference is no longer filled default users. Instead, plugins
fallback to hardcoded global policy reference.

Fix ipa-lockout plugin to fallback to it instead of failing to apply
the policy.

https://fedorahosted.org/freeipa/ticket/4085
2014-02-03 08:57:14 +01:00
Lukas Slebodnik
a4faa2f444 BUILD: Fix portability of NSS in file ipa_pwd.c
Tested-by: Timo Aaltonen <tjaalton@ubuntu.com>
2014-01-28 16:35:34 +01:00
Sumit Bose
2bb2aa8c48 CLDAP: add unit tests for make_netbios_name 2014-01-23 18:14:23 +01:00
Sumit Bose
311b2b1acf CLDAP: generate NetBIOS name like ipa-adtrust-install does
Fixes  https://fedorahosted.org/freeipa/ticket/4116
2014-01-23 18:14:23 +01:00
Alexander Bokovoy
c29211671c ipasam: delete trusted child domains before removing the trust
LDAP protocol doesn't allow deleting non-leaf entries. One needs to
remove all leaves first before removing the tree node.

https://fedorahosted.org/freeipa/ticket/4126
2014-01-21 12:31:54 +01:00
Simo Sorce
d0ed25c8cb Harmonize policy discovery to kdb driver
The KDB driver does not walk the tree back like the original password plugin.
Also we do not store the default policy in the base DN as we used to do in the
past anymore.
So doing a full subtree search and walking back the tree is just a waste of
time.
Instead hardcode the default policy like we do in the kdb driver.

Fixes: https://fedorahosted.org/freeipa/ticket/4085
2014-01-16 09:00:35 +01:00
Sumit Bose
487a8f4749 CLDAP: do not prepend \\
For NETLOGON_NT_VERSION_5EX requests the prepended \\ is not expected in
the PDC NetBIOS name. In general AD seems to be smart enough to handle
the two \ signs. But if the NetBIOS name reaches the maximum of 15
character AD does not accept the responses anymore.

Fixes https://fedorahosted.org/freeipa/ticket/4028
2014-01-15 16:26:09 +01:00
Xiao-Long Chen
5e96fbc22a Use /usr/bin/python2
Part of the effort to port FreeIPA to Arch Linux,
where Python 3 is the default.

FreeIPA hasn't been ported to Python 3, so the code must be modified to
run /usr/bin/python2

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

Updated by pviktori@redhat.com
2014-01-03 09:46:05 +01:00
Tomas Babej
71481a0aa4 ipa-cldap: Cut NetBIOS name after 15 characters
The CLDAP DS plugin uses the uppercased first segment of the fully
qualified hostname as the NetBIOS name. We need to limit its size
to 15 characters.

https://fedorahosted.org/freeipa/ticket/4028
2013-12-11 13:23:38 +01:00
Jan Cholasta
5e2f7b68f0 Remove CFLAGS duplication.
https://fedorahosted.org/freeipa/ticket/3896
2013-12-06 14:44:41 +01:00
Jan Cholasta
07ddfdd127 Fix compilation error in ipa-cldap.
https://fedorahosted.org/freeipa/ticket/3896
2013-12-06 14:44:40 +01:00
Jan Cholasta
75dadc1d8f Include LDFLAGS provided by rpmbuild in global LDFLAGS in the spec file.
Remove explicitly specified hardening flags from LDFLAGS in ipa-otpd.

https://fedorahosted.org/freeipa/ticket/3896
2013-12-06 14:44:40 +01:00
Petr Spacek
2348e0fab7 Clarify error message about IPv6 socket creation in ipa-cldap plugin
https://fedorahosted.org/freeipa/ticket/4056
2013-12-03 16:27:12 +01:00
Jan Cholasta
652c4e6ace Use hardening flags for ipa-optd.
https://fedorahosted.org/freeipa/ticket/4010
2013-12-02 12:37:41 +01:00
Simo Sorce
a1165ffbb8 Add krbticketPolicyAux objectclass if needed
When modifying ticket flags add the objectclass to the object if it is missing.

https://fedorahosted.org/freeipa/ticket/3901
2013-11-26 16:44:37 +01:00
Sumit Bose
d876a22732 Remove generation and handling of LM hashes
https://fedorahosted.org/freeipa/ticket/3795
2013-11-01 09:28:35 +01:00
Martin Kosek
21137ab63c Remove ipa-pwd-extop and ipa-enrollment duplicate error strings
Some error strings were duplicate which makes it then harder to
see what is the real root cause of it.

https://fedorahosted.org/freeipa/ticket/3988
2013-10-30 17:59:46 +01:00