<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 05/20/2014 10:30 PM, Martin Kosek
wrote:<br>
</div>
<blockquote cite="mid:537BBB4D.8030000@redhat.com" type="cite">I am
sharing the question below with the list as I think the
information is useful and relevant for everyone interested in this
feature. See answers in the text.
<br>
<br>
On 05/20/2014 06:26 PM, thierry bordaz wrote:
<br>
<blockquote type="cite">Hello Martin, Petr,
<br>
<br>
I implemented 'user-add --to-stage' in a very simple way.
Basically rather
<br>
than filling the 'accounts' container it fills the 'staged
users' container.
<br>
It helped me to start digging into the code.
<br>
<br>
Now I am looking at details of this entry. Especially the
attributes
<br>
present when the entry is in staging container. So far, the
entry is
<br>
looking like:
<br>
<br>
ldapsearch -LLL -h localhost -p 389 -D "cn=directory
manager" -w
<br>
Secret123 -b "dc=idm,dc=lab,dc=bos,dc=redhat,dc=com"
uid=tb1
<br>
dn: uid=tb1,cn=staged
<br>
users,cn=accounts,cn=provisioning,dc=idm,dc=lab,dc=bos,d
<br>
c=redhat,dc=com
<br>
displayName: tb1 tb1
<br>
cn: tb1 tb1
<br>
objectClass: top
<br>
objectClass: person
<br>
objectClass: organizationalperson
<br>
objectClass: inetorgperson
<br>
objectClass: inetuser
<br>
objectClass: posixaccount
<br>
objectClass: krbprincipalaux
<br>
objectClass: krbticketpolicyaux
<br>
objectClass: ipaobject
<br>
objectClass: ipasshuser
<br>
objectClass: ipaSshGroupOfPubKeys
<br>
loginShell: /bin/sh
<br>
initials: tt
<br>
gecos: tb1 tb1
<br>
sn: tb1
<br>
homeDirectory: /home/tb1
<br>
uid: tb1
<br>
mail: <a class="moz-txt-link-abbreviated" href="mailto:tb1@idm.lab.bos.redhat.com">tb1@idm.lab.bos.redhat.com</a>
<br>
krbPrincipalName: <a class="moz-txt-link-abbreviated" href="mailto:tb1@IDM.LAB.BOS.REDHAT.COM">tb1@IDM.LAB.BOS.REDHAT.COM</a>
<br>
givenName: tb1
<br>
ipaUniqueID: 5556123c-e036-11e3-9915-001a4a104ecd
<br>
uidNumber: 646400005
<br>
gidNumber: 646400005
<br>
memberOf:
<br>
cn=ipausers,cn=groups,cn=accounts,dc=idm,dc=lab,dc=bos,dc=redhat,dc=
<br>
com
<br>
<br>
<br>
As you can see it contains extra objectclasses and some
attributes are set
<br>
(like uidNumber or gidNumber).
<br>
According to the design that the entry should rather look
like:
<br>
<br>
<br>
dn: uid=tb1,cn=staged
users,cn=accounts,cn=provisioning,dc=idm,dc=lab,dc=bos,d
<br>
c=redhat,dc=com
<br>
displayName: tb1 tb1
<br>
cn: tb1 tb1
<br>
objectClass: top
<br>
objectClass: organizationalperson
<br>
objectClass:krbprincipalaux
<br>
objectClass: posixaccount
<br>
loginShell: autogenerated
<br>
sn: tb1
<br>
homeDirectory: /home/tb1
<br>
uid: tb1
<br>
krbPrincipalName: <a class="moz-txt-link-abbreviated" href="mailto:tb1@IDM.LAB.BOS.REDHAT.COM">tb1@IDM.LAB.BOS.REDHAT.COM</a>
<br>
uidNumber: -1
<br>
gidNumber: -1
<br>
<br>
Is that correct ?
<br>
</blockquote>
<br>
user-add sets the uidNumber and gidNumber to -1, meaning that
these numbers should be autogenerated by a plugin. If the plugin
scope is updated according to design to disregard staging users
container, the number should stay -1 until the entry is really
moved to active users container.
<br>
<br>
The same applies for ipaUniqueId, just the generation triggering
text is "autogenerate".
<br>
<br>
<br>
<blockquote type="cite"> Then when the entry get activated
('ipa user-activate tb1 --from-stage), we
<br>
should have the attribute being generated
<br>
uidNumber/gidNumber/ipaUniqueId... My understanding is that
those
<br>
attributes should be generate by DS plugins when the entry
is moved to
<br>
'accounts' container. So playing with plugin scope would
help to have
<br>
staged users without all these attributes and 'accounts'
users with them.
<br>
</blockquote>
<br>
Right.
<br>
<br>
<blockquote type="cite">
<br>
What is not clear to me is the chapter related to the
'placeholders'. My
<br>
understanding is that it should be a kind of template
defining how to fill
<br>
attribute values. I am looking for some code/doc dealing
with placeholders
<br>
but I do not know where to start from. Do you know any
pointers on this.
<br>
</blockquote>
<br>
I tried to write down the reasons for using placeholders in this
section:
<br>
<a class="moz-txt-link-freetext" href="http://www.freeipa.org/page/V4/User_Life-Cycle_Management#Placeholders">http://www.freeipa.org/page/V4/User_Life-Cycle_Management#Placeholders</a>
<br>
<br>
Placeholder allows provisioning systems to specify only some
attributes of for example posixAccount objectclass while not
having to fill all the MUST attributes.
<br>
<br>
I think the example with filled "homeDirectory: /home/tuser" tells
it all - homeDirectory is filled, other attributes are left for
FreeIPA to generate based on it's settings.
<br>
</blockquote>
<blockquote cite="mid:537BBB4D.8030000@redhat.com" type="cite">
<br>
As for UID and GID, you do not need to do anything - "-1" already
means autogenerate the values. Attributes not controlled by a
plugin needs to be controlled by the command that moves user from
staging users to active users - following list shows how should be
the values generated:
<br>
</blockquote>
<br>
Hello,<br>
<br>
<blockquote>Thanks for all these detailed descriptions.<br>
Just to be sure to be on the same page, here is my understanding
of the provisioning templates and placeholder definitions. An
administrator can provide a provisioning template. I suppose it
would be a file containing a lines of placeholder definitions. <br>
<br>
<ul>
<li>Where is located the template file ? Is there a standard
repository where templates are put ? (somewhere under
/etc/ipa/* ?)</li>
<li>Is there an already defined syntax for the provisionning
template. ('$' is separator attr/value, %{<attr>} is
substitute pattern...). If not, is it possible to user
':<space> ' as separator ?<br>
</li>
<li>What is the priority. The user can provide the
'homeDirectory' through different methods. Is it ok to use the
following order:</li>
<ul>
<li>the CLI option</li>
<li>the provisionning template <br>
</li>
<li>the default config value (in cn=ipaConfig,cn=etc,$SUFFIX)</li>
</ul>
</ul>
<p>For example, if it exists the provisioning template:
/etc/ipa/provisioning/shell-user.template<br>
</p>
<blockquote>
<p><tt>roomnumber$-2</tt><tt><br>
</tt><tt>homeDirectory$/home/net/shell-%{uid}</tt><tt><br>
</tt><tt>loginShell$?shell-plugin-autogenerate?</tt><br>
</p>
</blockquote>
<p>the command: <tt>ipa user-add tuser --homedir=/tmp/tuser</tt><tt>
--roomnumber=1234 --to-stage </tt>would create a staging
entry:</p>
<p><tt>dn: uid=tuser,cn=staged users,cn=provisioning,$SUFFIX</tt><br>
<tt>...</tt><br>
<tt>roomNumber: 1234</tt><br>
<tt>homeDirectory: /tmp/tuser</tt><br>
<tt>loginShell: </tt><tt>shell-plugin-autogenerate</tt></p>
<p>Then a private DS plugin (catching <tt>shell-plugin-autogenerate)
</tt>generate the loginShell value when the entry becomes
active.<br>
</p>
<p><br>
</p>
<p>the command: <tt>ipa user-add tuser --homedir=/tmp/tuser</tt><tt>
--to-stage </tt>would create a staging entry:</p>
<p><tt>dn: uid=tuser,cn=staged users,cn=provisioning,$SUFFIX</tt><br>
<tt>...</tt><br>
<tt>roomNumber: -2</tt><br>
<tt>homeDirectory: /tmp/tuser</tt><br>
<tt>loginShell: </tt><tt>shell-plugin-autogenerate<br>
</tt></p>
<p><tt><br>
<br>
</tt></p>
<p>the command: <tt>ipa user-add tuser </tt><tt> --to-stage </tt>would
create a staging entry:</p>
<p><tt>dn: uid=tuser,cn=staged users,cn=provisioning,$SUFFIX</tt><br>
<tt>...</tt><br>
<tt>roomNumber: -2</tt><br>
<tt>homeDirectory: /home/net/shell-tuser</tt><br>
<tt>loginShell: </tt><tt>shell-plugin-autogenerate<br>
</tt></p>
<p><tt><br>
</tt></p>
<p>In case the provisioning template does not define
'homeDirectory', then the created entry would take the value
from the ipa config definition:<tt><br>
</tt><tt>dn: uid=tuser,cn=staged users,cn=provisioning,$SUFFIX</tt><br>
<tt>...</tt><br>
<tt>roomNumber: -2</tt><br>
<tt>homeDirectory: /home/tuser</tt><br>
<tt>loginShell: </tt><tt>shell-plugin-autogenerate</tt><br>
</p>
<p>best regards<br>
thierry<br>
</p>
</blockquote>
<blockquote cite="mid:537BBB4D.8030000@redhat.com" type="cite">
<br>
<a class="moz-txt-link-freetext" href="http://www.freeipa.org/page/V4/User_Life-Cycle_Management#Placeholder_Definition">http://www.freeipa.org/page/V4/User_Life-Cycle_Management#Placeholder_Definition</a>
<br>
<br>
HTH,
<br>
Martin
<br>
</blockquote>
<br>
</body>
</html>