Compare commits

...

3 Commits

Author SHA1 Message Date
Bernd Schoolmann
a93eab1033
Update Readme.md 2024-02-21 06:58:57 +01:00
Bernd Schoolmann
ab431835d4
Fix socket path in daemonize 2024-02-21 06:42:10 +01:00
Bernd Schoolmann
ac9251d0f4
Add debugging info to cipherstring decryption 2024-02-21 06:39:06 +01:00
4 changed files with 24 additions and 22 deletions

View File

@ -28,7 +28,8 @@ There is a flatpak that includes a small UI, autotype functionality and autostar
[<img width='240' alt='Download on Flathub' src='https://flathub.org/assets/badges/flathub-badge-en.png' />](https://flathub.org/apps/details/com.quexten.Goldwarden)
<img src='https://github.com/quexten/goldwarden/assets/11866552/5d36ed8c-46f1-4444-adb0-f4ca1d0433c5' width='700'>
<img src='https://github.com/quexten/goldwarden/assets/11866552/88adefe4-90bc-4a77-b749-3c89a6bba7cd' width='400'>
<img src='https://github.com/quexten/goldwarden/assets/11866552/f6dfd24b-3cf4-4ce3-b504-c9bdf673e086' width='400'>
#### CLI
##### Arch (AUR)

View File

@ -47,13 +47,13 @@ func (s *EncString) UnmarshalText(data []byte) error {
i := bytes.IndexByte(data, '.')
if i < 0 {
return errors.New("invalid cipher string format")
return errors.New("invalid cipher string format, missign type. total length: " + strconv.Itoa(len(data)))
}
typStr := string(data[:i])
var err error
if t, err := strconv.Atoi(typStr); err != nil {
return errors.New("invalid cipher string type")
return errors.New("invalid cipher string type, could not parse, length: " + strconv.Itoa(len(data)))
} else {
s.Type = EncStringType(t)
}
@ -61,13 +61,13 @@ func (s *EncString) UnmarshalText(data []byte) error {
switch s.Type {
case AesCbc128_HmacSha256_B64, AesCbc256_HmacSha256_B64, AesCbc256_B64:
default:
return errors.New("invalid cipher string type")
return errors.New("invalid cipher string type, unknown type: " + strconv.Itoa(int(s.Type)))
}
data = data[i+1:]
parts := bytes.Split(data, []byte("|"))
if len(parts) != 3 {
return errors.New("invalid cipher string format")
return errors.New("invalid cipher string format, missing parts, length: " + strconv.Itoa(len(data)) + "type: " + strconv.Itoa(int(s.Type)))
}
if s.IV, err = b64decode(parts[0]); err != nil {

View File

@ -309,22 +309,6 @@ type AgentState struct {
func StartUnixAgent(path string, runtimeConfig config.RuntimeConfig) error {
ctx := context.Background()
home, _ := os.UserHomeDir()
_, err := os.Stat("/.flatpak-info")
isFlatpak := err == nil
if runtimeConfig.GoldwardenSocketPath == "" {
runtimeConfig.GoldwardenSocketPath = home + "/.goldwarden.sock"
if isFlatpak {
runtimeConfig.GoldwardenSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"
}
}
if runtimeConfig.SSHAgentSocketPath == "" {
runtimeConfig.SSHAgentSocketPath = home + "/.ssh-agent-socket"
if isFlatpak {
runtimeConfig.SSHAgentSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/ssh-auth-sock"
}
}
var keyring crypto.Keyring
if runtimeConfig.UseMemguard {
keyring = crypto.NewMemguardKeyring(nil)

View File

@ -2,6 +2,7 @@ package cmd
import (
"fmt"
"os"
"syscall"
"github.com/awnumar/memguard"
@ -42,7 +43,23 @@ var daemonizeCmd = &cobra.Command{
memguard.SafeExit(0)
}
err := agent.StartUnixAgent(runtimeConfig.GoldwardenSocketPath, runtimeConfig)
home, _ := os.UserHomeDir()
_, err := os.Stat("/.flatpak-info")
isFlatpak := err == nil
if runtimeConfig.GoldwardenSocketPath == "" {
runtimeConfig.GoldwardenSocketPath = home + "/.goldwarden.sock"
if isFlatpak {
runtimeConfig.GoldwardenSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"
}
}
if runtimeConfig.SSHAgentSocketPath == "" {
runtimeConfig.SSHAgentSocketPath = home + "/.ssh-agent-socket"
if isFlatpak {
runtimeConfig.SSHAgentSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/ssh-auth-sock"
}
}
err = agent.StartUnixAgent(runtimeConfig.GoldwardenSocketPath, runtimeConfig)
if err != nil {
panic(err)
}