This commit is contained in:
github-actions[bot] 2024-02-23 05:01:14 +00:00 committed by GitHub
commit d8f81af3b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 122 additions and 57 deletions

View File

@ -10,6 +10,23 @@ env:
GO_VERSION: '1.20'
jobs:
build_linux_x86_64_debug:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Install libfido2-dev
run: sudo apt-get install -y libfido2-dev
- name: Build Debug
run: go build -tags debuglogging -o goldwarden_linux_x86_64_debug -v .
- uses: actions/upload-artifact@v3
with:
name: goldwarden_linux_x86_64_debug
path: ./goldwarden_linux_x86_64_debug
build_linux_x86_64:
runs-on: ubuntu-latest
steps:

View File

@ -1,5 +1,5 @@
pkgname=goldwarden
pkgver=0.2.12
pkgver=0.2.13
pkgrel=1
pkgdesc='A feature-packed Bitwarden compatible desktop integration'
arch=('x86_64' 'aarch64')

View File

@ -1,4 +1,6 @@
## Goldwarden
<img src="https://raw.githubusercontent.com/quexten/goldwarden/main/gui/goldwarden.svg" width=200>
# Goldwarden
Goldwarden is a Bitwarden compatible desktop client. It focuses on providing useful desktop features that the official tools
do not (yet) have or are not willing to add, and enhanced security measures that other tools do not provide, such as:
@ -28,7 +30,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

