Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
46b4a32
Add Azure support
takuro-sato Jan 24, 2024
10d0c87
add accesstoken interface
beejones Jan 25, 2024
b198597
Move MakeRequest into AccessTokenClientFactory
beejones Jan 26, 2024
1ac756b
Support POST with body
beejones Jan 29, 2024
9d4982b
Add GetAccesToken
beejones Jan 29, 2024
dc73c79
cleanup
beejones Jan 31, 2024
5e04c5c
Fix pre-commit errors
DomAyre Feb 5, 2024
9cfadce
Merge pull request #6 from KenGordon/fix-pre-commit-errors
DomAyre Feb 5, 2024
84c725f
Fix lint errors
DomAyre Feb 5, 2024
560b1ea
third pre-commit pass
DomAyre Feb 5, 2024
6566a24
Fourth pass of pre-commit
DomAyre Feb 5, 2024
718b69e
Fifth pass of pre-commit
DomAyre Feb 5, 2024
a38c26b
Sixth pass of pre-commit
DomAyre Feb 5, 2024
e16c523
Seventh pass of pre-commit
DomAyre Feb 5, 2024
45cfe54
Fix snprintf
DomAyre Feb 5, 2024
e31a47f
Rename error code to satisfy linter
DomAyre Feb 5, 2024
e560708
.
DomAyre Feb 5, 2024
86ed158
Fix cpplint
DomAyre Feb 5, 2024
562b3f2
Merge pull request #7 from KenGordon/fix-pre-commit-errors
DomAyre Feb 5, 2024
03f0657
First azure_auth_token_provider implementation
takuro-sato Feb 7, 2024
0f904b0
Use managed identity not credentials
takuro-sato Feb 8, 2024
1f1622d
Fix lint (only token related codes)
takuro-sato Feb 8, 2024
185f207
Fix un-updated error name
DomAyre Feb 8, 2024
fd2684d
Add tests
takuro-sato Feb 8, 2024
91cf926
Improve azure_private_key_fetcher_provider_test
takuro-sato Feb 8, 2024
c925ce2
Use JWT for unwrapping
takuro-sato Feb 9, 2024
30db8c8
Remvoe debug print
takuro-sato Feb 9, 2024
9f6118e
Attempt to update test
takuro-sato Feb 9, 2024
a09002e
Fix bazel config
takuro-sato Feb 9, 2024
0cbc58d
Fix tests
takuro-sato Feb 9, 2024
082e9cb
Fix workaround
takuro-sato Feb 9, 2024
d00a136
Add a test case
takuro-sato Feb 9, 2024
9fcd937
Tidy up
takuro-sato Feb 9, 2024
42f9206
Merge branch 'dev' into beejones/add-jwt-support
takuro-sato Feb 9, 2024
fb35210
Fix lint
takuro-sato Feb 9, 2024
8c01893
Fix testing issue with bazel build file
DomAyre Feb 15, 2024
a6ce183
Appease linter
DomAyre Feb 15, 2024
ccdb3c1
Fix bazel config for azure/attestation (#8)
DomAyre Feb 15, 2024
5eeccc7
Merge branch 'dev' into beejones/add-jwt-support
takuro-sato Feb 16, 2024
6c29911
Fix test
takuro-sato Feb 16, 2024
02c4601
Use local IDP URL for now
takuro-sato Feb 16, 2024
3db7b14
Merge pull request #5 from KenGordon/beejones/add-jwt-support
takuro-sato Feb 19, 2024
418e9e1
Add azure specific parameters using env var
takuro-sato Feb 21, 2024
28eeba9
Merge pull request #10 from KenGordon/takurosato/env-var-config
takuro-sato Feb 21, 2024
de95061
Refactor attestation library and add tests (#11)
DomAyre Feb 22, 2024
2399af3
Add AzureRoleCredentialsProvider
takuro-sato Feb 23, 2024
b7d5ebe
Add comment
takuro-sato Feb 23, 2024
d0c1257
Merge pull request #12 from KenGordon/takurosato/role_credentials_pro…
takuro-sato Mar 1, 2024
5895649
Add wrapping functions
beejones Mar 5, 2024
5714c43
Revert "Add wrapping functions"
beejones Mar 5, 2024
10e94dc
Allow print_report to take report data & update fake report (#14)
DomAyre Mar 18, 2024
aeca33b
Fix linting
DomAyre Mar 18, 2024
77a396b
Lint pass
DomAyre Mar 18, 2024
1c87c6c
Merge branch 'dev' of github.com:KenGordon/data-plane-shared-librarie…
beejones Mar 20, 2024
ba20cbb
Update fake attestation with new key hash
DomAyre Mar 25, 2024
1c2c3fc
Merge commit 'a7515f845ef463450baddff60099a78a2e8eadc3' of https://gi…
kapilvgit Apr 23, 2024
c24cc2a
mock blob storage client provider
kapilvgit May 2, 2024
d20524f
bazel files pre-commit fix
kapilvgit May 3, 2024
79174bc
fixes
kapilvgit May 3, 2024
fadc1c2
precommit fixes
kapilvgit May 3, 2024
1fafb2a
bazel changes for precommit
kapilvgit May 3, 2024
62911e3
cpplint
kapilvgit May 3, 2024
6647d60
tests
kapilvgit May 3, 2024
4475a1f
precommit
kapilvgit May 3, 2024
a54a8a5
removing test
kapilvgit May 3, 2024
fd6c8f2
fixing tests
kapilvgit May 6, 2024
47ea912
tests
kapilvgit May 7, 2024
26b9120
precommit fix
kapilvgit May 8, 2024
e485bcf
clang formatting
kapilvgit May 8, 2024
3d3df1e
precommit
kapilvgit May 8, 2024
58f1695
Merge pull request #16 from KenGordon/kapilv/merge-dev-1fbac46
kapilvgit May 21, 2024
4119d26
Merge upstream 1fbac46 which is required by B&A v3.4.0 (#26)
takuro-sato Jun 10, 2024
d7387af
merge key-wrapping into new source structure (#17)
beejones Jun 11, 2024
c1a64f5
Initial checkin moving utilities to kms_client_provider
beejones Jun 14, 2024
872ebf0
fix dp-precommit
beejones Jun 14, 2024
59437e6
cleanup pr
beejones Jun 14, 2024
577fb33
solve lint issues
beejones Jun 14, 2024
f754016
Merge pull request #28 from KenGordon/beejones/issue-149-move-utilities
beejones Jun 17, 2024
d6450ef
Fix copyright (#30)
takuro-sato Jun 17, 2024
acf4d46
Change interface to use EvpPkeyWrapper
beejones Jun 18, 2024
4cb4892
All old tests pass with new interface
beejones Jun 18, 2024
1bfe0a5
Update openssl structure usage
beejones Jun 19, 2024
537693a
Refactor GenerateWrappingKey
beejones Jun 19, 2024
65feb64
Refactor more methods
beejones Jun 19, 2024
9405656
lint
beejones Jun 19, 2024
427ac38
Optimize decrytpion in services
beejones Jun 19, 2024
30b46c4
tweaking
beejones Jun 19, 2024
5bd09f1
improving error handling
beejones Jun 20, 2024
9d277fa
Document the wrapping key concept we use in /unwrapkey
beejones Jun 21, 2024
5a474cd
lint
beejones Jun 21, 2024
96a7054
Merge pull request #31 from KenGordon/beejones/issue-148-EVP_PKEY-ref…
beejones Jun 21, 2024
861eeac
Make docker registry configurable (#32)
takuro-sato Jul 9, 2024
3b685b7
Changes for managed identity (#33)
takuro-sato Jul 15, 2024
eea331f
Migrate standalone test toolings (#19)
takuro-sato Jul 22, 2024
70979e5
Remove exception (#34)
takuro-sato Jul 25, 2024
f49053e
Fix missing free aginst report object (#35)
takuro-sato Jul 31, 2024
109cfa6
Merge branch 'upstream-3e92e75-3.10.0' into takurosato/merge-3e92e75-…
takuro-sato Aug 5, 2024
8873bd8
Replace contents with takurosato/rebase-dev-3e92e75-v3.10.0 (99280ff)…
takuro-sato Sep 6, 2024
0a832d6
Merge pull request #40 from KenGordon/takurosato/merge-3e92e75-3.10.0
takuro-sato Sep 6, 2024
d1afc0d
Merge branch 'upstream-81262eb0-3.11.0' into takurosato/merge-81262eb…
takuro-sato Sep 6, 2024
435322f
Apply services/inference_sidecar/modules/tensorflow_v2_14_0/third_par…
takuro-sato Sep 10, 2024
b875200
Update precommit ignore to handle 81262eb0 (v3.11) format issue
takuro-sato Sep 10, 2024
5bf9e07
Tmp hack
takuro-sato Sep 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,12 @@ build:instance_gcp --//:instance=gcp

build:instance_aws --//:instance=aws

build:instance_azure --//:instance=azure

build:platform_aws --//:platform=aws

build:platform_azure --//:platform=azure

build:platform_gcp --//:platform=gcp

build:local_aws --config=instance_local
Expand All @@ -168,6 +172,13 @@ build:gcp_gcp --config=platform_gcp
build:aws_aws --config=instance_aws
build:aws_aws --config=platform_aws


build:local_azure --config=instance_local
build:local_azure --config=platform_azure

build:azure_azure --config=instance_azure
build:azure_azure --config=platform_azure

build:non_prod --//:build_flavor=non_prod
build:prod --//:build_flavor=prod

Expand Down
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# Azure support hack: added 'testing/functionaltest-system/.*'
exclude: (?x)^(
bazel-(bin|out|testlogs|workspace)/.*|
.bazel_output/.*|
builders/.*|
(third_party|src)/.*\.patch|
version.txt|
docs/cpio/protobuf/.*\.md
docs/cpio/protobuf/.*\.md|
testing/functionaltest-system/.*
)$

fail_fast: true
Expand Down
19 changes: 19 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2023 Google LLC
# Copyright (C) Microsoft Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,6 +30,7 @@ string_flag(
build_setting_default = "aws",
values = [
"aws",
"azure",
"gcp",
"local",
],
Expand All @@ -43,6 +45,14 @@ config_setting(
visibility = ["//visibility:public"],
)

config_setting(
name = "azure_platform",
flag_values = {
":platform": "azure",
},
visibility = ["//visibility:public"],
)

config_setting(
name = "gcp_platform",
flag_values = {
Expand All @@ -64,6 +74,7 @@ string_flag(
build_setting_default = "aws",
values = [
"aws",
"azure",
"gcp",
"local",
],
Expand All @@ -78,6 +89,14 @@ config_setting(
visibility = ["//visibility:public"],
)

config_setting(
name = "azure_instance",
flag_values = {
":instance": "azure",
},
visibility = ["//visibility:public"],
)

config_setting(
name = "gcp_instance",
flag_values = {
Expand Down
5 changes: 3 additions & 2 deletions builders/images/build-debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG BASE_IMAGE=ubuntu:20.04
ARG DOCKER_REGISTRY
ARG BASE_IMAGE=${DOCKER_REGISTRY}ubuntu:20.04

# ignore this hadolint error as BASE_IMAGE contains an image tag
# hadolint ignore=DL3006
Expand All @@ -24,7 +25,7 @@ ADD https://apt.llvm.org/llvm.sh /build/llvm.sh
COPY compile_libprofiler /scripts/
RUN /scripts/compile_libprofiler

FROM docker/buildx-bin:v0.10 AS buildx-bin
FROM ${DOCKER_REGISTRY}docker/buildx-bin:v0.10 AS buildx-bin

# ignore this hadolint error as BASE_IMAGE contains an image tag
# hadolint ignore=DL3006
Expand Down
3 changes: 2 additions & 1 deletion builders/images/presubmit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM ubuntu:24.04
ARG DOCKER_REGISTRY
FROM ${DOCKER_REGISTRY}ubuntu:24.04

COPY install_apps install_go.sh install_golang_apps .bazelversion .pre-commit-config.yaml /scripts/
COPY gitconfig /etc
Expand Down
2 changes: 1 addition & 1 deletion builders/tools/get-architecture
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ function _cleanup() {
if [[ -n ${BUILD_ARCH} ]]; then
printf "%s\n" "${BUILD_ARCH}"
else
docker run --rm --entrypoint=/usr/bin/dpkg ubuntu:20.04 --print-architecture
docker run --rm --entrypoint=/usr/bin/dpkg ${DOCKER_REGISTRY}ubuntu:20.04 --print-architecture
fi
10 changes: 8 additions & 2 deletions builders/tools/get-builder-image-tagged
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,16 @@ readonly IMAGES_DIR="${BUILDERS_DIR}"/images
declare -i SHA_ONLY=0
declare -i BUILD_IMAGE_IF_NEEDED=1
declare -i VERBOSE=0
declare -r -a DOCKER_BUILD_ARGS=(
declare -a DOCKER_BUILD_ARGS=(
--progress plain
)

if [ -n "$DOCKER_REGISTRY" ]; then
DOCKER_BUILD_ARGS+=(
--build-arg DOCKER_REGISTRY=$DOCKER_REGISTRY
)
fi

# shellcheck disable=SC1090
source "${TOOLS_DIR}"/builder.sh
WORKSPACE_MOUNT="$(builder::get_docker_workspace_mount)"
Expand Down Expand Up @@ -153,7 +159,7 @@ fi
function generate_image() {
{
cat <<Dockerfile
FROM alpine:3.16
FROM ${DOCKER_REGISTRY}alpine:3.16
RUN apk --no-cache add tar~=1.34
Dockerfile
} | docker buildx build "${DOCKER_BUILD_ARGS[@]}" --no-cache --output=type=docker --tag "${TAR_IMAGE}" - &>"${BUILD_OUTPUT}"
Expand Down
9 changes: 6 additions & 3 deletions builders/tools/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ if [[ $# -gt 0 ]]; then
shift
__init
# shellcheck disable=SC2086
"${TOOLS_DIR}"/cbuild "${CBUILD_COMMON_ARGS[@]}" --env "${SKIP_ENV}" --cmd "${PRECOMMIT} ${PRECOMMIT_CMD} --config ./.pre-commit-config.yaml $*"
"${TOOLS_DIR}"/cbuild "${CBUILD_COMMON_ARGS[@]}" --env "${SKIP_ENV}" --env "DOCKER_REGISTRY=$DOCKER_REGISTRY" --env "DOCKER_USER=$DOCKER_USER" --env "DOCKER_PASSWORD=$DOCKER_PASSWORD" --cmd "${PRECOMMIT} ${PRECOMMIT_CMD} --config ./.pre-commit-config.yaml $*"
;;

hook-impl)
Expand All @@ -143,6 +143,9 @@ if [[ $# -gt 0 ]]; then
--volume "${WORKSPACE}":/src/workspace \
-v /var/run/docker.sock:/var/run/docker.sock \
--env="${SKIP_ENV}" \
--env "DOCKER_REGISTRY=$DOCKER_REGISTRY" \
--env "DOCKER_USER=$DOCKER_USER" \
--env "DOCKER_PASSWORD=$DOCKER_PASSWORD" \
--workdir /src/workspace \
"${IMAGE_TAGGED}" \
"${PRECOMMIT_CMD}" --config ./.pre-commit-config.yaml "$@"
Expand All @@ -153,12 +156,12 @@ if [[ $# -gt 0 ]]; then
CLEANUP=1
for HOOK in "$@"; do
# shellcheck disable=SC2086
"${TOOLS_DIR}"/cbuild "${CBUILD_COMMON_ARGS[@]}" --env "${SKIP_ENV}" --cmd "${PRECOMMIT} run --config ./.pre-commit-config.yaml --all-files ${HOOK}"
"${TOOLS_DIR}"/cbuild "${CBUILD_COMMON_ARGS[@]}" --env "${SKIP_ENV}" --env "DOCKER_REGISTRY=$DOCKER_REGISTRY" --env "DOCKER_USER=$DOCKER_USER" --env "DOCKER_PASSWORD=$DOCKER_PASSWORD" --cmd "${PRECOMMIT} run --config ./.pre-commit-config.yaml --all-files ${HOOK}"
done
esac
else
__init
CLEANUP=1
# shellcheck disable=SC2086
"${TOOLS_DIR}"/cbuild "${CBUILD_COMMON_ARGS[@]}" --env "${SKIP_ENV}" --cmd "${PRECOMMIT} run --config ./.pre-commit-config.yaml --all-files"
"${TOOLS_DIR}"/cbuild "${CBUILD_COMMON_ARGS[@]}" --env "${SKIP_ENV}" --env "DOCKER_REGISTRY=$DOCKER_REGISTRY" --env "DOCKER_USER=$DOCKER_USER" --env "DOCKER_PASSWORD=$DOCKER_PASSWORD" --cmd "${PRECOMMIT} run --config ./.pre-commit-config.yaml --all-files"
fi
12 changes: 9 additions & 3 deletions builders/tools/terraform
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
# environment variables (all optional):
# TERRAFORM_VERSION specify the terraform version to use
# WORKSPACE repo root directory, must be an absolute path
# DOCKER_REGISTRY docker registry for terraform image
# DOCKER_USER docker user for DOCKER_REGISTRY
# DOCKER_PASSWORD docker password for DOCKER_REGISTRY
#
# AWS-related environment variables exported into the terraform container:
# For more info on supported env vars, see:
Expand Down Expand Up @@ -60,7 +63,11 @@ if [[ -t 0 ]] && [[ -t 1 ]]; then
)
fi

readonly IMAGE_TAGGED=hashicorp/terraform:"${TERRAFORM_VERSION}"
if [[ -n "$DOCKER_PASSWORD" ]]; then
docker login $DOCKER_REGISTRY -u ${DOCKER_USER} -p ${DOCKER_PASSWORD}
fi

readonly IMAGE_TAGGED=${DOCKER_REGISTRY}hashicorp/terraform:"${TERRAFORM_VERSION}"
REL_PWD="$(realpath --relative-to="${WORKSPACE}" "$(pwd)")"
readonly REL_PWD
WORKSPACE_MOUNT="$(builder::get_docker_workspace_mount)"
Expand All @@ -82,5 +89,4 @@ DOCKER_RUN_ARGS+=(
# shellcheck disable=SC2068
docker run \
"${DOCKER_RUN_ARGS[@]}" \
"${IMAGE_TAGGED}" \
"$@"
${IMAGE_TAGGED} "$@"
1 change: 1 addition & 0 deletions src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package_group(
name = "scp_internal_pkg",
packages = [
"//src/aws/...",
"//src/azure/...",
"//src/core/...",
"//src/cpio/...",
"//src/public/...",
Expand Down
20 changes: 20 additions & 0 deletions src/azure/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Portions Copyright (c) Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

package(default_visibility = ["//visibility:public"])

alias(
name = "attestation",
actual = "//src/azure/attestation:src",
)
30 changes: 30 additions & 0 deletions src/azure/attestation/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Portions Copyright (c) Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

package(default_visibility = ["//visibility:public"])

alias(
name = "src",
actual = "//src/azure/attestation/src:attestation",
)

alias(
name = "utils",
actual = "//src/azure/attestation/src/utils:attestation_utils",
)

alias(
name = "print_report",
actual = "//src/azure/attestation/src:print_report",
)
51 changes: 51 additions & 0 deletions src/azure/attestation/src/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Portions Copyright (c) Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")

package(default_visibility = ["//visibility:public"])

cc_library(
name = "attestation",
srcs = [
"endorsed_tcb.cc",
"endorsements.cc",
"evidence.cc",
"fake_report.cc",
"report.cc",
"snp.cc",
"uvm_endorsements.cc",
],
hdrs = [
"attestation.h",
"sev.h",
"sev_guest.h",
],
deps = [
"//src/azure/attestation:utils",
"//src/core/utils:core_utils",
"@com_github_google_glog//:glog",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
"@nlohmann_json//:lib",
],
)

cc_binary(
name = "print_report",
srcs = ["print_report.cc"],
deps = [
"attestation",
],
)
Loading