This application provides a console interface to test enterprise Wi-Fi commands. This application integrates the command console library.
See the command console library Readme.md for more information.
- ModusToolbox™ software v3.2 or later (tested with v3.2) with ModusToolbox™
- Programming language: C
- Associated parts: CYW955913EVK-01 Wi-Fi Bluetooth® Prototyping Kit
- EAP TLS
- PEAPv0 with MSCHAPv2
- EAP-TTLS with EAP-MSCHAPv2
- WPA
- WPA2
- WPA3 Transition
- WPA3 Enterprise only
- WPA3 192Bit
- GNU Arm® embedded compiler v11.3.1 (
GCC_ARM
) - Default value ofTOOLCHAIN
- CYW955913EVK-01 Wi-Fi Bluetooth® prototyping kit (
CYW955913EVK-01
) – Default value ofTARGET
This example uses the kit’s default configuration. See the respective kit guide to ensure that the kit is configured correctly.
-
Install a terminal emulator if you don't have one. Instructions in this document use Tera Term.
-
Install a Python interpreter if you don't have one. This code example is tested using Python 3.7.5.
The test setup shall consist of 3 components
- Client : Kit
- Authenticator : Enterprise Wi-Fi Access Point
- Authentication server : Radius server (Example, FreeRadius).
The kit will connect to the Wi-Fi Access point using the keys and certificates defined in certificate.h
. User shall update the certificate.h
with proper key and certificates.
Note: WPA3 192Bit command will be using the macros WPA3_192BIT_ROOT_CERTIFICATE_STRING, WPA3_192BIT_USER_PRIVATE_KEY_STRING, WPA3_192BIT_USER_CERTIFICATE_STRING in certificate.h
for connection.
This section describes the method to generate the keys and sertificate using openssl
for testing. If the testing is carried out in actual enterprise network, this step is not needed as the device key and certificates will be provided by the network administrator.
-
Generate Root Key
rootKey.pem
.openssl ecparam -name prime256v1 -genkey -noout -out rootKey.pem
-
Generate Root Certificate: This shall be updated in
WIFI_ROOT_CERTIFICATE_STRING
/WPA3_192BIT_ROOT_CERTIFICATE_STRING
. Also update the root certificate in radius server.openssl req -new -key rootKey.pem -x509 -nodes -days 365 -out rootCert.pem
This command will prompt for necessary information like country code, State etc.
-
Generate Client Key and certificate.
ClientKey.pem
shall be updated inWIFI_USER_PRIVATE_KEY_STRING
/WPA3_192BIT_USER_PRIVATE_KEY_STRING
. client.crt shall be updated inWIFI_USER_CERTIFICATE_STRING
/WPA3_192BIT_USER_CERTIFICATE_STRING
.- Create Client Key
ClientKey.pem
:
openssl ecparam -name prime256v1 -genkey -noout -out clientKey.pem
- Create CSR :
openssl req -new -sha256 -key clientKey.pem -out client.csr
- Create Client Certificate
client.crt
:
openssl x509 -req -days 365 -in client.csr -CA rootCert.pem -CAkey rootKey.pem -CAcreateserial -out client.crt
- Create Client Key
-
Generate Server Key and certificate. These shall be loaded in radius server.
- Create Server Key
serverKey.pem
:
openssl ecparam -name prime256v1 -genkey -noout -out serverKey.pem
- Create CSR :
openssl req -new -sha256 -key serverKey.pem -out server.csr
- Create Server Certificate
server.crt
:
openssl x509 -req -days 365 -in server.csr -CA rootCert.pem -CAkey rootKey.pem -CAcreateserial -out server.crt
- Create Server Key
Create the project and open it using one of the following:
In Eclipse IDE for ModusToolbox™ software
-
Click the New Application link in the Quick Panel (or, use File > New > ModusToolbox™ Application). This launches the Project Creator tool.
-
Pick a kit supported by the code example from the list shown in the Project Creator - Choose Board Support Package (BSP) dialog.
When you select a supported kit, the example is reconfigured automatically to work with the kit. To work with a different supported kit later, use the Library Manager to choose the BSP for the supported kit. You can use the Library Manager to select or update the BSP and firmware libraries used in this application. To access the Library Manager, click the link from the Quick Panel.
You can also just start the application creation process again and select a different kit.
If you want to use the application for a kit not listed here, you may need to update the source files. If the kit does not have the required resources, the application may not work.
-
In the Project Creator - Select Application dialog, choose the example by enabling the checkbox.
-
(Optional) Change the suggested New Application Name.
-
The Application(s) Root Path defaults to the Eclipse workspace which is usually the desired location for the application. If you want to store the application in a different location, you can change the Application(s) Root Path value. Applications that share libraries should be in the same root path.
-
Click Create to complete the application creation process.
For more details, see the Eclipse IDE for ModusToolbox™ software user guide (locally available at {ModusToolbox™ software install directory}/docs_{version}/mt_ide_user_guide.pdf).
In command-line interface (CLI)
ModusToolbox™ software provides the Project Creator as both a GUI tool and the command line tool, "project-creator-cli". The CLI tool can be used to create applications from a CLI terminal or from within batch files or shell scripts. This tool is available in the {ModusToolbox™ software install directory}/tools_{version}/project-creator/ directory.
Use a CLI terminal to invoke the "project-creator-cli" tool. On Windows, use the command line "modus-shell" program provided in the ModusToolbox™ software installation instead of a standard Windows command-line application. This shell provides access to all ModusToolbox™ software tools. You can access it by typing modus-shell
in the search box in the Windows menu. In Linux and macOS, you can use any terminal application.
The "project-creator-cli" tool has the following arguments:
Argument | Description | Required/optional |
---|---|---|
--board-id |
Defined in the <id> field of the BSP manifest |
Required |
--app-id |
Defined in the <id> field of the CE manifest |
Required |
--target-dir |
Specify the directory in which the application is to be created if you prefer not to use the default current working directory | Optional |
--user-app-name |
Specify the name of the application if you prefer to have a name other than the example's default name | Optional |
The following example clones the "mtb-threadx-enterprise-security-tester" application with the desired name "enterprise-tester" configured for the CYW955913EVK-01 BSP into the specified working directory, C:/mtb_projects:
project-creator-cli --board-id CYW955913EVK-01 --board-id CYW955913EVK-01 --app-id mtb-threadx-enterprise-security-tester --user-app-name enterprise-tester --target-dir "C:/mtb_projects"
Note: The project-creator-cli tool uses the git clone
and make getlibs
commands to fetch the repository and import the required libraries. For details, see the "Project creator tools" section of the ModusToolbox™ software user guide (locally available at {ModusToolbox™ software install directory}/docs_{version}/mtb_user_guide.pdf).
In third-party IDEs
Use one of the following options:
-
Use the standalone Project Creator tool:
-
Launch Project Creator from the Windows Start menu or from {ModusToolbox™ software install directory}/tools_{version}/project-creator/project-creator.exe.
-
In the initial Choose Board Support Package screen, select the BSP, and click Next.
-
In the Select Application screen, select the appropriate IDE from the Target IDE drop-down menu.
-
Click Create and follow the instructions printed in the bottom pane to import or open the exported project in the respective IDE.
-
-
Use command-line interface (CLI):
-
Follow the instructions from the In command-line interface (CLI) section to create the application.
-
Export the application to a supported IDE using the
make <ide>
command. -
Follow the instructions displayed in the terminal to create or import the application as an IDE project.
-
For a list of supported IDEs and more details, see the "Exporting to IDEs" section of the ModusToolbox™ software user guide (locally available at {ModusToolbox™ software install directory}/docs_{version}/mtb_user_guide.pdf).
-
Enterprise commands:
- join_ent : This command will connect the device to enterprise Wi-Fi network.
join_ent <ssid> <eap_protocol> [username] [password] <wifi auth_type>
Example:
join_ent WIFI_SSID eap_tls user pass wpa2_aes
Enterprise Join Example
Note1: WPA3 Enterprise command auth types :
wpa3_aes_ccmp
: WPA3 Transition modewpa3_aes_gcm
: WPA3 Enterprise only modewpa3_192bit
: WPA3-Enterprise 192-bit mode
Note2: EAP security protocols :
eap_tls
: EAP TLSpeap
: PEAPv0 with MSCHAPv2eap_ttls
: EAP-TTLS with EAP-MSCHAPv2
- leave_ent : Leave from the connected enterprise Wi-Fi network.
-
Data transfer commands:
- start_echo_server : This command will start a TCP echo server with the given port number. The server will echo back the data received from the client.
start_echo_server <tcp_port_number>
Example:
start_echo_server 50007
- stop_echo_server :Stops the TCP echo server.
- connect_to_server : This will create a secure connection to the remote server using the remote ip address and port number. The keys and ceriticates are taken from
ent_secure_tcp_client.h
. The device will send and 'ACK' back to any data received from remote side.
connect_to_server <IP Address> <tcp_port_number>
Example:
connect_to_server 10.0.0.3 50007
- disconnect_server : Disconnects the existing secure connection.
-
Connect the board to your PC using the provided USB cable through the KitProg3 USB connector.
-
Open a terminal program and select the KitProg3 COM port. Set the serial port parameters to 8N1 and 115200 baud.
-
Program using one of the following and reset the board:
Using Eclipse IDE for ModusToolbox™ software
-
Select the application project in the Project Explorer.
-
In the Quick Panel, scroll down, and click <Application Name> Program.
Using CLI
From the terminal, execute the
make program
command to build and program the application using the default toolchain to the default target. The default toolchain and target are specified in the application's Makefile but you can override those values manually:make program TARGET=APP_<BSP> TOOLCHAIN=<toolchain>
Example:
make program TARGET=APP_CYW955913EVK-01 TOOLCHAIN=GCC_ARM
-
-
Connect to enterprise Wi-Fi AP using join_ent.
-
Testing Data Path
- Start TCP echo server using start_echo_server with port number.
- Note down the IP address displayed in Step-4.
- Connect your PC to the Wi-Fi AP.
- From the scripts directory, open a command shell and run the Python TCP client (client.py). In the command shell opened in the scripts directory, type in the following command:
python client.py <IP address> <Port Number>
For Example, if the IP address of the device is "192.168.1.125" and the port number is "50007", the command will be
python client.py 192.168.1.125 50007
Note: The python script will wait for the input on the console and will send to the device after connection. To terminate the data transfer, type exit
Note : This code example has been tested with Aruba AP 635
for WPA2 Enterprise security and WPA3 Enterprise 192Bit. The WPA3 Enterprise only and transition modes are validated using hostapd (v2.10) as Access Point due to limiations in Aruba AP.
Document title: Enterprise Security Tester App
Version | Description of change |
---|---|
1.2.0 | Added EAP-TTLS command |
1.1.0 | Added PEAP command |
1.0.0 | Initial version with EAP TLS support. |