mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-03 07:37:16 -04:00
Re-ordered config wizard for better rsync support
This commit is contained in:
+52
-54
@@ -1,9 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# rpass 2021.09.08.pr4
|
|
||||||
# rpass is the gnu pass alternative for those who don't want to use git
|
|
||||||
# rpass is freely licensed for modification and redistribution under the GNU General Public License V3
|
|
||||||
|
|
||||||
from os import system
|
from os import system
|
||||||
from os import remove
|
from os import remove
|
||||||
from os import environ
|
from os import environ
|
||||||
@@ -115,7 +111,8 @@ if argument == 'version' or argument == '-v':
|
|||||||
print('/ /')
|
print('/ /')
|
||||||
print('/ rpass Copyright (C) 2021 Randall Winkhart /')
|
print('/ rpass Copyright (C) 2021 Randall Winkhart /')
|
||||||
print('/ /')
|
print('/ /')
|
||||||
print('/ version 2021.09.08.pr4 /')
|
print('/ Version 2021.09.08.pr4 /')
|
||||||
|
print('/ The Housekeeping Update (Pt. 1) /')
|
||||||
print('/ /')
|
print('/ /')
|
||||||
print('////////////////////////////////////////////////////////')
|
print('////////////////////////////////////////////////////////')
|
||||||
print()
|
print()
|
||||||
@@ -154,70 +151,71 @@ if argument == 'config':
|
|||||||
with open("/var/lib/rpass/rpassdir", 'w') as f:
|
with open("/var/lib/rpass/rpassdir", 'w') as f:
|
||||||
f.write(directory + '\n')
|
f.write(directory + '\n')
|
||||||
print()
|
print()
|
||||||
gpgpresent = str(input('rpass requires the use of a unique gpg key. Do you already have one you are willing to '
|
devicetype = str(input('Will this be a client or a server device? (c/S) '))
|
||||||
'use? (y/N) '))
|
if devicetype != 'c':
|
||||||
if gpgpresent == 'y' or gpgpresent == 'Y':
|
|
||||||
print()
|
print()
|
||||||
gpgid = str(input('Please input the ID of your gpg key: '))
|
print('Make sure the ssh service is running and properly configured.')
|
||||||
with open("/var/lib/rpass/rpassgpg", 'w') as f:
|
|
||||||
f.write(gpgid + '\n')
|
|
||||||
if gpgpresent != 'y':
|
|
||||||
print()
|
print()
|
||||||
gpggen = str(input('Would you like to generate one now? Note that if you choose not to do this, you will have '
|
if devicetype == 'c':
|
||||||
'to re-run "rpass config" to specify a gpg key when you acquire one (Y/n) '))
|
print()
|
||||||
if gpggen != 'n':
|
gpgpresent = str(input('rpass requires the use of a unique gpg key. Do you already have one you are willing to '
|
||||||
term('gpg --full-generate-key')
|
'use? (y/N) '))
|
||||||
|
if gpgpresent == 'y' or gpgpresent == 'Y':
|
||||||
print()
|
print()
|
||||||
gpgid = str(input('Please input the ID of your gpg key: '))
|
gpgid = str(input('Please input the ID of your gpg key: '))
|
||||||
with open("/var/lib/rpass/rpassgpg", 'w') as f:
|
with open("/var/lib/rpass/rpassgpg", 'w') as f:
|
||||||
f.write(gpgid + '\n')
|
f.write(gpgid + '\n')
|
||||||
if gpggen == 'n' or gpggen == 'N':
|
if gpgpresent != 'y':
|
||||||
exit()
|
print()
|
||||||
print()
|
gpggen = str(
|
||||||
syncsetup = str(input('Would you like to configure rsync over ssh for entry backup and syncing? (Y/n) '))
|
input('Would you like to generate one now? Note that if you choose not to do this, you will have '
|
||||||
if syncsetup != 'n':
|
'to re-run "rpass config" to specify a gpg key when you acquire one (Y/n) '))
|
||||||
|
if gpggen != 'n':
|
||||||
|
term('gpg --full-generate-key')
|
||||||
|
print()
|
||||||
|
gpgid = str(input('Please input the ID of your gpg key: '))
|
||||||
|
with open("/var/lib/rpass/rpassgpg", 'w') as f:
|
||||||
|
f.write(gpgid + '\n')
|
||||||
|
if gpggen == 'n' or gpggen == 'N':
|
||||||
|
exit()
|
||||||
|
print()
|
||||||
|
print('Make sure the ssh service on the remote server is running and properly configured.')
|
||||||
print()
|
print()
|
||||||
sshgen = str(input('rsync support requires a unique ssh key. Would you like to have this '
|
sshgen = str(input('rsync support requires a unique ssh key. Would you like to have this '
|
||||||
'automatically generated? (Y/n) '))
|
'automatically generated? (Y/n) '))
|
||||||
if sshgen != 'n':
|
if sshgen != 'n':
|
||||||
term('ssh-keygen -f ~/.ssh/rpass')
|
term('ssh-keygen -f ~/.ssh/rpass')
|
||||||
print()
|
print()
|
||||||
print('The server device(s) should be configured first.')
|
print('Example input: 10.10.10.10:9999')
|
||||||
print()
|
print()
|
||||||
devicetype = str(input('Will this be a client or a server device? (c/S) '))
|
ip_port = str(input('What is the IP and ssh port of the remote server? '))
|
||||||
if devicetype != 'c':
|
print()
|
||||||
|
usernamessh = str(input('What is the username of the remote server? '))
|
||||||
|
ip, sep, port = ip_port.partition(':')
|
||||||
|
with open("/var/lib/rpass/rpassuserssh", 'w') as f:
|
||||||
|
f.write(usernamessh + '\n')
|
||||||
|
with open("/var/lib/rpass/rpassrsyncup", 'w') as f:
|
||||||
|
f.write('rsync -v -H -r -l -t -p -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + '\n')
|
||||||
|
with open("/var/lib/rpass/rpassrsyncdown", 'w') as f:
|
||||||
|
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')
|
||||||
|
print()
|
||||||
|
print('Default directory: ' + '/home/' + usernamessh + '/.rpass-store/')
|
||||||
|
print()
|
||||||
|
directoryssh = str(input('Is the remote server using the default password directory? (Y/n) '))
|
||||||
|
if directoryssh != 'n':
|
||||||
|
directoryssh = ('/home/' + usernamessh + '/.rpass-store/')
|
||||||
|
if directoryssh == 'n' or directoryssh == 'N':
|
||||||
print()
|
print()
|
||||||
print('Make sure the ssh service is running and that the proper port is forwarded.')
|
print('Format: /this/path/ends/with/a/slash/')
|
||||||
if devicetype == 'c':
|
|
||||||
print()
|
print()
|
||||||
print('Make sure the ssh service is running and that the proper port is forwarded on the remote server.')
|
directoryssh = str(input('What directory is the server using?: '))
|
||||||
print('Example input: 10.10.10.10:9999')
|
with open("/var/lib/rpass/rpassdirssh", 'w') as f:
|
||||||
print()
|
f.write(directoryssh + '\n')
|
||||||
ip_port = str(input('What is the IP and ssh port of the remote server? '))
|
print()
|
||||||
print()
|
print('Configuration complete!')
|
||||||
usernamessh = str(input('What is the username of the remote server? '))
|
print()
|
||||||
ip, sep, port = ip_port.partition(':')
|
|
||||||
with open("/var/lib/rpass/rpassuserssh", 'w') as f:
|
|
||||||
f.write(usernamessh + '\n')
|
|
||||||
with open("/var/lib/rpass/rpassrsyncup", 'w') as f:
|
|
||||||
f.write('rsync -v -H -r -l -t -p -e ' + '"ssh -i ~/.ssh/rpass -p ' + port + '" ' + '\n')
|
|
||||||
with open("/var/lib/rpass/rpassrsyncdown", 'w') as f:
|
|
||||||
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')
|
|
||||||
print()
|
|
||||||
print('Default directory: ' + '/home/' + usernamessh + '/.rpass-store/')
|
|
||||||
print()
|
|
||||||
directoryssh = str(input('Is the remote server using the default password directory? (Y/n) '))
|
|
||||||
if directoryssh != 'n':
|
|
||||||
directoryssh = ('/home/' + usernamessh + '/.rpass-store/')
|
|
||||||
if directoryssh == 'n' or directoryssh == 'N':
|
|
||||||
print()
|
|
||||||
print('Format: /this/path/ends/with/a/slash/')
|
|
||||||
print()
|
|
||||||
directoryssh = str(input('What directory is the server using?: '))
|
|
||||||
with open("/var/lib/rpass/rpassdirssh", 'w') as f:
|
|
||||||
f.write(directoryssh + '\n')
|
|
||||||
|
|
||||||
# import userdata
|
# import userdata
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
rpass-2021.09.08.pr4
|
rpass-2021.09.08.pr4
|
||||||
|
|
||||||
The Housekeeping Update - Fourth public release of rpass
|
The Housekeeping Update (Pt. 1) - Fourth public release of rpass
|
||||||
|
|
||||||
This release focuses primarily on polishing rpass and tying up loose ends before
|
This release focuses primarily on polishing rpass and tying up loose ends before
|
||||||
making any major changes in the future.
|
making any major changes in the future.
|
||||||
|
|
||||||
New features:
|
New features:
|
||||||
|
|
||||||
**overhaul error message using exceptions
|
**overhaul error messages using exceptions
|
||||||
**add exceptions for unknown arguments
|
**add exceptions for unknown arguments
|
||||||
**make clean, colorful file list by exporting to document and removing extensions
|
**make clean, colorful file list by exporting to document and removing extensions
|
||||||
**make a manpage
|
**make a manpage
|
||||||
@@ -19,8 +19,8 @@ Changes:
|
|||||||
|
|
||||||
- fixed gpg decryption warnings
|
- fixed gpg decryption warnings
|
||||||
- added version info argument
|
- added version info argument
|
||||||
|
- re-ordered config wizard for better rsync support
|
||||||
**optimize code (specifically for when there is no folder but there is a slash)
|
**optimize code (specifically for when there is no folder but there is a slash)
|
||||||
**update rsync config wizard
|
|
||||||
**fix rsync delete on upload
|
**fix rsync delete on upload
|
||||||
**properly comment the code
|
**properly comment the code
|
||||||
**validate for Python 3.10
|
**validate for Python 3.10
|
||||||
|
|||||||
Reference in New Issue
Block a user