#1916 Install tools crash when password prompt is interrupted
Closed: Fixed None Opened 12 years ago by mkosek.

Our tools use getpass.getpass() function to get user password. However, when user interrupts entering the password via [CTRL+D], EOFError exception is thrown.

Most of our tools are not prepared for this and crashes with this exception. This is not very user-friendly ending.

Example:

# ipa-compat-manage enable
Directory Manager password: Traceback (most recent call last):
  File "/usr/sbin/ipa-compat-manage", line 203, in <module>
    sys.exit(main())
  File "/usr/sbin/ipa-compat-manage", line 102, in main
    dirman_password = get_dirman_password()
  File "/usr/sbin/ipa-compat-manage", line 64, in get_dirman_password
    password = installutils.read_password("Directory Manager", confirm=False, validate=False)
  File "/usr/lib/python2.7/site-packages/ipaserver/install/installutils.py", line 322, in read_password
    pwd = get_password(user + " password: ")
  File "/usr/lib/python2.7/site-packages/ipaserver/install/installutils.py", line 312, in get_password
    return getpass.getpass(prompt)
  File "/usr/lib64/python2.7/getpass.py", line 71, in unix_getpass
    passwd = _raw_input(prompt, stream, input=input)
  File "/usr/lib64/python2.7/getpass.py", line 135, in _raw_input
    raise EOFError
EOFError

OR

# ipa-server-install

The log file for this installation can be found in /var/log/ipaserver-install.log
==============================================================================
This program will set up the FreeIPA Server.

This includes:
  * Configure the Network Time Daemon (ntpd)
  * Create and configure an instance of Directory Server
  * Create and configure a Kerberos Key Distribution Center (KDC)
  * Configure Apache (httpd)

To accept the default shown in brackets, press the Enter key.

Enter the fully qualified domain name of the computer
on which you're setting up server software. Using the form
<hostname>.<domainname>
Example: master.example.com.


Server host name [vm-134.idm.lab.bos.redhat.com]:

The domain name has been calculated based on the host name.

Please confirm the domain name [idm.lab.bos.redhat.com]:

The IPA Master Server will be configured with
Hostname:    vm-134.idm.lab.bos.redhat.com
IP address:  10.16.78.134
Domain name: idm.lab.bos.redhat.com

The kerberos protocol requires a Realm name to be defined.
This is typically the domain name converted to uppercase.

Please provide a realm name [IDM.LAB.BOS.REDHAT.COM]: 
Certain directory server operations require an administrative user.
This user is referred to as the Directory Manager and has full access
to the Directory for system management tasks and will be added to the
instance of directory server created for IPA.
The password must be at least 8 characters long.

Directory Manager password: The IPA server requires an administrative user, named 'admin'.
This user is a regular system account used for IPA server administration.

IPA admin password: 
The following operations may take some minutes to complete.
Please wait until the prompt is returned.

Configuring ntpd
  [1/4]: stopping ntpd
  [2/4]: writing configuration
  [3/4]: configuring ntpd to start on boot
  [4/4]: starting ntpd
done configuring ntpd.
Configuring directory server for the CA: Estimated time 30 seconds
  [1/3]: creating directory server user
  [2/3]: creating directory server instance
  [3/3]: restarting directory server
done configuring pkids.
Configuring certificate server: Estimated time 3 minutes 30 seconds
  [1/17]: creating certificate server user
  [2/17]: creating pki-ca instance
  [3/17]: configuring certificate server instance
  [4/17]: disabling nonces
  [5/17]: creating CA agent PKCS#12 file in /root
Unexpected error - see ipaserver-install.log for details:
 must be string or buffer, not None

OR

# ipa-replica-prepare vm-134.idm.lab.bos.redhat.com
Directory Manager (existing master) password: preparation of replica failed:

  File "/usr/sbin/ipa-replica-prepare", line 459, in <module>
    main()

  File "/usr/sbin/ipa-replica-prepare", line 291, in main
    dirman_password = get_dirman_password()

  File "/usr/sbin/ipa-replica-prepare", line 230, in get_dirman_password
    return installutils.read_password("Directory Manager (existing master)", confirm=False, validate=False)

  File "/usr/lib/python2.7/site-packages/ipaserver/install/installutils.py", line 322, in read_password
    pwd = get_password(user + " password: ")

  File "/usr/lib/python2.7/site-packages/ipaserver/install/installutils.py", line 312, in get_password
    return getpass.getpass(prompt)

  File "/usr/lib64/python2.7/getpass.py", line 71, in unix_getpass
    passwd = _raw_input(prompt, stream, input=input)

  File "/usr/lib64/python2.7/getpass.py", line 135, in _raw_input
    raise EOFError

Metadata Update from @mkosek:
- Issue assigned to mkosek
- Issue set to the milestone: FreeIPA 2.1.2 (bug fixing)

7 years ago

Login to comment on this ticket.

Metadata