From 1bdef1382f4fad853ed7bb4b41b1111993c45fbf Mon Sep 17 00:00:00 2001 From: Cuan Date: Tue, 14 Sep 2021 13:15:28 -0400 Subject: [PATCH] fixed client-side deletion via ssh --- usr/bin/rpass | 16 +++++++++++----- usr/share/doc/rpass/changelog | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/usr/bin/rpass b/usr/bin/rpass index 1c75853..ef267a1 100755 --- a/usr/bin/rpass +++ b/usr/bin/rpass @@ -130,7 +130,7 @@ if argument == 'version' or argument == '-v': print('/ /') print('/ rpass Copyright (C) 2021 Randall Winkhart /') print('/ /') - print('/ Version 2021.09.14.pr4 /') + print('/ Version 2021.09.12.pr4 /') print('/ The Housekeeping Update (Pt. 1) /') print('/ /') print('////////////////////////////////////////////////////////') @@ -219,6 +219,8 @@ if argument == 'config': f.write('rsync -v -H -r -l -t -p --delete -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + '\n') with open("/var/lib/rpass/rpassip", 'w') as f: f.write(ip + '\n') + with open("/var/lib/rpass/rpassport", 'w') as f: + f.write(port + '\n') print() print('Default directory: ' + '/home/' + usernamessh + '/.rpass-store/') print() @@ -251,6 +253,8 @@ with open("/var/lib/rpass/rpassrsyncdown") as f: rsyncdownn = f.read().strip() with open("/var/lib/rpass/rpassip") as f: ip = f.read().strip() +with open("/var/lib/rpass/rpassport") as f: + port = f.read().strip() with open("/var/lib/rpass/rpassuserssh") as f: usernamessh = f.read().strip() @@ -634,10 +638,16 @@ if argument == 'remove' or argument == '-rm': entryname = str(input('What would you like to delete? ')) if entryname.startswith('/'): if entryname.replace('/', '', 1).__contains__('/'): + term('ssh -p ' + port + '' + usernamessh + '@' + ip + ' rm -rf ' + "'" + directoryssh + "'" + entryname + .replace('/', '', 1) + '.gpg') remove(directory + entryname.replace('/', '', 1) + '.gpg') else: + term('ssh -p ' + port + '' + usernamessh + '@' + ip + ' rm -rf ' + "'" + directoryssh + "'" + entryname + .replace('/', '', 1)) rmtree(directory + entryname.replace('/', '', 1)) else: + term('ssh -p ' + port + ' ' + usernamessh + '@' + ip + ' rm -rf ' + "'" + directoryssh + "'" + entryname + + '.gpg') remove(directory + entryname + '.gpg') # permissions - applied pre-sync to ensure permissions are correct before upload @@ -651,7 +661,3 @@ if argument.__contains__('add') or argument.__contains__('-rm') or argument.__co __contains__('edit') or argument.__contains__('gen') or argument == 'sync' or argument == '-s': rsyncup() rsyncdown() - print() - print('Please note that as of this time, entries can only be deleted if removed from the central server in a ' - 'client-server scenario. This will be adjusted soon.') - print() diff --git a/usr/share/doc/rpass/changelog b/usr/share/doc/rpass/changelog index a651f1d..f2f0bfa 100755 --- a/usr/share/doc/rpass/changelog +++ b/usr/share/doc/rpass/changelog @@ -22,8 +22,8 @@ Changes: - added version info argument - re-ordered config wizard for better rsync support - optimized code for random string generation in /dev/shm +- entry deletion can now be done client-side **optimize code (specifically for when there is no folder but there is a slash) -**fix rsync delete on upload **properly comment the code **validate for Python 3.10 **do a better job at clearing /dev/shm