diff --git a/auth.go b/auth.go index 6e0adcb..c4f329e 100644 --- a/auth.go +++ b/auth.go @@ -29,9 +29,9 @@ import ( // --------- System passwd/shadow auth routine(s) -------------- // Verify a password against system standard shadow file // Note auxilliary fields for expiry policy are *not* inspected. -func VerifyPass(user, password string) (bool, error) { +func VerifyPass(reader func(string) ([]byte, error), user, password string) (bool, error) { passlib.UseDefaults(passlib.Defaults20180601) - pwFileData, e := ioutil.ReadFile("/etc/shadow") + pwFileData, e := reader("/etc/shadow") if e != nil { return false, e } diff --git a/bacillus/ci_pushbuild.sh b/bacillus/ci_pushbuild.sh index 46cc42a..c49a483 100755 --- a/bacillus/ci_pushbuild.sh +++ b/bacillus/ci_pushbuild.sh @@ -25,6 +25,9 @@ ls stage "Build" make all +stage "UnitTests" +go test -v . + stage "Test(Authtoken)" echo "Clearing test user $USER ~/.xs_id file ..." rm -f ~/.xs_id diff --git a/go.mod b/go.mod index 8762b02..acded96 100644 --- a/go.mod +++ b/go.mod @@ -7,23 +7,23 @@ require ( blitter.com/go/goutmp v1.0.2 blitter.com/go/herradurakex v1.0.0 blitter.com/go/kyber v0.0.0-20200130200857-6f2021cb88d9 - blitter.com/go/mtwist v1.0.1 + blitter.com/go/mtwist v1.0.1 // indirect blitter.com/go/newhope v0.0.0-20200130200750-192fc08a8aae github.com/jameskeane/bcrypt v0.0.0-20120420032655-c3cd44c1e20f - github.com/klauspost/cpuid v1.2.2 - github.com/klauspost/reedsolomon v1.9.3 + github.com/klauspost/cpuid v1.2.2 // indirect + github.com/klauspost/reedsolomon v1.9.3 // indirect github.com/kr/pty v1.1.4 github.com/mattn/go-isatty v0.0.7 - github.com/pkg/errors v0.8.1 - github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 - github.com/templexxx/xor v0.0.0-20181023030647-4e92f724b73b - github.com/tjfoc/gmsm v1.0.1 + github.com/pkg/errors v0.8.1 // indirect + github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect + github.com/templexxx/xor v0.0.0-20181023030647-4e92f724b73b // indirect + github.com/tjfoc/gmsm v1.0.1 // indirect github.com/xtaci/kcp-go v5.4.19+incompatible github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae // indirect golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d - golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 + golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 // indirect golang.org/x/sys v0.0.0-20190902133755-9109b7679e13 - gopkg.in/hlandau/easymetric.v1 v1.0.0 - gopkg.in/hlandau/measurable.v1 v1.0.1 + gopkg.in/hlandau/easymetric.v1 v1.0.0 // indirect + gopkg.in/hlandau/measurable.v1 v1.0.1 // indirect gopkg.in/hlandau/passlib.v1 v1.0.10 ) diff --git a/vendor/modules.txt b/vendor/modules.txt index 89bf2f2..3cdfc45 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -37,19 +37,19 @@ github.com/tjfoc/gmsm/sm4 github.com/xtaci/kcp-go # golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d golang.org/x/crypto/blowfish -golang.org/x/crypto/cast5 golang.org/x/crypto/pbkdf2 +golang.org/x/crypto/twofish +golang.org/x/crypto/sha3 +golang.org/x/crypto/cast5 golang.org/x/crypto/salsa20 golang.org/x/crypto/tea -golang.org/x/crypto/twofish golang.org/x/crypto/xtea -golang.org/x/crypto/blake2b -golang.org/x/crypto/internal/subtle -golang.org/x/crypto/salsa20/salsa golang.org/x/crypto/argon2 golang.org/x/crypto/bcrypt +golang.org/x/crypto/internal/subtle +golang.org/x/crypto/salsa20/salsa +golang.org/x/crypto/blake2b golang.org/x/crypto/scrypt -golang.org/x/crypto/sha3 # golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 golang.org/x/net/ipv4 golang.org/x/net/ipv6 diff --git a/xsd/xsd.go b/xsd/xsd.go index e20096d..567e02e 100755 --- a/xsd/xsd.go +++ b/xsd/xsd.go @@ -713,7 +713,7 @@ func main() { } else { if useSystemPasswd { //var passErr error - valid, _ /*passErr*/ = xs.VerifyPass(string(rec.Who()), string(rec.AuthCookie(true))) + valid, _ /*passErr*/ = xs.VerifyPass(ioutil.ReadFile, string(rec.Who()), string(rec.AuthCookie(true))) } else { valid, allowedCmds = xs.AuthUserByPasswd(string(rec.Who()), string(rec.AuthCookie(true)), "/etc/xs.passwd") }