-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
podvm: Start Attestation Agent as Systemd Unit
fixes #773 - Add Attestation Agent process in podns namespace - Move netns mgmt into its own unit - Add docs for secure key release at runtime Signed-off-by: Magnus Kulke <[email protected]>
- Loading branch information
Showing
6 changed files
with
45 additions
and
7 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Secure Key Release at Runtime | ||
|
||
To request a key at runtime a Pod can invoke a local Key Broker Client (KBC) implemented in [Attestation Agent](https://github.com/confidential-containers/attestation-agent) (AA). An instance of AA is available as gRPC endpoint in the Pod's network namespace on port `50001`. Depending on the KBC implementation this might trigger a remote attestation exchange with an external [Key Broker Service](https://github.com/confidential-containers/kbs) (KBS). | ||
|
||
|
||
## Example | ||
|
||
The following code is supposed to run in a Peer Pod. It downloads a grpcurl binary, the respective proto files for the gRPC service, and triggers a request to retrieve a key. The example below is using an external KBS via the `cc_kbc` KBC implementation. | ||
|
||
```bash | ||
wget https://github.com/fullstorydev/grpcurl/releases/download/v1.8.7/grpcurl_1.8.7_linux_x86_64.tar.gz -O grpcurl.tar.gz | ||
tar -xvf grpcurl.tar.gz | ||
wget https://raw.githubusercontent.com/confidential-containers/attestation-agent/main/protos/getresource.proto -O aa.proto | ||
./grpcurl -proto aa.proto -plaintext -d @ localhost:50001 getresource.GetResourceService.GetResource <<EOM | ||
{ | ||
"ResourcePath": "/my_repo/resource_type/123abc", | ||
"KbcName":"cc_kbc", | ||
"KbsUri": "https://some-kbs.com" | ||
} | ||
EOM | ||
``` |
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,13 @@ | ||
[Unit] | ||
Description=Attestation Agent Service | ||
BindsTo[email protected] | ||
After=network.target kata-agent.service [email protected] | ||
|
||
[Service] | ||
Type=simple | ||
NetworkNamespacePath=/run/netns/podns | ||
ExecStart=/usr/local/bin/attestation-agent --getresource_sock 127.0.0.1:50001 | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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 |
---|---|---|
@@ -1,13 +1,11 @@ | ||
[Unit] | ||
Description=Kata Agent | ||
After=network.target | ||
BindsTo[email protected] | ||
After=network.target [email protected] | ||
|
||
[Service] | ||
ExecStart=/usr/local/bin/kata-agent --config /etc/agent-config.toml | ||
ExecStartPre=-umount /sys/fs/cgroup/misc | ||
ExecStartPre=ip netns add podns | ||
ExecStartPre=ip netns exec podns ip link set lo up | ||
ExecStopPost=ip netns delete podns | ||
ExecStopPost=/usr/local/bin/kata-agent-clean --config /etc/agent-config.toml | ||
# Now specified in the agent-config.toml Environment="KATA_AGENT_SERVER_ADDR=unix:///run/kata-containers/agent.sock" | ||
SyslogIdentifier=kata-agent | ||
|
1 change: 1 addition & 0 deletions
1
podvm/files/etc/systemd/system/multi-user.target.wants/attestation-agent.service
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 @@ | ||
../attestation-agent.service |
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,6 @@ | ||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStartPre=ip netns add %I | ||
ExecStart=ip netns exec %I ip link set lo up | ||
ExecStop=ip netns del %I |