sss_obfuscate revision c9f6ca2ca7399c301853ff774c20883fef2b2267
120eec9ff1748e1ae786e2ab073234198bc0f701Christian Maeder parser.set_description("sss_obfuscate converts a given password into \
120eec9ff1748e1ae786e2ab073234198bc0f701Christian Maeder human-unreadable format and places it into \
120eec9ff1748e1ae786e2ab073234198bc0f701Christian Maeder appropriate domain section of the SSSD config \
846286f96bb7bd5d2b9db834561a815f832a8d90Christian Maeder file. The password can be passed in by stdin, \
846286f96bb7bd5d2b9db834561a815f832a8d90Christian Maeder specified on the command-line or entered \
846286f96bb7bd5d2b9db834561a815f832a8d90Christian Maeder parser.add_option("-s", "--stdin", action="store_true",
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder help="The domain to use the password in (mandatory)",
d6a6c1a2fb6526fdcacd8386c9aa3340169a1049Cui Jian help="Set input file to FILE (default: Use system default, usually /etc/sssd/sssd.conf)",
120eec9ff1748e1ae786e2ab073234198bc0f701Christian Maeder print >> sys.stderr, "Cannot parse options"
99e6fb75f064189db8f26fe74eb8f01af353e58eCui Jian pprompt = lambda: (getpass.getpass("Enter password: "), getpass.getpass("Re-enter password: "))
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder # Obfuscate the password
99e6fb75f064189db8f26fe74eb8f01af353e58eCui Jian # Save the obfuscated password into the domain
afe76697dd6888856a066934a1112a38809b27faChristian Maeder print "Cannot open config file %s" % options.filename
afe76697dd6888856a066934a1112a38809b27faChristian Maeder domain = sssdconfig.get_domain(options.domain)
d6a6c1a2fb6526fdcacd8386c9aa3340169a1049Cui Jian domain.set_option('ldap_default_authtok_type', 'obfuscated_password')
846286f96bb7bd5d2b9db834561a815f832a8d90Christian Maeder domain.set_option('ldap_default_authtok', obfpwd)
846286f96bb7bd5d2b9db834561a815f832a8d90Christian Maeder print "The domain %s does not seem to support the required options" % \