@@ -22,6 +22,12 @@ class YubikeyHandler {
22
22
private val LOG = logger<YubikeyHandler >()
23
23
}
24
24
25
+ private val openscPath = if (SystemInfo .isLinux) {
26
+ " usr/lib/x86_64-linux-gnu/opensc-pkcs11.so"
27
+ } else {
28
+ " /usr/local/lib/opensc-pkcs11.so"
29
+ }
30
+
25
31
fun autoReset (project : Project , onFail : Runnable ): Boolean {
26
32
LOG .info(" Try auto reset Yubikey" )
27
33
val resetScript = createScriptIfNotExists(project) ? : return false
@@ -44,11 +50,7 @@ class YubikeyHandler {
44
50
PasswordSafe .instance.getPassword(credentialAttributes)!!
45
51
}
46
52
47
- val openscPath = if (SystemInfo .isLinux) {
48
- " usr/lib/x86_64-linux-gnu/opensc-pkcs11.so"
49
- } else {
50
- " /usr/local/lib/opensc-pkcs11.so"
51
- }
53
+
52
54
53
55
val evalOutput = CommandRunner .runLocallyEval(" ssh-agent -s" )
54
56
if (evalOutput == null ) {
@@ -64,10 +66,8 @@ class YubikeyHandler {
64
66
65
67
val echoBuilder = ProcessBuilder (" echo" , password)
66
68
67
- val sshResetKey = CommandRunner .runLocally(project," ssh-add -e $openscPath " )
68
-
69
+ val sshResetKey = CommandRunner .runLocally(project, " ssh-add -e $openscPath " )
69
70
val resetOk = sshResetKey.stderr.contains(" Card removed" )
70
-
71
71
if (! resetOk) {
72
72
LOG .warn(" Yubikey reset error: ${sshResetKey.stderr} " )
73
73
showYubikeyResetFailNotification(project, " Unable to reset yubikey" , null , onFail)
0 commit comments