From 1ad18bf128c4edfae76adaffd9c7801355f29b91 Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Fri, 15 Feb 2019 10:40:56 +1100 Subject: ui/ncurses: Add prompt for LUKS device password Implement device_add() in cui_client_ops and use this interface to recognise when the server notifies the client of an encrypted device. A "device header" will be created for this device and added to the menu with no associated boot options. The nc-auth prompt is extended to ask for a disk password when the device header for an encrypted device is selected. Assuming the password is correct pb-discover will remove the original device and notify the client about the newly opened device, which will be reflected in the menu. Signed-off-by: Samuel Mendoza-Jonas --- ui/common/discover-client.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'ui/common/discover-client.c') diff --git a/ui/common/discover-client.c b/ui/common/discover-client.c index e7dfb83..6dda2d3 100644 --- a/ui/common/discover-client.c +++ b/ui/common/discover-client.c @@ -552,3 +552,28 @@ int discover_client_send_set_password(struct discover_client *client, pb_log("sending auth message..\n"); return pb_protocol_write_message(client->fd, message); } + +int discover_client_send_open_luks_device(struct discover_client *client, + char *password, char *device_id) +{ + struct pb_protocol_message *message; + struct auth_message auth_msg; + int len; + + auth_msg.op = AUTH_MSG_DECRYPT; + auth_msg.decrypt_dev.password = password; + auth_msg.decrypt_dev.device_id = device_id; + + len = pb_protocol_authenticate_len(&auth_msg); + + message = pb_protocol_create_message(client, + PB_PROTOCOL_ACTION_AUTHENTICATE, len); + if (!message) + return -1; + + pb_log("serialising auth message..\n"); + pb_protocol_serialise_authenticate(&auth_msg, message->payload, len); + + pb_log("sending auth message..\n"); + return pb_protocol_write_message(client->fd, message); +} -- cgit v1.2.1