Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide centralized management of user short name resolution #573

Closed
wants to merge 4 commits into from

Conversation

martbab
Copy link
Contributor

@martbab martbab commented Mar 13, 2017

This PR implement an initial version of AD user short name resolution
infrastructure consumable by SSSD.[1]

Most of the stuff described in the design page[2] is in-place except of hooks
that would refresh the domain resolution orders after trust domain removal or
disablement. I would like to do them in a separate PR.

Also some edge cases like specifying only separator (':') or an empty domain
('dom1::dom2') have no special treatment, the current code will just complain
about empty DNS labels. Should I improve this behavior?

[1] https://pagure.io/freeipa/issue/6372
[2] https://www.freeipa.org/page/V4/AD_User_Short_Names

@@ -0,0 +1,135 @@
#
# Copyright (C) 2016 FreeIPA Contributors see COPYING for license
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2017 ehm ehm

attributes in the framework
"""

from __future__ import print_function, unicode_literals
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unicode_literals doesn't sound right to me

@MartinBasti
Copy link
Contributor

ACIs? AFAIK SSSD should be able to read this

@HonzaCholasta
Copy link
Contributor

I would rather avoid the refactoring in 4.5 - this is fragile code you are touching and I'm afraid it might break in some cases (think different client / server version combinations, thin client vs fat client, etc.).

As for the edge case values, IMO we should allow : without complaining as a special case to support "no domains in the list" configuration, and otherwise require known domain names (like in certmaprule-add).

@martbab
Copy link
Contributor Author

martbab commented Mar 13, 2017

Updated PR, added ACIs and fixed Py2/Py3 compatibility of doctests.

@abbra
Copy link
Contributor

abbra commented Mar 13, 2017

I don't see ACI.txt regenerated.

@@ -94,7 +95,7 @@ class idview(LDAPObject):
container_dn = api.env.container_views
object_name = _('ID View')
object_name_plural = _('ID Views')
object_class = ['ipaIDView', 'top']
object_class = ['ipaIDView', 'ipaNameResolutionData', 'top']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO ipaNameResolutionData must be in possible_object_class, because idviews after upgrade doesn't have it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, it is auxilliary object class, so it should be in the possible_object_class and default_attributes should contain ipaNameResolutionOrder to be able to return the value if it is there.

'ipadomainresolutionorder?',
cli_name='domain_resolution_order',
label=_('Domain resolution order'),
doc=_('colon-separated list of domains used for short name'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: all other doc strings in this plugin start with capital letter

@martbab
Copy link
Contributor Author

martbab commented Mar 14, 2017

@HonzaCholasta I agree, I have removed the commit which introduces special param handling and resorted to simple splitting in validator. I have also regenerated ACIs in the respective commits.

VERSION.m4 Outdated
@@ -73,8 +73,8 @@ define(IPA_DATA_VERSION, 20100614120000)
# #
########################################################
define(IPA_API_VERSION_MAJOR, 2)
define(IPA_API_VERSION_MINOR, 220)
# Last change: Add whoami command
define(IPA_API_VERSION_MINOR, 222)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

220 + 1 != 222

@@ -84,5 +85,6 @@ objectClasses: (2.16.840.1.113730.3.8.12.24 NAME 'ipaPublicKeyObject' DESC 'Wrap
objectClasses: (2.16.840.1.113730.3.8.12.25 NAME 'ipaPrivateKeyObject' DESC 'Wrapped private keys' SUP top AUXILIARY MUST ( ipaPrivateKey $ ipaWrappingKey $ ipaWrappingMech ) X-ORIGIN 'IPA v4.1' )
objectClasses: (2.16.840.1.113730.3.8.12.26 NAME 'ipaSecretKeyObject' DESC 'Wrapped secret keys' SUP top AUXILIARY MUST ( ipaSecretKey $ ipaWrappingKey $ ipaWrappingMech ) X-ORIGIN 'IPA v4.1' )
objectClasses: (2.16.840.1.113730.3.8.12.34 NAME 'ipaSecretKeyRefObject' DESC 'Indirect storage for encoded key material' SUP top AUXILIARY MUST ( ipaSecretKeyRef ) X-ORIGIN 'IPA v4.1' )
objectClasses: (2.16.840.1.113730.3.8.12.39 NAME 'ipaNameResolutionData' DESC 'Data used to resolve short names to fully-qualified form' SUP top AUXILIARY MAY ( ipaDomainResolutionOrder ) X-ORIGIN 'IPA v4.5')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ipaNameResolutionConfig would make more sense to me (I know, I know).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have already registered this OID and name so we are out of luck I think.

}
)

return trusted_domains
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to share code with certmap.check_associateddomain_is_trusted. Not a blocker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, I will try to think about plugging the trustdomain retrieval magic there.

Copy link
Contributor

@HonzaCholasta HonzaCholasta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Server upgrade is missing. See inline comments for some nitpicks. Otherwise LGTM.

@martbab
Copy link
Contributor Author

martbab commented Mar 14, 2017

Server upgrade consists only from adding the objectclass to ipaConfig which is taken care of in the update file. The idview object schema is modified on-demand when the attribute is set. Is there something else I need to take care of?

@HonzaCholasta
Copy link
Contributor

IMO you should add the object class to all existing idviews on upgrade rather than add it on-demand.

@MartinBasti
Copy link
Contributor

@HonzaCholasta it will break in case when idview entry is created on older replica, so it is more safe to appending the objectclass dynamically

@HonzaCholasta
Copy link
Contributor

Ah, right.

Martin Babinsky added 4 commits March 14, 2017 16:15
Add ipaDomainResolutionOrder and ipaNameResolutionData to IPAv3 schema.
Extend ipaConfig object with ipaNameResolutionData objectclass during
update.

https://pagure.io/freeipa/issue/6372
optional attribute was added to config object along with validator that
check for valid domain names and also checks whether the specified
domains exist in FreeIPA or in trusted forests and, in case of trusted
domains, are not disabled.

Part of http://www.freeipa.org/page/V4/AD_User_Short_Names

https://pagure.io/freeipa/issue/6372
`idview-add` and `idview-mod` can now set and validate the attribute.
The required objectclass is added on-demand after modification

https://pagure.io/freeipa/issue/6372
@martbab
Copy link
Contributor Author

martbab commented Mar 14, 2017

PR rebased, I have fixed bugs in ID view objectclass handling and re-used the trusted domain retrieval code in certmap plugin. This is a separate commit so it can be removed if necessary.

I have noticed that with current PR we can not add the domain resolution order to Default Trust View, as it is protected from both modification and removal. @abbra is this expected also in this case?

@abbra
Copy link
Contributor

abbra commented Mar 14, 2017

Yes, it is expected too. Remember that 'Default Trust View' is a view that applies globally. You have already global setting to apply.

@martbab
Copy link
Contributor Author

martbab commented Mar 14, 2017

Ok thanks for explanation.

@MartinBasti MartinBasti added ack Pull Request approved, can be merged pushed Pull Request has already been pushed labels Mar 14, 2017
@MartinBasti
Copy link
Contributor

master:

  • 594c87d Short name resolution: introduce the required schema
  • 1b5f56d ipaconfig: add the ability to manipulate domain resolution order
  • 544d66b idview: add domain_resolution_order attribute
  • 4e5e3ee Re-use trust domain retrieval code in certmap validators

@martbab martbab deleted the ad-user-short-names branch March 15, 2017 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
5 participants