[Freeipa-devel] [PATCH] allow password to be sent in via pipe

Jason Gerard DeRose jderose at redhat.com
Mon May 4 21:37:08 UTC 2009


On Thu, 2009-04-30 at 15:08 -0400, Rob Crittenden wrote:
> When reading a password, if there is no tty, read from stdin instead.
> 
> This will allow one to pipe a password in:
> 
> echo -e "secret123\secret123\n" | ipa password someuser
> 
> rob

ack, good start.

One thing we might want to change is I don't think you should have to
provide the password twice from stdin.  I think this would be better:

if stdin.isatty():
    # prompt with getpass()
    # prompt again with getpass() to confirm
else:
    stdin.readline().strip()  # Just once

This will make it easier when scripting with ipa (which I assume is when
this feature would most likely be used).

Also, this use is pretty ambiguous in cases where you have a command
that has more than one Password param.  I don't think we have anything
like this in IPA yet, but we might down the road.
    




More information about the Freeipa-devel mailing list