fix ssl_decrypt replace logging with message window and path corrected #36

Merged
punix merged 1 commits from 04-06-2025_large_update into main 2025-06-08 00:38:23 +02:00
5 changed files with 41 additions and 42 deletions
Showing only changes of commit 298a3da73b - Show all commits

View File

@ -6,11 +6,21 @@ My standard System: Linux Mint 22 Cinnamon
- os import in common_tools.py replaced by other methods - os import in common_tools.py replaced by other methods
- If Wire-Py already runs, prevent further start - If Wire-Py already runs, prevent further start
- for loops with lists replaced by List Comprehensions - for loops with lists replaced by List Comprehensions
- Tunnel in tk.canvas for modern look
- Replace Download Button with Lx Tools installer
### Added ### Added
03-06-2025 07-06-2025
- ssl_decrypt now directly checks whether encrypted files are located in the specified directory.
- This method has been removed from common_tools. The path has been adjusted ssl_decrypt likely
had an incorrect path. No files were decrypted. This has been fixed.
- Key generation has been removed from ssl_decrypt, as it is only needed in ssl_encrypt.
- Logviewer now in the settings menu. Moduls now as libs in share_libs.
- The Lx Tools installer is there to ensure that everything required for the selected app is installed.
-
### Added ### Added
13-04-20255 13-04-20255
@ -49,12 +59,14 @@ My standard System: Linux Mint 22 Cinnamon
- Tunnels are now read from the directory to view them in the list. - Tunnels are now read from the directory to view them in the list.
To display only own tunnels, and read errors are minimized. To display only own tunnels, and read errors are minimized.
### Added ### Added
10-11-2024 10-11-2024
- Fix Checkbutton Autostart when first install Wire-Py - Fix Checkbutton Autostart when first install Wire-Py
- Update Translate Files - Update Translate Files
### Added ### Added
10-11-2024 10-11-2024

View File

@ -5,7 +5,8 @@ from pathlib import Path
import pwd import pwd
import shutil import shutil
from subprocess import CompletedProcess, run from subprocess import CompletedProcess, run
from shared_libs.wp_app_config import AppConfig, logging from shared_libs.wp_app_config import AppConfig
from shared_libs.common_tools import LxTools
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--user", required=True, help="Username of the target file system") parser.add_argument("--user", required=True, help="Username of the target file system")
@ -17,41 +18,21 @@ try:
uid = user_info.pw_uid # User ID (e.g., 1000) uid = user_info.pw_uid # User ID (e.g., 1000)
gid = user_info.pw_gid # Group ID (e.g., 1000) gid = user_info.pw_gid # Group ID (e.g., 1000)
except KeyError: except KeyError:
logging.error(f"User '{args.user}' not found.", exc_info=True) LxTools.msg_window(
AppConfig.IMAGE_PATHS["icon_error"],
AppConfig.IMAGE_PATHS["icon_error"],
"Error decrypt",
f"User '{args.user}' not found.",
exc_info=True,
)
exit(1) exit(1)
keyfile: Path = Path(f"/home/{args.user}/.config/wire_py/pbwgk.pem") crypted_tunnel: Path = Path(f"/home/{args.user}/.config/wire_py")
path_of_crypted_tunnel: Path = Path(f"/home/{args.user}/.config/wire_py")
if not keyfile.is_file(): if len([str(file) for file in crypted_tunnel.glob("*.dat")]) == 0:
process: CompletedProcess[str] = run( pass
[ else:
"openssl", crypted__tunnel = [str(file) for file in crypted_tunnel.glob("*.dat")]
"rsa",
"-in",
AppConfig.SYSTEM_PATHS["pkey_path"],
"-out",
keyfile,
"-outform",
"PEM",
"-pubout",
],
capture_output=True,
text=True,
check=False,
)
if process.returncode == 0:
logging.info("Public key generated successfully.", exc_info=True)
else:
logging.error(
f"Error with the following code... {process.returncode}", exc_info=True
)
shutil.chown(keyfile, uid, gid)
if AppConfig.PUBLICKEY.exists():
crypted__tunnel = [str(file) for file in path_of_crypted_tunnel.glob("*.dat")]
for tunnel_path in crypted__tunnel: for tunnel_path in crypted__tunnel:
@ -74,11 +55,12 @@ if AppConfig.PUBLICKEY.exists():
check=False, check=False,
) )
shutil.chown(f"{AppConfig.TEMP_DIR}/{base_name}.conf", uid, gid) shutil.chown(f"{AppConfig.TEMP_DIR}/{base_name}.conf", uid, gid)
logging.info(f"Processing of the file: {tunnel_path}", exc_info=True)
# Output from Openssl Error # Output from Openssl Error
if process.stderr: if process.stderr:
logging.error( LxTools.msg_window(
AppConfig.IMAGE_PATHS["icon_error"],
AppConfig.IMAGE_PATHS["icon_error"],
"Error decrypt",
f"{process.stderr} Error by [{tunnel_path}] Code: {process.returncode}", f"{process.stderr} Error by [{tunnel_path}] Code: {process.returncode}",
exc_info=True,
) )

