-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #145 from GaloisInc/120-mkm-client
Add a simple helper program to request keys from the MKM This branch adds a small helper program called `mkm_client` that will connect to the MKM server and to the local trusted boot daemon, request a key, and (on success) print the key to stdout. The logging component's startup script will use this to get an encryption key that it can pass to `cryptsetup` to open the encrypted filesystem.
- Loading branch information
Showing
9 changed files
with
388 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/build/ | ||
/build.*/ | ||
/mkm_client | ||
/mkm_client.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) | ||
|
||
ifeq ($(TARGET),x86_64) | ||
CC = x86_64-linux-gnu-gcc | ||
CXX = x86_64-linux-gnu-g++ | ||
else ifeq ($(TARGET),aarch64) | ||
CC = aarch64-linux-gnu-gcc | ||
CXX = aarch64-linux-gnu-g++ | ||
else ifeq ($(TARGET),) | ||
# If target is unspecified, use gcc and its default target. | ||
CC = gcc | ||
CXX = g++ | ||
else | ||
$(error "bad TARGET $(TARGET)") | ||
endif | ||
|
||
TARGET_SUFFIX = $(foreach x,$(TARGET),.$(x)) | ||
BUILD_DIR = build$(TARGET_SUFFIX) | ||
|
||
MKM_CLIENT_BIN = mkm_client$(TARGET_SUFFIX) | ||
|
||
SRC = mkm_client.c | ||
OBJ = $(SRC:%.c=$(BUILD_DIR)/%.o) | ||
CFLAGS = -I$(ROOT_DIR) -Wall -Wextra -pedantic | ||
|
||
$(MKM_CLIENT_BIN): $(OBJ) | ||
@mkdir -pv $(dir $@) | ||
$(CC) $(CFLAGS) -o $@ $^ | ||
|
||
$(BUILD_DIR)/%.o: $(ROOT_DIR)/%.c | ||
@mkdir -pv $(dir $@) | ||
$(CC) $(CFLAGS) -c $< -o $@ | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf build/ build.*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Mission Key Management Client | ||
|
||
This is a small helper program for requesting a key from the Mission Key | ||
Management component. It connects to an MKM server and the local trusted boot | ||
daemon and requests a particular key ID. The key received is written to | ||
stdout. If the request fails for any reason, the client program exits nonzero. | ||
|
||
|
||
## Building | ||
|
||
To build the MKM client: | ||
|
||
```sh | ||
make | ||
``` | ||
|
||
Or, to build an ARM binary for use inside the OpenSUT VMs: | ||
|
||
```sh | ||
make TARGET=aarch64 | ||
``` | ||
|
||
|
||
## Protocol | ||
|
||
See `../mission_key_management/README.md` for details on the protocol. | ||
|
||
The MKM client connects to localhost (127.0.0.1) port 6000 by default. To | ||
change this, set the `MKM_HOST` and/or `MKM_PORT` environment variables. | ||
For example, `MKM_HOST=10.0.2.121 MKM_PORT=6001 ./mkm_client` will cause it to | ||
connect to port 6001 on 10.0.2.121. |
Oops, something went wrong.