Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Rename cert_provider_autoprov_test.cc to cert_provider_shared_cred_te…
Browse files Browse the repository at this point in the history
…st.cc.

Signed-off-by: Patrick Vacek <patrickvacek@gmail.com>
  • Loading branch information
pattivacek committed May 27, 2019
1 parent 3cce3a6 commit 4f76dd1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 26 deletions.
18 changes: 9 additions & 9 deletions actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,12 @@ These tools all link with libaktualizr, although they do not necessary use the A

### aktualizr-cert-provider

`aktualizr-cert-provider` assists with generating credentials and uploading them to a device for implicit provisioning.
`aktualizr-cert-provider` assists with generating credentials and uploading them to a device for device credential provisioning.

- [x] Use file paths from config if provided (cert_provider_test.cc)
- [x] Use autoprovisioning credentials if fleet CA and private key are not provided (cert_provider_autoprov_test.cc)
- [x] Use shared provisioning credentials if fleet CA and private key are not provided (cert_provider_shared_cred_test.cc)
- [x] Generate a random device ID (OTA-986, utils_test.cc, uptane_init_test.cc)
- [x] Automatically provision (cert_provider_autoprov_test.cc)
- [x] Provision with shared credentials (cert_provider_shared_cred_test.cc)
- [x] Use fleet credentials if provided (cert_provider_test.cc)
- [x] Abort if fleet CA is provided without fleet private key (cert_provider_test.cc)
- [x] Abort if fleet private key is provided without fleet CA (cert_provider_test.cc)
Expand All @@ -390,12 +390,12 @@ These tools all link with libaktualizr, although they do not necessary use the A
- [x] Serialize device certificate to a string (cert_provider_test.cc)
- [ ] Read server root CA from credentials archive
- [ ] Read server root CA from server_ca.pem if present (to support community edition use case)
- [x] Read server root CA from p12 (cert_provider_autoprov_test.cc)
- [x] Read server root CA from p12 (cert_provider_shared_cred_test.cc)
- [x] Write credentials to a local directory if requested (cert_provider_test.cc)
- [x] Provide device private key (cert_provider_test.cc)
- [x] Provide device certificate (cert_provider_test.cc)
- [x] Provide root CA if requested (cert_provider_autoprov_test.cc)
- [x] Provide server URL if requested (cert_provider_autoprov_test.cc)
- [x] Provide root CA if requested (cert_provider_shared_cred_test.cc)
- [x] Provide server URL if requested (cert_provider_shared_cred_test.cc)
- [ ] Copy credentials to a device with ssh
- [ ] Create parent directories
- [ ] Provide device private key
Expand Down Expand Up @@ -527,9 +527,9 @@ These tools also use libaktualizr, but only for common utility functions. They a
- [x] Run garage-sign
- [x] Build credentials into an image
- [x] Run aktualizr-cert-provider
- [x] Build an image with automatic provisioning that provisions successfully
- [x] Build an image with implicit provisioning that provisions successfully
- [x] Build an image with implicit provisioning using an HSM that provisions successfully
- [x] Build an image with shared credential provisioning that provisions successfully
- [x] Build an image with device credential provisioning that provisions successfully
- [x] Build an image with device credential provisioning using an HSM that provisions successfully
- [x] Build an image with manual control that provisions successfully
- [x] Build an image for Raspberry Pi
- [x] Build an image using grub as a bootloader that provisions successfully
Expand Down
11 changes: 4 additions & 7 deletions src/cert_provider/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@ install(TARGETS aktualizr-cert-provider RUNTIME DESTINATION bin)
add_aktualizr_test(NAME aktualizr_cert_provider SOURCES cert_provider_test.cc PROJECT_WORKING_DIRECTORY ARGS $<TARGET_FILE:aktualizr-cert-provider>)

if (SOTA_PACKED_CREDENTIALS)

add_aktualizr_test(NAME aktualizr_cert_provider_auto_prov SOURCES cert_provider_autoprov_test.cc
PROJECT_WORKING_DIRECTORY ARGS $<TARGET_FILE:aktualizr-cert-provider> ${SOTA_PACKED_CREDENTIALS})

set_tests_properties(test_aktualizr_cert_provider_auto_prov PROPERTIES LABELS "credentials")

add_aktualizr_test(NAME aktualizr_cert_provider_shared_cred SOURCES cert_provider_shared_cred_test.cc
PROJECT_WORKING_DIRECTORY ARGS $<TARGET_FILE:aktualizr-cert-provider> ${SOTA_PACKED_CREDENTIALS})
set_tests_properties(test_aktualizr_cert_provider_shared_cred PROPERTIES LABELS "credentials")
endif(SOTA_PACKED_CREDENTIALS)

aktualizr_source_file_checks(${AKTUALIZR_CERT_PROVIDER_SRC}
${AKTUALIZR_CERT_HEADERS}
cert_provider_autoprov_test.cc
cert_provider_shared_cred_test.cc
cert_provider_test.cc
cert_provider_test.h)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,16 @@ class AktualizrCertProviderTest : public ::testing::Test {
};

/**
* Verifies the cert provider work in case of autoprovisioning credentials usage,
* if the fleet CA and private key are not specified
* Verifies that cert-provider works when given shared provisioning credentials
* and the fleet CA and private key are not specified.
*
* Check actions
*
* - [x] Use autoprovisioning credentials if fleet CA and private key are not provided
* - [x] Use shared provisioning credentials if fleet CA and private key are not provided
* - [x] Provision with shared credentials
* - [x] Read server root CA from p12
* - [x] Provide root CA if requested
* - [x] Provide server URL if requested
*/

TEST_F(AktualizrCertProviderTest, AutoprovisioningCredsUsage) {
TEST_F(AktualizrCertProviderTest, SharedCredProvisioning) {
if (test_args_.credentials_path.empty()) {
// GTEST_SKIP() was introduced in recent gtest version;
SUCCEED() << "A path to the credentials file hasn't been proided, so skip the test";
Expand Down Expand Up @@ -79,15 +77,15 @@ int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);

if (argc < 3) {
std::cerr << "Two arguments are required: <path-to-cert-rpvoder> <path-to-credentials>" << std::endl;
std::cerr << "Two arguments are required: <path-to-cert-provider> <path-to-credentials>" << std::endl;
return EXIT_FAILURE;
}

CERT_PROVIDER_PATH = argv[1];
std::cout << "Path to the cert_provider executable: " << CERT_PROVIDER_PATH << std::endl;
std::cout << "Path to the cert-provider executable: " << CERT_PROVIDER_PATH << std::endl;

CREDENTIALS_PATH = argv[2];
std::cout << "Path to the autoprovisioning credentials: " << CREDENTIALS_PATH << std::endl;
std::cout << "Path to the shared provisioning credentials: " << CREDENTIALS_PATH << std::endl;

int test_run_res = RUN_ALL_TESTS();

Expand Down

0 comments on commit 4f76dd1

Please sign in to comment.