You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
idf.py menuconfig # Configure WiFi/Ethernet and WebSocket URI
27
+
idf.py build
28
+
```
29
+
30
+
3.**Flash and monitor:**
31
+
```bash
32
+
idf.py -p PORT flash monitor
33
+
```
34
+
35
+
4.**Run tests:**
36
+
```bash
37
+
pytest .
38
+
```
4
39
5
40
## How to Use Example
6
41
@@ -15,6 +50,27 @@ This example can be executed on any ESP32 board, the only required interface is
15
50
* Configure the websocket endpoint URI under "Example Configuration", if "WEBSOCKET_URI_FROM_STDIN" is selected then the example application will connect to the URI it reads from stdin (used for testing)
16
51
* To test a WebSocket client example over TLS, please enable one of the following configurations: `CONFIG_WS_OVER_TLS_MUTUAL_AUTH` or `CONFIG_WS_OVER_TLS_SERVER_AUTH`. See the sections below for more details.
17
52
53
+
### Pre-configured SDK Configurations
54
+
55
+
This example includes several pre-configured `sdkconfig.ci.*` files for different testing scenarios:
56
+
57
+
***sdkconfig.ci** - Default configuration with WebSocket over Ethernet (IP101 PHY, ESP32, IPv6) and hardcoded URI.
58
+
***sdkconfig.ci.plain_tcp** - WebSocket over plain TCP (no TLS, URI from stdin) using Ethernet (IP101 PHY, ESP32, IPv6).
59
+
***sdkconfig.ci.mutual_auth** - WebSocket with mutual TLS authentication (client/server certificate verification, skips CN check) and URI from stdin.
60
+
***sdkconfig.ci.dynamic_buffer** - WebSocket with dynamic buffer allocation, Ethernet (IP101 PHY, ESP32, IPv6), and hardcoded URI.
* Mutual Authentication: When `CONFIG_WS_OVER_TLS_MUTUAL_AUTH=y` is enabled, it's essential to provide valid certificates for both the server and client.
@@ -26,7 +82,7 @@ This example can be executed on any ESP32 board, the only required interface is
26
82
Please note: This example represents an extremely simplified approach to generating self-signed certificates/keys with a single common CA, devoid of CN checks, lacking password protection, and featuring hardcoded key sizes and types. It is intended solely for testing purposes.
27
83
In the outlined steps, we are omitting the configuration of the CN (Common Name) field due to the context of a testing environment. However, it's important to recognize that the CN field is a critical element of SSL/TLS certificates, significantly influencing the security and efficacy of HTTPS communications. This field facilitates the verification of a website's identity, enhancing trust and security in web interactions. In practical deployments beyond testing scenarios, ensuring the CN field is accurately set is paramount for maintaining the integrity and reliability of secure communications
28
84
29
-
### Generating a self signed Certificates with OpenSSL
85
+
### Generating a self signed Certificates with OpenSSL manually
30
86
* The example below outlines the process for creating new certificates for both the server and client using OpenSSL, a widely-used command line tool for implementing TLS protocol:
31
87
32
88
```
@@ -63,6 +119,26 @@ Please see the openssl man pages (man openssl) for more details.
63
119
It is **strongly recommended** to not reuse the example certificate in your application;
64
120
it is included only for demonstration.
65
121
122
+
### Certificate Generation Options
123
+
124
+
#### Option 1: Manual OpenSSL Commands
125
+
Follow the step-by-step process in the section above to understand certificate generation.
126
+
127
+
#### Option 2: Automated Script
128
+
**Note:** Test certificates are already available in the example. If you want to regenerate them or create new ones, use the provided `generate_certs.sh` script:
129
+
130
+
```bash
131
+
chmod +x generate_certs.sh
132
+
./generate_certs.sh
133
+
```
134
+
135
+
This script automatically generates all required certificates in the correct directories and cleans up temporary files.
136
+
137
+
#### Option 3: Online Certificate Generators
138
+
-**mkcert**: `install mkcert` then `mkcert -install` and `mkcert localhost`
139
+
-**Let's Encrypt**: For production certificates (free, automated renewal)
140
+
-**Online generators**: Search for "self-signed certificate generator" online
141
+
66
142
### Build and Flash
67
143
68
144
Build the project and flash it to the board, then run monitor tool to view serial output:
@@ -73,7 +149,36 @@ idf.py -p PORT flash monitor
73
149
74
150
(To exit the serial monitor, type ``Ctrl-]``.)
75
151
76
-
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
152
+
See the [ESP-IDF Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html) for full steps to configure and use ESP-IDF to build projects.
153
+
154
+
## Testing with pytest
155
+
156
+
### Install Dependencies
157
+
158
+
Before running the pytest tests, you need to install the required Python packages:
159
+
160
+
```
161
+
pip install -r esp-protocols/ci/requirements.txt
162
+
```
163
+
164
+
### Run pytest
165
+
166
+
After installing the dependencies, you can run the pytest tests:
0 commit comments