GNOME Bugzilla – Bug 759116
[review] cli: do not echo passwords on terminal when asking for them
Last modified: 2016-05-20 10:00:53 UTC
Do not display passwords when user is asked for one and types it on the command line. E.g. nmcli -a con up pub-wifi Passwords or encryption keys are required to access the wireless network 'Pub Wi-Fi'. Password (802-11-wireless-security.psk):
Done in branch jk/nmcli-show-secrets-rh759116 It hides passwords on terminal by default and also adds global --show-secrets option. The option - can be used for turning on displaying passwords input on terminal - replaces --show-secrets in 'nmcli connection show', which is deprecated now - replaces --show-password in 'nmcli device wifi hotspot', which is deprecated now
+ + str = nmc_readline_helper (prompt); + + g_free (prompt); + + /* Restore original terminal settings */ + if (!echo_on) + tcsetattr (STDIN_FILENO, TCSADRAIN, &termios_orig); what happens if you CTRL+C nmcli during password request? Is the terminal afterwards broken (until you do `reset` in shell)? Can that be avoided? Otherwise, LGTM.
(In reply to Thomas Haller from comment #2) > + > + str = nmc_readline_helper (prompt); > + > + g_free (prompt); > + > + /* Restore original terminal settings */ > + if (!echo_on) > + tcsetattr (STDIN_FILENO, TCSADRAIN, &termios_orig); > > > what happens if you CTRL+C nmcli during password request? Is the terminal > afterwards broken (until you do `reset` in shell)? Can that be avoided? > > > Otherwise, LGTM. The terminal is not broken, the situation is handled correctly. nmcli gets terminal attributes on startup and then restores them in signal handler. The code has already been in. Committed to master: c52b204 merge: nmcli: don't show password by default, add --show-secrets (rh #759116) 629de4e cli: add global --show-secrets option 23aff47 cli: use nmc_readline_echo() for asking password in 'nmcli con add' 1056408 cli: use nmc_readline_echo() for asking password in 'nmcli dev wifi connect' 0238806 cli: use new nmc_readline_echo() in polkit agent a14306c cli: do not echo passwords on terminal when asking for them
*** Bug 745012 has been marked as a duplicate of this bug. ***
*** Bug 766702 has been marked as a duplicate of this bug. ***