This file is indexed.

/usr/sbin/dsconf is in 389-ds-base 1.3.7.10-1ubuntu1.

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

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
#!/usr/bin/python3

# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---

import argparse
import logging
import ldap
import sys

# This has to happen before we import  DirSrv else it tramples our config ... :(
logging.basicConfig(format='%(message)s')

from lib389 import DirSrv
from lib389._constants import DN_CONFIG, DN_DM
from lib389.cli_conf import backend as cli_backend
from lib389.cli_conf import plugin as cli_plugin
from lib389.cli_conf import schema as cli_schema
from lib389.cli_conf import health as cli_health
from lib389.cli_conf.plugins import memberof as cli_memberof
from lib389.cli_conf.plugins import usn as cli_usn
from lib389.cli_conf.plugins import rootdn_ac as cli_rootdn_ac
from lib389.cli_conf.plugins import whoami as cli_whoami
from lib389.cli_conf.plugins import referint as cli_referint
from lib389.cli_base import disconnect_instance, connect_instance

from lib389.cli_base.dsrc import dsrc_to_ldap, dsrc_arg_concat

log = logging.getLogger("dsconf")

if __name__ == '__main__':

    defbase = ldap.get_option(ldap.OPT_DEFBASE)

    parser = argparse.ArgumentParser(allow_abbrev=True)
    # Build the base ldap options, this keeps in unified.

    # Can we get default options for these from .rc file?

    parser.add_argument('instance',
            help="The instance name OR the LDAP url to connect to, IE localhost, ldap://mai.example.com:389",
        )
    parser.add_argument('-v', '--verbose',
            help="Display verbose operation tracing during command execution",
            action='store_true', default=False
        )
    parser.add_argument('-D', '--binddn',
            help="The account to bind as for executing operations",
            default=None,
        )
    parser.add_argument('-b', '--basedn',
            help="Basedn (root naming context) of the instance to manage",
            default=None
        )
    parser.add_argument('-Z', '--starttls',
            help="Connect with StartTLS",
            default=False, action='store_true'
        )

    subparsers = parser.add_subparsers(help="resources to act upon")

    cli_backend.create_parser(subparsers)
    cli_schema.create_parser(subparsers)
    cli_health.create_parser(subparsers)
    cli_plugin.create_parser(subparsers)
    cli_memberof.create_parser(subparsers)
    cli_usn.create_parser(subparsers)
    cli_rootdn_ac.create_parser(subparsers)
    cli_whoami.create_parser(subparsers)
    cli_referint.create_parser(subparsers)

    args = parser.parse_args()

    if args.verbose:
        log.setLevel(logging.DEBUG)
    else:
        # We aren't verbose, so fix our formatter up to be more minimal ...
        log.setLevel(logging.INFO)

    log.debug("The 389 Directory Server Configuration Tool")
    # Leave this comment here: UofA let me take this code with me provided
    # I gave attribution. -- wibrown
    log.debug("Inspired by works of: ITS, The University of Adelaide")

    # Now that we have our args, see how they relate with our instance.
    dsrc_inst = dsrc_to_ldap("~/.dsrc", args.instance, log.getChild('dsrc'))

    # Now combine this with our arguments

    dsrc_inst = dsrc_arg_concat(args, dsrc_inst)

    log.debug("Called with: %s" % args)
    log.debug("Instance details: %s" % dsrc_inst)

    # Assert we have a resources to work on.
    if not hasattr(args, 'func'):
        log.error("No resource provided to act upon")
        log.error("USAGE: dsconf [options] <resource> <action> [action options]")
        sys.exit(1)

    # Connect
    # We don't need a basedn, because the config objects derive it properly
    inst = None
    if args.verbose:
        inst = connect_instance(dsrc_inst=dsrc_inst, verbose=args.verbose)
        args.func(inst, None, log, args)
    else:
        try:
            inst = connect_instance(dsrc_inst=dsrc_inst, verbose=args.verbose)
            args.func(inst, None, log, args)
        except Exception as e:
            log.debug(e, exc_info=True)
            log.error("Error: %s" % e)
    disconnect_instance(inst)

    # Done!
    log.debug("dsconf is brought to you by the letter H and the number 25.")