Add code comments on the different requirements for credential constants between evaluation and production systems. (#386)

Only comments have changed.  No code changes.

Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com>
Co-authored-by: Gary Wicker <14828980+gkwicker@users.noreply.github.com>
This commit is contained in:
RichardBarry 2020-11-09 14:56:52 -08:00 committed by GitHub
parent 72e6c2ca92
commit 596b466300
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 76 additions and 6 deletions

View file

@ -60,7 +60,12 @@
* must be unique; so edit as required to ensure that no two clients connecting to * must be unique; so edit as required to ensure that no two clients connecting to
* the same broker use the same client identifier. * the same broker use the same client identifier.
* *
* #define democonfigCLIENT_IDENTIFIER "...insert here..." *!!! Please note a #defined constant is used for convenience of demonstration
*!!! only. Production devices can use something unique to the device that can
*!!! be read by software, such as a production serial number, instead of a
*!!! hard coded constant.
*
* #define democonfigCLIENT_IDENTIFIER "insert here."
*/ */

View file

@ -58,6 +58,11 @@
* must be unique so edit as required to ensure no two clients connecting to the * must be unique so edit as required to ensure no two clients connecting to the
* same broker use the same client identifier. * same broker use the same client identifier.
* *
*!!! Please note a #defined constant is used for convenience of demonstration
*!!! only. Production devices can use something unique to the device that can
*!!! be read by software, such as a production serial number, instead of a
*!!! hard coded constant.
*
* #define democonfigCLIENT_IDENTIFIER "insert here." * #define democonfigCLIENT_IDENTIFIER "insert here."
*/ */

View file

@ -111,6 +111,13 @@
/* If no username is defined, then a client certificate/key is required. */ /* If no username is defined, then a client certificate/key is required. */
#ifndef democonfigCLIENT_USERNAME #ifndef democonfigCLIENT_USERNAME
/*
*!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for
*!!! convenience of demonstration only. Production devices should
*!!! store keys securely, such as within a secure element.
*/
#ifndef democonfigCLIENT_CERTIFICATE_PEM #ifndef democonfigCLIENT_CERTIFICATE_PEM
#error "Please define client certificate(democonfigCLIENT_CERTIFICATE_PEM) in demo_config.h." #error "Please define client certificate(democonfigCLIENT_CERTIFICATE_PEM) in demo_config.h."
#endif #endif

View file

@ -57,6 +57,11 @@
* must be unique so edit as required to ensure no two clients connecting to the * must be unique so edit as required to ensure no two clients connecting to the
* same broker use the same client identifier. * same broker use the same client identifier.
* *
*!!! Please note a #defined constant is used for convenience of demonstration
*!!! only. Production devices can use something unique to the device that can
*!!! be read by software, such as a production serial number, instead of a
*!!! hard coded constant.
*
* #define democonfigCLIENT_IDENTIFIER "insert here." * #define democonfigCLIENT_IDENTIFIER "insert here."
*/ */
@ -133,6 +138,14 @@
/** /**
* @brief Client's private key. * @brief Client's private key.
* *
*!!! Please note pasting a key into the header file in this manner is for
*!!! convenience of demonstration only and should not be done in production.
*!!! Never paste a production private key here!. Production devices should
*!!! store keys securely, such as within a secure element. Additionally,
*!!! we provide the corePKCS library that further enhances security by
*!!! enabling securely stored keys to be used without exposing them to
*!!! software.
*
* For AWS IoT MQTT broker, refer to the AWS documentation below for details * For AWS IoT MQTT broker, refer to the AWS documentation below for details
* regarding clientauthentication. * regarding clientauthentication.
* https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html * https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html

View file

@ -63,14 +63,19 @@ TLS mutual authentication for use with this MQTT demo.
"-----BEGIN CERTIFICATE-----\n" \ "-----BEGIN CERTIFICATE-----\n" \
"...base64 data...\n" \ "...base64 data...\n" \
"-----END CERTIFICATE-----\n" "-----END CERTIFICATE-----\n"
11. In the certs folder of your Documents, you will find a file called `client.key`. 12. In the certs folder of your Documents, you will find a file called `client.key`.
Copy its contents to `#define democonfigCLIENT_PRIVATE_KEY_PEM`. Keep in mind Copy its contents to `#define democonfigCLIENT_PRIVATE_KEY_PEM`. Keep in mind
that it must include the PEM header and footer and be formatted in this manner: that it must include the PEM header and footer and be formatted in this manner:
#define democonfigCLIENT_PRIVATE_KEY_PEM \ #define democonfigCLIENT_PRIVATE_KEY_PEM \
"-----BEGIN RSA PRIVATE KEY-----\n" \ "-----BEGIN RSA PRIVATE KEY-----\n" \
"...base64 data...\n" \ "...base64 data...\n" \
"-----END RSA PRIVATE KEY-----\n" "-----END RSA PRIVATE KEY-----\n"
12. Update the config `democonfigdisableSNI` to `( pdTRUE )`. It needs to be
*!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for convenience
*!!! of demonstration only. Production devices should store keys securely,
*!!! such as within a secure element.
13. Update the config `democonfigdisableSNI` to `( pdTRUE )`. It needs to be
configured this way because the local MQTT broker will only have an IP configured this way because the local MQTT broker will only have an IP
address but not a hostname. However, SNI (Server name indication) should address but not a hostname. However, SNI (Server name indication) should
be enabled whenever possible. be enabled whenever possible.

View file

@ -72,6 +72,13 @@
/* If no username is defined, then a client certificate/key is required. */ /* If no username is defined, then a client certificate/key is required. */
#ifndef democonfigCLIENT_USERNAME #ifndef democonfigCLIENT_USERNAME
/*
*!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for
*!!! convenience of demonstration only. Production devices should
*!!! store keys securely, such as within a secure element.
*/
#ifndef democonfigCLIENT_CERTIFICATE_PEM #ifndef democonfigCLIENT_CERTIFICATE_PEM
#error "Please define client certificate(democonfigCLIENT_CERTIFICATE_PEM) in demo_config.h." #error "Please define client certificate(democonfigCLIENT_CERTIFICATE_PEM) in demo_config.h."
#endif #endif

View file

@ -60,6 +60,11 @@
* must be unique; so edit as required to ensure that no two clients connecting to * must be unique; so edit as required to ensure that no two clients connecting to
* the same broker use the same client identifier. * the same broker use the same client identifier.
* *
*!!! Please note a #defined constant is used for convenience of demonstration
*!!! only. Production devices can use something unique to the device that can
*!!! be read by software, such as a production serial number, instead of a
*!!! hard coded constant.
*
* #define democonfigCLIENT_IDENTIFIER "insert here." * #define democonfigCLIENT_IDENTIFIER "insert here."
*/ */
@ -132,6 +137,14 @@
/** /**
* @brief Client's private key. * @brief Client's private key.
* *
*!!! Please note pasting a key into the header file in this manner is for
*!!! convenience of demonstration only and should not be done in production.
*!!! Never paste a production private key here!. Production devices should
*!!! store keys securely, such as within a secure element. Additionally,
*!!! we provide the corePKCS library that further enhances security by
*!!! enabling securely stored keys to be used without exposing them to
*!!! software.
*
* For AWS IoT MQTT broker, refer to the AWS documentation below for details * For AWS IoT MQTT broker, refer to the AWS documentation below for details
* regarding clientauthentication. * regarding clientauthentication.
* https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html * https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html

View file

@ -63,14 +63,19 @@ TLS mutual authentication for use with this MQTT demo.
"-----BEGIN CERTIFICATE-----\n" \ "-----BEGIN CERTIFICATE-----\n" \
"...base64 data...\n" \ "...base64 data...\n" \
"-----END CERTIFICATE-----\n" "-----END CERTIFICATE-----\n"
11. In the certs folder of your Documents, you will find a file called `client.key`. 12. In the certs folder of your Documents, you will find a file called `client.key`.
Copy its contents to `#define democonfigCLIENT_PRIVATE_KEY_PEM`. Keep in mind Copy its contents to `#define democonfigCLIENT_PRIVATE_KEY_PEM`. Keep in mind
that it must include the PEM header and footer and be formatted in this manner: that it must include the PEM header and footer and be formatted in this manner:
#define democonfigCLIENT_PRIVATE_KEY_PEM \ #define democonfigCLIENT_PRIVATE_KEY_PEM \
"-----BEGIN RSA PRIVATE KEY-----\n" \ "-----BEGIN RSA PRIVATE KEY-----\n" \
"...base64 data...\n" \ "...base64 data...\n" \
"-----END RSA PRIVATE KEY-----\n" "-----END RSA PRIVATE KEY-----\n"
12. Update the config `democonfigdisableSNI` to `( pdTRUE )`. It needs to be
*!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for convenience
*!!! of demonstration only. Production devices should store keys securely,
*!!! such as within a secure element.
13. Update the config `democonfigdisableSNI` to `( pdTRUE )`. It needs to be
configured this way because the local MQTT broker will only have an IP configured this way because the local MQTT broker will only have an IP
address but not a hostname. However, SNI (Server name indication) should address but not a hostname. However, SNI (Server name indication) should
be enabled whenever possible. be enabled whenever possible.

View file

@ -58,6 +58,11 @@
* must be unique so edit as required to ensure no two clients connecting to the * must be unique so edit as required to ensure no two clients connecting to the
* same broker use the same client identifier. * same broker use the same client identifier.
* *
*!!! Please note a #defined constant is used for convenience of demonstration
*!!! only. Production devices can use something unique to the device that can
*!!! be read by software, such as a production serial number, instead of a
*!!! hard coded constant.
*
* #define democonfigCLIENT_IDENTIFIER "insert here." * #define democonfigCLIENT_IDENTIFIER "insert here."
*/ */

View file

@ -58,6 +58,11 @@
* must be unique so edit as required to ensure no two clients connecting to the * must be unique so edit as required to ensure no two clients connecting to the
* same broker use the same client identifier. * same broker use the same client identifier.
* *
*!!! Please note a #defined constant is used for convenience of demonstration
*!!! only. Production devices can use something unique to the device that can
*!!! be read by software, such as a production serial number, instead of a
*!!! hard coded constant.
*
* #define democonfigCLIENT_IDENTIFIER "insert here." * #define democonfigCLIENT_IDENTIFIER "insert here."
*/ */