summaryrefslogtreecommitdiffstats
path: root/doc/admin/realmd/usage.rst
blob: 1613373996a7c58e892565d0b2f3c0b2502ddef3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
OpenLMI Realmd usage
=====================

The OpenLMI Realmd provider allows for basic configuration of the managed
systems Active Directory or Kerberos realms membership. It relies on the Realmd
system service.

Querying a domain membership
----------------------------

To verify if the remote machine is part of the domain, it is enough to query the
value of the :ref:`LMI_RealmdService.Domain<LMI-RealmdService-Domain>` property:
If non-NULL it contains the name of the joined domain::

    #!/usr/bin/lmishell
    c = connect("localhost", "pegasus", "test")
    realmsrv = c.root.cimv2.LMI_RealmdService.first_instance()
    dom = realmsrv.Domain
    if (dom):
        print "Joined to the domain: " + dom
    else:
        print "No domain joined."

Joining a domain
----------------

The :ref:`LMI_RealmdService.JoinDomain()<LMI-RealmdService-JoinDomain>` method
can be used to join a domain. It takes three mandatory arguments: username and
password for the authentication and the domain name::

    #!/usr/bin/lmishell
    c = connect("localhost", "pegasus", "test")
    realmsrv = c.root.cimv2.LMI_RealmdService.first_instance()
    realmsrv.JoinDomain(Password='ZisIzSECRET', User='admin', Domain='AD.EXAMPLE.COM')

Leaving a domain
----------------

Similarly to joining a domain the
:ref:`LMI_RealmdService.LeaveDomain()<LMI-RealmdService-LeaveDomain>` can be used
to leave the joined domain. It requires the same arguments as the
:ref:`JoinDomain()<LMI-RealmdService-JoinDomain>` method::

    #!/usr/bin/lmishell
    c = connect("localhost", "pegasus", "test")
    realmsrv = c.root.cimv2.LMI_RealmdService.first_instance()
    realmsrv.LeaveDomain(Password='ZisIzSECRET', User='admin', Domain='AD.EXAMPLE.COM')