fix ssldecrypt

This commit is contained in:
2025-04-17 16:25:24 +02:00
parent 177fa1cc34
commit ca58ac86a4
3 changed files with 32 additions and 6 deletions

View File

@ -12,7 +12,13 @@ with open(uname, 'r') as f:
''' Dirname "tlecdewg" = Tunnel Encrypt Decrypt Wireguard '''
dirname = Path('/tmp/tlecdcwg/')
keyfile = '/usr/local/etc/ssl/pwgk.pem'
keyfile = Path(f'/home/{logname}/.config/wire_py/pbwgk.pem')
pkeyfile = '/usr/local/etc/ssl/pwgk.pem'
if not keyfile.is_file():
check_call(['openssl', 'rsa', '-in', pkeyfile, '-out', keyfile, '-outform', 'PEM', '-pubout'])
shutil.chown(keyfile, 1000, 1000)
dirname2 = ('/home/' + logname + '/.config/wire_py/')
detl = os.listdir(dirname2)
@ -24,5 +30,5 @@ if os.path.exists(dirname2 + 'pbwgk.pem'):
for detunnels in detl:
tlname2 = detunnels[:-4] + '.conf'
extpath = str(dirname) + '/' + tlname2
check_call(['openssl', 'pkeyutl', '-decrypt', '-inkey', keyfile, '-in', detunnels, '-out', extpath])
check_call(['openssl', 'pkeyutl', '-decrypt', '-inkey', pkeyfile, '-in', detunnels, '-out', extpath])
shutil.chown(extpath, 1000, 1000)