Script Kerberos Ktutil to make keytabs

前端 未结 4 740
庸人自扰
庸人自扰 2021-02-03 10:50

I want to make a script that will generate the a keytab using ktutil. When running the script I want to use [user]$ script.sh PASSWORD

#script.sh
echo \"addent -         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-03 11:20

    enjoy

    import os, getpass
    from subprocess import run, PIPE
    import sys
    userndomain, passwd, enctype = 'username@DOMAIN', 'secret', 'arcfour-hmac-md5'
    input_load = f"""add_entry -password -p {userndomain} -k 1 -e {enctype}
    {passwd}
    write_kt {user}.keytab
    quit
    """
    p = run(['ktutil'], stdout=PIPE, input=input_load, encoding='ascii')
    

提交回复
热议问题