pkcs11-protected-authentication not working in 2.1beta4 ?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Hello,
I've given 2.1beta4 a try as it includes direct PKCS11 support which looks very promising in being able to run openvpn as a service AND getting the cert from a smartcard. At least I hope I can archieve just that. If i'm totally barking up the wrong tree please tell me right away :)
The setup i've been testing is Windows XP OS and SafeSign PKCS#11 provider DLL.
The --show-pkcs11-* commands cause the SafeSign PIN code popup to show before openvpn.exe can access the smartcard.
Using (--)askpass works fine too when connecting with openvpn but pkcs11-protected-authentication doesn't seem to work:
Mon Oct 31 14:35:04 2005 PKCS#11: Adding PKCS#11 provider 'aetpkss1.dll' Mon Oct 31 14:35:06 2005 PKCS#11: Cannot set parameters -'CKR_ARGUMENTS_BAD' Mon Oct 31 14:35:06 2005 Cannot load certificate "........"
config excerpt:
ca cacert.pem
pkcs11-providers aetpkss1.dll
;pkcs11-sign-mode auto
;
pkcs11-slot-type label
pkcs11-slot MYSLOT
; need to use askpass as:
;pkcs11-protected-authentication
; won't work. Dunno why not as the --show-pkcs11 commands do pop up ; the safesign PIN dialog box
askpass
pkcs11-id-type label
pkcs11-id MYCERT
Cheers,
Albert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDZiIfKltZixSsH2QRA3GEAJ0YwqnvC63rW8pm0c7O7LNZDopS4gCfUMIa eHDL1I0Sa7lRer+mgMQPpAs=
=0ZLt
-----END PGP SIGNATURE-----
Quoted 4 lines · Albert Siersema
Hello,
The --show-pkcs11-* commands cause the SafeSign PIN code popup to show before openvpn.exe can access the smartcard.
This is violation of PKCS#11 standard.
Quoted 1 line
Using (--)askpass works fine too when connecting with openvpn but
Does it also popup PIN dialog?
Quoted 4 lines
pkcs11-protected-authentication doesn't seem to work:
Mon Oct 31 14:35:04 2005 PKCS#11: Adding PKCS#11 provider 'aetpkss1.dll' Mon Oct 31 14:35:06 2005 PKCS#11: Cannot set parameters -'CKR_ARGUMENTS_BAD' Mon Oct 31 14:35:06 2005 Cannot load certificate "........"
PKCS#11 protected authentication is not implemented by most of PKCS#11 providers, it is used in biometric environment or when external keypad is available. Are you sure your provider support protected authentication?
The askpass should be the preferred method.
Beta5 will remove askpass and will ask password unless protected authentication is requested.
Best Regards,
Alon Bar-Lev.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Hello Alon,
Quoted 2 lines
Quoted 1 line
Using (--)askpass works fine too when connecting with openvpn but
Does it also popup PIN dialog?
No, it reads from stdin which makes it impossible to run openvpn as a MSWindows service.
I was hoping the pkcs11 code would be helpful in that department as using the cryptoapi and running as a service won't work. Probably because the service runs as System and tries to retrieve it from the wrong cert store. Running the service as another user won't help either ?! :-(
Anyone who has an idea how to tackle this ?
Basically I want to store the certificate on a smartcard and be able to run openvpn as a service (e.g. start/stopping it through net start/stop openvpnservice).
Quoted 3 lines
PKCS#11 protected authentication is not implemented by most of PKCS#11 providers, it is used in biometric environment or when external keypad is available. Are you sure your provider support protected authentication?
I haven't got a clue as of yet. I'm not really a Windows user myself so it took me quite a while to figure out what to supply as a provider. In the end I looked in the firefox preferences :) but there's probably a win32 CLI tool somewhere that can list the various pkcs11 resources and info.
Cheers,
Albert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDZzmiKltZixSsH2QRAz6IAJ41gKLFO0K7YQTK3VyZLWBXxleHfgCeP/eS BPzRYQr2muYQnZQjE7FwBTo=
=B992
-----END PGP SIGNATURE-----
Hi!
Quoted 7 lines · Albert Siersema
Hello Alon,
Quoted 3 lines
Quoted 1 line
Using (--)askpass works fine too when connecting with openvpn but
Does it also popup PIN dialog?
No, it reads from stdin which makes it impossible to run openvpn as a MSWindows service.
Strange... I don't understand what is the difference between the --show-pkcs11-* and the --askpass... Just to make sure... --show-pkcs11-slots prompt for PIN???
Quoted 4 lines
I was hoping the pkcs11 code would be helpful in that department as using the cryptoapi and running as a service won't work. Probably because the service runs as System and tries to retrieve it from the wrong cert store. Running the service as another user won't help either ?! :-(
But it does!
Use the management interface.
Put the following in your configuration file:
management hold
management 127.0.0.1 8887
management-query-passwords
Now start your service.
Insert your smartcard.
Run "telnet localhost 8887"
Enter the following commands:
hold release
password "XXXX token" pin
I will write a simple perl script that does it for you soon...
Best Regards,
Alon Bar-Lev.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Quoted 3 lines
Strange... I don't understand what is the difference between the --show-pkcs11-* and the --askpass...
Just to make sure... --show-pkcs11-slots prompt for PIN???
Yes it pops up the PIN dialog window (GUI) from the safesign middleware so to speak.
askpass shows a prompt on stdout and reads from stdin.
Quoted 7 lines
But it does!
Use the management interface.
Put the following in your configuration file:management hold
management 127.0.0.1 8887
management-query-passwords
Yes, just what I thought :) After browsing through the beta4 source and manual pages 'n all I saw this one as well. It has potential but for it to be useful to a mere user (i.e. less computer literate people) a kind of GUI wrapper has to be written. I was thinking about this along the lines of combining it with something like:
inactive 1800
ping 10
ping-exit 60
explicit-exit-notify
tls-exit
Then writing a script or such that starts the openvpn service, connects to the management interface, pops up a GUI dialog to ask the user for the PIN, then sending it through the management interface.
Should be feasable. Thing is, i'm not a Windows programming-person but maybe I can think up something simpler.
Quoted 9 lines
Now start your service.
Insert your smartcard.
Run "telnet localhost 8887"Enter the following commands:
hold release
password "XXXX token" pinI will write a simple perl script that does it for you soon...
If I come up with a non-perl but GUI-y like solution i'll post it to the list as well.
Albert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDaNW4KltZixSsH2QRA+8PAKCN1F7QLHXThxvbpBe4f5MNZlYTawCgi8/y vvbSeYvC7AbnwofDnDtNNqQ=
=6Lvn
-----END PGP SIGNATURE-----
Quoted 7 lines · Albert Siersema
Quoted 3 lines
Strange... I don't understand what is the difference between the --show-pkcs11-* and the --askpass...
Just to make sure... --show-pkcs11-slots prompt for PIN???Yes it pops up the PIN dialog window (GUI) from the safesign middleware so to speak.
askpass shows a prompt on stdout and reads from stdin.
Can you please check that beta6 does not popup GUI? (During normal operation). It is very strange, I don't understand why the provider need authentication for show slots... Please remember that askpass option should no longer be specified.
Quoted 9 lines
Quoted 3 lines
But it does!
Use the management interface.
Put the following in your configuration file:Yes, just what I thought :) After browsing through the beta4 source and manual pages 'n all I saw this one as well. It has potential but for it to be useful to a mere user (i.e. less computer literate people) a kind of GUI wrapper has to be written. I was thinking about this along the lines of combining it with something like:
I think that the service can always be started and put "on hold", then using the management you can control when it connects. It makes the GUI much simpler... And it does not need special permission, like start/stop service...
Quoted 5 lines
Quoted 1 line
I will write a simple perl script that does it for you soon...
If I come up with a non-perl but GUI-y like solution i'll post it to the list as well.
It would be great...
Do you know the openvpn GUI? (http://openvpn.se/)
It does not work with the management interface yet... So you can start from something...
Best Regards,
Alon Bar-Lev.
Quoted 4 lines · Albert Siersema
Quoted 1 line
I will write a simple perl script that does it for you soon...
If I come up with a non-perl but GUI-y like solution i'll post it to the list as well.
Well... I don't work with Windows...
So attached is a simple perl script that helps me interact with OpenVPN.
I hope some will find it useful!
-----------------------------------------------------------
This script provides a simple interface for OpenVPN management. It allows a KDE user to handle the following commands:
- hold
- need-ok
- password
In order to use this script specify the following options at OpenVPN configuration file:
management-hold
management 127.0.0.1 2222
management-query-passwordsThe best place to run this script is at .kde/Autostart, put the following script at this location:
#!/bin/sh
exec openvpn-kde-dialogs.pl 2222
The script will signal openvpn into hold state when the user logoffs.
Best Regards,
Alon Bar-Lev.
#!/usr/bin/perl
#
# This script provides a simple interface for OpenVPN management. # It allows a KDE user to handle the following commands:
# - hold
# - need-ok
# - password
#
# In order to use this script specify the following options at # OpenVPN configuration file:
# management-hold # management 127.0.0.1 2222 # management-query-passwords # # The best place to run this script is at .kde/Autostart, put # the following script at this location: # #!/bin/sh # exec openvpn-kde-dialogs.pl 2222 # # The script will signal openvpn into hold state when the # user logoffs. # # History: # 2005-11-03, Alon Bar-Lev ([email protected]...) # Written. #
use strict;
use Net::Telnet;
my $FALSE = 0;
my $TRUE = (!$FALSE);
my $t = new Net::Telnet;
$SIG{'INT'} = $SIG{'STOP'} = $SIG{'TERM'} = $SIG{'QUIT'} = $SIG{'HUP'} = sub {
$t->print ("signal SIGUSR1");
exit (1);
};main (@ARGV);
sub main {
my (
$port
) = @_;
my $fShouldConnect = $TRUE;
if ($port eq undef) {
printf STDERR ("usage: $0 port\n");
exit (1);
}
while ($TRUE) {
while ($fShouldConnect) {
my $r = $t->open (
host => "localhost",
port => $port,
errmode => "return"
);
if ($r == undef) {
sleep (5);
}
else {
$fShouldConnect = $FALSE;
}
}
my ($pre, $match) = $t->waitfor (
string => ">HOLD:",
string => ">PASSWORD:",
string => ">NEED-OK:",
errmode => "return",
timeout => 2
);
if ($match eq undef) {
my $msg = $t->errmsg;
if ($msg =~ /eof/) {
$fShouldConnect = $TRUE;
}
}
elsif ($match eq ">HOLD:") {
do {
`kdialog --title \"OpenVPN\" --yesno \"Release hold\"`;
} while ($? != 0);
$t->print ("hold release");
}
elsif ($match eq ">NEED-OK:") {
my $line = $t->getline ();
$line =~ /.*'(.*)'.* MSG:(.*)/;
my $req = $1;
my $msg = $2;
`kdialog --title \"OpenVPN\" --yesno \"$msg\"`;
if ($? == 0) {
$t->print ("needok \"$req\" ok");
}
else {
$t->print ("needok \"$req\" cancel");
}
}
elsif ($match eq ">PASSWORD:") {
my $line = $t->getline ();
$line =~ /.*'(.*)'.*/;
my $req = $1;
my $pass = `kdialog --title \"OpenVPN\" --password \"$req password:\"`;
if ($? == 0) {
$pass =~ s/[\r\n]//g;
}
else {
$pass = "";
}
$t->print ("password \"$req\" \"$pass\"");
}
}
}