Added disk decryption endpoint

pull/2/head
Illia Chub 2021-04-13 16:54:30 +03:00
parent d7a6b3ca12
commit c4ab0a9f7f
1 changed files with 7 additions and 0 deletions

View File

@ -70,5 +70,12 @@ def getServiceStatus():
smtp=smtpService.returncode,
http=httpService.returncode
)
@app.route("/decryptDisk", methods=["POST"])
def requestDiskDecryption():
decryptionService = subprocess.Popen(["echo", "-n", request.headers['X-Decryption-Key'], "|", "cryptsetup", "luksOpen", "/dev/sdb", "decryptedVar"], stdout=subprocess.PIPE, shell=False)
decryptionService.communicate()[0]
return jsonify(
status=decryptionService.returncode
)
if __name__ == '__main__':
app.run(port=5050, debug=False)