Fix pinentry in flatpak

This commit is contained in:
Bernd Schoolmann 2024-02-09 17:26:41 +01:00
parent 563ad6fa45
commit a6d3a1026d
No known key found for this signature in database
4 changed files with 15 additions and 5 deletions

View File

@ -139,6 +139,8 @@ func serveAgentSession(c net.Conn, vault *vault.Vault, cfg *config.Config) {
payload := messages.PinentryRegistrationResponse{
Success: pinnentrySetError == nil,
}
log.Info("Pinentry registration success: %t", payload.Success)
responsePayload, err := messages.IPCMessageFromPayload(payload)
if err != nil {
writeError(c, err)

View File

@ -6,6 +6,7 @@ from .monitors import dbus_autofill_monitor
from .monitors import dbus_monitor
import sys
from src.services import goldwarden
from src.services import pinentry
from threading import Thread
import os
import secrets
@ -36,6 +37,7 @@ def main():
# start daemons
dbus_autofill_monitor.run_daemon(token) # todo: remove after migration
dbus_monitor.run_daemon(token)
pinentry.daemonize()
if not "--hidden" in sys.argv:
p = subprocess.Popen(["python3", "-m", "src.gui.settings"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, cwd=root_path, start_new_session=True)

View File

@ -175,7 +175,7 @@ def run_daemon(token):
daemon_env = os.environ.copy()
daemon_env["GOLDWARDEN_DAEMON_AUTH_TOKEN"] = token
print("starting goldwarden daemon", BINARY_PATH, token)
print("starting goldwarden daemon", BINARY_PATH)
# print while running
result = subprocess.Popen([f"{BINARY_PATH}", "daemonize"], stdout=subprocess.PIPE, text=True, env=daemon_env)

View File

@ -1,11 +1,13 @@
import subprocess
import os
from gui.src.services import goldwarden
from src.services import goldwarden
from threading import Thread
import time
root_path = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir))
def get_pin(message):
p = subprocess.Popen(["python3", "-m", "src.ui.pinentry"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=root_path, start_new_session=True)
p = subprocess.Popen(["python3", "-m", "src.gui.pinentry"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=root_path, start_new_session=True)
p.stdin.write(f"{message}\n".encode())
p.stdin.flush()
pin = p.stdout.readline().decode().strip()
@ -14,7 +16,7 @@ def get_pin(message):
return pin
def get_approval(message):
p = subprocess.Popen(["python3", "-m", "src.ui.pinentry_approval"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, cwd=root_path, start_new_session=True)
p = subprocess.Popen(["python3", "-m", "src.gui.pinentry_approval"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, cwd=root_path, start_new_session=True)
p.stdin.write(f"{message}\n".encode())
p.stdin.flush()
result = p.stdout.readline().decode().strip()
@ -25,4 +27,8 @@ def get_approval(message):
def daemon():
goldwarden.listen_for_pinentry(get_pin, get_approval)
daemon()
def daemonize():
#todo fix this
time.sleep(3)
thread = Thread(target=daemon)
thread.start()