From b0864b66daa7e25df42f9b33e999ecfac70faa21 Mon Sep 17 00:00:00 2001 From: Markus Krogh Date: Fri, 2 Nov 2018 13:38:20 +0100 Subject: Bump go version + ubuntu. Fix pwned length --- Dockerfile | 4 ++-- docker-compose.yml | 3 ++- kdc.go | 1 - pwned.go | 6 +++--- utils.go | 4 ++++ 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8660b07..6e756bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.10 as build +FROM golang:1.11 as build WORKDIR /go/src/pwman RUN go get -d -v gopkg.in/ldap.v2 github.com/gorilla/csrf gopkg.in/jcmturner/gokrb5.v5/client gopkg.in/jcmturner/gokrb5.v5/config github.com/namsral/flag COPY *.go ./ @@ -7,7 +7,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o pwman . #FROM alpine:latest #RUN apk --no-cache add ca-certificates -FROM ubuntu:16.04 +FROM ubuntu:18.04 RUN apt-get update && \ apt-get install -y libheimdal-kadm5-perl WORKDIR /opt diff --git a/docker-compose.yml b/docker-compose.yml index 7d713fd..a5d5b96 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,4 +52,5 @@ services: - ./data/keytabs:/opt/keytabs - ./data/pwman:/opt/pwman - ./data/pwman/krb5.conf:/etc/krb5.conf:ro - - ./data/pwman/pwned-passwords-ordered-2.0.txt:/opt/pwned-passwords-ordered-2.0.txt:ro + - /Users/markus/Downloads/pwned-passwords-ordered-v3-shaonly.txt:/opt/pwned-passwords-ordered-2.0.txt:ro + #- ./data/pwman/pwned-passwords-ordered-v3.txt:/opt/pwned-passwords-ordered-2.0.txt:ro diff --git a/kdc.go b/kdc.go index 52ed0de..81dded1 100644 --- a/kdc.go +++ b/kdc.go @@ -6,7 +6,6 @@ import ( "gopkg.in/jcmturner/gokrb5.v5/config" "log" "os/exec" - "strings" ) var suffixMap map[string]string = map[string]string{ diff --git a/pwned.go b/pwned.go index a965c4d..c6083b8 100644 --- a/pwned.go +++ b/pwned.go @@ -29,11 +29,11 @@ func NewPWDB(fn string) (*pwdb, error) { return nil, err } - const rs = 63 // V2 has fixed width of 63 bytes + const hash_length = 40 // sha1 is 40 chars + const rs = hash_length + 1 // sha1 + newline if stat.Size()%rs != 0 { - return nil, fmt.Errorf("Unexpected password file format (must be a text file with 63 char width starting with sha1)") + return nil, fmt.Errorf("Unexpected password file format (must be a text file with only sha1 + newline)") } - const hash_length = 40 // sha1 is 40 chars return &pwdb{f, int(stat.Size() / rs), rs, hash_length}, nil } diff --git a/utils.go b/utils.go index c725153..178e2e8 100644 --- a/utils.go +++ b/utils.go @@ -1,5 +1,9 @@ package main +import ( + "strings" +) + func first(list []string) string { if len(list) > 0 { return list[0] -- cgit v1.1