Project

General

Profile

RealmJoinIntegration » History » Version 3

Dominic Cleal, 06/18/2013 06:24 AM
Incorporated info from Martin Kosek and Dmitri Pal

1 1 Dominic Cleal
h1. Realm Join Integration
2
3
*This is just sketching out some ideas, it doesn't exist, yet.*
4
5
This page covers ideas for joining hosts to FreeIPA realms or Active Directory domains when they're built, using a hypothetical foreman_realm plugin.
6
7
h2. DNS management
8
9 2 Dominic Cleal
Related, but not actually realm joining.  Updates to DNS can be made via the normal smart proxy route, however for both FreeIPA and AD we require GSS-TSIG support for nsupdate.  This was completed for Foreman 1.2 via #1685.
10 1 Dominic Cleal
11
h2. Realm configuration
12
13
foreman_realm should add a realm model and associate them with domains, plus everything needed to manage them.
14
15 3 Dominic Cleal
To support classes and hostgroups in IPA (see below), additional attributes could be added to Foreman's host groups (or whatever they get replaced with) to define the IPA classes that the host would have when created.
16
17 1 Dominic Cleal
h2. Host/computer creation
18
19
h3. Proxy support
20
21
The proxy should provide an API for creating hosts in realms (or computer objects in AD domains).  This might depend on being able to define new APIs entirely through plugins.
22
23 3 Dominic Cleal
h4. FreeIPA
24 1 Dominic Cleal
25 3 Dominic Cleal
For FreeIPA, this can either call the @ipa host-add@ command or the XMLRPC API that backs it.  Here's an example of creating a user with minimal privileges that can create new hosts:
26
27
<pre>
28
# kinit admin
29
# ipa user-add --first=Host --last=Adder hadder
30
31
# ipa privilege-add "Add computers" --desc"Add computers"
32
# ipa privilege-add-permission "Add computers" --permissions="add hosts"
33
34
# ipa role-add "Host Adder" --desc="Can add new hosts"
35
# ipa role-add-privilege "Computer creator" --privilege="Add computers"
36
# ipa role-add-member "Computer creator" --user=hadder
37
38
# ipa-getkeytab -s `hostname` -p hadder@IDM.LAB.BOS.REDHAT.COM -k /root/hadder.keytab
39
# kinit -kt /root/hadder.keytab hadder@IDM.LAB.BOS.REDHAT.COM
40
# klist
41
Ticket cache: DIR::/run/user/0/krb5cc/tkt3GbmCZ
42
Default principal: hadder@IDM.LAB.BOS.REDHAT.COM    <<<<<
43
44
Valid starting       Expires              Service principal
45
06/14/2013 21:54:06  06/15/2013 21:54:06
46
krbtgt/IDM.LAB.BOS.REDHAT.COM@IDM.LAB.BOS.REDHAT.COM
47
</pre>
48
49
System user is now privileged to add hosts to IPA:
50
51
<pre>
52
# ipa host-add random.host.test --random --force
53
-----------------------------
54
Added host "random.host.test"
55
-----------------------------
56
  Host name: random.host.test
57
  Random password: K8-5rr0U8vL,
58
  Password: True
59
  Keytab: False
60
  Managed by: random.host.test
61
</pre>
62
63
He is unable to perform other administrative tasks as expected:
64
65
<pre>
66
# ipa host-mod random.host.test --desc=foo
67
ipa: ERROR: Insufficient access: Insufficient 'write' privilege to the
68
'description' attribute of entry
69
'fqdn=random.host.test,cn=computers,cn=accounts,dc=idm,dc=lab,dc=bos,dc=redhat,dc=com'.
70
</pre>
71
72
As a later step, classes can be assigned to hosts in IPA that associate it with hostgroups (not to be confused with Foreman host groups).
73
74
The attribute is called "userClass" in IPA LDAP, it is available by default with host entries under "--class" option. This is how it works:
75
76
1. We create a hostgroups to demonstrate how the automatic assignment of hosts to host groups works
77
78
<pre>
79
# ipa hostgroup-add webservers
80
Description: web servers
81
----------------------------
82
Added hostgroup "webservers"
83
----------------------------
84
  Host-group: webservers
85
  Description: web servers
86
</pre>
87
88
2. Create an automember rule for this hostgroup
89
90
<pre>
91
# ipa automember-add --type=hostgroup webservers
92
----------------------------------
93
Added automember rule "webservers"
94
----------------------------------
95
  Automember Rule: webservers
96
</pre>
97
98
3. The automember condition is hooked to the host's userclass attribute
99
100
<pre>
101
# ipa automember-add-condition --key=userclass --type=hostgroup
102
--inclusive-regex=^webserver webservers
103
----------------------------------
104
Added condition(s) to "webservers"
105
----------------------------------
106
  Automember Rule: webservers
107
  Inclusive Regex: userclass=^webserver
108
----------------------------
109
Number of conditions added 1
110
----------------------------
111
</pre>
112
113
Steps 1, 2 and 3 need to be done just once when the IPA is being configured.
114
115
4. Now this is the best part. When Foreman proxy adds a host, it can specify
116
the host class which will automatically triggers
117
118
<pre>
119
# ipa host-add web.example.com --force --class=webserver --class=mailserver
120
----------------------------
121
Added host "web.example.com"
122
----------------------------
123
  Host name: web.example.com
124
  Principal name: host/web.example.com@EXAMPLE.COM
125
  Class: webserver, mailserver                    <<<<<<<<<<
126
  Password: False
127
  Member of host-groups: webservers               <<<<<<<<<<
128
  Indirect Member of netgroup: webservers
129
  Keytab: False
130
  Managed by: web.example.com
131
</pre>
132
133
You can have more these rules in parallel.
134
135
h4. Active Directory
136
137 1 Dominic Cleal
For AD, adcli can be used (available in F18+):
138
* http://fedoraproject.org/wiki/Features/ActiveDirectory
139
* https://fedoraproject.org/wiki/Features/AnacondaRealmIntegration (has an adcli example)
140
141
h3. Foreman support
142
143
foreman_realm should add an orchestration step to create and destroy the host object via the proxy.  The OTP used when creating should be stored.
144
145
h2. Joining hosts
146
147
foreman_realm could add a new %25post snippet which uses the "realm" command (part of realmd) to join the host to the specified realm.
148
* http://www.freedesktop.org/software/realmd/docs/index.html (see joining sections)
149
150
For new anacondas, we could use this instead (maybe a second snippet):
151
* https://fedoraproject.org/wiki/Features/AnacondaRealmIntegration
152
153
For older (EL5/6/F18), it should also support the ipa* client tools as realm is only just getting FreeIPA support:
154
* http://fedoraproject.org/wiki/Features/RealmdFreeIpaSupport
155 3 Dominic Cleal
156
Example: @ipa-client-install --password K8-5rr0U8vL,@