This file is indexed.

/usr/lib/python2.7/dist-packages/maasserver/management/commands/get_named_conf.py is in python-django-maas 1.5.4+bzr2294-0ubuntu1.2.

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
# Copyright 2012-2014 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

"""Django command: get the named configuration snippet used to hook
up MAAS' DNS configuration files with an existing DNS server.
"""

from __future__ import (
    absolute_import,
    print_function,
    unicode_literals,
    )

str = None

__metaclass__ = type
__all__ = [
    'Command',
    ]


from optparse import make_option

from django.core.management.base import BaseCommand
from provisioningserver.dns.config import DNSConfig


INCLUDE_SNIPPET_COMMENT = """\
# Append the following content to your local BIND configuration
# file (usually /etc/bind/named.conf.local) in order to allow
# MAAS to manage its DNS zones.
"""


class Command(BaseCommand):
    option_list = BaseCommand.option_list + (
        make_option(
            '--edit', action='store_true', dest='edit',
            default=False,
            help="Edit the configuration file instead of simply "
                 "printing the snippet."),
        make_option(
            '--config_path', dest='config_path',
            default='/etc/bind/named.conf.local',
            help="Specifies the configuration file location ("
                 "used in conjonction with --edit). Defaults to "
                 "/etc/bind/named.conf.local."),
    )
    help = (
        "Return the named configuration snippet used to include "
        "MAAS' DNS configuration in an existing named "
        "configuration.")

    def handle(self, *args, **options):
        edit = options.get('edit')
        config_path = options.get('config_path')
        include_snippet = DNSConfig.get_include_snippet()

        if edit is True:
            with open(config_path, "ab") as conf_file:
                conf_file.write(include_snippet)
        else:
            return INCLUDE_SNIPPET_COMMENT + include_snippet