Moved all password-related stuff to a tmp folder you can bind to tmpfs
This commit is contained in:
parent
e73aec8110
commit
133f409f77
6
app.py
6
app.py
|
@ -14,17 +14,17 @@ def create_email_account(username, password):
|
||||||
if password and is_valid_input(username):
|
if password and is_valid_input(username):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
with open("password.tmp", "w") as file:
|
with open("tmp/password.tmp", "w") as file:
|
||||||
file.write(password)
|
file.write(password)
|
||||||
|
|
||||||
# Use echo to securely pass the password to the command
|
# Use echo to securely pass the password to the command
|
||||||
cmd = ["cat", "password.tmp", "|", "doas", "-u", "maddy", "maddy", "creds", "create", f"{username}@hectabit.org"]
|
cmd = ["cat", "tmp/password.tmp", "|", "doas", "-u", "maddy", "maddy", "creds", "create", f"{username}@hectabit.org"]
|
||||||
result = subprocess.run(" ".join(cmd), shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
result = subprocess.run(" ".join(cmd), shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
|
||||||
cmd2 = ["doas", "-u", "maddy", "maddy", "imap-acct", "create", f"{username}@hectabit.org"]
|
cmd2 = ["doas", "-u", "maddy", "maddy", "imap-acct", "create", f"{username}@hectabit.org"]
|
||||||
result2 = subprocess.run(" ".join(cmd2), shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
result2 = subprocess.run(" ".join(cmd2), shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
|
||||||
os.remove("password.tmp")
|
os.remove("tmp/password.tmp")
|
||||||
|
|
||||||
if result.returncode == 0 and result2.returncode == 0:
|
if result.returncode == 0 and result2.returncode == 0:
|
||||||
# Command executed successfully
|
# Command executed successfully
|
||||||
|
|
Loading…
Reference in New Issue