Fix pinentry in flatpak
This commit is contained in:
parent
563ad6fa45
commit
a6d3a1026d
4 changed files with 15 additions and 5 deletions
|
|
@ -139,6 +139,8 @@ func serveAgentSession(c net.Conn, vault *vault.Vault, cfg *config.Config) {
|
||||||
payload := messages.PinentryRegistrationResponse{
|
payload := messages.PinentryRegistrationResponse{
|
||||||
Success: pinnentrySetError == nil,
|
Success: pinnentrySetError == nil,
|
||||||
}
|
}
|
||||||
|
log.Info("Pinentry registration success: %t", payload.Success)
|
||||||
|
|
||||||
responsePayload, err := messages.IPCMessageFromPayload(payload)
|
responsePayload, err := messages.IPCMessageFromPayload(payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
writeError(c, err)
|
writeError(c, err)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ from .monitors import dbus_autofill_monitor
|
||||||
from .monitors import dbus_monitor
|
from .monitors import dbus_monitor
|
||||||
import sys
|
import sys
|
||||||
from src.services import goldwarden
|
from src.services import goldwarden
|
||||||
|
from src.services import pinentry
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
import os
|
import os
|
||||||
import secrets
|
import secrets
|
||||||
|
|
@ -36,6 +37,7 @@ def main():
|
||||||
# start daemons
|
# start daemons
|
||||||
dbus_autofill_monitor.run_daemon(token) # todo: remove after migration
|
dbus_autofill_monitor.run_daemon(token) # todo: remove after migration
|
||||||
dbus_monitor.run_daemon(token)
|
dbus_monitor.run_daemon(token)
|
||||||
|
pinentry.daemonize()
|
||||||
|
|
||||||
if not "--hidden" in sys.argv:
|
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)
|
p = subprocess.Popen(["python3", "-m", "src.gui.settings"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, cwd=root_path, start_new_session=True)
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ def run_daemon(token):
|
||||||
daemon_env = os.environ.copy()
|
daemon_env = os.environ.copy()
|
||||||
daemon_env["GOLDWARDEN_DAEMON_AUTH_TOKEN"] = token
|
daemon_env["GOLDWARDEN_DAEMON_AUTH_TOKEN"] = token
|
||||||
|
|
||||||
print("starting goldwarden daemon", BINARY_PATH, token)
|
print("starting goldwarden daemon", BINARY_PATH)
|
||||||
|
|
||||||
# print while running
|
# print while running
|
||||||
result = subprocess.Popen([f"{BINARY_PATH}", "daemonize"], stdout=subprocess.PIPE, text=True, env=daemon_env)
|
result = subprocess.Popen([f"{BINARY_PATH}", "daemonize"], stdout=subprocess.PIPE, text=True, env=daemon_env)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
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))
|
root_path = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir))
|
||||||
|
|
||||||
def get_pin(message):
|
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.write(f"{message}\n".encode())
|
||||||
p.stdin.flush()
|
p.stdin.flush()
|
||||||
pin = p.stdout.readline().decode().strip()
|
pin = p.stdout.readline().decode().strip()
|
||||||
|
|
@ -14,7 +16,7 @@ def get_pin(message):
|
||||||
return pin
|
return pin
|
||||||
|
|
||||||
def get_approval(message):
|
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.write(f"{message}\n".encode())
|
||||||
p.stdin.flush()
|
p.stdin.flush()
|
||||||
result = p.stdout.readline().decode().strip()
|
result = p.stdout.readline().decode().strip()
|
||||||
|
|
@ -25,4 +27,8 @@ def get_approval(message):
|
||||||
def daemon():
|
def daemon():
|
||||||
goldwarden.listen_for_pinentry(get_pin, get_approval)
|
goldwarden.listen_for_pinentry(get_pin, get_approval)
|
||||||
|
|
||||||
daemon()
|
def daemonize():
|
||||||
|
#todo fix this
|
||||||
|
time.sleep(3)
|
||||||
|
thread = Thread(target=daemon)
|
||||||
|
thread.start()
|
||||||
Loading…
Reference in a new issue