Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle vault HTTP redirects #75

Closed
drmdrew opened this issue Nov 18, 2016 · 2 comments
Closed

Handle vault HTTP redirects #75

drmdrew opened this issue Nov 18, 2016 · 2 comments

Comments

@drmdrew
Copy link

drmdrew commented Nov 18, 2016

Prior to vault 0.6.2, vault standby nodes would redirect HTTP to the active vault node. Current versions of the go http package do not seamlessly handle this redirection properly.

Attempting to use gomplate with pre-0.6.2 vault in HA configuration results in a panic, e.g.

echo -n '{{(datasource "vault" "secret/my_secret").value}}'  | gomplate -d vault="vault:///"
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
@drmdrew
Copy link
Author

drmdrew commented Nov 19, 2016

The relevant portions of a sample panic that occurs against pre-0.6.2 vault HA setup when a redirect from a standby is encountered:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xf0b1a]

goroutine 1 [running]:
panic(0x51b940, 0xc4200161c0)
        /usr/local/Cellar/go/1.7.3/libexec/src/runtime/panic.go:500 +0x1a1
github.com/urfave/cli.HandleAction.func1(0xc4201e5d00)
        /Users/dee/gocode/src/github.com/urfave/cli/app.go:478 +0x247
panic(0x51b940, 0xc4200161c0)
        /usr/local/Cellar/go/1.7.3/libexec/src/runtime/panic.go:458 +0x243
text/template.errRecover(0xc4201e5730)
        /usr/local/Cellar/go/1.7.3/libexec/src/text/template/exec.go:140 +0x2ad
panic(0x51b940, 0xc4200161c0)
        /usr/local/Cellar/go/1.7.3/libexec/src/runtime/panic.go:458 +0x243
github.com/hairyhenderson/gomplate/vault.(*Client).Login(0xc4201d2180, 0x5c3b3e, 0x7fff5fbff61f)
        /Users/dee/gocode/src/github.com/hairyhenderson/gomplate/vault/client.go:59 +0x2a
main.readVault(0xc420074d80, 0xc4201ce040, 0x1, 0x1, 0xc420077d10, 0x1, 0x1246c, 0x7fff5fbff619, 0xc4201564bf)
        /Users/dee/gocode/src/github.com/hairyhenderson/gomplate/data.go:244 +0x19a
main.(*Data).ReadSource(0xc4201b2aa0, 0x0, 0x0, 0xc420074d80, 0xc4201ce040, 0x1, 0x1, 0x507048, 0x9, 0xc4201ce051, ...)
        /Users/dee/gocode/src/github.com/hairyhenderson/gomplate/data.go:175 +0x1ec
main.(*Data).Datasource(0xc4201b2aa0, 0xc4201564bf, 0x5, 0xc4201ce040, 0x1, 0x1, 0x179e5)
        /Users/dee/gocode/src/github.com/hairyhenderson/gomplate/data.go:149 +0xd8
main.(*Data).Datasource-fm(0xc4201564bf, 0x5, 0xc4201ce040, 0x1, 0x1, 0x0)
        /Users/dee/gocode/src/github.com/hairyhenderson/gomplate/main.go:67 +0x5c

@hairyhenderson
Copy link
Owner

Fixed by #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants