diff options
author | Markus Krogh <markus@nordu.net> | 2018-11-02 13:38:20 +0100 |
---|---|---|
committer | Markus Krogh <markus@nordu.net> | 2018-11-02 13:38:20 +0100 |
commit | b0864b66daa7e25df42f9b33e999ecfac70faa21 (patch) | |
tree | f10dea57fd508e333b11dfd98c22e179b3eea2cd | |
parent | 2fa87628ed738f6bf4be2bf0e3285402b32ebd0f (diff) |
Bump go version + ubuntu. Fix pwned length
-rw-r--r-- | Dockerfile | 4 | ||||
-rw-r--r-- | docker-compose.yml | 3 | ||||
-rw-r--r-- | kdc.go | 1 | ||||
-rw-r--r-- | pwned.go | 6 | ||||
-rw-r--r-- | utils.go | 4 |
5 files changed, 11 insertions, 7 deletions
@@ -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 @@ -6,7 +6,6 @@ import ( "gopkg.in/jcmturner/gokrb5.v5/config" "log" "os/exec" - "strings" ) var suffixMap map[string]string = map[string]string{ @@ -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 } @@ -1,5 +1,9 @@ package main +import ( + "strings" +) + func first(list []string) string { if len(list) > 0 { return list[0] |