This file is indexed.

/usr/lib/python2.7/dist-packages/ipalib/install/service.py is in python-ipalib 4.7.0~pre1+git20180411-2ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#
# Copyright (C) 2016  FreeIPA Contributors see COPYING for license
#

"""
Base service installer module
"""

from ipalib.util import validate_domain_name
from ipapython.install import common, core, typing
from ipapython.install.core import group, knob


def prepare_only(obj):
    """
    Decorator which makes an installer attribute appear only in the prepare
    phase of the install
    """
    obj.__exclude__ = getattr(obj, '__exclude__', set()) | {'enroll'}
    return obj


def enroll_only(obj):
    """
    Decorator which makes an installer attribute appear only in the enroll
    phase of the install
    """
    obj.__exclude__ = getattr(obj, '__exclude__', set()) | {'prepare'}
    return obj


def master_install_only(obj):
    """
    Decorator which makes an installer attribute appear only in master install
    """
    obj.__exclude__ = getattr(obj, '__exclude__', set()) | {'replica_install'}
    return obj


def replica_install_only(obj):
    """
    Decorator which makes an installer attribute appear only in replica install
    """
    obj.__exclude__ = getattr(obj, '__exclude__', set()) | {'master_install'}
    return obj


def _does(cls, arg):
    def remove(name):
        def removed(self):
            raise AttributeError(name)

        return property(removed)

    return type(
        cls.__name__,
        (cls,),
        {
            n: remove(n) for n in dir(cls)
            if arg in getattr(getattr(cls, n), '__exclude__', set())
        }
    )


def prepares(cls):
    """
    Returns installer class stripped of attributes not related to the prepare
    phase of the install
    """
    return _does(cls, 'prepare')


def enrolls(cls):
    """
    Returns installer class stripped of attributes not related to the enroll
    phase of the install
    """
    return _does(cls, 'enroll')


def installs_master(cls):
    """
    Returns installer class stripped of attributes not related to master
    install
    """
    return _does(cls, 'master_install')


def installs_replica(cls):
    """
    Returns installer class stripped of attributes not related to replica
    install
    """
    return _does(cls, 'replica_install')


@group
class ServiceInstallInterface(common.Installable,
                              common.Interactive,
                              core.Composite):
    """
    Interface common to all service installers
    """
    description = "Basic"

    domain_name = knob(
        str, None,
        description="primary DNS domain of the IPA deployment "
                    "(not necessarily related to the current hostname)",
        cli_names='--domain',
    )

    @domain_name.validator
    def domain_name(self, value):
        validate_domain_name(value)

    servers = knob(
        # pylint: disable=invalid-sequence-index
        typing.List[str], None,
        description="FQDN of IPA server",
        cli_names='--server',
        cli_metavar='SERVER',
    )

    realm_name = knob(
        str, None,
        description="Kerberos realm name of the IPA deployment (typically "
                    "an upper-cased name of the primary DNS domain)",
        cli_names='--realm',
    )

    @realm_name.validator
    def realm_name(self, value):
        validate_domain_name(value, entity="realm")

    host_name = knob(
        str, None,
        description="The hostname of this machine (FQDN). If specified, the "
                    "hostname will be set and the system configuration will "
                    "be updated to persist over reboot. By default the result "
                    "of getfqdn() call from Python's socket module is used.",
        cli_names='--hostname',
    )

    ca_cert_files = knob(
        # pylint: disable=invalid-sequence-index
        typing.List[str], None,
        description="load the CA certificate from this file",
        cli_names='--ca-cert-file',
        cli_metavar='FILE',
    )

    replica_file = knob(
        str, None,
        description="a file generated by ipa-replica-prepare",
    )
    replica_file = replica_install_only(replica_file)

    dm_password = knob(
        str, None,
        sensitive=True,
        description="Directory Manager password (for the existing master)",
    )


class ServiceAdminInstallInterface(ServiceInstallInterface):
    """
    Interface common to all service installers which require admin user
    authentication
    """

    principal = knob(
        str, None,
    )
    principal = enroll_only(principal)
    principal = replica_install_only(principal)

    admin_password = knob(
        str, None,
        sensitive=True,
    )
    admin_password = enroll_only(admin_password)