Skip to content
Snippets Groups Projects
Commit ffd32426 authored by Arie Peterson's avatar Arie Peterson
Browse files

Resolve discussions

parent 4170ed77
No related branches found
No related tags found
No related merge requests found
......@@ -73,22 +73,8 @@ int callback_encryption_remove_post(const struct _u_request * request,
}
// Determine the filesystem usage of the encrypted data partition.
unsigned long size = filesystem_usage(DATA_TMP_MOUNTPOINT);
if (size < 0)
{
// Something went wrong in determining the filesystem usage.
printf("determining filesystem usage failed: return code %lu\n", size);
return send_simple_response(response, 500, "error",
"determining filesystem usage failed");
}
printf("root device usage: %lu bytes\n", size);
// Determine the available memory.
unsigned long memory = available_memory();
double projected_usage = (double)size / (double)memory;
printf("projected memory usage: %.3f\n", projected_usage);
if (projected_usage > MEMORY_USAGE)
bool fits = filesystem_fits_in_memory(DATA_TMP_MOUNTPOINT, MEMORY_USAGE);
if (! fits)
{
// Projected memory usage is really high, so abort.
return send_simple_response(response, 500, "error",
......
// Web interface settings.
#define PREFIX "/cryptops/v0"
#define PORT 8000
#define BIND_ADDRESS "127.0.0.1"
// Device paths.
#define ROOT_DEVICE "/dev/xvda"
#define INFO_PARTITION_DEVICE ROOT_DEVICE "1"
#define DATA_PARTITION_DEVICE ROOT_DEVICE "2"
#define MAPPED_DEVICE_NAME "xvda1_crypt"
#define MAPPED_DEVICE_PATH "/dev/mapper/" MAPPED_DEVICE_NAME
// Filesystem parameters.
#define FILESYSTEM_TYPE "xfs"
// Mountpoint paths.
#define INFO_MOUNTPOINT "/conf/persistent"
// Resource usage.
#define MEMORY_USAGE 0.9
// Temporary mountpoints.
#define UNENCRYPTED_TMP_MOUNTPOINT "/tmp/mnt-plain"
#define INFO_TMP_MOUNTPOINT "/tmp/mnt-info"
#define DATA_TMP_MOUNTPOINT "/tmp/mnt-data"
#define TMP_LOCATION "/tmp/" MAPPED_DEVICE_NAME
#define INFO_MOUNTPOINT "/conf/persistent"
// Ssh configuration file locations.
#define AUTHORIZED_KEYS_DIR "/root/.ssh"
#define AUTHORIZED_KEYS_PATH AUTHORIZED_KEYS_DIR "/authorized_keys"
#define SSH_HOST_KEY_DIR "/dropbear"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment