From 332f415db3c8dd9b317a104775dffd5c1f519b0a Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 10:02:22 +0100 Subject: [PATCH 01/42] Fix ADFS --- handlers/handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/handlers.go b/handlers/handlers.go index f826fce6..475a035f 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -48,7 +48,7 @@ var ( func randString() string { b := make([]byte, 32) rand.Read(b) - return base64.StdEncoding.EncodeToString(b) + return base64.URLEncoding.EncodeToString(b) } func loginURL(r *http.Request, state string) string { From 407f65869efec10ccc77144c75b3216059a54efc Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 10:05:01 +0100 Subject: [PATCH 02/42] temp debug cookie domain --- pkg/cookie/cookie.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index f6a140b3..95cbd6f0 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -24,6 +24,7 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { } domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file + log.Debugf("temp debug - cookie domain to %v", cfg.Cfg.Cookie.Domain) if cfg.Cfg.Cookie.Domain != "" { domain = cfg.Cfg.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) From 46911c1c4900ce37b7330ad50d4bfaf65f3b5266 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 10:28:11 +0100 Subject: [PATCH 03/42] temp debug --- pkg/cookie/cookie.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 95cbd6f0..2464e386 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -24,7 +24,8 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { } domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file - log.Debugf("temp debug - cookie domain to %v", cfg.Cfg.Cookie.Domain) + log.Debugf("temp debug - cookie domain: %v", cfg.Cfg.Cookie.Domain) + log.Debugf("temp debug - cfg: %v", cfg.Cfg) if cfg.Cfg.Cookie.Domain != "" { domain = cfg.Cfg.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) From aa65c7b1eac173336dbdd4d32bbce8bf9e560fdb Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 10:42:49 +0100 Subject: [PATCH 04/42] test Cfg --- pkg/cookie/cookie.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 2464e386..a0027048 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -24,8 +24,8 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { } domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file - log.Debugf("temp debug - cookie domain: %v", cfg.Cfg.Cookie.Domain) - log.Debugf("temp debug - cfg: %v", cfg.Cfg) + log.Debugf("temp debug - cookie domain: %v", Cfg.Cookie.Domain) + log.Debugf("temp debug - cfg: %v", Cfg) if cfg.Cfg.Cookie.Domain != "" { domain = cfg.Cfg.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) From 707eed8df6fea89414bd09c781e94f6029749bb9 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 10:46:04 +0100 Subject: [PATCH 05/42] test --- pkg/cookie/cookie.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index a0027048..cce866d7 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -6,7 +6,7 @@ import ( // "github.com/vouch/vouch-proxy/pkg/structs" log "github.com/Sirupsen/logrus" - "github.com/vouch/vouch-proxy/pkg/cfg" + Cfg "github.com/vouch/vouch-proxy/pkg/cfg" "github.com/vouch/vouch-proxy/pkg/domains" ) From eed8998a36c2b4ddda1d92ffb0554d0b0572056c Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 10:48:02 +0100 Subject: [PATCH 06/42] test --- pkg/cookie/cookie.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index cce866d7..83e40311 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -10,7 +10,7 @@ import ( "github.com/vouch/vouch-proxy/pkg/domains" ) -var defaultMaxAge = cfg.Cfg.JWT.MaxAge * 60 +var defaultMaxAge = Cfg.JWT.MaxAge * 60 // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { @@ -26,25 +26,25 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { // Allow overriding the cookie domain in the config file log.Debugf("temp debug - cookie domain: %v", Cfg.Cookie.Domain) log.Debugf("temp debug - cfg: %v", Cfg) - if cfg.Cfg.Cookie.Domain != "" { - domain = cfg.Cfg.Cookie.Domain + if Cfg.Cookie.Domain != "" { + domain = Cfg.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) } // log.Debugf("cookie %s expires %d", cfg.Cfg.Cookie.Name, expires) http.SetCookie(w, &http.Cookie{ - Name: cfg.Cfg.Cookie.Name, + Name: Cfg.Cookie.Name, Value: val, Path: "/", Domain: domain, MaxAge: maxAge, - Secure: cfg.Cfg.Cookie.Secure, - HttpOnly: cfg.Cfg.Cookie.HTTPOnly, + Secure: Cfg.Cookie.Secure, + HttpOnly: Cfg.Cookie.HTTPOnly, }) } // Cookie get the vouch jwt cookie func Cookie(r *http.Request) (string, error) { - cookie, err := r.Cookie(cfg.Cfg.Cookie.Name) + cookie, err := r.Cookie(Cfg.Cookie.Name) if err != nil { return "", err } @@ -53,7 +53,7 @@ func Cookie(r *http.Request) (string, error) { } log.WithFields(log.Fields{ - "cookieName": cfg.Cfg.Cookie.Name, + "cookieName": Cfg.Cookie.Name, "cookieValue": cookie.Value, }).Debug("cookie") return cookie.Value, err From 0081c8cbc9b0072d99624384f7a336f42ec2790a Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 10:53:04 +0100 Subject: [PATCH 07/42] test --- pkg/cookie/cookie.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 83e40311..03b43e92 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -6,11 +6,11 @@ import ( // "github.com/vouch/vouch-proxy/pkg/structs" log "github.com/Sirupsen/logrus" - Cfg "github.com/vouch/vouch-proxy/pkg/cfg" + "github.com/vouch/vouch-proxy/pkg/cfg" "github.com/vouch/vouch-proxy/pkg/domains" ) -var defaultMaxAge = Cfg.JWT.MaxAge * 60 +var defaultMaxAge = cfg.Cfg.JWT.MaxAge * 60 // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { @@ -24,27 +24,27 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { } domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file - log.Debugf("temp debug - cookie domain: %v", Cfg.Cookie.Domain) - log.Debugf("temp debug - cfg: %v", Cfg) - if Cfg.Cookie.Domain != "" { - domain = Cfg.Cookie.Domain + log.Debugf("temp debug - cookie domain: %v", cfg.Cfg.Cookie.Domain) + log.Debugf("temp debug - cfg: %v", cfg) + if cfg.Cfg.Cookie.Domain != "" { + domain = cfg.Cfg.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) } // log.Debugf("cookie %s expires %d", cfg.Cfg.Cookie.Name, expires) http.SetCookie(w, &http.Cookie{ - Name: Cfg.Cookie.Name, + Name: cfg.Cfg.Cookie.Name, Value: val, Path: "/", Domain: domain, MaxAge: maxAge, - Secure: Cfg.Cookie.Secure, - HttpOnly: Cfg.Cookie.HTTPOnly, + Secure: cfg.Cfg.Cookie.Secure, + HttpOnly: cfg.Cfg.Cookie.HTTPOnly, }) } // Cookie get the vouch jwt cookie func Cookie(r *http.Request) (string, error) { - cookie, err := r.Cookie(Cfg.Cookie.Name) + cookie, err := r.Cookie(cfg.Cfg.Cookie.Name) if err != nil { return "", err } @@ -53,7 +53,7 @@ func Cookie(r *http.Request) (string, error) { } log.WithFields(log.Fields{ - "cookieName": Cfg.Cookie.Name, + "cookieName": cfg.Cfg.Cookie.Name, "cookieValue": cookie.Value, }).Debug("cookie") return cookie.Value, err From 7e9f96720fc33650769dd48db8ce8da8641e5a3d Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 10:54:31 +0100 Subject: [PATCH 08/42] pretty print --- pkg/cookie/cookie.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 03b43e92..b4d10470 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -25,7 +25,7 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file log.Debugf("temp debug - cookie domain: %v", cfg.Cfg.Cookie.Domain) - log.Debugf("temp debug - cfg: %v", cfg) + log.Debugf("temp debug - cfg: %v", pretty.Formatter(cfg)) if cfg.Cfg.Cookie.Domain != "" { domain = cfg.Cfg.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) From 0b55ea9f98724d26aa1ae0c8201f1ac6e8ba8a6c Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 11:00:49 +0100 Subject: [PATCH 09/42] test --- pkg/cookie/cookie.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index b4d10470..badf025b 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -25,7 +25,8 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file log.Debugf("temp debug - cookie domain: %v", cfg.Cfg.Cookie.Domain) - log.Debugf("temp debug - cfg: %v", pretty.Formatter(cfg)) + log.Debugf("temp debug - cookie: %v", cfg.Cfg.Cookie) + log.Debugf("temp debug - cfg: %v", pretty.Formatter(cfg.Cfg)) if cfg.Cfg.Cookie.Domain != "" { domain = cfg.Cfg.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) From 53feba754a323638b253737cbd550e606a55b872 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 11:02:43 +0100 Subject: [PATCH 10/42] add pretty --- pkg/cookie/cookie.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index badf025b..1ddb66ff 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -8,6 +8,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/vouch/vouch-proxy/pkg/cfg" "github.com/vouch/vouch-proxy/pkg/domains" + "github.com/kr/pretty" ) var defaultMaxAge = cfg.Cfg.JWT.MaxAge * 60 From aacb434da894c1bac78132e523b8f00dec07cbcb Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 11:12:52 +0100 Subject: [PATCH 11/42] cookieConfig --- pkg/cookie/cookie.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 1ddb66ff..9372fd1c 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -12,6 +12,7 @@ import ( ) var defaultMaxAge = cfg.Cfg.JWT.MaxAge * 60 +var cookieConfig = cfg.Cfg.Cookie // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { @@ -28,6 +29,8 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { log.Debugf("temp debug - cookie domain: %v", cfg.Cfg.Cookie.Domain) log.Debugf("temp debug - cookie: %v", cfg.Cfg.Cookie) log.Debugf("temp debug - cfg: %v", pretty.Formatter(cfg.Cfg)) + log.Debugf("temp debug - host: %v", r.Host) + log.Debugf("temp debug - cookieConfig: %v", cookieConfig) if cfg.Cfg.Cookie.Domain != "" { domain = cfg.Cfg.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) From 205060e324689cc8b911debb11783b827885c49c Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 11:35:29 +0100 Subject: [PATCH 12/42] debug main --- main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/main.go b/main.go index 68060d03..6762cafb 100644 --- a/main.go +++ b/main.go @@ -36,6 +36,7 @@ func init() { } func main() { + log.Debugf("debug - main cfg %s", cfg.Cfg) var listen = cfg.Cfg.Listen + ":" + strconv.Itoa(cfg.Cfg.Port) log.WithFields(log.Fields{ // "semver": semver, From 3f2f47754d4c261b82327fe75607b1049f53f8d3 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 11:44:37 +0100 Subject: [PATCH 13/42] change git repo --- .travis.yml | 2 +- Dockerfile | 6 +++--- README.md | 4 ++-- do.sh | 2 +- handlers/handlers.go | 12 ++++++------ main.go | 10 +++++----- pkg/cfg/cfg.go | 8 ++++---- pkg/cfg/cfg_test.go | 2 +- pkg/cookie/cookie.go | 6 +++--- pkg/domains/domains.go | 2 +- pkg/jwtmanager/jwtmanager.go | 4 ++-- pkg/jwtmanager/jwtmanager_test.go | 4 ++-- pkg/model/model.go | 2 +- pkg/model/model_test.go | 2 +- pkg/model/site.go | 2 +- pkg/model/team.go | 2 +- pkg/model/user.go | 2 +- pkg/timelog/timelog.go | 2 +- pkg/transciever/client.go | 4 ++-- templates/index.tmpl | 6 +++--- 20 files changed, 42 insertions(+), 42 deletions(-) diff --git a/.travis.yml b/.travis.yml index 553749ec..91a5299e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: go -go_import_path: github.com/vouch/vouch-proxy +go_import_path: github.com/simongottschlag/vouch-proxy sudo: false diff --git a/Dockerfile b/Dockerfile index 9847df0c..d583e0c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ # voucher/vouch-proxy -# https://github.com/vouch/vouch-proxy +# https://github.com/simongottschlag/vouch-proxy FROM golang:1.10 AS builder LABEL maintainer="vouch@bnf.net" -RUN mkdir -p ${GOPATH}/src/github.com/vouch/vouch-proxy -WORKDIR ${GOPATH}/src/github.com/vouch/vouch-proxy +RUN mkdir -p ${GOPATH}/src/github.com/simongottschlag/vouch-proxy +WORKDIR ${GOPATH}/src/github.com/simongottschlag/vouch-proxy COPY . . diff --git a/README.md b/README.md index 8545755b..019cd9b2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Vouch Proxy # Renaming project to **Vouch Proxy** in January 2019 -In January the project was renamed to [vouch/vouch-proxy](https://github.com/vouch/vouch-proxy) from `LassoProject/lasso`. This is to [avoid a naming conflict](https://github.com/vouch/vouch-proxy/issues/35) with another project. +In January the project was renamed to [vouch/vouch-proxy](https://github.com/simongottschlag/vouch-proxy) from `LassoProject/lasso`. This is to [avoid a naming conflict](https://github.com/simongottschlag/vouch-proxy/issues/35) with another project. Other namespaces have been changed including the docker hub repo [lassoproject/lasso](https://hub.docker.com/r/lassoproject/lasso/) which has become [voucher/vouch-proxy](https://hub.docker.com/r/voucher/vouch-proxy) @@ -85,7 +85,7 @@ server { proxy_pass http://dev.yourdomain.com:8080; # may need to set # auth_request_set $auth_resp_x_vouch_user $upstream_http_x_vouch_user - # in this bock as per https://github.com/vouch/vouch-proxy/issues/26#issuecomment-425215810 + # in this bock as per https://github.com/simongottschlag/vouch-proxy/issues/26#issuecomment-425215810 # set user header (usually an email) proxy_set_header X-Vouch-User $auth_resp_x_vouch_user; } diff --git a/do.sh b/do.sh index 8dcdbb55..40ac8dc7 100755 --- a/do.sh +++ b/do.sh @@ -7,7 +7,7 @@ SCRIPT=$(readlink -f "$0") SDIR=$(dirname "$SCRIPT") cd $SDIR -export VOUCH_ROOT=${GOPATH}/src/github.com/vouch/vouch-proxy/ +export VOUCH_ROOT=${GOPATH}/src/github.com/simongottschlag/vouch-proxy/ IMAGE=voucher/vouch-proxy GOIMAGE=golang:1.10 diff --git a/handlers/handlers.go b/handlers/handlers.go index 475a035f..b98ad53a 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -15,12 +15,12 @@ import ( log "github.com/Sirupsen/logrus" "github.com/gorilla/sessions" - "github.com/vouch/vouch-proxy/pkg/cfg" - "github.com/vouch/vouch-proxy/pkg/cookie" - "github.com/vouch/vouch-proxy/pkg/domains" - "github.com/vouch/vouch-proxy/pkg/jwtmanager" - "github.com/vouch/vouch-proxy/pkg/model" - "github.com/vouch/vouch-proxy/pkg/structs" + "github.com/simongottschlag/vouch-proxy/pkg/cfg" + "github.com/simongottschlag/vouch-proxy/pkg/cookie" + "github.com/simongottschlag/vouch-proxy/pkg/domains" + "github.com/simongottschlag/vouch-proxy/pkg/jwtmanager" + "github.com/simongottschlag/vouch-proxy/pkg/model" + "github.com/simongottschlag/vouch-proxy/pkg/structs" "golang.org/x/oauth2" ) diff --git a/main.go b/main.go index 6762cafb..06070e36 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,7 @@ package main // vouch -// github.com/vouch/vouch-proxy +// github.com/simongottschlag/vouch-proxy import ( "net/http" @@ -13,10 +13,10 @@ import ( "github.com/gorilla/mux" - "github.com/vouch/vouch-proxy/handlers" - "github.com/vouch/vouch-proxy/pkg/cfg" - "github.com/vouch/vouch-proxy/pkg/timelog" - tran "github.com/vouch/vouch-proxy/pkg/transciever" + "github.com/simongottschlag/vouch-proxy/handlers" + "github.com/simongottschlag/vouch-proxy/pkg/cfg" + "github.com/simongottschlag/vouch-proxy/pkg/timelog" + tran "github.com/simongottschlag/vouch-proxy/pkg/transciever" ) // version and semver get overwritten by build with diff --git a/pkg/cfg/cfg.go b/pkg/cfg/cfg.go index 251ec7f0..977630c4 100644 --- a/pkg/cfg/cfg.go +++ b/pkg/cfg/cfg.go @@ -87,12 +87,12 @@ type branding struct { UCName string // upper case CcName string // camel case OldLCName string // lasso - URL string // https://github.com/vouch/vouch-proxy + URL string // https://github.com/simongottschlag/vouch-proxy } var ( // Branding that's our name - Branding = branding{"vouch", "VOUCH", "Vouch", "lasso", "https://github.com/vouch/vouch-proxy"} + Branding = branding{"vouch", "VOUCH", "Vouch", "lasso", "https://github.com/simongottschlag/vouch-proxy"} // Cfg the main exported config variable Cfg config @@ -441,7 +441,7 @@ func setDefaultsGitHub() { GenOAuth.UserInfoURL = "https://api.github.com/user?access_token=" } if len(GenOAuth.Scopes) == 0 { - // https://github.com/vouch/vouch-proxy/issues/63 + // https://github.com/simongottschlag/vouch-proxy/issues/63 // https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/ GenOAuth.Scopes = []string{"read:user"} } @@ -472,7 +472,7 @@ func getOrGenerateJWTSecret() string { log.Warn("generating random jwt.secret and storing it in " + secretFile) // make sure to create 256 bits for the secret - // see https://github.com/vouch/vouch-proxy/issues/54 + // see https://github.com/simongottschlag/vouch-proxy/issues/54 rstr, err := securerandom.Base64OfBytes(base64Bytes) if err != nil { log.Error(err) diff --git a/pkg/cfg/cfg_test.go b/pkg/cfg/cfg_test.go index b4a8aba7..918cd326 100644 --- a/pkg/cfg/cfg_test.go +++ b/pkg/cfg/cfg_test.go @@ -2,7 +2,7 @@ package cfg import ( "testing" - // "github.com/vouch/vouch-proxy/pkg/structs" + // "github.com/simongottschlag/vouch-proxy/pkg/structs" // log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus" "github.com/stretchr/testify/assert" diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 9372fd1c..63f55751 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -4,10 +4,10 @@ import ( "errors" "net/http" - // "github.com/vouch/vouch-proxy/pkg/structs" + // "github.com/simongottschlag/vouch-proxy/pkg/structs" log "github.com/Sirupsen/logrus" - "github.com/vouch/vouch-proxy/pkg/cfg" - "github.com/vouch/vouch-proxy/pkg/domains" + "github.com/simongottschlag/vouch-proxy/pkg/cfg" + "github.com/simongottschlag/vouch-proxy/pkg/domains" "github.com/kr/pretty" ) diff --git a/pkg/domains/domains.go b/pkg/domains/domains.go index d90fa88d..189d78d6 100644 --- a/pkg/domains/domains.go +++ b/pkg/domains/domains.go @@ -5,7 +5,7 @@ import ( "strings" log "github.com/Sirupsen/logrus" - "github.com/vouch/vouch-proxy/pkg/cfg" + "github.com/simongottschlag/vouch-proxy/pkg/cfg" ) var domains = cfg.Cfg.Domains diff --git a/pkg/jwtmanager/jwtmanager.go b/pkg/jwtmanager/jwtmanager.go index f6f7558e..0697febd 100644 --- a/pkg/jwtmanager/jwtmanager.go +++ b/pkg/jwtmanager/jwtmanager.go @@ -11,8 +11,8 @@ import ( "time" log "github.com/Sirupsen/logrus" - "github.com/vouch/vouch-proxy/pkg/cfg" - "github.com/vouch/vouch-proxy/pkg/structs" + "github.com/simongottschlag/vouch-proxy/pkg/cfg" + "github.com/simongottschlag/vouch-proxy/pkg/structs" jwt "github.com/dgrijalva/jwt-go" ) diff --git a/pkg/jwtmanager/jwtmanager_test.go b/pkg/jwtmanager/jwtmanager_test.go index 95a3d873..e47e7729 100644 --- a/pkg/jwtmanager/jwtmanager_test.go +++ b/pkg/jwtmanager/jwtmanager_test.go @@ -3,8 +3,8 @@ package jwtmanager import ( "testing" - "github.com/vouch/vouch-proxy/pkg/cfg" - "github.com/vouch/vouch-proxy/pkg/structs" + "github.com/simongottschlag/vouch-proxy/pkg/cfg" + "github.com/simongottschlag/vouch-proxy/pkg/structs" // log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus" diff --git a/pkg/model/model.go b/pkg/model/model.go index e8355448..8c678c2c 100644 --- a/pkg/model/model.go +++ b/pkg/model/model.go @@ -10,7 +10,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/boltdb/bolt" - "github.com/vouch/vouch-proxy/pkg/cfg" + "github.com/simongottschlag/vouch-proxy/pkg/cfg" ) var ( diff --git a/pkg/model/model_test.go b/pkg/model/model_test.go index f875de49..e150818d 100644 --- a/pkg/model/model_test.go +++ b/pkg/model/model_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/vouch/vouch-proxy/pkg/structs" + "github.com/simongottschlag/vouch-proxy/pkg/structs" ) var testdb = "/tmp/storage-test.db" diff --git a/pkg/model/site.go b/pkg/model/site.go index 8a4f5f55..f2b0a801 100644 --- a/pkg/model/site.go +++ b/pkg/model/site.go @@ -7,7 +7,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/boltdb/bolt" - "github.com/vouch/vouch-proxy/pkg/structs" + "github.com/simongottschlag/vouch-proxy/pkg/structs" ) // PutSite inna da db diff --git a/pkg/model/team.go b/pkg/model/team.go index 6bb926c4..22aa8acf 100644 --- a/pkg/model/team.go +++ b/pkg/model/team.go @@ -8,7 +8,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/boltdb/bolt" - "github.com/vouch/vouch-proxy/pkg/structs" + "github.com/simongottschlag/vouch-proxy/pkg/structs" ) // PutTeam - create or update a team diff --git a/pkg/model/user.go b/pkg/model/user.go index 15f86949..344678c5 100644 --- a/pkg/model/user.go +++ b/pkg/model/user.go @@ -8,7 +8,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/boltdb/bolt" - "github.com/vouch/vouch-proxy/pkg/structs" + "github.com/simongottschlag/vouch-proxy/pkg/structs" ) // PutUser inna da db diff --git a/pkg/timelog/timelog.go b/pkg/timelog/timelog.go index 29052f15..2f95c71e 100644 --- a/pkg/timelog/timelog.go +++ b/pkg/timelog/timelog.go @@ -8,7 +8,7 @@ import ( "strconv" "time" - "github.com/vouch/vouch-proxy/pkg/response" + "github.com/simongottschlag/vouch-proxy/pkg/response" log "github.com/Sirupsen/logrus" isatty "github.com/mattn/go-isatty" diff --git a/pkg/transciever/client.go b/pkg/transciever/client.go index 6d862a87..1a0bb393 100644 --- a/pkg/transciever/client.go +++ b/pkg/transciever/client.go @@ -6,8 +6,8 @@ import ( "net/http" "time" - "github.com/vouch/vouch-proxy/pkg/model" - "github.com/vouch/vouch-proxy/pkg/structs" + "github.com/simongottschlag/vouch-proxy/pkg/model" + "github.com/simongottschlag/vouch-proxy/pkg/structs" log "github.com/Sirupsen/logrus" "github.com/mitchellh/mapstructure" diff --git a/templates/index.tmpl b/templates/index.tmpl index 5c9b0df6..de4fd0c5 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -7,8 +7,8 @@ {{ if .Testing }}

@@ -33,7 +33,7 @@ All 302 redirects will be captured and presented as links here For support, please contact your network administrator or whomever configured nginx to use Vouch Proxy.

-For help with Vouch Proxy or to file a bug report, please see the project page at https://github.com/vouch/vouch-proxy +For help with Vouch Proxy or to file a bug report, please see the project page at https://github.com/simongottschlag/vouch-proxy

From 457db078fea5cf28c62db3c4eecbcde225fc4a35 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 11:56:57 +0100 Subject: [PATCH 14/42] debug viper --- pkg/cfg/cfg.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/cfg/cfg.go b/pkg/cfg/cfg.go index 977630c4..a15a5e4f 100644 --- a/pkg/cfg/cfg.go +++ b/pkg/cfg/cfg.go @@ -165,6 +165,7 @@ func init() { } log.Debug(viper.AllSettings()) + log.Debugf("temp debug - all settings: %v", viper.AllSettings()) } // ParseConfig parse the config file From bffe2fe34f64762d399fd8a004c5f49a22138bbd Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 12:15:59 +0100 Subject: [PATCH 15/42] test viper in cookie --- pkg/cookie/cookie.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 63f55751..a6f87a59 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -8,11 +8,11 @@ import ( log "github.com/Sirupsen/logrus" "github.com/simongottschlag/vouch-proxy/pkg/cfg" "github.com/simongottschlag/vouch-proxy/pkg/domains" - "github.com/kr/pretty" + "github.com/spf13/viper" ) var defaultMaxAge = cfg.Cfg.JWT.MaxAge * 60 -var cookieConfig = cfg.Cfg.Cookie +var cookieConfig = viper.AllSettings() // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { @@ -28,7 +28,7 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { // Allow overriding the cookie domain in the config file log.Debugf("temp debug - cookie domain: %v", cfg.Cfg.Cookie.Domain) log.Debugf("temp debug - cookie: %v", cfg.Cfg.Cookie) - log.Debugf("temp debug - cfg: %v", pretty.Formatter(cfg.Cfg)) + log.Debugf("temp debug - cfg: %v", cfg.Cfg) log.Debugf("temp debug - host: %v", r.Host) log.Debugf("temp debug - cookieConfig: %v", cookieConfig) if cfg.Cfg.Cookie.Domain != "" { From b7d070da50cea2c4278e4d4e7e4aaa61de4b5aa2 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 12:20:41 +0100 Subject: [PATCH 16/42] change cfg.Cfg to config --- pkg/cookie/cookie.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index a6f87a59..9d872080 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -11,8 +11,8 @@ import ( "github.com/spf13/viper" ) -var defaultMaxAge = cfg.Cfg.JWT.MaxAge * 60 -var cookieConfig = viper.AllSettings() +var defaultMaxAge = config.JWT.MaxAge * 60 +var config = viper.AllSettings() // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { @@ -26,30 +26,30 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { } domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file - log.Debugf("temp debug - cookie domain: %v", cfg.Cfg.Cookie.Domain) - log.Debugf("temp debug - cookie: %v", cfg.Cfg.Cookie) + log.Debugf("temp debug - cookie domain: %v", config.Cookie.Domain) + log.Debugf("temp debug - cookie: %v", config.Cookie) log.Debugf("temp debug - cfg: %v", cfg.Cfg) log.Debugf("temp debug - host: %v", r.Host) log.Debugf("temp debug - cookieConfig: %v", cookieConfig) - if cfg.Cfg.Cookie.Domain != "" { - domain = cfg.Cfg.Cookie.Domain + if config.Cookie.Domain != "" { + domain = config.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) } - // log.Debugf("cookie %s expires %d", cfg.Cfg.Cookie.Name, expires) + // log.Debugf("cookie %s expires %d", config.Cookie.Name, expires) http.SetCookie(w, &http.Cookie{ - Name: cfg.Cfg.Cookie.Name, + Name: config.Cookie.Name, Value: val, Path: "/", Domain: domain, MaxAge: maxAge, - Secure: cfg.Cfg.Cookie.Secure, - HttpOnly: cfg.Cfg.Cookie.HTTPOnly, + Secure: config.Cookie.Secure, + HttpOnly: config.Cookie.HTTPOnly, }) } // Cookie get the vouch jwt cookie func Cookie(r *http.Request) (string, error) { - cookie, err := r.Cookie(cfg.Cfg.Cookie.Name) + cookie, err := r.Cookie(config.Cookie.Name) if err != nil { return "", err } @@ -58,7 +58,7 @@ func Cookie(r *http.Request) (string, error) { } log.WithFields(log.Fields{ - "cookieName": cfg.Cfg.Cookie.Name, + "cookieName": config.Cookie.Name, "cookieValue": cookie.Value, }).Debug("cookie") return cookie.Value, err From 6614288f2770396ec6944b5dc69d76aa93fdcbca Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 12:23:31 +0100 Subject: [PATCH 17/42] place config before defaultMaxAge --- pkg/cookie/cookie.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 9d872080..ea78b735 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -11,8 +11,8 @@ import ( "github.com/spf13/viper" ) -var defaultMaxAge = config.JWT.MaxAge * 60 var config = viper.AllSettings() +var defaultMaxAge = config.JWT.MaxAge * 60 // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { From f580ad5aedc6c2630b07c28c9dbe43ac5a0f57ef Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 12:37:20 +0100 Subject: [PATCH 18/42] test resturn Cfg --- pkg/cfg/cfg.go | 3 ++- pkg/cookie/cookie.go | 23 +++++++++-------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/pkg/cfg/cfg.go b/pkg/cfg/cfg.go index a15a5e4f..a8f9e4e1 100644 --- a/pkg/cfg/cfg.go +++ b/pkg/cfg/cfg.go @@ -165,7 +165,8 @@ func init() { } log.Debug(viper.AllSettings()) - log.Debugf("temp debug - all settings: %v", viper.AllSettings()) + var Cfg = viper.AllSettings() + return Cfg } // ParseConfig parse the config file diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index ea78b735..e3890185 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -12,7 +12,7 @@ import ( ) var config = viper.AllSettings() -var defaultMaxAge = config.JWT.MaxAge * 60 +var defaultMaxAge = cfg.Cfg.JWT.MaxAge * 60 // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { @@ -26,30 +26,25 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { } domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file - log.Debugf("temp debug - cookie domain: %v", config.Cookie.Domain) - log.Debugf("temp debug - cookie: %v", config.Cookie) - log.Debugf("temp debug - cfg: %v", cfg.Cfg) - log.Debugf("temp debug - host: %v", r.Host) - log.Debugf("temp debug - cookieConfig: %v", cookieConfig) - if config.Cookie.Domain != "" { - domain = config.Cookie.Domain + if cfg.Cfg.Cookie.Domain != "" { + domain = cfg.Cfg.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) } - // log.Debugf("cookie %s expires %d", config.Cookie.Name, expires) + // log.Debugf("cookie %s expires %d", cfg.Cfg.Cookie.Name, expires) http.SetCookie(w, &http.Cookie{ - Name: config.Cookie.Name, + Name: cfg.Cfg.Cookie.Name, Value: val, Path: "/", Domain: domain, MaxAge: maxAge, - Secure: config.Cookie.Secure, - HttpOnly: config.Cookie.HTTPOnly, + Secure: cfg.Cfg.Cookie.Secure, + HttpOnly: cfg.Cfg.Cookie.HTTPOnly, }) } // Cookie get the vouch jwt cookie func Cookie(r *http.Request) (string, error) { - cookie, err := r.Cookie(config.Cookie.Name) + cookie, err := r.Cookie(cfg.Cfg.Cookie.Name) if err != nil { return "", err } @@ -58,7 +53,7 @@ func Cookie(r *http.Request) (string, error) { } log.WithFields(log.Fields{ - "cookieName": config.Cookie.Name, + "cookieName": cfg.Cfg.Cookie.Name, "cookieValue": cookie.Value, }).Debug("cookie") return cookie.Value, err From 303c5868dda3db5f51e2b179f510ba76fa0449d3 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 12:38:57 +0100 Subject: [PATCH 19/42] . --- main.go | 2 +- pkg/cookie/cookie.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 06070e36..a6b701ce 100644 --- a/main.go +++ b/main.go @@ -36,7 +36,7 @@ func init() { } func main() { - log.Debugf("debug - main cfg %s", cfg.Cfg) + log.Debugf("debug main cfg: %v", cfg.Cfg) var listen = cfg.Cfg.Listen + ":" + strconv.Itoa(cfg.Cfg.Port) log.WithFields(log.Fields{ // "semver": semver, diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index e3890185..bfcd94c3 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -26,6 +26,7 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { } domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file + log.Debugf("debug domain: %v", domain) if cfg.Cfg.Cookie.Domain != "" { domain = cfg.Cfg.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) From 0be0fab067dc10fa5eeee182fce9f125a804a37b Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 12:41:56 +0100 Subject: [PATCH 20/42] remove return Cfg --- pkg/cfg/cfg.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkg/cfg/cfg.go b/pkg/cfg/cfg.go index a8f9e4e1..977630c4 100644 --- a/pkg/cfg/cfg.go +++ b/pkg/cfg/cfg.go @@ -165,8 +165,6 @@ func init() { } log.Debug(viper.AllSettings()) - var Cfg = viper.AllSettings() - return Cfg } // ParseConfig parse the config file From 62c9cfed654d55cc3fd93dee9d93c1d2a530dfe4 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 12:48:54 +0100 Subject: [PATCH 21/42] debug unmarshal key --- pkg/cfg/cfg.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/cfg/cfg.go b/pkg/cfg/cfg.go index 977630c4..f55ba413 100644 --- a/pkg/cfg/cfg.go +++ b/pkg/cfg/cfg.go @@ -184,6 +184,7 @@ func ParseConfig() { panic(err) } UnmarshalKey(Branding.LCName, &Cfg) + log.Debugf("debug unmarshal Cfg: %v", Cfg) if len(Cfg.Domains) == 0 { // then lets check for "lasso" var oldConfig config From f1299fa1b0de1bc966965b2efeb4411ba84cf62a Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 13:03:18 +0100 Subject: [PATCH 22/42] change domain to config instead of cfg.Cfg --- pkg/cookie/cookie.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index bfcd94c3..b490133f 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -26,9 +26,9 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { } domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file - log.Debugf("debug domain: %v", domain) - if cfg.Cfg.Cookie.Domain != "" { - domain = cfg.Cfg.Cookie.Domain + log.Debugf("debug domain: %v", config.Cookie.Domain) + if config.Cookie.Domain != "" { + domain = config.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) } // log.Debugf("cookie %s expires %d", cfg.Cfg.Cookie.Name, expires) From 9668c7859ba44bd1a43e774db67de9ba944fc272 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 13:06:07 +0100 Subject: [PATCH 23/42] change back --- pkg/cookie/cookie.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index b490133f..decce662 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -11,7 +11,6 @@ import ( "github.com/spf13/viper" ) -var config = viper.AllSettings() var defaultMaxAge = cfg.Cfg.JWT.MaxAge * 60 // SetCookie http @@ -26,9 +25,10 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { } domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file - log.Debugf("debug domain: %v", config.Cookie.Domain) - if config.Cookie.Domain != "" { - domain = config.Cookie.Domain + log.Debugf("debug domain: %v", cfg.Cfg.Cookie.Domain) + log.Debugf("debug viper: %v", viper.AllSettings()) + if cfg.Cfg.Cookie.Domain != "" { + domain = cfg.Cfg.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) } // log.Debugf("cookie %s expires %d", cfg.Cfg.Cookie.Name, expires) From 1e825ec24e3086fdd74d60633d0d383b1489e63d Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 13:39:43 +0100 Subject: [PATCH 24/42] debug temp --- pkg/cookie/cookie.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index decce662..fb35652c 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -27,6 +27,8 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { // Allow overriding the cookie domain in the config file log.Debugf("debug domain: %v", cfg.Cfg.Cookie.Domain) log.Debugf("debug viper: %v", viper.AllSettings()) + var temp = viper.AllSettings().Cookies.domain + log.Debugf("debug temp: %v", temp) if cfg.Cfg.Cookie.Domain != "" { domain = cfg.Cfg.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) From fb888256153ee93e480a4dbcb739c8d5d24cb324 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 13:48:53 +0100 Subject: [PATCH 25/42] debug cfg.go --- pkg/cfg/cfg.go | 4 ++++ pkg/cookie/cookie.go | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/cfg/cfg.go b/pkg/cfg/cfg.go index f55ba413..91c9f2e8 100644 --- a/pkg/cfg/cfg.go +++ b/pkg/cfg/cfg.go @@ -131,6 +131,7 @@ const ( func init() { // from config file ParseConfig() + log.Debug("test 1") // can pass loglevel on the command line var ll = flag.String("loglevel", Cfg.LogLevel, "enable debug log output") @@ -148,6 +149,7 @@ func init() { } setDefaults() + log.Debug("test 2") if *port != -1 { Cfg.Port = *port @@ -165,6 +167,8 @@ func init() { } log.Debug(viper.AllSettings()) + log.Debug("test 3") + log.Debuf("debug Cfg: %v", Cfg) } // ParseConfig parse the config file diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index fb35652c..decce662 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -27,8 +27,6 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { // Allow overriding the cookie domain in the config file log.Debugf("debug domain: %v", cfg.Cfg.Cookie.Domain) log.Debugf("debug viper: %v", viper.AllSettings()) - var temp = viper.AllSettings().Cookies.domain - log.Debugf("debug temp: %v", temp) if cfg.Cfg.Cookie.Domain != "" { domain = cfg.Cfg.Cookie.Domain log.Debugf("setting the cookie domain to %v", domain) From 040c0a10b50684846d3907abc69814cd1026440c Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 13:57:19 +0100 Subject: [PATCH 26/42] . --- pkg/cfg/cfg.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cfg/cfg.go b/pkg/cfg/cfg.go index 91c9f2e8..24ec6345 100644 --- a/pkg/cfg/cfg.go +++ b/pkg/cfg/cfg.go @@ -168,7 +168,7 @@ func init() { log.Debug(viper.AllSettings()) log.Debug("test 3") - log.Debuf("debug Cfg: %v", Cfg) + log.Debugf("debug Cfg: %v", Cfg) } // ParseConfig parse the config file From 690ae2dbad5c52a125b7a405aaa0726717acc4f9 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 15:46:55 +0100 Subject: [PATCH 27/42] test cfg.init --- pkg/cookie/cookie.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index decce662..88459f0d 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -12,7 +12,7 @@ import ( ) var defaultMaxAge = cfg.Cfg.JWT.MaxAge * 60 - +cfg.Init() // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { setCookie(w, r, val, defaultMaxAge) From a823028722186d2538b35c7429c0acdd96be1b03 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 15:49:21 +0100 Subject: [PATCH 28/42] move cfg.init() --- pkg/cookie/cookie.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 88459f0d..376e6c3d 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -12,7 +12,7 @@ import ( ) var defaultMaxAge = cfg.Cfg.JWT.MaxAge * 60 -cfg.Init() + // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { setCookie(w, r, val, defaultMaxAge) @@ -25,6 +25,7 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { } domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file + cfg.init() log.Debugf("debug domain: %v", cfg.Cfg.Cookie.Domain) log.Debugf("debug viper: %v", viper.AllSettings()) if cfg.Cfg.Cookie.Domain != "" { From f4fcba93b990b2ef5d4ee9371d3fc160cc9173d5 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 15:58:07 +0100 Subject: [PATCH 29/42] test cfg.Get --- pkg/cookie/cookie.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 376e6c3d..b1e3c0a7 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -25,8 +25,7 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { } domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file - cfg.init() - log.Debugf("debug domain: %v", cfg.Cfg.Cookie.Domain) + log.Debugf("debug domain: %v", cfg.Get("Cookie.Domain")) log.Debugf("debug viper: %v", viper.AllSettings()) if cfg.Cfg.Cookie.Domain != "" { domain = cfg.Cfg.Cookie.Domain From 832691e1cf6249194c7e338f685d6da594ffabeb Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 16:01:19 +0100 Subject: [PATCH 30/42] fix everything --- pkg/cookie/cookie.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index b1e3c0a7..fa72d328 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -25,10 +25,8 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { } domain := domains.Matches(r.Host) // Allow overriding the cookie domain in the config file - log.Debugf("debug domain: %v", cfg.Get("Cookie.Domain")) - log.Debugf("debug viper: %v", viper.AllSettings()) - if cfg.Cfg.Cookie.Domain != "" { - domain = cfg.Cfg.Cookie.Domain + if cfg.Get("Cookie.Domain") != "" { + domain = cfg.Get("Cookie.Domain") log.Debugf("setting the cookie domain to %v", domain) } // log.Debugf("cookie %s expires %d", cfg.Cfg.Cookie.Name, expires) From 931ca4d683f4b0e25abc5a5a16af921eadb4f0b5 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 16:05:08 +0100 Subject: [PATCH 31/42] fix everything again --- pkg/cookie/cookie.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index fa72d328..b2613022 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -8,10 +8,9 @@ import ( log "github.com/Sirupsen/logrus" "github.com/simongottschlag/vouch-proxy/pkg/cfg" "github.com/simongottschlag/vouch-proxy/pkg/domains" - "github.com/spf13/viper" ) -var defaultMaxAge = cfg.Cfg.JWT.MaxAge * 60 +var defaultMaxAge = cfg.Get("JWT.MaxAge") * 60 // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { @@ -31,19 +30,19 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { } // log.Debugf("cookie %s expires %d", cfg.Cfg.Cookie.Name, expires) http.SetCookie(w, &http.Cookie{ - Name: cfg.Cfg.Cookie.Name, + Name: cfg.Get("Cookie.Name"), Value: val, Path: "/", Domain: domain, MaxAge: maxAge, - Secure: cfg.Cfg.Cookie.Secure, - HttpOnly: cfg.Cfg.Cookie.HTTPOnly, + Secure: cfg.Get("Cookie.Secure"), + HttpOnly: cfg.Get("Cookie.HTTPOnly"), }) } // Cookie get the vouch jwt cookie func Cookie(r *http.Request) (string, error) { - cookie, err := r.Cookie(cfg.Cfg.Cookie.Name) + cookie, err := r.Cookie(cfg.Get("Cookie.Name")) if err != nil { return "", err } @@ -52,7 +51,7 @@ func Cookie(r *http.Request) (string, error) { } log.WithFields(log.Fields{ - "cookieName": cfg.Cfg.Cookie.Name, + "cookieName": cfg.Get("Cookie.Name"), "cookieValue": cookie.Value, }).Debug("cookie") return cookie.Value, err From 5229f06eb1f4276497b4a703a201f91bcbf3450e Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 16:07:25 +0100 Subject: [PATCH 32/42] test? --- pkg/cookie/cookie.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index b2613022..e204dfab 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -10,7 +10,7 @@ import ( "github.com/simongottschlag/vouch-proxy/pkg/domains" ) -var defaultMaxAge = cfg.Get("JWT.MaxAge") * 60 +var defaultMaxAge = cfg.Get("JWT.MaxAge").(int) * 60 // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { From 86c0025ad21cfa2d1a5795bd5a4c515840837623 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 16:08:32 +0100 Subject: [PATCH 33/42] switch to unint --- pkg/cookie/cookie.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index e204dfab..a699da8d 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -10,7 +10,7 @@ import ( "github.com/simongottschlag/vouch-proxy/pkg/domains" ) -var defaultMaxAge = cfg.Get("JWT.MaxAge").(int) * 60 +var defaultMaxAge = uint(cfg.Get("JWT.MaxAge"))) * 60 // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { From c9d6a47ec8b1c5b0c8c13fd7ee6e17063fe531e0 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 16:08:54 +0100 Subject: [PATCH 34/42] change to int --- pkg/cookie/cookie.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index a699da8d..cfcaccc9 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -10,7 +10,7 @@ import ( "github.com/simongottschlag/vouch-proxy/pkg/domains" ) -var defaultMaxAge = uint(cfg.Get("JWT.MaxAge"))) * 60 +var defaultMaxAge = int(cfg.Get("JWT.MaxAge"))) * 60 // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { From 919a49d89011529354184961121c9bedf1f4bb61 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 16:12:40 +0100 Subject: [PATCH 35/42] fix --- pkg/cookie/cookie.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index cfcaccc9..38ec2748 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -10,7 +10,7 @@ import ( "github.com/simongottschlag/vouch-proxy/pkg/domains" ) -var defaultMaxAge = int(cfg.Get("JWT.MaxAge"))) * 60 +var defaultMaxAge = int(cfg.Get("JWT.MaxAge")) * 60 // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { From 49e8390b5d2e5f8de953b919cacea4587a7c4e93 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 16:18:12 +0100 Subject: [PATCH 36/42] test --- pkg/cookie/cookie.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 38ec2748..960c7f4b 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -12,6 +12,7 @@ import ( var defaultMaxAge = int(cfg.Get("JWT.MaxAge")) * 60 + // SetCookie http func SetCookie(w http.ResponseWriter, r *http.Request, val string) { setCookie(w, r, val, defaultMaxAge) From 44581b2dbf848a6df940130c507574390a928a81 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 16:22:21 +0100 Subject: [PATCH 37/42] lalalal --- pkg/cookie/cookie.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 960c7f4b..8d57d6de 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -10,7 +10,7 @@ import ( "github.com/simongottschlag/vouch-proxy/pkg/domains" ) -var defaultMaxAge = int(cfg.Get("JWT.MaxAge")) * 60 +var defaultMaxAge = cfg.Cfg.JWT.MaxAge * 60 // SetCookie http @@ -36,8 +36,8 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { Path: "/", Domain: domain, MaxAge: maxAge, - Secure: cfg.Get("Cookie.Secure"), - HttpOnly: cfg.Get("Cookie.HTTPOnly"), + Secure: cfg.Cfg.Cookie.Secure, + HttpOnly: cfg.Cfg.Cookie.HTTPOnly, }) } From 248ba83c8a4bcd817be24f0349ec53571384de74 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 16:31:24 +0100 Subject: [PATCH 38/42] fix --- pkg/cfg/cfg.go | 10 ++++++++++ pkg/cookie/cookie.go | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/cfg/cfg.go b/pkg/cfg/cfg.go index 24ec6345..57a5e477 100644 --- a/pkg/cfg/cfg.go +++ b/pkg/cfg/cfg.go @@ -218,6 +218,16 @@ func Get(key string) string { return viper.GetString(key) } +// Get int value for key +func GetInt(key string) int { + return viper.GetInt(key) +} + +// Get bool value for key +func GetBool(key string) bool { + return viper.GetBool(key) +} + // BasicTest just a quick sanity check to see if the config is sound func BasicTest() error { for _, opt := range RequiredOptions { diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 8d57d6de..9d777c07 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -10,7 +10,7 @@ import ( "github.com/simongottschlag/vouch-proxy/pkg/domains" ) -var defaultMaxAge = cfg.Cfg.JWT.MaxAge * 60 +var defaultMaxAge = cfg.GetInt("JWT.MaxAge") * 60 // SetCookie http @@ -36,8 +36,8 @@ func setCookie(w http.ResponseWriter, r *http.Request, val string, maxAge int) { Path: "/", Domain: domain, MaxAge: maxAge, - Secure: cfg.Cfg.Cookie.Secure, - HttpOnly: cfg.Cfg.Cookie.HTTPOnly, + Secure: cfg.GetBool("Cookie.Secure"), + HttpOnly: cfg.GetBool("Cookie.HTTPOnly"), }) } From a596bc125db8142010f791a93be96f32b951f1a3 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 16:41:23 +0100 Subject: [PATCH 39/42] remove debug --- main.go | 1 - pkg/cfg/cfg.go | 4 ---- 2 files changed, 5 deletions(-) diff --git a/main.go b/main.go index a6b701ce..b8a2c4b0 100644 --- a/main.go +++ b/main.go @@ -36,7 +36,6 @@ func init() { } func main() { - log.Debugf("debug main cfg: %v", cfg.Cfg) var listen = cfg.Cfg.Listen + ":" + strconv.Itoa(cfg.Cfg.Port) log.WithFields(log.Fields{ // "semver": semver, diff --git a/pkg/cfg/cfg.go b/pkg/cfg/cfg.go index 57a5e477..78fc2077 100644 --- a/pkg/cfg/cfg.go +++ b/pkg/cfg/cfg.go @@ -131,7 +131,6 @@ const ( func init() { // from config file ParseConfig() - log.Debug("test 1") // can pass loglevel on the command line var ll = flag.String("loglevel", Cfg.LogLevel, "enable debug log output") @@ -149,7 +148,6 @@ func init() { } setDefaults() - log.Debug("test 2") if *port != -1 { Cfg.Port = *port @@ -167,8 +165,6 @@ func init() { } log.Debug(viper.AllSettings()) - log.Debug("test 3") - log.Debugf("debug Cfg: %v", Cfg) } // ParseConfig parse the config file From da1c17202b7476e1acecb4b1253eb765ddc2e95d Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 16:42:40 +0100 Subject: [PATCH 40/42] restore --- .travis.yml | 2 +- Dockerfile | 6 +++--- README.md | 4 ++-- do.sh | 2 +- handlers/handlers.go | 12 ++++++------ main.go | 10 +++++----- pkg/cfg/cfg.go | 8 ++++---- pkg/cfg/cfg_test.go | 2 +- pkg/cookie/cookie.go | 6 +++--- pkg/domains/domains.go | 2 +- pkg/jwtmanager/jwtmanager.go | 4 ++-- pkg/jwtmanager/jwtmanager_test.go | 4 ++-- pkg/model/model.go | 2 +- pkg/model/model_test.go | 2 +- pkg/model/site.go | 2 +- pkg/model/team.go | 2 +- pkg/model/user.go | 2 +- pkg/timelog/timelog.go | 2 +- pkg/transciever/client.go | 4 ++-- templates/index.tmpl | 6 +++--- 20 files changed, 42 insertions(+), 42 deletions(-) diff --git a/.travis.yml b/.travis.yml index 91a5299e..553749ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: go -go_import_path: github.com/simongottschlag/vouch-proxy +go_import_path: github.com/vouch/vouch-proxy sudo: false diff --git a/Dockerfile b/Dockerfile index d583e0c9..9847df0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ # voucher/vouch-proxy -# https://github.com/simongottschlag/vouch-proxy +# https://github.com/vouch/vouch-proxy FROM golang:1.10 AS builder LABEL maintainer="vouch@bnf.net" -RUN mkdir -p ${GOPATH}/src/github.com/simongottschlag/vouch-proxy -WORKDIR ${GOPATH}/src/github.com/simongottschlag/vouch-proxy +RUN mkdir -p ${GOPATH}/src/github.com/vouch/vouch-proxy +WORKDIR ${GOPATH}/src/github.com/vouch/vouch-proxy COPY . . diff --git a/README.md b/README.md index 019cd9b2..8545755b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Vouch Proxy # Renaming project to **Vouch Proxy** in January 2019 -In January the project was renamed to [vouch/vouch-proxy](https://github.com/simongottschlag/vouch-proxy) from `LassoProject/lasso`. This is to [avoid a naming conflict](https://github.com/simongottschlag/vouch-proxy/issues/35) with another project. +In January the project was renamed to [vouch/vouch-proxy](https://github.com/vouch/vouch-proxy) from `LassoProject/lasso`. This is to [avoid a naming conflict](https://github.com/vouch/vouch-proxy/issues/35) with another project. Other namespaces have been changed including the docker hub repo [lassoproject/lasso](https://hub.docker.com/r/lassoproject/lasso/) which has become [voucher/vouch-proxy](https://hub.docker.com/r/voucher/vouch-proxy) @@ -85,7 +85,7 @@ server { proxy_pass http://dev.yourdomain.com:8080; # may need to set # auth_request_set $auth_resp_x_vouch_user $upstream_http_x_vouch_user - # in this bock as per https://github.com/simongottschlag/vouch-proxy/issues/26#issuecomment-425215810 + # in this bock as per https://github.com/vouch/vouch-proxy/issues/26#issuecomment-425215810 # set user header (usually an email) proxy_set_header X-Vouch-User $auth_resp_x_vouch_user; } diff --git a/do.sh b/do.sh index 40ac8dc7..8dcdbb55 100755 --- a/do.sh +++ b/do.sh @@ -7,7 +7,7 @@ SCRIPT=$(readlink -f "$0") SDIR=$(dirname "$SCRIPT") cd $SDIR -export VOUCH_ROOT=${GOPATH}/src/github.com/simongottschlag/vouch-proxy/ +export VOUCH_ROOT=${GOPATH}/src/github.com/vouch/vouch-proxy/ IMAGE=voucher/vouch-proxy GOIMAGE=golang:1.10 diff --git a/handlers/handlers.go b/handlers/handlers.go index b98ad53a..475a035f 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -15,12 +15,12 @@ import ( log "github.com/Sirupsen/logrus" "github.com/gorilla/sessions" - "github.com/simongottschlag/vouch-proxy/pkg/cfg" - "github.com/simongottschlag/vouch-proxy/pkg/cookie" - "github.com/simongottschlag/vouch-proxy/pkg/domains" - "github.com/simongottschlag/vouch-proxy/pkg/jwtmanager" - "github.com/simongottschlag/vouch-proxy/pkg/model" - "github.com/simongottschlag/vouch-proxy/pkg/structs" + "github.com/vouch/vouch-proxy/pkg/cfg" + "github.com/vouch/vouch-proxy/pkg/cookie" + "github.com/vouch/vouch-proxy/pkg/domains" + "github.com/vouch/vouch-proxy/pkg/jwtmanager" + "github.com/vouch/vouch-proxy/pkg/model" + "github.com/vouch/vouch-proxy/pkg/structs" "golang.org/x/oauth2" ) diff --git a/main.go b/main.go index b8a2c4b0..68060d03 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,7 @@ package main // vouch -// github.com/simongottschlag/vouch-proxy +// github.com/vouch/vouch-proxy import ( "net/http" @@ -13,10 +13,10 @@ import ( "github.com/gorilla/mux" - "github.com/simongottschlag/vouch-proxy/handlers" - "github.com/simongottschlag/vouch-proxy/pkg/cfg" - "github.com/simongottschlag/vouch-proxy/pkg/timelog" - tran "github.com/simongottschlag/vouch-proxy/pkg/transciever" + "github.com/vouch/vouch-proxy/handlers" + "github.com/vouch/vouch-proxy/pkg/cfg" + "github.com/vouch/vouch-proxy/pkg/timelog" + tran "github.com/vouch/vouch-proxy/pkg/transciever" ) // version and semver get overwritten by build with diff --git a/pkg/cfg/cfg.go b/pkg/cfg/cfg.go index 78fc2077..b0bdcbad 100644 --- a/pkg/cfg/cfg.go +++ b/pkg/cfg/cfg.go @@ -87,12 +87,12 @@ type branding struct { UCName string // upper case CcName string // camel case OldLCName string // lasso - URL string // https://github.com/simongottschlag/vouch-proxy + URL string // https://github.com/vouch/vouch-proxy } var ( // Branding that's our name - Branding = branding{"vouch", "VOUCH", "Vouch", "lasso", "https://github.com/simongottschlag/vouch-proxy"} + Branding = branding{"vouch", "VOUCH", "Vouch", "lasso", "https://github.com/vouch/vouch-proxy"} // Cfg the main exported config variable Cfg config @@ -452,7 +452,7 @@ func setDefaultsGitHub() { GenOAuth.UserInfoURL = "https://api.github.com/user?access_token=" } if len(GenOAuth.Scopes) == 0 { - // https://github.com/simongottschlag/vouch-proxy/issues/63 + // https://github.com/vouch/vouch-proxy/issues/63 // https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/ GenOAuth.Scopes = []string{"read:user"} } @@ -483,7 +483,7 @@ func getOrGenerateJWTSecret() string { log.Warn("generating random jwt.secret and storing it in " + secretFile) // make sure to create 256 bits for the secret - // see https://github.com/simongottschlag/vouch-proxy/issues/54 + // see https://github.com/vouch/vouch-proxy/issues/54 rstr, err := securerandom.Base64OfBytes(base64Bytes) if err != nil { log.Error(err) diff --git a/pkg/cfg/cfg_test.go b/pkg/cfg/cfg_test.go index 918cd326..b4a8aba7 100644 --- a/pkg/cfg/cfg_test.go +++ b/pkg/cfg/cfg_test.go @@ -2,7 +2,7 @@ package cfg import ( "testing" - // "github.com/simongottschlag/vouch-proxy/pkg/structs" + // "github.com/vouch/vouch-proxy/pkg/structs" // log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus" "github.com/stretchr/testify/assert" diff --git a/pkg/cookie/cookie.go b/pkg/cookie/cookie.go index 9d777c07..2a48a5ca 100644 --- a/pkg/cookie/cookie.go +++ b/pkg/cookie/cookie.go @@ -4,10 +4,10 @@ import ( "errors" "net/http" - // "github.com/simongottschlag/vouch-proxy/pkg/structs" + // "github.com/vouch/vouch-proxy/pkg/structs" log "github.com/Sirupsen/logrus" - "github.com/simongottschlag/vouch-proxy/pkg/cfg" - "github.com/simongottschlag/vouch-proxy/pkg/domains" + "github.com/vouch/vouch-proxy/pkg/cfg" + "github.com/vouch/vouch-proxy/pkg/domains" ) var defaultMaxAge = cfg.GetInt("JWT.MaxAge") * 60 diff --git a/pkg/domains/domains.go b/pkg/domains/domains.go index 189d78d6..d90fa88d 100644 --- a/pkg/domains/domains.go +++ b/pkg/domains/domains.go @@ -5,7 +5,7 @@ import ( "strings" log "github.com/Sirupsen/logrus" - "github.com/simongottschlag/vouch-proxy/pkg/cfg" + "github.com/vouch/vouch-proxy/pkg/cfg" ) var domains = cfg.Cfg.Domains diff --git a/pkg/jwtmanager/jwtmanager.go b/pkg/jwtmanager/jwtmanager.go index 0697febd..f6f7558e 100644 --- a/pkg/jwtmanager/jwtmanager.go +++ b/pkg/jwtmanager/jwtmanager.go @@ -11,8 +11,8 @@ import ( "time" log "github.com/Sirupsen/logrus" - "github.com/simongottschlag/vouch-proxy/pkg/cfg" - "github.com/simongottschlag/vouch-proxy/pkg/structs" + "github.com/vouch/vouch-proxy/pkg/cfg" + "github.com/vouch/vouch-proxy/pkg/structs" jwt "github.com/dgrijalva/jwt-go" ) diff --git a/pkg/jwtmanager/jwtmanager_test.go b/pkg/jwtmanager/jwtmanager_test.go index e47e7729..95a3d873 100644 --- a/pkg/jwtmanager/jwtmanager_test.go +++ b/pkg/jwtmanager/jwtmanager_test.go @@ -3,8 +3,8 @@ package jwtmanager import ( "testing" - "github.com/simongottschlag/vouch-proxy/pkg/cfg" - "github.com/simongottschlag/vouch-proxy/pkg/structs" + "github.com/vouch/vouch-proxy/pkg/cfg" + "github.com/vouch/vouch-proxy/pkg/structs" // log "github.com/Sirupsen/logrus" log "github.com/Sirupsen/logrus" diff --git a/pkg/model/model.go b/pkg/model/model.go index 8c678c2c..e8355448 100644 --- a/pkg/model/model.go +++ b/pkg/model/model.go @@ -10,7 +10,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/boltdb/bolt" - "github.com/simongottschlag/vouch-proxy/pkg/cfg" + "github.com/vouch/vouch-proxy/pkg/cfg" ) var ( diff --git a/pkg/model/model_test.go b/pkg/model/model_test.go index e150818d..f875de49 100644 --- a/pkg/model/model_test.go +++ b/pkg/model/model_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/simongottschlag/vouch-proxy/pkg/structs" + "github.com/vouch/vouch-proxy/pkg/structs" ) var testdb = "/tmp/storage-test.db" diff --git a/pkg/model/site.go b/pkg/model/site.go index f2b0a801..8a4f5f55 100644 --- a/pkg/model/site.go +++ b/pkg/model/site.go @@ -7,7 +7,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/boltdb/bolt" - "github.com/simongottschlag/vouch-proxy/pkg/structs" + "github.com/vouch/vouch-proxy/pkg/structs" ) // PutSite inna da db diff --git a/pkg/model/team.go b/pkg/model/team.go index 22aa8acf..6bb926c4 100644 --- a/pkg/model/team.go +++ b/pkg/model/team.go @@ -8,7 +8,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/boltdb/bolt" - "github.com/simongottschlag/vouch-proxy/pkg/structs" + "github.com/vouch/vouch-proxy/pkg/structs" ) // PutTeam - create or update a team diff --git a/pkg/model/user.go b/pkg/model/user.go index 344678c5..15f86949 100644 --- a/pkg/model/user.go +++ b/pkg/model/user.go @@ -8,7 +8,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/boltdb/bolt" - "github.com/simongottschlag/vouch-proxy/pkg/structs" + "github.com/vouch/vouch-proxy/pkg/structs" ) // PutUser inna da db diff --git a/pkg/timelog/timelog.go b/pkg/timelog/timelog.go index 2f95c71e..29052f15 100644 --- a/pkg/timelog/timelog.go +++ b/pkg/timelog/timelog.go @@ -8,7 +8,7 @@ import ( "strconv" "time" - "github.com/simongottschlag/vouch-proxy/pkg/response" + "github.com/vouch/vouch-proxy/pkg/response" log "github.com/Sirupsen/logrus" isatty "github.com/mattn/go-isatty" diff --git a/pkg/transciever/client.go b/pkg/transciever/client.go index 1a0bb393..6d862a87 100644 --- a/pkg/transciever/client.go +++ b/pkg/transciever/client.go @@ -6,8 +6,8 @@ import ( "net/http" "time" - "github.com/simongottschlag/vouch-proxy/pkg/model" - "github.com/simongottschlag/vouch-proxy/pkg/structs" + "github.com/vouch/vouch-proxy/pkg/model" + "github.com/vouch/vouch-proxy/pkg/structs" log "github.com/Sirupsen/logrus" "github.com/mitchellh/mapstructure" diff --git a/templates/index.tmpl b/templates/index.tmpl index de4fd0c5..5c9b0df6 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -7,8 +7,8 @@

{{ if .Testing }}

@@ -33,7 +33,7 @@ All 302 redirects will be captured and presented as links here For support, please contact your network administrator or whomever configured nginx to use Vouch Proxy.

-For help with Vouch Proxy or to file a bug report, please see the project page at https://github.com/simongottschlag/vouch-proxy +For help with Vouch Proxy or to file a bug report, please see the project page at https://github.com/vouch/vouch-proxy

From f78b05b68408f72f3decb414a06a63b8c714c81c Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 16:43:35 +0100 Subject: [PATCH 41/42] remove --- pkg/cfg/cfg.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/cfg/cfg.go b/pkg/cfg/cfg.go index b0bdcbad..b8177053 100644 --- a/pkg/cfg/cfg.go +++ b/pkg/cfg/cfg.go @@ -184,7 +184,6 @@ func ParseConfig() { panic(err) } UnmarshalKey(Branding.LCName, &Cfg) - log.Debugf("debug unmarshal Cfg: %v", Cfg) if len(Cfg.Domains) == 0 { // then lets check for "lasso" var oldConfig config From 045efa30a63f776e12e2c2ffa64ef09b9a2ebf65 Mon Sep 17 00:00:00 2001 From: Simon Gottschlag Date: Tue, 5 Feb 2019 16:45:04 +0100 Subject: [PATCH 42/42] just fix cookies --- handlers/handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/handlers.go b/handlers/handlers.go index 475a035f..f826fce6 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -48,7 +48,7 @@ var ( func randString() string { b := make([]byte, 32) rand.Read(b) - return base64.URLEncoding.EncodeToString(b) + return base64.StdEncoding.EncodeToString(b) } func loginURL(r *http.Request, state string) string {