<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 10/08/2014 11:46 PM, Nathaniel
      McCallum wrote:<br>
    </div>
    <blockquote cite="mid:1412804761.9441.12.camel@redhat.com"
      type="cite">
      <pre wrap="">The background of this email is this bug:
<a class="moz-txt-link-freetext" href="https://fedorahosted.org/freeipa/ticket/4456">https://fedorahosted.org/freeipa/ticket/4456</a>

Attached are two patches which solve this issue for admin users (not
very helpful, I know). They depend on this fix in 389:
<a class="moz-txt-link-freetext" href="https://fedorahosted.org/389/ticket/47920">https://fedorahosted.org/389/ticket/47920</a>

There are two outstanding issues:

1. 389 does not send the post read control for normal users. The
operation itself succeeds, but no control is sent.</pre>
    </blockquote>
    <blockquote cite="mid:1412804761.9441.12.camel@redhat.com"
      type="cite">
      <pre wrap="">

The relevant sections from the log are attached. 389 is denying access
to the following attributes (* = valid, ! = invalid):
! objectClass
! ipatokenOTPalgorithm
! ipatokenOTPdigits
* ipatokenOTPkey
* ipatokenHOTPcounter
! ipatokenOwner
! managedBy
! ipatokenUniqueID
</pre>
    </blockquote>
    Hello Nathaniel,<br>
    <br>
    <blockquote>The post read control needs access to the modified entry
      to return it.<br>
      This access is granted at the condition, the binddn can access
      attributes.<br>
      My understanding is that the target entry is
      ipatokenuniqueid=52001946-4f2d-11e4-9127-7831c1d63a78,cn=otp,dc=example,dc=com
      and the binddn "uid=otp,cn=users,cn=accounts,dc=example,dc=com".<br>
      <br>
      The only ACI I found that match this target is:<br>
      <pre><code><span class="hl opt"></span>aci: (targetfilter <span class="hl opt">=</span> <span class="hl str">"(objectClass=ipaToken)"</span><span class="hl opt">)
(</span>targetattrs <span class="hl opt">=</span> <span class="hl str">"objectclass || description || managedBy || ipatokenUniqueID || ipatokenDisabled 
 || ipatokenNotBefore || ipatokenNotAfter || ipatokenVendor || ipatokenModel || ipatokenSerial || ipatokenOwner"</span><span class="hl opt">)
(</span>version <span class="hl num">3.0</span><span class="hl opt">;</span> acl <span class="hl str">"Users/managers can read basic token info"</span><span class="hl opt">;</span> allow <span class="hl opt">(</span>read<span class="hl opt">,</span> search<span class="hl opt">,</span> compare<span class="hl opt">)</span> userattr <span class="hl opt">=</span> <span class="hl str">"ipatokenOwner#USERDN"</span> or userattr <span class="hl opt">=</span> <span class="hl str">"managedBy#USERDN"</span><span class="hl opt">;)</span></code></pre>
      <br>
      Do you know if the target entry has 'ipatokenOwner' or 'managedBy'
      with the binddn value ?<br>
      <br>
      <br>
    </blockquote>
    <blockquote cite="mid:1412804761.9441.12.camel@redhat.com"
      type="cite">
      <pre wrap="">
The ACIs allowing access to most of these attributes are here:
<a class="moz-txt-link-freetext" href="https://git.fedorahosted.org/cgit/freeipa.git/tree/install/share/default-aci.ldif#n90">https://git.fedorahosted.org/cgit/freeipa.git/tree/install/share/default-aci.ldif#n90</a>

Note that I am able to query the entry just fine (including all the
above invalidly restricted attributes). Hence, I know the ACIs are
working just fine.

Part of the strange thing is that in the post read control request, I
haven't indicated that I want *any* attributes returned (i.e. I want
just the DN). So I'm not sure why it is querying all the attributes. I
would suspect that the proper behavior would be to only check the ACIs
on attributes that will actually be returned.</pre>
    </blockquote>
    <blockquote>It may not querying all attributes, but just search the
      first one it can read.<br>
      As it finds none of them you get the message for all attributes.<br>
      <br>
      thanks<br>
      thierry<br>
    </blockquote>
    <blockquote cite="mid:1412804761.9441.12.camel@redhat.com"
      type="cite">
      <pre wrap="">

2. The second patch (0002) modifies the ACI for normal user token
addition from this:

aci: (target = <a class="moz-txt-link-rfc2396E" href="ldap:///ipatokenuniqueid=*,cn=otp,$SUFFIX">"ldap:///ipatokenuniqueid=*,cn=otp,$SUFFIX"</a>)(targetfilter
= "(objectClass=ipaToken)")(version 3.0; acl "Users can create
self-managed tokens"; allow (add) userattr = "ipatokenOwner#SELFDN" and
userattr = "managedBy#SELFDN";)

To this:

aci: (target = <a class="moz-txt-link-rfc2396E" href="ldap:///ipatokenuniqueid=autogenerate,cn=otp,$SUFFIX">"ldap:///ipatokenuniqueid=autogenerate,cn=otp,
$SUFFIX"</a>)(targetfilter = "(objectClass=ipaToken)")(version 3.0; acl
"Users can create self-managed tokens"; allow (add) userattr =
"ipatokenOwner#SELFDN" and userattr = "managedBy#SELFDN";)

The idea is to allow users to create tokens which will be expanded by
the UUID plugin. Unfortunately, after the UUID is expanded, the ACIs are
checked. Since the expanded UUID no longer matches the ACI, the addition
is denied. Is this truly the correct behavior? I would think that the
ACIs would be checked before the UUID plugin, not after.
</pre>
    </blockquote>
    <br>
  </body>
</html>