added keyring auth, so we don't have to save credentials in file
This commit is contained in:
@@ -67,6 +67,12 @@
|
|||||||
<p>Updated to newest FreeRDP which seems to fix issues with hanging / freezing</p>
|
<p>Updated to newest FreeRDP which seems to fix issues with hanging / freezing</p>
|
||||||
</description>
|
</description>
|
||||||
</release>
|
</release>
|
||||||
|
<release version="1.3.0" date="2025-02-19">
|
||||||
|
<url type="details">https://gitea.farmdash.org/angoosh/Flatpaks/src/tag/1.3.0</url>
|
||||||
|
<description>
|
||||||
|
<p>Changed pasword storage from file to system keyring. Still using file for compatibility. Also added menu for credential selection.</p>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
</releases>
|
</releases>
|
||||||
|
|
||||||
<screenshots>
|
<screenshots>
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ finish-args:
|
|||||||
- --filesystem=xdg-download
|
- --filesystem=xdg-download
|
||||||
- --socket=pcsc
|
- --socket=pcsc
|
||||||
# - --socket=system-bus
|
# - --socket=system-bus
|
||||||
|
- --socket=session-bus
|
||||||
# - --talk-name=org.freedesktop.Flatpak
|
# - --talk-name=org.freedesktop.Flatpak
|
||||||
|
|
||||||
add-build-extensions:
|
add-build-extensions:
|
||||||
@@ -68,7 +69,7 @@ modules:
|
|||||||
build-args:
|
build-args:
|
||||||
- --share=network
|
- --share=network
|
||||||
build-commands:
|
build-commands:
|
||||||
- pip3 install PyGObject cryptography
|
- pip3 install PyGObject cryptography keyring
|
||||||
|
|
||||||
- name: rdpconnect
|
- name: rdpconnect
|
||||||
buildsystem: simple
|
buildsystem: simple
|
||||||
|
|||||||
@@ -18,13 +18,15 @@ from cryptography.fernet import Fernet
|
|||||||
gi.require_version('Gtk', '4.0')
|
gi.require_version('Gtk', '4.0')
|
||||||
gi.require_version('Adw', '1')
|
gi.require_version('Adw', '1')
|
||||||
from gi.repository import Gtk, Adw, Gdk, Gio
|
from gi.repository import Gtk, Adw, Gdk, Gio
|
||||||
|
import keyring
|
||||||
|
|
||||||
APPID = "com.angoosh.RDPConnect"
|
APPID = "com.angoosh.RDPConnect"
|
||||||
HOMEDIR = os.path.expanduser('~')
|
HOMEDIR = os.path.expanduser('~')
|
||||||
|
|
||||||
VERSION = "1.2.0"
|
VERSION = "1.3.0"
|
||||||
|
|
||||||
conn_info = {}
|
conn_info = {}
|
||||||
|
hist_info = {}
|
||||||
settings = {}
|
settings = {}
|
||||||
settings["extra_params"] = {}
|
settings["extra_params"] = {}
|
||||||
fernet = ""
|
fernet = ""
|
||||||
@@ -47,6 +49,18 @@ def load_keys():
|
|||||||
def load_config():
|
def load_config():
|
||||||
global conn_info, settings
|
global conn_info, settings
|
||||||
loaded_json = ""
|
loaded_json = ""
|
||||||
|
try:
|
||||||
|
with open(HOMEDIR+"/.config/rdpconnect/history.json", "r") as history_file:
|
||||||
|
for line in connection_file:
|
||||||
|
loaded_json += line
|
||||||
|
|
||||||
|
hist_info = json.loads(loaded_json)
|
||||||
|
last_conn = conn_info[max(hist_info)]
|
||||||
|
conn_info["user"] = last_conn.split('@')[0]
|
||||||
|
conn_info["ip"] = last_conn.split('@')[1]
|
||||||
|
conn_info["passwd"] = keyring.get_password("rdpconnect", last_conn)
|
||||||
|
|
||||||
|
except:
|
||||||
try:
|
try:
|
||||||
with open(HOMEDIR+"/.config/rdpconnect/connection.json", "r") as connection_file:
|
with open(HOMEDIR+"/.config/rdpconnect/connection.json", "r") as connection_file:
|
||||||
for line in connection_file:
|
for line in connection_file:
|
||||||
@@ -261,6 +275,15 @@ class MyApp(Adw.Application):
|
|||||||
def saveConnConf(self):
|
def saveConnConf(self):
|
||||||
if settings["save_conn"]:
|
if settings["save_conn"]:
|
||||||
password = conn_info["passwd"]
|
password = conn_info["passwd"]
|
||||||
|
useratip = conn_info["user"] + "@" + conn_info["ip"]
|
||||||
|
with open(HOMEDIR+"/.config/rdpconnect/history.json", "a") as hist_file:
|
||||||
|
hist_id = str(int(max(hist_info)) + 1)
|
||||||
|
hist_info[hist_id] = useratip
|
||||||
|
js = json.dumps(hist_info, sort_keys=True, indent=4, separators=(',', ': '))
|
||||||
|
hist_file.write(js)
|
||||||
|
try:
|
||||||
|
keyring.set_password("rdpconnect", useratip, password)
|
||||||
|
except:
|
||||||
conn_info["passwd"] = fernet.encrypt(password.encode()).decode("utf-8")
|
conn_info["passwd"] = fernet.encrypt(password.encode()).decode("utf-8")
|
||||||
|
|
||||||
print("Saving connection config to "+HOMEDIR+"/.config/rdpconnect/connection.json")
|
print("Saving connection config to "+HOMEDIR+"/.config/rdpconnect/connection.json")
|
||||||
|
|||||||
Reference in New Issue
Block a user