DataDog / yubikey

YubiKey at Datadog
MIT License
495 stars 36 forks source link

`gpg.sh` broken on Ubuntu due to slightly-different output #109

Closed ivoanjo closed 1 year ago

ivoanjo commented 1 year ago

Hey!

I'm running gpg.sh and my setup is breaking on this step:

You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
    "Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"

Real name: Ivo Anjo
E-mail address: (HANGS HERE)

I did not know a lot about what the script was doing, but poking at it I found this step...

https://github.com/DataDog/yubikey/blob/925b9f7ace0bccb3434fa8eafa813ae3b31fa688/expect.sh#L182

...and the problem is that my ykman outputs "E-mail" and not "Email".

I fixed that one and it broke again for a similar reason in

You selected this USER-ID:
    "Ivo Anjo (GPG on YubiKey for Datadog) <ivo.anjo@datadoghq.com>"

Change (N)ame, (C)omment, (E)-mail or (O)kay/(Q)uit? 

Which is in https://github.com/DataDog/yubikey/blob/925b9f7ace0bccb3434fa8eafa813ae3b31fa688/expect.sh#L188

Here's some of the versions I'm using:

ivo.anjo@rubyshade:~/datadog/yubikey$ ykman -v
YubiKey Manager (ykman) version: 5.0.0
ivo.anjo@rubyshade:~/datadog/yubikey$ env | grep LANG
LANGUAGE=en_GB:en
LANG=en_GB.UTF-8
ivo.anjo@rubyshade:~/datadog/yubikey$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:    22.04
Codename:   jammy
trishankatdatadog commented 1 year ago

Hey Ivo! Thanks for your report. Would it be possible to send a quick PR to fix this (without breaking other platforms ofc)?

daisukixci commented 1 year ago

We might need to split the expect by os. IMO it would be safer as ykman and gpg version are probably not sync between OSes

ivoanjo commented 1 year ago

Would it be possible to send a quick PR to fix this (without breaking other platforms ofc)?

Sorry for the late reply! I may not be able to open a PR for this for some time, but if nobody fixes it in the meanwhile I may take a stab at it.

daisukixci commented 1 year ago

Drafted #110 if you could test

ivoanjo commented 1 year ago

@daisukixci thanks for looking into this! :bow:

Is there a way to test it without nuking my current setup?

daisukixci commented 1 year ago

If you key is setup you cannot. I will test it once I grab an empty key then