Skip to content

Commit

Permalink
Trying with device loops and checks (#198)
Browse files Browse the repository at this point in the history
* updates to dependencies

* minor fixes on logs for certgen

* changes requested no dup log on debug

* move p1..  no reties and ugly errors... but it works

* mostly working... but only localhost? why

* adding change of path depending on lib return

* minor loop

* now with clumsy but working webauthn supporting multiple devices

* cleanup

* now with full backwards compatiblity paths

* adding checks and moving close of devices

* adding simple valiation test

* updating compiler to get latest version of strings package

* adding code for checking devices on new library. Make default on linux old one as new one is not full

* typo and logic fix

* addressing comments
  • Loading branch information
cviecco authored Jun 20, 2023
1 parent 7e617aa commit b53b689
Show file tree
Hide file tree
Showing 6 changed files with 254 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.17.x]
go-version: [1.20.x]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion keymaster.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: keymaster
Version: 1.13.2
Version: 1.13.3
Release: 1%{?dist}
Summary: Short term access certificate generator and client

Expand Down
19 changes: 15 additions & 4 deletions lib/client/twofa/twofa.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,23 @@ func authenticateUser(
}
// upgrade to u2f
successful2fa := false
useNewLib := true

// Linux support for the new library is not quite correct
// so for now we keep using the old library (pure u2f)
// for linux cli as default. Windows 10 and MacOS have been
// tested successfully.
// The env variable allows us to swap what library is used by
// default
useWebAuthh := true
if runtime.GOOS == "linux" {
useWebAuthh = false
}
if os.Getenv("KEYMASTER_USEALTU2FLIB") != "" {
useWebAuthh = !useWebAuthh
}
if !skip2fa {
if allowU2F {
if useNewLib {
//err = u2f.WithDevicesDoU2FAuthenticate(u2fhost.Devices(),
// client, baseUrl, userAgentString, logger)
if useWebAuthh {
err = u2f.WithDevicesDoWebAuthnAuthenticate(u2fhost.Devices(),
client, baseUrl, userAgentString, logger)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion lib/client/twofa/u2f/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// CheckU2FDevices checks the U2F devices and terminates the application by
// calling Fatal on the passed logger if the U2F devices cannot be read.
func CheckU2FDevices(logger log.Logger) {
func CheckU2FDevices(logger log.DebugLogger) {
checkU2FDevices(logger)
}

Expand Down
Loading

0 comments on commit b53b689

Please sign in to comment.