@ -111,16 +111,20 @@ func detectAndInstallBrowsers(startPath string) error {
if info.IsDir() && info.Name() == "native-messaging-hosts" {
fmt.Printf("Found mozilla-like browser: %s\n", path)
fmt.Println("Removing old manifest and proxy script")
os.Chown(path+"/com.8bit.bitwarden.json", 7, 7)
os.Remove(path + "/com.8bit.bitwarden.json")
os.Chown(path+"/goldwarden-proxy.sh", 7, 7)
os.Remove(path + "/goldwarden-proxy.sh")
fmt.Println("Writing new manifest")
manifest := strings.Replace(templateMozilla, "PATH", path+"/goldwarden-proxy.sh", 1)
err = os.WriteFile(path+"/com.8bit.bitwarden.json", []byte(manifest), 0444)
if err != nil {
return err
}
fmt.Println("Writing new proxy script")
err = os.WriteFile(path+"/goldwarden-proxy.sh", []byte(proxyScript), 0755)
if err != nil {
return err
@ -128,16 +132,20 @@ func detectAndInstallBrowsers(startPath string) error {
} else if info.IsDir() && info.Name() == "NativeMessagingHosts" {
fmt.Printf("Found chrome-like browser: %s\n", path)
fmt.Println("Removing old manifest and proxy script")
os.Chown(path+"/com.8bit.bitwarden.json", 7, 7)
os.Remove(path + "/com.8bit.bitwarden.json")
os.Chown(path+"/goldwarden-proxy.sh", 7, 7)
os.Remove(path + "/goldwarden-proxy.sh")
fmt.Println("Writing new manifest")
manifest := strings.Replace(templateChrome, "PATH", path+"/goldwarden-proxy.sh", 1)
err = os.WriteFile(path+"/com.8bit.bitwarden.json", []byte(manifest), 0444)
if err != nil {
return err
}
fmt.Println("Writing new proxy script")
err = os.WriteFile(path+"/goldwarden-proxy.sh", []byte(proxyScript), 0755)
if err != nil {
return err

View File

@ -105,7 +105,26 @@ func handlePayloadMessage(msg PayloadMessage, appID string) {
case "biometricUnlock":
logging.Debugf("Biometric unlock requested")
// logging.Debugf("Biometrics authorized: %t", isAuthorized)
home, err := os.UserHomeDir()
if err != nil {
panic(err)
}
if runtimeConfig.GoldwardenSocketPath == "" {
if _, err := os.Stat(home + "/.goldwarden.sock"); err == nil {
runtimeConfig.GoldwardenSocketPath = home + "/.goldwarden.sock"
} else if _, err := os.Stat(home + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"); err == nil {
runtimeConfig.GoldwardenSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"
}
if _, err = os.Stat("/.flatpak-info"); err == nil {
runtimeConfig.GoldwardenSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"
}
}
logging.Debugf("Connecting to agent at path %s", runtimeConfig.GoldwardenSocketPath)
result, err := client.NewUnixSocketClient(runtimeConfig).SendToAgent(messages.GetBiometricsKeyRequest{})
if err != nil {
logging.Errorf("Unable to send message to agent: %s", err.Error())

View File

@ -4,6 +4,7 @@ import (
"encoding/json"
"io"
"net"
"os"
"github.com/quexten/goldwarden/agent/config"
"github.com/quexten/goldwarden/ipc/messages"
@ -52,6 +53,26 @@ func (client UnixSocketClient) SendToAgent(request interface{}) (interface{}, er
}
func (client UnixSocketClient) Connect() (UnixSocketConnection, error) {
runtimeConfig := client.runtimeConfig
home, err := os.UserHomeDir()
if err != nil {
panic(err)
}
if runtimeConfig.SSHAgentSocketPath == "" {
if _, err := os.Stat(home + "/.goldwarden-ssh-agent.sock"); err == nil {
runtimeConfig.SSHAgentSocketPath = home + "/.goldwarden-ssh-agent.sock"
} else if _, err := os.Stat(home + "/.var/app/com.quexten.Goldwarden/data/ssh-auth-sock"); err == nil {
runtimeConfig.SSHAgentSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/ssh-auth-sock"
}
}
if runtimeConfig.GoldwardenSocketPath == "" {
if _, err := os.Stat(home + "/.goldwarden.sock"); err == nil {
runtimeConfig.GoldwardenSocketPath = home + "/.goldwarden.sock"
} else if _, err := os.Stat(home + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"); err == nil {
runtimeConfig.GoldwardenSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"
}
}
c, err := net.Dial("unix", client.runtimeConfig.GoldwardenSocketPath)
if err != nil {
return UnixSocketConnection{}, err

View File

@ -2,6 +2,7 @@ package cmd
import (
"fmt"
"os"
"syscall"
"github.com/awnumar/memguard"
@ -42,7 +43,29 @@ 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 == "" {
if isFlatpak {
fmt.Println("Socket path is empty, overwriting with flatpak path.")
runtimeConfig.GoldwardenSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"
} else {
fmt.Println("Socket path is empty, overwriting with default path.")
runtimeConfig.GoldwardenSocketPath = home + "/.goldwarden.sock"
}
}
if runtimeConfig.SSHAgentSocketPath == "" {
if isFlatpak {
fmt.Println("SSH Agent socket path is empty, overwriting with flatpak path.")
runtimeConfig.SSHAgentSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/ssh-auth-sock"
} else {
fmt.Println("SSH Agent socket path is empty, overwriting with default path.")
runtimeConfig.SSHAgentSocketPath = home + "/.goldwarden-ssh-agent.sock"
}
}
err = agent.StartUnixAgent(runtimeConfig.GoldwardenSocketPath, runtimeConfig)
if err != nil {
panic(err)
}

View File

@ -36,7 +36,8 @@
<developer_name>Bernd Schoolmann</developer_name>
<update_contact>mail@quexten.com</update_contact>
<releases>
<release version="0.2.11" date="2024-02-17"/>
<release version="0.2.13" date="2024-02-23"/>
<release version="0.2.12" date="2024-02-17"/>
<release version="0.2.9" date="2024-01-04"/>
<release version="0.2.7" date="2023-12-30"/>
<release version="0.2.6" date="2023-12-30"/>

View File

@ -24,11 +24,11 @@
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="1.6792579"
inkscape:cx="142.62253"
inkscape:cy="292.09332"
inkscape:zoom="3.3585158"
inkscape:cx="193.53787"
inkscape:cy="151.70392"
inkscape:window-width="3840"
inkscape:window-height="2091"
inkscape:window-height="2083"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
@ -39,45 +39,39 @@
id="linearGradient17"
inkscape:collect="always">
<stop
style="stop-color:#ffeb28;stop-opacity:1;"
style="stop-color:#ffeb52;stop-opacity:1;"
offset="0"
id="stop17" />
<stop
style="stop-color:#ffb608;stop-opacity:1;"
offset="0.76853603"
id="stop18" />
<stop
style="stop-color:#ffa21f;stop-opacity:1;"
style="stop-color:#ff774b;stop-opacity:1;"
offset="1"
id="stop19" />
</linearGradient>
<radialGradient
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient17"
id="radialGradient18"
cx="66.050179"
cy="50.758305"
fx="66.050179"
fy="50.758305"
r="45"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.1205298,9.6606045e-4,-7.5884389e-4,0.88018377,-7.9225014,6.0178603)" />
id="linearGradient1"
x1="-11.825131"
y1="23.294865"
x2="107.26698"
y2="86.020233"
gradientUnits="userSpaceOnUse" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:url(#radialGradient18);fill-opacity:1;stroke-width:0.262037;fill-rule:nonzero"
style="fill:url(#linearGradient1);fill-opacity:1;fill-rule:nonzero;stroke-width:0.244568"
id="rect1"
width="90"
height="90"
x="5.0169253"
y="4.8409019"
ry="12.342399" />
width="84"
height="84"
x="8"
y="8"
ry="11.519571" />
<g
id="g17"
transform="matrix(1.0914831,0,0,1.0914831,-10.347732,-4.5673979)">
transform="matrix(1.3540167,0,0,1.3477391,-44.781168,-16.956296)">
<circle
style="fill:#ffffff;fill-opacity:1;stroke-width:0.279194"
id="path1"

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

23
main.go
View File

@ -36,33 +36,12 @@ func main() {
ConfigDirectory: configPath,
}
home, err := os.UserHomeDir()
if err != nil {
panic(err)
}
if runtimeConfig.SSHAgentSocketPath == "" {
if _, err := os.Stat(home + "/.ssh-agent-socket"); err == nil {
runtimeConfig.SSHAgentSocketPath = home + "/.ssh-agent-socket"
} else if _, err := os.Stat(home + "/.var/app/com.quexten.Goldwarden/data/ssh-auth-sock"); err == nil {
runtimeConfig.SSHAgentSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/ssh-auth-sock"
}
}
if runtimeConfig.GoldwardenSocketPath == "" {
if _, err := os.Stat(home + "/.goldwarden.sock"); err == nil {
runtimeConfig.GoldwardenSocketPath = home + "/.goldwarden.sock"
} else if _, err := os.Stat(home + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"); err == nil {
runtimeConfig.GoldwardenSocketPath = home + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"
}
}
_, err = os.Stat("/.flatpak-info")
_, err := os.Stat("/.flatpak-info")
isFlatpak := err == nil
if isFlatpak {
userHome, _ := os.UserHomeDir()
runtimeConfig.ConfigDirectory = userHome + "/.var/app/com.quexten.Goldwarden/config/goldwarden.json"
runtimeConfig.ConfigDirectory = strings.ReplaceAll(runtimeConfig.ConfigDirectory, "~", userHome)
runtimeConfig.SSHAgentSocketPath = userHome + "/.var/app/com.quexten.Goldwarden/data/ssh-auth-sock"
runtimeConfig.GoldwardenSocketPath = userHome + "/.var/app/com.quexten.Goldwarden/data/goldwarden.sock"
}
if len(os.Args) > 1 && (strings.Contains(os.Args[1], "com.8bit.bitwarden.json") || strings.Contains(os.Args[1], "chrome-extension://")) {