/usr/lib/python2.7/dist-packages/txwinrm/genkrb5conf.py is in python-txwinrm 1.3.3-1.
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 | ##############################################################################
#
# Copyright (C) Zenoss, Inc. 2013, all rights reserved.
#
# This content is made available according to terms specified in the LICENSE
# file at the top-level directory of this package.
#
##############################################################################
import sys
import socket
import uuid
from argparse import ArgumentParser
TEMPLATE = """
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
default_realm = {realm}
dns_lookup_realm = false
dns_lookup_kdc = false
ticket_lifetime = 24h
renew_lifetime = 7d
forwardable = true
[realms]
{realm} = {{
kdc = {domain_controller_ip}
admin_server = {domain_controller_ip}
}}
[domain_realm]
.{domain} = {realm}
{domain} = {realm}
"""
def _parse_args():
parser = ArgumentParser()
parser.add_argument(
"domain",
help="The name of the Windows domain")
parser.add_argument(
"domain_controller_ip",
help="The IP address of the Domain Controller")
parser.add_argument(
"--output", "-o",
default="/etc/krb5.conf",
help="Path to the krb5.conf file")
return parser.parse_args()
def main():
args = _parse_args()
try:
socket.inet_aton(args.domain_controller_ip)
except socket.error:
print >>sys.stderr, "ERROR: {0} is not a valid IP address".format(
args.domain_controller_ip)
existing_content = None
try:
with open(args.output) as f:
existing_content = f.read()
except IOError:
pass
if existing_content is not None:
backup_file = '{0}-genkrb5conf-{1}'.format(args.output, uuid.uuid4())
with open(backup_file, 'w') as f:
f.write(existing_content)
with open(args.output, 'w') as f:
f.write(TEMPLATE.format(
domain=args.domain.lower(),
realm=args.domain.upper(),
domain_controller_ip=args.domain_controller_ip))
if __name__ == '__main__':
main()
|