[mdlug] Programatically Answering a Password Prompt
Gregory Czerniak
gregczrk at gmail.com
Fri Aug 8 11:41:48 EDT 2014
Hi Greg,
I believe you can solve your problem more elegantly by using a
keytab file to supply credentials to Kerberos rather than trying to
pipe a password into kinit.
Here are two tutorials on how to do this:
- http://www.microhowto.info/howto/add_a_host_or_service_principal_to_a_keytab_using_mit_kerberos.html
- http://xteams.oit.ncsu.edu/iso/node/814
Thanks,
Greg Czerniak
On Thu, Aug 7, 2014 at 12:38 PM, Wojtak, Greg
<GregWojtak at quickenloans.com> wrote:
> I’m writing a python script and part of it is calling kinit to get a kerberos ticket before doing some ldap operations. I’m trying to find a method to pass the password into my script, and I haven’t been able to reliably do this. Depending on the distribution of Linux and the version of that distribution, I’ve found that different versions of kinit will read the password:
>
>
> * From STDIN
> * From a file descriptor dup()’ed from STDIN
> * By opening /dev/tty and polling directly for key presses/input
>
> I have been able to get the first two cases covered, but I am at a loss as to how to get the third case going. I’ve even tried firing off the kinit and then writing directly to /dev/tty, but as expected, that does not work. If it helps, I am using the python subprocess module with Popen to run kinit, but as far as I know, there is no method to redirect anything other than file descriptors 0, 1, and 2 with Popen.
>
> Does anyone have any insight into this? Even if you’re not a python programmer, if you know how this is working, any insight you could give would be much appreciated.
>
> TIA,
>
> Greg
> _______________________________________________
> mdlug mailing list
> mdlug at mdlug.org
> http://mdlug.org/mailman/listinfo/mdlug
More information about the mdlug
mailing list