-
Notifications
You must be signed in to change notification settings - Fork 434
add ability to save pin for smartcards #753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
selvanair
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
I'm not sure whether saving a smartcard/token PIN is a good idea. Many tokens lock-up if a wrong PIN is entered multiple times. Its easy for this to happen if we use a saved PIN and somehow miss to promptly clear it on failure.
Apart from that, the patch has some issues: it handles token password similar to auth-password. Instead treat it like the private key password and use the flags related to it (such as FLAG_SAVE_KEY_PASS). Also, if saved, consider submitting with no delay as done for private key password.
failed_psw_attempts has to be incremented when token password fails. Unclear whether it will be caught by the cases currently handled in OnStateChange().
We can intercept PIN prompts only when a token is used through pkcs11-helper or pkcs11-provider. On windows, its much better to use the cryptoapicert option which can cover certificates/keys in tokens as well. In that case PIN prompt is triggered by Windows itself and not seen by OpenVPN-GUI.
openvpn.c
Outdated
| break; | ||
|
|
||
| case ID_CHK_SAVE_PASS: | ||
| param->c->flags ^= FLAG_SAVE_AUTH_PASS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This flag determines whether user-auth password should be saved or not. Do not disable it here as this is not about user-auth, but token password. Instead use FLAG_KEY_SAVE_PASS. Also respect FLAG_DISABLE_SAVE_PASS which allows administrators to ban password saving.
1. If we recall pin just send pin without connect Timeout für &Connect-Skript: 2. If connect error we extend ID_DLG_CHALLENGE_RESPONSE dialog to place ID_TXT_WARNING
|
@thanks for your review, i fixed as i think all you remarks, also i want to coment something:
Yeah you right but for example viscosity client have ability to save pin, so i think openvpn-gui also must have this...
I don't think using windows cryptoapi is a good idea, since the dialog it shows is completely different from the openvpn gui, and may confuse users - in other words, they may not understand what it is all about. |
|
|
||
| if (param->c->flags & FLAG_DISABLE_SAVE_PASS) | ||
| { | ||
| ShowWindow(GetDlgItem(hwndDlg, ID_CHK_SAVE_PASS), SW_HIDE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it better to make this hiding of the save password checkbox the default outside of all if-else clauses? That will simplify the logic and have less deeply nested code.
Like, the following line could become else if (!(param->c->flags & FLAG_DISABLE_SAVE_PASS) && RecallSmart...())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you confirmed that c->failed_auth_attempts does get incremented when token password fails?
PS. Also, shouldn't it be c->failed_psw_attempts ?
In fact, a wrong PIN causes pkcs11-helper to re-prompt for it three times without a restart. When a SIGUSR1 restart happens finally, its triggered as a generic "tls-error" leading to a further round of wrong PIN submission and so on. This is not acceptable. So, NAK from me. |
Thanks for you investigations, its very helpful for me(I not fully yet understand how full process works), and I have few questions:
|
Yes. You can test this yourself using a config and deliberately enter a wrong PIN. Testing that the patch works when all goes well is not good enough --- wrong PIN and combinations like right PIN followed by some other failures (say, wrong auth-password or wrong certificate) need to work correctly too.
"SIGUSR1 restart" is what OpenVPN does on non-fatal errors. It uses a pseudo-signal generated internally. For the purpose of this discussion, just think of it as an internal "soft restart" of the connection process. When that happens the management interface gets the "RECONNECTING" message with a short description of what went wrong. But token prompt comes from pkcs11-helper library and it retries 3 times before a restart can trigger.
At what point to increment the counter? Correct location is where restart occurs and we get an appropriate "RECONNECTING" message as done for key password and auth password. But that's too late in this case as pkcs11-helper library does the multiple prompting (see above). Also, the RECONNECTING error message in case of PIN failure is too generic to be sure that it was PIN that failed. You can try, but do test various scenarios to ensure the user experience is not adversely affected. A wrongly incremented counter will cause a confusing PIN error warning in the next round if a restart occurs due to some other failure. |
This patch adds ability to save smartcards(i.e. yubikey) pins