Browse Source

Remove disk decryption endpoint as unused

pull/7/head
Inex Code 12 months ago
parent
commit
0ef2b36f24
  1. 1
      selfprivacy_api/app.py
  2. 52
      selfprivacy_api/resources/common.py

1
selfprivacy_api/app.py

@ -51,7 +51,6 @@ def create_app(test_config=None):
api.add_resource(ApiVersion, "/api/version")
api.add_resource(Users, "/users")
api.add_resource(User, "/users/<string:username>")
api.add_resource(DecryptDisk, "/decryptDisk")
app.register_blueprint(api_system)
app.register_blueprint(api_services)

52
selfprivacy_api/resources/common.py

@ -25,55 +25,3 @@ class ApiVersion(Resource):
description: Unauthorized
"""
return {"version": "1.1.0"}
class DecryptDisk(Resource):
"""Decrypt disk"""
def post(self):
"""
Decrypt /dev/sdb using cryptsetup luksOpen
---
consumes:
- application/json
tags:
- System
security:
- bearerAuth: []
parameters:
- in: body
name: body
required: true
description: Provide a password for decryption
schema:
type: object
required:
- password
properties:
password:
type: string
description: Decryption password.
responses:
201:
description: OK
400:
description: Bad request
401:
description: Unauthorized
"""
parser = reqparse.RequestParser(bundle_errors=True)
parser.add_argument("password", type=str, required=True)
args = parser.parse_args()
decryption_command = ["cryptsetup", "luksOpen", "/dev/sdb", "decryptedVar"]
# TODO: Check if this works at all
decryption_service = subprocess.Popen(
decryption_command,
shell=False,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
)
decryption_service.communicate(input=args["password"])
return {"status": decryption_service.returncode}, 201

Loading…
Cancel
Save