Add Libredesk, a support desk for email and live chat (#36)
* Add Libredesk, a support desk for email and live chat Libredesk 2.9.2 with PostgreSQL and Redis, configured entirely by environment variables. Its admin password must mix cases, digits and a symbol, so it uses a new "password" secret generator; the schema, README and local test know it. Libredesk keeps its address in its own database, so a small settings service sets it to HARBOR_PUBLIC_URL on every start before the app boots. Its logos are PNG only, so it gets a drawn icon for now (docs/icons.md). * Check recipes against Harbor a21eb2c, which knows generate: password
This commit is contained in:
1 parent
daf4f8b627
commit
a5baf5bbb5
11 files changed
+186
-7
No files matched your search
@@ -23,13 +23,29 @@ with socket.socket() as s: # a free port on this machine
|
||||
port = s.getsockname()[1]
|
||||
|
||||
# Same as Cottage's servers: random32 and random16 are 24 and 12 characters from this
|
||||
# alphabet (no look-alike characters), hex32 is 32 hex digits. Match them exactly, so a recipe
|
||||
# that depends on a secret's length or characters fails here rather than in production.
|
||||
ALPHA = "abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"
|
||||
# alphabet (no look-alike characters), hex32 is 32 hex digits, and password is 24 characters
|
||||
# with at least one lowercase, uppercase, digit and symbol (-_.), never starting with a symbol.
|
||||
# Match them exactly, so a recipe that depends on a secret's length or characters fails here
|
||||
# rather than in production.
|
||||
LOWER, UPPER, DIGIT, SYMBOL = "abcdefghijkmnpqrstuvwxyz", "ABCDEFGHJKLMNPQRSTUVWXYZ", "23456789", "-_."
|
||||
ALPHA = LOWER + UPPER + DIGIT
|
||||
|
||||
|
||||
def password():
|
||||
chars = [secrets.choice(s) for s in (LOWER, UPPER, DIGIT, SYMBOL)]
|
||||
chars += [secrets.choice(ALPHA + SYMBOL) for _ in range(20)]
|
||||
secrets.SystemRandom().shuffle(chars)
|
||||
if chars[0] in SYMBOL:
|
||||
i = next(i for i, c in enumerate(chars) if c not in SYMBOL)
|
||||
chars[0], chars[i] = chars[i], chars[0]
|
||||
return "".join(chars)
|
||||
|
||||
|
||||
GEN = {
|
||||
"random32": lambda: "".join(secrets.choice(ALPHA) for _ in range(24)),
|
||||
"random16": lambda: "".join(secrets.choice(ALPHA) for _ in range(12)),
|
||||
"hex32": lambda: secrets.token_hex(16),
|
||||
"password": password,
|
||||
}
|
||||
env = {
|
||||
# what Cottage's servers provide to every app
|
||||
|
||||
Reference in new issue
Block a user