FIDO key does not work with ssh

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

FIDO key does not work with ssh

openbsd-24
>Synopsis: ecdsa-sk no longer works with latest snapshot
>Category:
>Environment:
        System      : OpenBSD 6.7
        Details     : OpenBSD 6.7-current (GENERIC.MP) #52: Sun Aug 30 17:55:06 MDT 2020
                         [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP

        Architecture: OpenBSD.amd64
        Machine     : amd64
>Description:
        As of a recent snapshot, my Yubikey with an ecdsa-sk key no longer
        works with ssh. Where the ssh process would typically pause to confirm
        presence, now it fails immediately with the following:

                Confirm user presence for key ECDSA-SK SHA256:____
                sign_and_send_pubkey: signing failed for ECDSA-SK "$keypath": invalid format
                $user@$ip: Permission denied (publickey).
>How-To-Repeat:
        1. Insert a single Yubikey into a USB port.
        2. Generate an ecdsa-sk key with normal options, i.e. not a resident
           key.
        3. Attempt to ssh into any service that uses your ecdsa-sk key.

        This can be reproduced with or without ssh-agent running.
>Fix:
        Unknown


dmesg:
OpenBSD 6.7-current (GENERIC.MP) #52: Sun Aug 30 17:55:06 MDT 2020
    [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 17023057920 (16234MB)
avail mem = 16492101632 (15728MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 3.0 @ 0x8b1a8000 (94 entries)
bios0: vendor American Megatrends Inc. version "3801" date 03/14/2018
bios0: ASUSTeK COMPUTER INC. Z170-AR
acpi0 at bios0: ACPI 6.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC FPDT DBG2 MCFG SSDT FIDT SSDT SSDT HPET SSDT SSDT UEFI SSDT LPIT WSMT SSDT SSDT DBGP
acpi0: wakeup devices PEG0(S4) PEGP(S4) PEG1(S4) PEGP(S4) PEG2(S4) PEGP(S4) SIO1(S3) PS2K(S4) PS2M(S4) UAR1(S4) RP09(S4) PXSX(S4) RP10(S4) PXSX(S4) RP11(S4) PXSX(S4) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz, 3510.81 MHz, 06-5e-03
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SGX,BMI1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,MD_CLEAR,TSXFA,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES,MELTDOWN
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 24MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4.1, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz, 3509.52 MHz, 06-5e-03
cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SGX,BMI1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,MD_CLEAR,TSXFA,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES,MELTDOWN
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 4 (application processor)
cpu2: Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz, 3509.52 MHz, 06-5e-03
cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SGX,BMI1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,MD_CLEAR,TSXFA,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES,MELTDOWN
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 0, core 2, package 0
cpu3 at mainbus0: apid 6 (application processor)
cpu3: Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz, 3509.52 MHz, 06-5e-03
cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SGX,BMI1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,MD_CLEAR,TSXFA,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES,MELTDOWN
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 0, core 3, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 120 pins
acpimcfg0 at acpi0
acpimcfg0: addr 0xe0000000, bus 0-255
acpihpet0 at acpi0: 23999999 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (PEG0)
acpiprt2 at acpi0: bus -1 (PEG1)
acpiprt3 at acpi0: bus -1 (PEG2)
acpiprt4 at acpi0: bus 6 (RP09)
acpiprt5 at acpi0: bus -1 (RP10)
acpiprt6 at acpi0: bus -1 (RP11)
acpiprt7 at acpi0: bus -1 (RP12)
acpiprt8 at acpi0: bus -1 (RP13)
acpiprt9 at acpi0: bus 2 (RP01)
acpiprt10 at acpi0: bus -1 (RP02)
acpiprt11 at acpi0: bus 3 (RP03)
acpiprt12 at acpi0: bus -1 (RP04)
acpiprt13 at acpi0: bus -1 (RP05)
acpiprt14 at acpi0: bus 5 (RP06)
acpiprt15 at acpi0: bus -1 (RP07)
acpiprt16 at acpi0: bus -1 (RP08)
acpiprt17 at acpi0: bus 1 (RP17)
acpiprt18 at acpi0: bus -1 (RP18)
acpiprt19 at acpi0: bus -1 (RP19)
acpiprt20 at acpi0: bus -1 (RP20)
acpiprt21 at acpi0: bus -1 (RP21)
acpiprt22 at acpi0: bus -1 (RP22)
acpiprt23 at acpi0: bus -1 (RP23)
acpiprt24 at acpi0: bus -1 (RP24)
acpiprt25 at acpi0: bus -1 (RP14)
acpiprt26 at acpi0: bus -1 (RP15)
acpiprt27 at acpi0: bus -1 (RP16)
acpiec0 at acpi0: not present
acpipci0 at acpi0 PCI0: 0x00000004 0x00000011 0x00000001
extent `acpipci0 pcibus' (0x0 - 0xff), flags=0
     0xff - 0xff
extent `acpipci0 pciio' (0x0 - 0xffffffff), flags=0
     0xcf8 - 0xcff
     0x10000 - 0xffffffff
extent `acpipci0 pcimem' (0x0 - 0xffffffffffffffff), flags=0
     0x0 - 0x9ffff
     0xc0000 - 0x8fffffff
     0xe0000000 - 0xfcffffff
     0xfe800000 - 0xffffffffffffffff
acpicmos0 at acpi0
"PNP0C14" at acpi0 not configured
acpibtn0 at acpi0: SLPB
"PNP0C14" at acpi0 not configured
"INT33A1" at acpi0 not configured
acpibtn1 at acpi0: PWRB
"PNP0C14" at acpi0 not configured
acpicpu0 at acpi0: C1(@1 halt!), PSS
acpicpu1 at acpi0: C1(@1 halt!), PSS
acpicpu2 at acpi0: C1(@1 halt!), PSS
acpicpu3 at acpi0: C1(@1 halt!), PSS
acpipwrres0 at acpi0: PG00, resource for PEG0
acpipwrres1 at acpi0: PG01, resource for PEG1
acpipwrres2 at acpi0: PG02, resource for PEG2
acpipwrres3 at acpi0: WRST
acpipwrres4 at acpi0: WRST
acpipwrres5 at acpi0: WRST
acpipwrres6 at acpi0: WRST
acpipwrres7 at acpi0: WRST
acpipwrres8 at acpi0: WRST
acpipwrres9 at acpi0: WRST
acpipwrres10 at acpi0: WRST
acpipwrres11 at acpi0: WRST
acpipwrres12 at acpi0: WRST
acpipwrres13 at acpi0: WRST
acpipwrres14 at acpi0: WRST
acpipwrres15 at acpi0: WRST
acpipwrres16 at acpi0: WRST
acpipwrres17 at acpi0: WRST
acpipwrres18 at acpi0: WRST
acpipwrres19 at acpi0: WRST
acpipwrres20 at acpi0: WRST
acpipwrres21 at acpi0: WRST
acpipwrres22 at acpi0: WRST
acpivideo0 at acpi0: GFX0
acpivout0 at acpivideo0: DD1F
cpu0: using VERW MDS workaround (except on vmm entry)
cpu0: Enhanced SpeedStep 3510 MHz: speeds: 3501, 3500, 3300, 3100, 2900, 2700, 2500, 2300, 2100, 2000, 1800, 1600, 1400, 1200, 1000, 800 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel Core 6G Host" rev 0x07
inteldrm0 at pci0 dev 2 function 0 "Intel HD Graphics 530" rev 0x06
drm0 at inteldrm0
inteldrm0: msi, SKYLAKE, gen 9
xhci0 at pci0 dev 20 function 0 "Intel 100 Series xHCI" rev 0x31: msi, xHCI 1.0
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "Intel xHCI root hub" rev 3.00/1.00 addr 1
"Intel 100 Series MEI" rev 0x31 at pci0 dev 22 function 0 not configured
ahci0 at pci0 dev 23 function 0 "Intel 100 Series AHCI" rev 0x31: msi, AHCI 1.3.1
ahci0: PHY offline on port 0
ahci0: PHY offline on port 1
ahci0: port 2: 6.0Gb/s
ahci0: port 3: 6.0Gb/s
ahci0: PHY offline on port 4
ahci0: PHY offline on port 5
scsibus1 at ahci0: 32 targets
sd0 at scsibus1 targ 2 lun 0: <ATA, ST2000DX001-1NS1, CC41> naa.5000c50087c25129
sd0: 1907729MB, 512 bytes/sector, 3907029168 sectors
sd1 at scsibus1 targ 3 lun 0: <ATA, Samsung SSD 850, EMT0> naa.5002538d4070cf6e
sd1: 238475MB, 512 bytes/sector, 488397168 sectors, thin
ppb0 at pci0 dev 27 function 0 "Intel 100 Series PCIE" rev 0xf1: msi
pci1 at ppb0 bus 1
ppb1 at pci0 dev 28 function 0 "Intel 100 Series PCIE" rev 0xf1: msi
pci2 at ppb1 bus 2
xhci1 at pci2 dev 0 function 0 "ASMedia ASM1042AE xHCI" rev 0x00: msi, xHCI 1.10
usb1 at xhci1: USB revision 3.0
uhub1 at usb1 configuration 1 interface 0 "ASMedia xHCI root hub" rev 3.00/1.00 addr 1
ppb2 at pci0 dev 28 function 2 "Intel 100 Series PCIE" rev 0xf1: msi
pci3 at ppb2 bus 3
ppb3 at pci3 dev 0 function 0 "ASMedia ASM1083/1085 PCIE-PCI" rev 0x04
pci4 at ppb3 bus 4
ppb4 at pci0 dev 28 function 5 "Intel 100 Series PCIE" rev 0xf1: msi
pci5 at ppb4 bus 5
iwm0 at pci5 dev 0 function 0 "Intel Dual Band Wireless AC 7260" rev 0x73, msi
ppb5 at pci0 dev 29 function 0 "Intel 100 Series PCIE" rev 0xf1: msi
pci6 at ppb5 bus 6
nvme0 at pci6 dev 0 function 0 "Samsung SM981/PM981 NVMe" rev 0x00: msix, NVMe 1.3
nvme0: Samsung SSD 970 EVO 500GB, firmware 1B2QEXE7, serial S466NB0K616489R
scsibus2 at nvme0: 2 targets, initiator 0
sd2 at scsibus2 targ 1 lun 0: <NVMe, Samsung SSD 970, 1B2Q>
sd2: 476940MB, 512 bytes/sector, 976773168 sectors
pcib0 at pci0 dev 31 function 0 "Intel Z170 LPC" rev 0x31
"Intel 100 Series PMC" rev 0x31 at pci0 dev 31 function 2 not configured
azalia0 at pci0 dev 31 function 3 "Intel 100 Series HD Audio" rev 0x31: msi
azalia0: codecs: Realtek/0x0892, Intel/0x2809, using Realtek/0x0892
audio0 at azalia0
ichiic0 at pci0 dev 31 function 4 "Intel 100 Series SMBus" rev 0x31: apic 2 int 16
iic0 at ichiic0
sdtemp0 at iic0 addr 0x18: gt30ts00
sdtemp1 at iic0 addr 0x19: gt30ts00
em0 at pci0 dev 31 function 6 "Intel I219-V" rev 0x31: msi, address 30:5a:3a:54:cf:ea
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
lm0 at isa0 port 0x290/8: W83627DHG
vmm0 at mainbus0: VMX/EPT
uhub2 at uhub0 port 5 configuration 1 interface 0 "Texas Instruments product 0x8142" rev 2.10/1.00 addr 2
uhidev0 at uhub2 port 3 configuration 1 interface 0 "Yubico Yubikey NEO OTP+U2F+CCID" rev 2.00/3.49 addr 3
uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 variable keys, 6 key codes
wskbd1 at ukbd0 mux 1
uhidev1 at uhub2 port 3 configuration 1 interface 1 "Yubico Yubikey NEO OTP+U2F+CCID" rev 2.00/3.49 addr 3
uhidev1: iclass 3/0
fido0 at uhidev1: input=64, output=64, feature=0
ugen0 at uhub2 port 3 configuration 1 "Yubico Yubikey NEO OTP+U2F+CCID" rev 2.00/3.49 addr 3
uhidev2 at uhub0 port 10 configuration 1 interface 0 "Holtek USB Keyboard" rev 1.10/1.10 addr 4
uhidev2: iclass 3/1
ukbd1 at uhidev2: 8 variable keys, 6 key codes
wskbd2 at ukbd1 mux 1
uhidev3 at uhub0 port 10 configuration 1 interface 1 "Holtek USB Keyboard" rev 1.10/1.10 addr 4
uhidev3: iclass 3/1, 2 report ids
uhid0 at uhidev3 reportid 1: input=6, output=0, feature=0
uhid1 at uhidev3 reportid 2: input=1, output=0, feature=0
uhidev4 at uhub1 port 4 configuration 1 interface 0 "Logitech Gaming Mouse G402" rev 2.00/90.02 addr 2
uhidev4: iclass 3/1
ums0 at uhidev4: 16 buttons, Z and W dir
wsmouse0 at ums0 mux 0
uhidev5 at uhub1 port 4 configuration 1 interface 1 "Logitech Gaming Mouse G402" rev 2.00/90.02 addr 2
uhidev5: iclass 3/0, 17 report ids
ukbd2 at uhidev5 reportid 1: 8 variable keys, 6 key codes
wskbd3 at ukbd2 mux 1
uhid2 at uhidev5 reportid 3: input=4, output=0, feature=0
uhid3 at uhidev5 reportid 4: input=1, output=0, feature=0
uhid4 at uhidev5 reportid 16: input=6, output=6, feature=0
uhid5 at uhidev5 reportid 17: input=19, output=19, feature=0
vscsi0 at root
scsibus3 at vscsi0: 256 targets
softraid0 at root
scsibus4 at softraid0: 256 targets
sd3 at scsibus4 targ 1 lun 0: <OPENBSD, SR CRYPTO, 006>
sd3: 238472MB, 512 bytes/sector, 488391473 sectors
softraid0: volume sd3 is roaming, it used to be sd4, updating metadata
root on sd3a (4ff3f83b32292268.a) swap on sd3b dump on sd3b
inteldrm0: 2560x1440, 32bpp
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation), using wskbd0
wskbd1: connecting to wsdisplay0
wskbd2: connecting to wsdisplay0
uhidev_intr: bad repid 228
wskbd3: connecting to wsdisplay0
wsdisplay0: screen 1-5 added (std, vt100 emulation)
iwm0: hw rev 0x140, fw ver 17.3216344376.0, address 7c:5c:f8:2b:30:59

usbdevs:
Controller /dev/usb0:
addr 01: 8086:0000 Intel, xHCI root hub
         super speed, self powered, config 1, rev 1.00
         driver: uhub0
addr 02: 0451:8142 Texas Instruments, product 0x8142
         high speed, self powered, config 1, rev 1.00, iSerial A2000849C37F
         driver: uhub2
addr 03: 1050:0116 Yubico, Yubikey NEO OTP+U2F+CCID
         full speed, power 30 mA, config 1, rev 3.49
         driver: uhidev0
         driver: uhidev1
         driver: ugen0
addr 04: 04d9:0169 Holtek, USB Keyboard
         low speed, power 100 mA, config 1, rev 1.10
         driver: uhidev2
         driver: uhidev3
Controller /dev/usb1:
addr 01: 1b21:0000 ASMedia, xHCI root hub
         super speed, self powered, config 1, rev 1.00
         driver: uhub1
addr 02: 046d:c07e Logitech, Gaming Mouse G402
         full speed, power 300 mA, config 1, rev 90.02, iSerial 6D7524725055
         driver: uhidev4
         driver: uhidev5

Reply | Threaded
Open this post in threaded view
|

Re: FIDO key does not work with ssh

Damien Miller
On Mon, 31 Aug 2020, [hidden email] wrote:

> >Synopsis: ecdsa-sk no longer works with latest snapshot
> >Category:
> >Environment:
> System      : OpenBSD 6.7
> Details     : OpenBSD 6.7-current (GENERIC.MP) #52: Sun Aug 30 17:55:06 MDT 2020
> [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>
> Architecture: OpenBSD.amd64
> Machine     : amd64
> >Description:
> As of a recent snapshot, my Yubikey with an ecdsa-sk key no longer
> works with ssh. Where the ssh process would typically pause to confirm
> presence, now it fails immediately with the following:
>
> Confirm user presence for key ECDSA-SK SHA256:____
> sign_and_send_pubkey: signing failed for ECDSA-SK "$keypath": invalid format
> $user@$ip: Permission denied (publickey).
> >How-To-Repeat:
> 1. Insert a single Yubikey into a USB port.
> 2. Generate an ecdsa-sk key with normal options, i.e. not a resident
>   key.
> 3. Attempt to ssh into any service that uses your ecdsa-sk key.
>
> This can be reproduced with or without ssh-agent running.

Hi,

Thanks for the report - plase send the output of a failing ssh session
in verbose mode, i.e.

ssh -vvv user@host

Thanks,
Damien

Reply | Threaded
Open this post in threaded view
|

Re: FIDO key does not work with ssh

Evan Tann
On Mon Aug 31, 2020 at 6:56 PM PDT, Damien Miller wrote:

> On Mon, 31 Aug 2020, [hidden email] wrote:
>
> > >Synopsis: ecdsa-sk no longer works with latest snapshot
> > >Category:
> > >Environment:
> > System      : OpenBSD 6.7
> > Details     : OpenBSD 6.7-current (GENERIC.MP) #52: Sun Aug 30 17:55:06 MDT 2020
> > [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> >
> > Architecture: OpenBSD.amd64
> > Machine     : amd64
> > >Description:
> > As of a recent snapshot, my Yubikey with an ecdsa-sk key no longer
> > works with ssh. Where the ssh process would typically pause to confirm
> > presence, now it fails immediately with the following:
> >
> > Confirm user presence for key ECDSA-SK SHA256:____
> > sign_and_send_pubkey: signing failed for ECDSA-SK "$keypath": invalid format
> > $user@$ip: Permission denied (publickey).
> > >How-To-Repeat:
> > 1. Insert a single Yubikey into a USB port.
> > 2. Generate an ecdsa-sk key with normal options, i.e. not a resident
> >   key.
> > 3. Attempt to ssh into any service that uses your ecdsa-sk key.
> >
> > This can be reproduced with or without ssh-agent running.
>
> Hi,
>
> Thanks for the report - plase send the output of a failing ssh session
> in verbose mode, i.e.
>
> ssh -vvv user@host
>
> Thanks,
> Damien

Hi Damien,

Sure thing. Please see the output of `ssh -vvv user@host` below.

Best,

Evan

OpenSSH_8.3, LibreSSL 3.2.1
debug1: Reading configuration data /home/$myuser/.ssh/config
debug1: /home/$myuser/.ssh/config line 1: Applying options for *
debug1: /home/$myuser/.ssh/config line 11: Applying options for $myserver
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname $myip is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/$myuser/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/$myuser/.ssh/known_hosts2'
debug1: auto-mux: Trying existing master
debug1: Control socket "/home/$myuser/.ssh/31c0e4a977b4607445212bb8627b62f6ee34b72e.sock" does not exist
debug2: ssh_connect_direct
debug1: Connecting to $myip [$myip] port 22.
debug1: Connection established.
debug1: identity file /home/$myuser/.ssh/id_rsa type 0
debug1: identity file /home/$myuser/.ssh/id_rsa-cert type -1
debug1: identity file /home/$myuser/.ssh/id_dsa type -1
debug1: identity file /home/$myuser/.ssh/id_dsa-cert type -1
debug1: identity file /home/$myuser/.ssh/id_ecdsa type -1
debug1: identity file /home/$myuser/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/$myuser/.ssh/id_ecdsa_sk type 10
debug1: identity file /home/$myuser/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/$myuser/.ssh/id_ed25519 type -1
debug1: identity file /home/$myuser/.ssh/id_ed25519-cert type -1
debug1: identity file /home/$myuser/.ssh/id_ed25519_sk type -1
debug1: identity file /home/$myuser/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/$myuser/.ssh/id_xmss type -1
debug1: identity file /home/$myuser/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.3
debug1: match: OpenSSH_8.3 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to $myip:22 as '$myuser'
debug3: hostkeys_foreach: reading file "/home/$myuser/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/$myuser/.ssh/known_hosts:61
debug3: load_hostkeys: loaded 1 keys from $myip
debug3: order_hostkeyalgs: prefer hostkeyalgs: [hidden email],[hidden email],[hidden email],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[hidden email],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: [hidden email],[hidden email],[hidden email],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[hidden email],[hidden email],[hidden email],[hidden email],[hidden email],[hidden email],[hidden email],ssh-ed25519,[hidden email],rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [hidden email],aes128-ctr,aes192-ctr,aes256-ctr,[hidden email],[hidden email]
debug2: ciphers stoc: [hidden email],aes128-ctr,aes192-ctr,aes256-ctr,[hidden email],[hidden email]
debug2: MACs ctos: [hidden email],[hidden email],[hidden email],[hidden email],[hidden email],[hidden email],[hidden email],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [hidden email],[hidden email],[hidden email],[hidden email],[hidden email],[hidden email],[hidden email],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[hidden email],zlib
debug2: compression stoc: none,[hidden email],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[hidden email],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [hidden email],aes128-ctr,aes192-ctr,aes256-ctr,[hidden email],[hidden email]
debug2: ciphers stoc: [hidden email],aes128-ctr,aes192-ctr,aes256-ctr,[hidden email],[hidden email]
debug2: MACs ctos: [hidden email],[hidden email],[hidden email],[hidden email],[hidden email],[hidden email],[hidden email],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [hidden email],[hidden email],[hidden email],[hidden email],[hidden email],[hidden email],[hidden email],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[hidden email]
debug2: compression stoc: none,[hidden email]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [hidden email] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [hidden email] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:P7DtIw7f2H9affC1tQbNzaZt6eIAXWH9E54tUp8kFKo
debug3: hostkeys_foreach: reading file "/home/$myuser/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/$myuser/.ssh/known_hosts:61
debug3: load_hostkeys: loaded 1 keys from $myip
debug1: Host '$myip' is known and matches the ECDSA host key.
debug1: Found key in /home/$myuser/.ssh/known_hosts:61
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: /home/$myuser/.ssh/id_rsa RSA SHA256:2v8Wb4Dtk7c18WbM0BTK11dRHBCZDYZgaUWyLgk35jY
debug1: Will attempt key: /home/$myuser/.ssh/id_dsa
debug1: Will attempt key: /home/$myuser/.ssh/id_ecdsa
debug1: Will attempt key: /home/$myuser/.ssh/id_ecdsa_sk ECDSA-SK SHA256:GB4xULL7euanCP2PZeL3KAQS9+rbhUepIvy+tYSmfRk authenticator
debug1: Will attempt key: /home/$myuser/.ssh/id_ed25519
debug1: Will attempt key: /home/$myuser/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/$myuser/.ssh/id_xmss
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[hidden email],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[hidden email]>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/$myuser/.ssh/id_rsa RSA SHA256:2v8Wb4Dtk7c18WbM0BTK11dRHBCZDYZgaUWyLgk35jY
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/$myuser/.ssh/id_dsa
debug3: no such identity: /home/$myuser/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/$myuser/.ssh/id_ecdsa
debug3: no such identity: /home/$myuser/.ssh/id_ecdsa: No such file or directory
debug1: Offering public key: /home/$myuser/.ssh/id_ecdsa_sk ECDSA-SK SHA256:GB4xULL7euanCP2PZeL3KAQS9+rbhUepIvy+tYSmfRk authenticator
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: /home/$myuser/.ssh/id_ecdsa_sk ECDSA-SK SHA256:GB4xULL7euanCP2PZeL3KAQS9+rbhUepIvy+tYSmfRk authenticator
debug3: sign_and_send_pubkey: ECDSA-SK SHA256:GB4xULL7euanCP2PZeL3KAQS9+rbhUepIvy+tYSmfRk
debug3: sign_and_send_pubkey: signing using [hidden email] SHA256:GB4xULL7euanCP2PZeL3KAQS9+rbhUepIvy+tYSmfRk
debug3: no authentication agent, not adding key
debug3: start_helper: started pid=45801
debug3: ssh_msg_send: type 5
debug3: ssh_msg_recv entering
debug1: start_helper: starting /usr/libexec/ssh-sk-helper
debug1: ssh-sk-helper: ready to sign with key ECDSA-SK, provider internal: msg len 245, compat 0x4000000
debug1: sshsk_sign: provider "internal", key ECDSA-SK, flags 0x01
debug1: sk_probe: 1 device(s) detected
debug1: sk_probe: selecting sk by cred
debug1: sk_open: fido_dev_open /dev/fido/0 failed: FIDO_ERR_INTERNAL
debug1: sk_openv: sk_open failed
debug1: sk_select_by_cred: sk_openv failed
debug1: ssh_sk_sign: failed to find sk
debug1: sshsk_sign: sk_sign failed with code -1
debug1: ssh-sk-helper: Signing failed: invalid format
debug1: ssh-sk-helper: reply len 8
debug3: ssh_msg_send: type 5
debug1: client_converse: helper returned error -4
debug3: reap_helper: pid=45801
debug1: identity_sign: sshkey_sign: invalid format
sign_and_send_pubkey: signing failed for ECDSA-SK "/home/$myuser/.ssh/id_ecdsa_sk": invalid format
debug1: Trying private key: /home/$myuser/.ssh/id_ed25519
debug3: no such identity: /home/$myuser/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /home/$myuser/.ssh/id_ed25519_sk
debug3: no such identity: /home/$myuser/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /home/$myuser/.ssh/id_xmss
debug3: no such identity: /home/$myuser/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
$myuser@$myip: Permission denied (publickey).

Reply | Threaded
Open this post in threaded view
|

Re: FIDO key does not work with ssh

Damien Miller
On Mon, 31 Aug 2020, Evan Tann wrote:

> Hi Damien,
>
> Sure thing. Please see the output of `ssh -vvv user@host` below.

Thanks for the quick reply.

> debug1: ssh-sk-helper: ready to sign with key ECDSA-SK, provider internal: msg len 245, compat 0x4000000
> debug1: sshsk_sign: provider "internal", key ECDSA-SK, flags 0x01
> debug1: sk_probe: 1 device(s) detected
> debug1: sk_probe: selecting sk by cred
> debug1: sk_open: fido_dev_open /dev/fido/0 failed: FIDO_ERR_INTERNAL

This is what is failing. You might be able to get more detail by
placing libfido2 in debug mode:

env FIDO_DEBUG=1 ssh -vvv ...

But please also try updating src/sys/dev/usb/uhidev.c up to 1.83 (the
current revision) and rebuilding your kernel. There was an attempt at
working around a xhci(4) problem that caused more problems that it
solved. The bad commit was included in the kernel you are running but
was since backed out.

Per your dmesg, fido0 -> uhub2 -> uhub0 -> xhci0 so it may well be that.

-d

Reply | Threaded
Open this post in threaded view
|

Re: FIDO key does not work with ssh

openbsd-24
On Mon Aug 31, 2020 at 8:17 PM PDT, Damien Miller wrote:

> On Mon, 31 Aug 2020, Evan Tann wrote:
>
> > Hi Damien,
> >
> > Sure thing. Please see the output of `ssh -vvv user@host` below.
>
> Thanks for the quick reply.
>
> > debug1: ssh-sk-helper: ready to sign with key ECDSA-SK, provider internal: msg len 245, compat 0x4000000
> > debug1: sshsk_sign: provider "internal", key ECDSA-SK, flags 0x01
> > debug1: sk_probe: 1 device(s) detected
> > debug1: sk_probe: selecting sk by cred
> > debug1: sk_open: fido_dev_open /dev/fido/0 failed: FIDO_ERR_INTERNAL
>
> This is what is failing. You might be able to get more detail by
> placing libfido2 in debug mode:
>
> env FIDO_DEBUG=1 ssh -vvv ...
>
> But please also try updating src/sys/dev/usb/uhidev.c up to 1.83 (the
> current revision) and rebuilding your kernel. There was an attempt at
> working around a xhci(4) problem that caused more problems that it
> solved. The bad commit was included in the kernel you are running but
> was since backed out.
>
> Per your dmesg, fido0 -> uhub2 -> uhub0 -> xhci0 so it may well be that.
>
> -d

Hi Damien,

The latest snapshot fixed the issue. Thank you!

Evan