mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
v1.8.0
This commit is contained in:
parent
b8e851c332
commit
a0c1239246
|
@ -1577,7 +1577,7 @@ you can hash passwords before putting them into config files / providing them a
|
||||||
|
|
||||||
optionally also specify `--ah-cli` to enter an interactive mode where it will hash passwords without ever writing the plaintext ones to disk
|
optionally also specify `--ah-cli` to enter an interactive mode where it will hash passwords without ever writing the plaintext ones to disk
|
||||||
|
|
||||||
the default configs take about 0.4 sec to process a new password on a decent laptop
|
the default configs take about 0.4 sec and 256 MiB RAM to process a new password on a decent laptop
|
||||||
|
|
||||||
|
|
||||||
## https
|
## https
|
||||||
|
|
|
@ -659,6 +659,7 @@ def get_sects():
|
||||||
use sha2-512 with 424242 iterations
|
use sha2-512 with 424242 iterations
|
||||||
|
|
||||||
recommended: \033[32m--ah-alg argon2\033[0m
|
recommended: \033[32m--ah-alg argon2\033[0m
|
||||||
|
(takes about 0.4 sec and 256M RAM to process a new password)
|
||||||
|
|
||||||
argon2 needs python-package argon2-cffi,
|
argon2 needs python-package argon2-cffi,
|
||||||
scrypt needs openssl,
|
scrypt needs openssl,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
VERSION = (1, 7, 6)
|
VERSION = (1, 8, 0)
|
||||||
CODENAME = "unlinked"
|
CODENAME = "argon"
|
||||||
BUILD_DT = (2023, 6, 11)
|
BUILD_DT = (2023, 6, 26)
|
||||||
|
|
||||||
S_VERSION = ".".join(map(str, VERSION))
|
S_VERSION = ".".join(map(str, VERSION))
|
||||||
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)
|
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)
|
||||||
|
|
|
@ -1136,7 +1136,7 @@ class AuthSrv(object):
|
||||||
self.log("\n{0}\n{1}{0}".format(t, "\n".join(slns)))
|
self.log("\n{0}\n{1}{0}".format(t, "\n".join(slns)))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
self.setup_pwhash()
|
self.setup_pwhash(acct)
|
||||||
|
|
||||||
# case-insensitive; normalize
|
# case-insensitive; normalize
|
||||||
if WINDOWS:
|
if WINDOWS:
|
||||||
|
@ -1658,9 +1658,9 @@ class AuthSrv(object):
|
||||||
|
|
||||||
self.re_pwd = re.compile(zs)
|
self.re_pwd = re.compile(zs)
|
||||||
|
|
||||||
def setup_pwhash(self) -> None:
|
def setup_pwhash(self, acct: dict[str, str]) -> None:
|
||||||
self.ah = PWHash(self.args)
|
self.ah = PWHash(self.args)
|
||||||
if self.ah.alg == "none":
|
if not self.ah.on:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.args.ah_cli:
|
if self.args.ah_cli:
|
||||||
|
@ -1673,19 +1673,17 @@ class AuthSrv(object):
|
||||||
print(self.ah.hash(self.args.ah_gen))
|
print(self.ah.hash(self.args.ah_gen))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if not self.args.a:
|
if not acct:
|
||||||
return
|
return
|
||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
for acct in self.args.a[:]:
|
for uname, pw in list(acct.items())[:]:
|
||||||
uname, pw = acct.split(":", 1)
|
|
||||||
if pw.startswith("+") and len(pw) == 33:
|
if pw.startswith("+") and len(pw) == 33:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
changed = True
|
changed = True
|
||||||
hpw = self.ah.hash(pw)
|
hpw = self.ah.hash(pw)
|
||||||
self.args.a.remove(acct)
|
acct[uname] = hpw
|
||||||
self.args.a.append("{}:{}".format(uname, hpw))
|
|
||||||
t = "hashed password for account {}: {}"
|
t = "hashed password for account {}: {}"
|
||||||
self.log(t.format(uname, hpw), 3)
|
self.log(t.format(uname, hpw), 3)
|
||||||
|
|
||||||
|
@ -1693,8 +1691,7 @@ class AuthSrv(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
lns = []
|
lns = []
|
||||||
for acct in self.args.a:
|
for uname, pw in acct.items():
|
||||||
uname, pw = acct.split(":", 1)
|
|
||||||
lns.append(" {}: {}".format(uname, pw))
|
lns.append(" {}: {}".format(uname, pw))
|
||||||
|
|
||||||
t = "please use the following hashed passwords in your config:\n{}"
|
t = "please use the following hashed passwords in your config:\n{}"
|
||||||
|
|
|
@ -17,7 +17,9 @@ class Ico(object):
|
||||||
def get(self, ext: str, as_thumb: bool, chrome: bool) -> tuple[str, bytes]:
|
def get(self, ext: str, as_thumb: bool, chrome: bool) -> tuple[str, bytes]:
|
||||||
"""placeholder to make thumbnails not break"""
|
"""placeholder to make thumbnails not break"""
|
||||||
|
|
||||||
zb = hashlib.sha1(ext.encode("utf-8")).digest()[2:4]
|
bext = ext.encode("ascii", "replace")
|
||||||
|
ext = bext.decode("utf-8")
|
||||||
|
zb = hashlib.sha1(bext).digest()[2:4]
|
||||||
if PY2:
|
if PY2:
|
||||||
zb = [ord(x) for x in zb]
|
zb = [ord(x) for x in zb]
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,12 @@ class PWHash(object):
|
||||||
alg = args.ah_alg
|
alg = args.ah_alg
|
||||||
ac = {}
|
ac = {}
|
||||||
|
|
||||||
|
if alg == "none":
|
||||||
|
alg = ""
|
||||||
|
|
||||||
self.alg = alg
|
self.alg = alg
|
||||||
self.ac = ac
|
self.ac = ac
|
||||||
if alg == "none":
|
if not alg:
|
||||||
self.on = False
|
self.on = False
|
||||||
self.hash = unicode
|
self.hash = unicode
|
||||||
return
|
return
|
||||||
|
|
|
@ -23,6 +23,7 @@ copyparty/ico.py,
|
||||||
copyparty/mdns.py,
|
copyparty/mdns.py,
|
||||||
copyparty/mtag.py,
|
copyparty/mtag.py,
|
||||||
copyparty/multicast.py,
|
copyparty/multicast.py,
|
||||||
|
copyparty/pwhash.py,
|
||||||
copyparty/res,
|
copyparty/res,
|
||||||
copyparty/res/__init__.py,
|
copyparty/res/__init__.py,
|
||||||
copyparty/res/COPYING.txt,
|
copyparty/res/COPYING.txt,
|
||||||
|
|
|
@ -98,7 +98,7 @@ class Cfg(Namespace):
|
||||||
def __init__(self, a=None, v=None, c=None):
|
def __init__(self, a=None, v=None, c=None):
|
||||||
ka = {}
|
ka = {}
|
||||||
|
|
||||||
ex = "daw dav_auth dav_inf dav_mac dav_rt dotsrch e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp ed emp force_js getmod grid hardlink ih ihead magic never_symlink nid nih no_acode no_athumb no_dav no_dedup no_del no_dupe no_logues no_mv no_readme no_robots no_sb_md no_sb_lg no_scandir no_thumb no_vthumb no_zip nrand nw rand vc xdev xlink xvol"
|
ex = "daw dav_auth dav_inf dav_mac dav_rt dotsrch e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp ed emp force_js getmod grid hardlink ih ihead magic never_symlink nid nih no_acode no_athumb no_dav no_dedup no_del no_dupe no_logues no_mv no_readme no_robots no_sb_md no_sb_lg no_scandir no_thumb no_vthumb no_zip nrand nw rand smb vc xdev xlink xvol"
|
||||||
ka.update(**{k: False for k in ex.split()})
|
ka.update(**{k: False for k in ex.split()})
|
||||||
|
|
||||||
ex = "dotpart no_rescan no_sendfile no_voldump plain_ip"
|
ex = "dotpart no_rescan no_sendfile no_voldump plain_ip"
|
||||||
|
@ -113,7 +113,7 @@ class Cfg(Namespace):
|
||||||
ex = "df loris re_maxage rproxy rsp_jtr rsp_slp s_wr_slp theme themes turbo"
|
ex = "df loris re_maxage rproxy rsp_jtr rsp_slp s_wr_slp theme themes turbo"
|
||||||
ka.update(**{k: 0 for k in ex.split()})
|
ka.update(**{k: 0 for k in ex.split()})
|
||||||
|
|
||||||
ex = "doctitle favico html_head lg_sbf log_fk md_sbf mth textfiles unlist R RS SR"
|
ex = "ah_alg doctitle favico html_head lg_sbf log_fk md_sbf mth textfiles unlist R RS SR"
|
||||||
ka.update(**{k: "" for k in ex.split()})
|
ka.update(**{k: "" for k in ex.split()})
|
||||||
|
|
||||||
ex = "xad xar xau xbd xbr xbu xiu xm"
|
ex = "xad xar xau xbd xbr xbu xiu xm"
|
||||||
|
|
Loading…
Reference in a new issue