mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-03 07:37:16 -04:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d82c9b5e02 | ||
|
|
9133a73553 | ||
|
|
ad039d6322 | ||
|
|
caa5fad0bc | ||
|
|
68ded52e8c | ||
|
|
85c59b302d | ||
|
|
954dd30361 | ||
|
|
65d1885311 | ||
|
|
5a7b45c3ac | ||
|
|
e5638255a8 | ||
|
|
2e32911470 | ||
|
|
4973d18034 | ||
|
|
6e13a6ebb3 | ||
|
|
dfbdc16079 |
@@ -42,7 +42,7 @@ cd sshyp
|
||||
makepkg -si
|
||||
```
|
||||
|
||||
Packaging for other distributions coming soon.
|
||||
Pre-built packages exist for Arch, Debian, and Termux. These can be downloaded from the releases page.
|
||||
|
||||
# Building
|
||||
Since sshyp is written entirely in Python, it doesn't need to be compiled. It does, however, need to be packaged for installation.
|
||||
|
||||
+7
-11
@@ -1,26 +1,23 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
# sshync 2022.01.16.unreleased11
|
||||
# sshync 2022.01.17.unreleased13
|
||||
|
||||
# external modules
|
||||
|
||||
from os import system, remove, mkdir, walk
|
||||
from os import path, system, walk
|
||||
from os.path import getmtime, join, expanduser
|
||||
from sys import exit as s_exit
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
# utility functions
|
||||
|
||||
def get_titles_mods(_directory, _destination, _user_data):
|
||||
_title_list, _mod_list = [], []
|
||||
try: # create config directory
|
||||
mkdir(expanduser('~/.config/sshync'), 0o700)
|
||||
except FileExistsError:
|
||||
pass
|
||||
Path(path.expanduser('~/.config/sshync')).mkdir(0o700, parents=True, exist_ok=True) # create config directory
|
||||
# local fetching
|
||||
if _destination == 'l':
|
||||
remove(expanduser('~/.config/sshync/database')) # assumed to exist because remote runs first
|
||||
open(expanduser('~/.config/sshync/database'), 'w') # create blank database file
|
||||
open(expanduser('~/.config/sshync/database'), 'w').write('') # blanks out database file
|
||||
for _root, _directories, _files in walk(_directory):
|
||||
for _filename in _files:
|
||||
_title_list.append(join(_root.replace(_directory, '', 1), _filename))
|
||||
@@ -34,9 +31,8 @@ def get_titles_mods(_directory, _destination, _user_data):
|
||||
if _destination == 'r':
|
||||
system(f"ssh -i '{_user_data[5]}' -p {_user_data[2]} {_user_data[0]}@{_user_data[1]} \"python -c 'import sshync"
|
||||
f"; sshync.get_titles_mods(\"'\"{_user_data[4]}\"'\", \"'\"l\"'\", \"'\"{_user_data}\"'\")'\"")
|
||||
system(f"sftp -P {_user_data[2]} {_user_data[0]}@{_user_data[1]}:"
|
||||
f"'{expanduser(f'/home/{_user_data[0]}/.config/sshync/database')}' "
|
||||
f"'{expanduser('~/.config/sshync/database')}'")
|
||||
system(f"sftp -i '{_user_data[5]}' -P {_user_data[2]} {_user_data[0]}@{_user_data[1]}:"
|
||||
f"'{expanduser(f'/home/{_user_data[0]}/.config/sshync/database')}' '{expanduser('~/.config/sshync/')}'")
|
||||
_titles, _sep, _mods = ' '.join(open(expanduser('~/.config/sshync/database')).readlines()).replace('\n', '')\
|
||||
.partition('^&*')
|
||||
_title_list, _mod_list = _titles.split(' ')[:-1], _mods.split(' ')[1:]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# external modules
|
||||
|
||||
from os import environ, mkdir, remove, system, path
|
||||
from os import environ, remove, system, path
|
||||
from shutil import copy, move, rmtree
|
||||
from sys import argv, exit as s_exit
|
||||
from pathlib import Path
|
||||
@@ -24,7 +24,7 @@ def shm_gen(): # generates a random temporary folder for security and returns r
|
||||
for _ in range(random.randint(10, 30)))
|
||||
_shm_entry_gen = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits)
|
||||
for _ in range(random.randint(10, 30)))
|
||||
mkdir(f"{tmp_dir}{_shm_folder_gen}", 0o700)
|
||||
Path(tmp_dir + _shm_folder_gen).mkdir(0o700)
|
||||
return _shm_folder_gen, _shm_entry_gen
|
||||
|
||||
|
||||
@@ -48,17 +48,11 @@ def edit_note(_shm_folder, _shm_entry):
|
||||
|
||||
def tweak(): # runs configuration wizard
|
||||
# storage/config directory creation
|
||||
try:
|
||||
mkdir(path.expanduser('~/.password-pasture'), 0o700)
|
||||
except FileExistsError:
|
||||
pass
|
||||
try:
|
||||
mkdir(path.expanduser('~/.config/sshyp'), 0o700)
|
||||
except FileExistsError:
|
||||
pass
|
||||
if not Path(f"{path.expanduser('~/.config/sshyp/tmp')}").is_file():
|
||||
if Path("/data/data/com.termux").is_file():
|
||||
system(f"ln -s {path.expanduser('~/../usr/tmp')} {path.expanduser('~/.config/sshyp/tmp')}")
|
||||
Path(path.expanduser('~/.password-pasture')).mkdir(0o700, parents=True, exist_ok=True)
|
||||
Path(path.expanduser('~/.config/sshyp')).mkdir(0o700, parents=True, exist_ok=True)
|
||||
if not Path(f"{path.expanduser('~/.config/sshyp/tmp')}").exists():
|
||||
if Path("/data/data/com.termux").exists():
|
||||
system(f"ln -s '/data/data/com.termux/files/usr/tmp' {path.expanduser('~/.config/sshyp/tmp')}")
|
||||
else:
|
||||
system(f"ln -s /dev/shm {path.expanduser('~/.config/sshyp/tmp')}")
|
||||
# device type configuration
|
||||
@@ -83,10 +77,7 @@ def tweak(): # runs configuration wizard
|
||||
open(path.expanduser('~/.config/sshyp/sshyp-gpg'), 'w').write(_gpg_id + '\n')
|
||||
|
||||
# lock file generation
|
||||
try:
|
||||
open(path.expanduser('~/.config/sshyp/lock'), 'x').write('')
|
||||
except FileExistsError:
|
||||
pass
|
||||
open(path.expanduser('~/.config/sshyp/lock'), 'w')
|
||||
system(f"gpg -r {str(_gpg_id)} -e {path.expanduser('~/.config/sshyp/lock')}")
|
||||
remove(f"{path.expanduser('~/.config/sshyp')}/lock")
|
||||
|
||||
@@ -154,9 +145,9 @@ def print_info(): # prints help text based on argument
|
||||
elif argument == 'version' or argument == '-v':
|
||||
print('\n////////////////////////////////////////////////////////')
|
||||
print('/ /')
|
||||
print('/ sshyp Copyright (C) 2021 Randall Winkhart /')
|
||||
print('/ sshyp Copyright (C) 2021-2022 Randall Winkhart /')
|
||||
print('/ /')
|
||||
print('/ Version 2022.01.16.fr3.2 /')
|
||||
print('/ Version 2022.01.26.fr3.4 /')
|
||||
print('/ The Boxing Update /')
|
||||
print('/ /')
|
||||
print('////////////////////////////////////////////////////////\n')
|
||||
@@ -242,7 +233,7 @@ def add_entry(): # adds a new entry
|
||||
|
||||
def add_folder(): # creates a new folder
|
||||
_folder_name = str(input('Name of new folder: '))
|
||||
mkdir(directory + _folder_name, 0o700)
|
||||
Path(directory + _folder_name).mkdir(0o700)
|
||||
system(f"ssh -p {port} {username_ssh}@{ip} \"mkdir -p '{directory_ssh}{_folder_name}'\"")
|
||||
|
||||
|
||||
@@ -348,7 +339,7 @@ def copy_data(): # copies a specified field of an entry to the clipboard
|
||||
_shm_folder, _shm_entry = shm_gen()
|
||||
system(f"gpg -d --output {tmp_dir}{_shm_folder}/{_shm_entry} '{directory}{_read_entry}.gpg'")
|
||||
_copy_line = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'r').readlines()
|
||||
if Path("/data/data/com.termux").is_file(): # checks for Termux, Wayland, or X
|
||||
if Path("/data/data/com.termux").exists(): # checks for Termux, Wayland, or X
|
||||
if argument == 'copy username' or argument == 'copy -u':
|
||||
system('termux-clipboard-set ' + "'" + _copy_line[0].replace('\n', '').replace("'", "'\\''") + "'")
|
||||
elif argument == 'copy password' or argument == 'copy -p':
|
||||
@@ -386,14 +377,18 @@ def remove_data(): # deletes an entry or folder from both the client and the se
|
||||
_entry_name = _entry_name.replace('/', '', 1)
|
||||
try:
|
||||
system(f"gpg -d --output {tmp_dir}sshyp.lock {path.expanduser('~/.config/sshyp/lock.gpg')}")
|
||||
_unlock = open('{tmp_dir}sshyp.lock', 'r').readlines()
|
||||
_unlock = open(f"{tmp_dir}sshyp.lock", 'r').readlines()
|
||||
remove(f"{tmp_dir}sshyp.lock")
|
||||
except FileNotFoundError:
|
||||
print('\nAccess denied.\n')
|
||||
s_exit()
|
||||
if device_type == 'c':
|
||||
system(f"ssh -p {port} {username_ssh}@{ip} \"rm -rf '{directory_ssh}{_entry_name}.gpg'\"")
|
||||
remove(f"{directory}{_entry_name}.gpg")
|
||||
try:
|
||||
remove(f"{directory}{_entry_name}.gpg")
|
||||
except FileNotFoundError:
|
||||
print("\nThe file does not exist!\n")
|
||||
s_exit()
|
||||
|
||||
|
||||
# program start sequence
|
||||
|
||||
+97
-2
@@ -1,8 +1,103 @@
|
||||
sshyp 2022.01.26.fr3.4
|
||||
|
||||
The Boxing Update - Patch 4
|
||||
|
||||
This release is a hotfix for 2022.01.17.fr3.3. It fixes a major bug with sshync.
|
||||
|
||||
Changes:
|
||||
|
||||
- sshync now correctly uses the auto-generated SSH key in all operations
|
||||
- an exception has been added for attempting to delete/shear a file that does not exist
|
||||
- the manpage has been updated and now includes setup instructions
|
||||
|
||||
&&
|
||||
|
||||
Planned for next major update (fr4, The sshyp Doing a Split Update):
|
||||
|
||||
sshyp:
|
||||
** sshyp has recieved a major visual overhaul
|
||||
^ this includes the new file list and thematic text art
|
||||
|
||||
sshync:
|
||||
** sshync has been split into a separate package and now has standalone functionality as a backup/syncing utility
|
||||
^ more details will be available in the sshync repo, once it is created
|
||||
|
||||
&&
|
||||
|
||||
Planned for next, next major update (fr5, The Farmer Shearing the sshyp Update):
|
||||
|
||||
** allow for multi-client deletion... somehow (in sshync)
|
||||
** when syncing, a check is made to see if any folders are not on all devices - if the check comes back true, it is corrected (in sshyp)
|
||||
** imporove password generator to guarantee more secure results
|
||||
** enforce permissions on the server-side
|
||||
** allow for copying entire notes (not just first line)
|
||||
** ability to pass entries as arguments for more functions
|
||||
|
||||
&&
|
||||
|
||||
Backlog:
|
||||
|
||||
** create separate gui frontend targetting mobile and desktop Linux
|
||||
** auto-completion on tab (currently unsure of best way to make this work)
|
||||
|
||||
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||
|
||||
sshyp 2022.01.17.fr3.3
|
||||
|
||||
The Boxing Update - Patch 3
|
||||
|
||||
This release is a hotfix for 2022.01.16.fr3.2. It fixes major bugs, especially with Termux.
|
||||
|
||||
Changes:
|
||||
|
||||
- the temporary directory for Termux is now sym-linked with its full path (no longer dangling)
|
||||
- the copy function can now properly detect if Termux is being used
|
||||
- ~/.config is created, if it does not already exist
|
||||
- "sshyp shear" now functions again, as a bug with the lock file has been fixed
|
||||
- sshync -should- now properly detect the database file on all platforms (was broken on Termux)
|
||||
- total lines of code have been slightly reduced with various small optimizations
|
||||
|
||||
Additions planned for minor releases:
|
||||
|
||||
** updated the manpage with more information regarding how sshyp works and how to set it up
|
||||
** ensured that it is now impossible for ghosts of entires to remain in /dev/shm
|
||||
** reduced total lines of code with small optimizations
|
||||
|
||||
&&
|
||||
|
||||
Planned for next major update (fr4, The sshyp Doing a Split Update):
|
||||
|
||||
sshyp:
|
||||
** sshyp has recieved a major visual overhaul
|
||||
^ this includes the new file list and thematic text art
|
||||
|
||||
sshync:
|
||||
** sshync has been split into a separate package and now has standalone functionality as a backup/syncing utility
|
||||
^ more details will be available in the sshync repo, once it is created
|
||||
|
||||
&&
|
||||
|
||||
Planned for next, next major update (fr5, The Farmer Shearing the sshyp Update):
|
||||
|
||||
** allow for multi-client deletion... somehow (in sshync)
|
||||
** when syncing, a check is made to see if any folders are not on all devices - if the check comes back true, it is corrected (in sshyp)
|
||||
** imporove password generator to guarantee more secure results
|
||||
** enforce permissions on the server-side
|
||||
** allow for copying entire notes (not just first line)
|
||||
** ability to pass entries as arguments for more functions
|
||||
|
||||
&&
|
||||
|
||||
Backlog:
|
||||
|
||||
** create separate gui frontend targetting mobile and desktop Linux
|
||||
** auto-completion on tab (currently unsure of best way to make this work)
|
||||
|
||||
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||
|
||||
sshyp 2022.01.16.fr3.2
|
||||
|
||||
The Boxing Update
|
||||
The Boxing Update - Patch 2
|
||||
|
||||
This release is a hotfix for 2022.01.16.fr3.1. It fixes major bugs, including one massively impacting Termux.
|
||||
|
||||
@@ -52,7 +147,7 @@ Backlog:
|
||||
|
||||
sshyp 2022.01.16.fr3.1
|
||||
|
||||
The Boxing Update
|
||||
The Boxing Update - Patch 1
|
||||
|
||||
This release is a hotfix for 2022.01.13.fr3. It fixes sshync/syncing support after the changes in the last release.
|
||||
|
||||
|
||||
+28
-3
@@ -1,4 +1,4 @@
|
||||
.TH sshyp 1 "10 January 2022" "2021.12.01.fr2.3" "sshyp man page"
|
||||
.TH sshyp 1 "26 January 2022" "2022.01.26.fr3.4" "sshyp man page"
|
||||
.SH NAME
|
||||
sshyp \- A very simple self-hosted, synchronized password manager. Alternative to GNU pass.
|
||||
.SH SYNOPSIS
|
||||
@@ -66,9 +66,34 @@ copy:
|
||||
note/-n copy the note of an entry to your clipboard
|
||||
gen:
|
||||
update/-u generate a password for an existing entry
|
||||
.SH BUGS
|
||||
This is more of a current limitation than a bug, but:
|
||||
.SH LIMITATIONS
|
||||
The following limitations will be corrected in future updates:
|
||||
|
||||
Currently, if multiple clients are connected to a single server and a client deletes an entry, the entry is correctly deleted from the client and the server, but since the entry still exists on the other client, the next time it syncs the file will be re-uploaded. This will be fixed in an upcoming release of the syncing backend, sshync.
|
||||
|
||||
Currently, folders (for sorting) are not replicated onto new clients (they need to be manually created before syncing).
|
||||
|
||||
Currently, the entry list displays each entry with the file extension ".gpg" visible (which you do not type when reading, modifying, or creating an entry). This will be corrected when the new entry list is added.
|
||||
.SH SETUP
|
||||
sshyp operates on a client-server model, and thus requires you to have access to your own server (whether it be a physical home server or a cloud rental) with remote access via SSH.
|
||||
|
||||
The sshyp package includes modes for operating on both client and server devices, so only one package is necessary.
|
||||
|
||||
Server setup:
|
||||
Configure an openssh server (if sshyp was installed from the Debian package, the ssh server was not installed as a dependency and needs to be installed manually)
|
||||
Allow remote access to the SSH server w/public key authentication (disabling password-only authentication recommended)
|
||||
Install sshyp
|
||||
Run "sshyp tweak" and set the device type as server
|
||||
Done!
|
||||
|
||||
Client setup:
|
||||
Install sshyp
|
||||
Run "sshyp tweak" and follow the prompts
|
||||
Copy the generated public SSH key to the server using preferred method (manually adding to authorized_keys, ssh-copy-id, etc.)
|
||||
**this step will be automated in the future: if an entry library already exists on the server, make sure to manually recreate any folders that exist on the server in the ~/.password-pasture directory
|
||||
If you already have entries on the server, sync them using "sshyp sync"
|
||||
Done!
|
||||
|
||||
Please note that the server setup intentionally does not allow the reading of entries (it does not allow adding a gpg decryption key). For security purposes, only clients can read entries.
|
||||
.SH AUTHOR
|
||||
Randall Winkhart (https://github.com/rwinkhart)
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
sshyp 2022.01.16.fr3.2
|
||||
sshyp 2022.01.26.fr3.4
|
||||
|
||||
The Boxing Update
|
||||
The Boxing Update - Patch 4
|
||||
|
||||
This release is a hotfix for 2022.01.16.fr3.1. It fixes major bugs, including one massively impacting Termux.
|
||||
This release is a hotfix for 2022.01.17.fr3.3. It fixes a major bug with sshync.
|
||||
|
||||
Changes:
|
||||
|
||||
- sshyp now uses a symlink to the temporary storage directory, allowing for easy implementation of different temporary directories on different platforms
|
||||
^ the first usage of this is enabling the use of temporary storage on Termux
|
||||
- sshync now properly auto-generates its config directory
|
||||
|
||||
Additions planned for minor releases:
|
||||
|
||||
** updated the manpage with more information regarding how sshyp works and how to set it up
|
||||
** ensured that it is now impossible for ghosts of entires to remain in /dev/shm
|
||||
** reduced total lines of code with small optimizations
|
||||
- sshync now correctly uses the auto-generated SSH key in all operations
|
||||
- an exception has been added for attempting to delete/shear a file that does not exist
|
||||
- the manpage has been updated and now includes setup instructions
|
||||
|
||||
&&
|
||||
|
||||
|
||||
Reference in New Issue
Block a user