View File

@ -2,16 +2,19 @@
""" This Script encrypt Wireguardfiles for Wirepy users for more Security """ """ This Script encrypt Wireguardfiles for Wirepy users for more Security """
import argparse import argparse
import logging
from pathlib import Path from pathlib import Path
import pwd import pwd
import shutil import shutil
from subprocess import CompletedProcess, run from subprocess import CompletedProcess, run
from shared_libs.wp_app_config import AppConfig, logging from shared_libs.wp_app_config import AppConfig
from shared_libs.common_tools import LogConfig
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--user", required=True, help="Username of the target file system") parser.add_argument("--user", required=True, help="Username of the target file system")
args = parser.parse_args() args = parser.parse_args()
LogConfig.logger(f"/home/{args.user}/.local/share/lxlogs/wirepy.log")
try: try:
# Retrieve UID and GID # Retrieve UID and GID
user_info = pwd.getpwnam(args.user) user_info = pwd.getpwnam(args.user)

View File

@ -848,6 +848,7 @@ class FrameWidgets(ttk.Frame):
self.selected_option.set(1) self.selected_option.set(1)
self.autoconnect_var.set("") self.autoconnect_var.set("")
self.auto_con = ConfigManager.get("autostart") self.auto_con = ConfigManager.get("autostart")
AppConfig.get_autostart_content()
else: else:
self.selected_option.set(0) self.selected_option.set(0)
@ -1144,10 +1145,9 @@ class FrameWidgets(ttk.Frame):
if __name__ == "__main__": if __name__ == "__main__":
AppConfig.ensure_directories() AppConfig.ensure_directories()
AppConfig.create_default_settings() AppConfig.create_default_settings()
CryptoUtil.decrypt(getpass.getuser(), AppConfig.CONFIG_DIR)
_ = AppConfig.setup_translations() _ = AppConfig.setup_translations()
LxTools.sigi(AppConfig.TEMP_DIR) LxTools.sigi(AppConfig.TEMP_DIR)
CryptoUtil.decrypt(getpass.getuser())
window = Wirepy() window = Wirepy()
LogConfig.logger(ConfigManager.get("logfile")) LogConfig.logger(ConfigManager.get("logfile"))
""" """

View File

@ -57,7 +57,7 @@ class AppConfig:
# Updates # Updates
# 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year # 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year
VERSION: str = "v. 2.04.1725" VERSION: str = "v. 2.06.0725"
UPDATE_URL: str = "https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases" UPDATE_URL: str = "https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases"
DOWNLOAD_URL: str = "https://git.ilunix.de/punix/Wire-Py/archive" DOWNLOAD_URL: str = "https://git.ilunix.de/punix/Wire-Py/archive"
@ -153,6 +153,8 @@ class AppConfig:
text=True, text=True,
check=False, check=False,
) )
if process.returncode == 0:
logging.info(process.stdout, exc_info=True)
if process.stderr: if process.stderr:
logging.error(f"{process.stderr} Code: {process.returncode}", exc_info=True) logging.error(f"{process.stderr} Code: {process.returncode}", exc_info=True)