Added disk decryption endpoint

This commit is contained in:
Illia Chub 2021-04-13 16:54:30 +03:00
parent d7a6b3ca12
commit c4ab0a9f7f

View file

@ -70,5 +70,12 @@ def getServiceStatus():
smtp=smtpService.returncode, smtp=smtpService.returncode,
http=httpService.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__': if __name__ == '__main__':
app.run(port=5050, debug=False) app.run(port=5050, debug=False)