/usr/sbin/maas-region is in maas-region-api 2.4.0~beta2-6865-gec43e47e6-0ubuntu1.
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 | #!/usr/bin/python3
# Copyright 2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
str = None
__metaclass__ = type
__all__ = []
import grp
import os
import sys
def check_user():
# At present, only root should execute this.
if os.getuid() != 0:
raise SystemExit("This utility may only be run as root.")
def set_group():
# Ensure that we're running as the `maas` group.
try:
gr_maas = grp.getgrnam("maas")
except KeyError:
raise SystemExit("No such group: maas")
else:
os.setegid(gr_maas.gr_gid)
def set_umask():
# Prevent creation of world-readable (or writable, executable) files.
os.umask(0o007)
def run():
# Force the production MAAS Django configuration.
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE", "maasserver.djangosettings.settings")
# Let Django do the rest.
from django.core import management
management.execute_from_command_line()
def main():
if 'maas-region-admin' in sys.argv[0]:
sys.stderr.write(
"WARNING: The maas-region-admin command is deprecated and will be "
"removed in a future version. From now on please use 'maas-region' "
"instead.\n")
check_user()
set_group()
set_umask()
run()
if __name__ == "__main__":
main()
|