Commit c6edae53 authored by Scott Vokes's avatar Scott Vokes
Browse files

Finish SECURITY command, testing by restricting 2nd identity.

Add SystemTestSetupWithIdentity to create a system test fixture with a
custom identity. This is used to test switching back and forth between
identity 1, which has full permissions, and 2, which has a custom key
and restricted permissions.

Add KINETIC_STATUS_NOT_AUTHORIZED to the API's error types.

Updated release notes.
parent fb7852b9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -5,10 +5,12 @@ v0.12.0 (kinetic-protocol 3.0.5)
        * KineticClient_InstantSecureErase => KineticAdminClient_InstantErase/KineticAdminClient_SecureErase
        * KineticClient_GetLog => KineticAdminClient_GetLog
        * KineticClient_FreeDeviceInfo -> KineticAdminClient_LogInfo
* Added `KINETIC_STATUS_NOT_AUTHORIZED` to KineticStatus enum.
* Added KineticAdminClient_SetACL command.
* KineticSession is now supplied as an opaque instance pointer from KineticClient_CreateSession
    * Passed KineticClientConfig copied and can be discarded after session creation
* *KNOWN ISSUES*
    * KineticAdminClient_UpdateFirmware and KineticAdminClient_SetAcl are incomplete
    * KineticAdminClient_UpdateFirmware is incomplete

v0.11.2 (kinetic-protocol 3.0.5)
--------------------------------
+1 −0
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@ typedef enum {
    KINETIC_STATUS_SSL_REQUIRED,            ///< The operation requires an SSL connection and the specified connection is non-SSL
    KINETIC_STATUS_DEVICE_LOCKED,           ///< The operation failed because the device is sercurely locked. An UNLOCK must be issued to unlock for use.
    KINETIC_STATUS_ACL_ERROR,               ///< A security operation failed due to bad ACL(s)
    KINETIC_STATUS_NOT_AUTHORIZED,          ///< Authorization failure
    KINETIC_STATUS_COUNT                    ///< Number of status codes in KineticStatusDescriptor
} KineticStatus;

+1 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ STATIC const char* KineticStatusDescriptor[] = {
    "SSL_REQUIRED",
    "DEVICE_LOCKED",
    "ACL_ERROR",
    "NOT_AUTHORIZED",
};

#ifdef TEST
+4 −1
Original line number Diff line number Diff line
@@ -69,13 +69,16 @@ KineticStatus KineticProtoStatusCode_to_KineticStatus(
        break;

    case KINETIC_PROTO_COMMAND_STATUS_STATUS_CODE_INTERNAL_ERROR:
    case KINETIC_PROTO_COMMAND_STATUS_STATUS_CODE_NOT_AUTHORIZED:
    case KINETIC_PROTO_COMMAND_STATUS_STATUS_CODE_EXPIRED:
    case KINETIC_PROTO_COMMAND_STATUS_STATUS_CODE_NO_SPACE:
    case KINETIC_PROTO_COMMAND_STATUS_STATUS_CODE_NESTED_OPERATION_ERRORS:
        status = KINETIC_STATUS_OPERATION_FAILED;
        break;

    case KINETIC_PROTO_COMMAND_STATUS_STATUS_CODE_NOT_AUTHORIZED:
        status = KINETIC_STATUS_NOT_AUTHORIZED;
        break;

    case KINETIC_PROTO_COMMAND_STATUS_STATUS_CODE_DEVICE_LOCKED:
        status = KINETIC_STATUS_DEVICE_LOCKED;
        break;
+11 −4
Original line number Diff line number Diff line
@@ -26,6 +26,13 @@
SystemTestFixture Fixture = {.connected = false};

void SystemTestSetup(int log_level)
{
    const uint8_t *key = (const uint8_t *)SESSION_HMAC_KEY;
    SystemTestSetupWithIdentity(log_level, SESSION_IDENTITY, key, strlen((const char*)key));
}

void SystemTestSetupWithIdentity(int log_level, int64_t identity,
    const uint8_t *key, size_t key_size)
{
    KineticClientConfig clientConfig = {
        .logFile = "stdout",
@@ -41,8 +48,8 @@ void SystemTestSetup(int log_level)
        .host = SYSTEM_TEST_HOST,
        .port = KINETIC_PORT,
        .clusterVersion = SESSION_CLUSTER_VERSION,
        .identity = SESSION_IDENTITY,
        .hmacKey = ByteArray_Create(config.keyData, strlen(SESSION_HMAC_KEY)),
        .identity = identity,
        .hmacKey = ByteArray_Create((void *)key, key_size),
    };
    strcpy((char*)config.keyData, SESSION_HMAC_KEY);
    KineticStatus status = KineticClient_CreateSession(&config, Fixture.client, &Fixture.session);
@@ -52,8 +59,8 @@ void SystemTestSetup(int log_level)
        .host = SYSTEM_TEST_HOST,
        .port = KINETIC_TLS_PORT,
        .clusterVersion = SESSION_CLUSTER_VERSION,
        .identity = SESSION_IDENTITY,
        .hmacKey = ByteArray_Create(config.keyData, strlen(SESSION_HMAC_KEY)),
        .identity = identity,
        .hmacKey = ByteArray_Create((void *)key, key_size),
        .useSsl = true,
    };
    strcpy((char*)config.keyData, SESSION_HMAC_KEY);
Loading