|
| 1 | +.. _wifi_prov_tools: |
| 2 | + |
| 3 | +Wi-Fi Provisioning Configuration Generator |
| 4 | +########################################## |
| 5 | + |
| 6 | +.. contents:: |
| 7 | + :local: |
| 8 | + :depth: 2 |
| 9 | + |
| 10 | +This tool generates Protocol Buffers (protobuf) configuration messages for Wi-Fi® provisioning, supporting both EAP-TLS (Enterprise) and Personal (WPA2-PSK/WPA3-PSK) modes. |
| 11 | + |
| 12 | +Prerequisites |
| 13 | +************* |
| 14 | + |
| 15 | +The script automatically generates its own protobuf dependencies when needed. |
| 16 | +No manual setup is required. |
| 17 | + |
| 18 | +.. note:: |
| 19 | + The script requires the ``protoc`` compiler to be available in your PATH. |
| 20 | + This is typically included in the NCS toolchain. |
| 21 | + |
| 22 | +Usage |
| 23 | +***** |
| 24 | + |
| 25 | +The script supports two main modes: |
| 26 | + |
| 27 | +Enterprise mode |
| 28 | +=============== |
| 29 | + |
| 30 | +Run the following command for enterprise networks using certificate-based authentication, EAP-TLS is used as an example: |
| 31 | + |
| 32 | +.. code-block:: bash |
| 33 | +
|
| 34 | + python3 generate_wifi_prov_config.py "MyWi-Fi" "AA:BB:CC:DD:EE:FF" \ |
| 35 | + -d /path/to/certs \ |
| 36 | + -j -o eap_tls_config.json |
| 37 | +
|
| 38 | +The following are the required certificate files in the cert directory: |
| 39 | + |
| 40 | +* :file:`ca.pem` - CA certificate |
| 41 | +* :file:`client.pem` - Client certificate |
| 42 | +* :file:`client-key.pem` - Client private key |
| 43 | +* :file:`ca2.pem` - Secondary CA certificate |
| 44 | +* :file:`client2.pem` - Secondary client certificate |
| 45 | +* :file:`client-key2.pem` - Secondary client private key |
| 46 | + |
| 47 | +Personal mode |
| 48 | +============= |
| 49 | + |
| 50 | +Run the following commands for home or office networks using passphrase authentication: |
| 51 | + |
| 52 | +.. code-block:: bash |
| 53 | +
|
| 54 | + # WPA2-PSK |
| 55 | + python3 generate_wifi_prov_config.py "MyWi-Fi" "AA:BB:CC:DD:EE:FF" \ |
| 56 | + -w "mypassword" -a 3 -j -o personal_config.json |
| 57 | +
|
| 58 | + # WPA3-SAE |
| 59 | + python3 generate_wifi_prov_config.py "MyWi-Fi" "AA:BB:CC:DD:EE:FF" \ |
| 60 | + -w "mypassword" -a 10 -j -o wpa3_config.json |
| 61 | +
|
| 62 | +Command line options |
| 63 | +==================== |
| 64 | + |
| 65 | +.. list-table:: Command-line arguments |
| 66 | + :header-rows: 1 |
| 67 | + :widths: 20 40 40 |
| 68 | + |
| 69 | + * - Argument |
| 70 | + - Description |
| 71 | + - Default values and notes |
| 72 | + |
| 73 | + * - ``ssid`` |
| 74 | + - Wi-Fi network name |
| 75 | + - (positional) |
| 76 | + |
| 77 | + * - ``bssid`` |
| 78 | + - Wi-Fi BSSID (MAC address) |
| 79 | + - (positional) |
| 80 | + |
| 81 | + * - ``-d, --cert-dir`` |
| 82 | + - Certificate directory (for EAP-TLS mode) |
| 83 | + - (optional) |
| 84 | + |
| 85 | + * - ``-w, --passphrase`` |
| 86 | + - Wi-Fi passphrase (for Personal mode) |
| 87 | + - (optional) |
| 88 | + |
| 89 | + * - ``-a, --auth-mode`` |
| 90 | + - Authentication mode |
| 91 | + - 0=OPEN, 1=WEP, 2=WPA_PSK, 3=WPA2_PSK, 4=WPA_WPA2_PSK, 5=WPA2_ENTERPRISE, 6=WPA3_PSK, 7=NONE, 8=PSK, 9=PSK_SHA256, 10=SAE, 11=WAPI, 12=EAP, 13=WPA_AUTO_PERSONAL, 14=DPP, 15=EAP_PEAP_MSCHAPV2, 16=EAP_PEAP_GTC, 17=EAP_TTLS_MSCHAPV2, 18=EAP_PEAP_TLS, 19=FT_PSK, 20=FT_SAE, 21=FT_EAP, 22=FT_EAP_SHA384, 23=SAE_EXT_KEY; default: 5=WPA2_ENTERPRISE |
| 92 | + |
| 93 | + * - ``-c, --channel`` |
| 94 | + - Wi-Fi channel |
| 95 | + - default: 0 |
| 96 | + |
| 97 | + * - ``-b, --band`` |
| 98 | + - Wi-Fi band |
| 99 | + - 0=AUTO, 1=2.4GHz, 2=5GHz; default: 0 |
| 100 | + |
| 101 | + * - ``-i, --identity`` |
| 102 | + - EAP identity |
| 103 | + |
| 104 | + |
| 105 | + * - ``-p, --password`` |
| 106 | + - EAP password |
| 107 | + - default: user_password |
| 108 | + |
| 109 | + * - ``-k, --private-key-passwd`` |
| 110 | + - Primary private key password |
| 111 | + - (optional) |
| 112 | + |
| 113 | + * - ``-k2, --private-key-passwd2`` |
| 114 | + - Secondary private key password |
| 115 | + - (optional) |
| 116 | + |
| 117 | + * - ``-o, --output`` |
| 118 | + - Output file |
| 119 | + - (optional) |
| 120 | + |
| 121 | + * - ``-j, --json`` |
| 122 | + - Display JSON configuration |
| 123 | + - (optional) |
| 124 | + |
| 125 | +Output |
| 126 | +****** |
| 127 | + |
| 128 | +The tool always displays the encoded protobuf format: |
| 129 | + |
| 130 | +Encoded Protobuf (Base64) - Base64-encoded protobuf string for transmission |
| 131 | + |
| 132 | +When using the ``-j`` flag, JSON configuration is also displayed for reference. |
| 133 | + |
| 134 | +When using the ``-o`` option, files are saved in the specified format: |
| 135 | + |
| 136 | +* ``-j -o file.json`` - Save as JSON file |
| 137 | +* ``-o file.bin`` - Save as binary protobuf file |
| 138 | + |
| 139 | +Configuration details |
| 140 | +********************* |
| 141 | + |
| 142 | +The generated configuration includes: |
| 143 | + |
| 144 | +* *SSID* - Wi-Fi network name |
| 145 | +* *BSSID* - Access point MAC address |
| 146 | +* *Channel* - Wi-Fi channel number |
| 147 | +* *Band* - 2.4GHz or 5GHz |
| 148 | +* *Authentication Mode* - WPA-PSK, WPA2-PSK, WPA2-ENTERPRISE, WPA3-PSK |
| 149 | +* *Mode* - EAP-TLS (Enterprise) or Personal |
| 150 | +* *Identity* - EAP identity (for Enterprise mode) |
| 151 | +* *Passphrase* - Wi-Fi password (for Personal mode, masked in output) |
| 152 | + |
| 153 | +Error handling |
| 154 | +************** |
| 155 | + |
| 156 | +The tool performs the following validation checks: |
| 157 | + |
| 158 | +* Certificate directory existence (for EAP-TLS mode) |
| 159 | +* Required certificate files presence |
| 160 | +* Valid authentication mode selection |
| 161 | +* Proper parameter combinations |
| 162 | + |
| 163 | +The following are common error messages you may encounter while using the tool: |
| 164 | + |
| 165 | +* "Certificate directory does not exist" |
| 166 | +* "Missing required certificate files" |
| 167 | +* "Must specify either --cert-dir (EAP-TLS) or --passphrase (Personal)" |
| 168 | +* "Auth mode X is not valid for EAP-TLS" (for invalid EAP auth modes) |
| 169 | + |
| 170 | +Integration |
| 171 | +*********** |
| 172 | + |
| 173 | +The generated protobuf messages can be used with the following systems: |
| 174 | + |
| 175 | +* Nordic Semiconductor's Wi-Fi provisioning service |
| 176 | +* Zephyr RTOS Wi-Fi stack |
| 177 | +* Custom Wi-Fi provisioning applications |
| 178 | + |
| 179 | +The binary protobuf format is suitable for transmission over Bluetooth LE or other communication channels. |
0 commit comments