Skip to content
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

Enable Yubikey coming out of sleep #46

Open
jberets opened this issue Dec 21, 2015 · 12 comments
Open

Enable Yubikey coming out of sleep #46

jberets opened this issue Dec 21, 2015 · 12 comments

Comments

@jberets
Copy link

jberets commented Dec 21, 2015

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
Copy link
Owner

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
Copy link
Author

jberets commented Dec 21, 2015

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
#46 (comment)
.

@pallotron
Copy link
Owner

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
Copy link
Owner

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
Copy link
Author

jberets commented Dec 22, 2015

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
#46 (comment)
.

@pallotron
Copy link
Owner

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
Copy link
Author

jberets commented Dec 22, 2015

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
#46 (comment)
.

@ishunyu
Copy link

ishunyu commented Nov 2, 2018

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
Copy link

stsully commented Feb 24, 2019

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
Copy link

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
Copy link
Owner

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants