mirror of
https://github.com/vwxyzjn/portwarden
synced 2025-12-06 01:33:18 +00:00
API-15 # Delete the Salt and use environment variable to generate the salt
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
vendor
|
vendor
|
||||||
Dockerfile
|
Dockerfile
|
||||||
|
salt.go
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@ cmd/portwarden/portwarden_backup/*
|
|||||||
vendor/*
|
vendor/*
|
||||||
**/*.portwarden
|
**/*.portwarden
|
||||||
**/*.decrypted.zip
|
**/*.decrypted.zip
|
||||||
|
salt.go
|
||||||
@@ -14,8 +14,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Salt = `,(@0vd<)D6c3:5jI;4BZ(#Gx2IZ6B>`
|
|
||||||
|
|
||||||
ErrMessageAuthenticationFailed = "cipher: message authentication failed"
|
ErrMessageAuthenticationFailed = "cipher: message authentication failed"
|
||||||
ErrWrongBackupPassphrase = "wrong backup passphrase entered"
|
ErrWrongBackupPassphrase = "wrong backup passphrase entered"
|
||||||
)
|
)
|
||||||
|
|||||||
31
utils/generate_salt_file.go
Normal file
31
utils/generate_salt_file.go
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
Template = `package portwarden
|
||||||
|
|
||||||
|
const (
|
||||||
|
Salt = "%v"
|
||||||
|
)
|
||||||
|
`
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
Salt := os.Getenv("Salt")
|
||||||
|
if len(Salt) == 0 {
|
||||||
|
log.Fatal("Salt not detected in Environment Variable `Salt`")
|
||||||
|
}
|
||||||
|
err := ioutil.WriteFile("./salt.go", []byte(fmt.Sprintf(Template, Salt)), 0644)
|
||||||
|
if err != nil {
|
||||||
|
if len(Salt) == 0 {
|
||||||
|
log.Fatalf("Error writing salt file: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user