pallotron / yubiswitch

OSX status bar application to enable/disable Yubikey Nano
Other
872 stars 65 forks source link

Enable Yubikey coming out of sleep #46

Open jberets opened 8 years ago

jberets commented 8 years ago

It would be helpful if YubiSwitch automatically enabled the YubiKey for the usual time period when a laptop comes out of sleep. That way when a laptop was opened up, any services that needed logging into wouldn't require selecting "Enable YubiKey" from the menu first. Thanks.

pallotron commented 8 years ago

image

I think this is the behavior when you select the "Enable Yubikey when system locks/sleeps". See screenshot. You can give it a try.

jberets commented 8 years ago

Hi - Thanks for your note. I believe that's different and covers the case where a screensaver locks a system that's still on. I want it to enable the YubiKey when a laptop that has been closed wakes up on opening the lid.

On Mon, Dec 21, 2015 at 5:06 PM, Angelo Failla notifications@github.com wrote:

[image: image] https://cloud.githubusercontent.com/assets/508703/11942507/f54ce56a-a82e-11e5-9b40-f7d4925dc2a7.png

I think this is the behavior when you select the "Enable Yubikey when system locks/sleeps". See screenshot. You can give it a try.

— Reply to this email directly or view it on GitHub https://github.com/pallotron/yubiswitch/issues/46#issuecomment-166436903 .

pallotron commented 8 years ago

So, yeah, you are right, I just tried it :)

1) selected that option 2) closed lid 3) waited 10 seconds 4) reopened lid 5) my yubikey was enabled, so you could use it in the loging window (some people have login authentication for their MACs via yubikey) but they key got disabled as soon as I logged in.

I think it should be easy to make your change by hacking around here => https://github.com/pallotron/yubiswitch/blob/master/yubiswitch/ComputerStateMonitor.m#L41

but I don't have time to do this for a pretty long time, you can send me a PR if you have time/will to hack a few things around :)

pallotron commented 8 years ago

I think removing like 56-58 could do the trick, then you just have to make sure to set up a long disable timer in the preference window of the application...

jberets commented 8 years ago

A bit more detail on what the specific situation. I'm using WiFI that requires a OTP, but the laptop login doesn't. So my login procedure today is:

(1) Open cover of Mac laptop, waking it up (2) Login / unlock Mac OTP not required WiFi login popup appears (4) Enable YubiKey in the menu (5) Use YubiKey to enter OTP [network connects]

I'm trying to avoid step (4), which it seems should be possible if the YubiKey is enabled automatically when the laptop wakes up, and the rest of the steps are completed before the YubiKey automatically disables again.

I don't have an environment set up to do dev, but this looks like it might be useful regarding the notifications needed on wakeup: https://developer.apple.com/library/mac/qa/qa1340/_index.html

On Mon, Dec 21, 2015 at 5:39 PM, Angelo Failla notifications@github.com wrote:

I think removing like 56-58 could do the trick, then you just have to make sure to set up a long disable timer in the preference window of the application...

— Reply to this email directly or view it on GitHub https://github.com/pallotron/yubiswitch/issues/46#issuecomment-166443718 .

pallotron commented 8 years ago

ok I will see if I can work on it in the future, but I am pretty busy right now, I wrote this to solve a personal need, but it happened to be useful to other people :)

BTW did you know that you can enable the yubikey with an hotkey sequence of your own? for example I use cmd-option-y, and you con configure yours in the preference window.

jberets commented 8 years ago

Of course, thanks. I understand. I find it very useful as is, and so appreciate that you did it at all!

The hotkey suggestion is a good one. I'll try that for now.

On Tue, Dec 22, 2015 at 9:58 AM, Angelo Failla notifications@github.com wrote:

ok I will see if I can work on it in the future, but I am pretty busy right now, I wrote this to solve a personal need, but it happened to be useful to other people :)

BTW did you know that you can enable the yubikey with an hotkey sequence of your own? for example I use cmd-option-y, and you con configure yours in the preference window.

— Reply to this email directly or view it on GitHub https://github.com/pallotron/yubiswitch/issues/46#issuecomment-166637401 .

ishunyu commented 5 years ago

I have the opposite problem. When my computer comes out of sleep (overnight usually, just going to sleep and coming back immediately doesn't trigger this bug), the YubiSwitch menu icon indicates that the yubikey is disabled (NOT green), but I'm still able to use it to log into stuff. I have to click on the "Enable YubiKey" menu item to disable it (the menubar icon stays NOT green).

stsully commented 5 years ago

I have the same issue as ishunyu... basically it behaves like I have "Enable yubikey when the system locks/sleeps" set; but I don't. image

So here's my routine: work, work, work. Close lid, mac goes to sleep. Open lid next day. Observe: Yubikey is active/hot (despite setting it to disable after lock/sleep) Expect: Yubikey is "cold"

Workaround Add the following to crontab: 05 8 * * * osascript -e 'tell application "yubiswitch" to KeyOff' $HOME/Downloads/yubi.out 2>&1

peterschussheim commented 4 years ago

I have similar experiences as @ishunyu and @stsully... i think the gist of our issues is that YubiSwitch was created to solve a specific problem: enable/disable the yubikey from randomly sending OTP whenever the contact point is touched, usually accidently.

It might be useful to consider forking this project and adding features that suit our own needs since @pallotron is busy with work.

pallotron commented 4 years ago

It might be useful to consider forking this project and adding features that suit our own needs since @pallotron is busy with work.

that would be great! you can fork the project into your own github and send PR to be merged here? (if that's what you mean).

pallotron commented 4 years ago

alternatively, if you don't want to feel slowed down by my reviews I can make people as "collaborator" of this repo.