8000 RFC: cc3200: Support WPA-Enterprise networks (802.1x auth) by noahwilliamsson · Pull Request #1592 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

RFC: cc3200: Support WPA-Enterprise networks (802.1x auth) #1592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

noahwilliamsson
Copy link

The CC3200 used in the WiPy boards supports WPA-Enterprise with 802.1x authentication but this functionality is currently not exposed in the Python API. This PR takes a stab at fixing that by extending WLAN.connect() and adding a bunch of new class constants.

Size changes as reported by arm-none-eabi-size for a release build of git master (af3e454) vs. this PR for WPA-Enterprise support (7690423d)

branch text data bss dec hex filename
git master 184840 1208 76096 262144 40000 build/WIPY/release/application.axf
wpa-enterprise 185416 1208 75520 262144 40000 build/WIPY/release/application.axf
+576 -576

I have some reservations about what the best way is to implement support for the additional 802.1x parameters, hence the RFC.

Using the current Python API for the WiPy board, connections to networks may be established like this (docs here):

wlan = WLAN(mode=WLAN.STA)
# Prototype: wlan.connect(ssid, *, auth=None, bssid=None, timeout=None)
wlan.connect('Free WiFi SSID')
wlan.connect('my-home-ssid', auth=(wlan.WPA2, '1234567890'))

With this patch I've simply extended the tuple in the auth kwarg to expect five items when WLAN.WPA_ENT is used in wlan.connect(). Example:

wlan.connect(WLAN.WPA_ENT, auth=( 'enterprise-ssid-802.1x', # SSID 'username', # Identity 'password', # Password 'anonymous ID', # Anonymous identity (may be: None) WLAN.EAP_PEAP0_MSCHAPv2 # EAP phase 1 and 2 methods (details: drivers/cc3100/inc/wlan.h) ))

I'm not entirely happy with a long list of unnamed arguments, where the second one is also not of the same kind (identity vs. key) as in the other security protocols supported. Feedback is welcome on how to make this API friendlier.

Additionally, I included QSTRs for all of the EAP authentication methods the CC3100/CC3200 support, which add to the code size. In practise, I guess the most popular mechanisms are EAP-TLS (client certs) and PEAPv0/EAP-MSCHAPv2 (common in the Windows world), so it would be possible to trade a few bytes for less flexibility.

- Define WLAN.WPA_ENT in addition to WLAN.WEP, WLAN.WPA and WLAN.WPA2
- Define a bunch of WLAN.EAP_* constants for 802.1x EAP authentication methods
- If wlan.connect() is called with WLAN.WPA_ENT as the first arg, the auth kwarg expects
  a tuple with five items (instead of two items, as used with WEP/WPA/WPA2.)  Example:

  wlan = WLAN(mode=WLAN.STA)
  wlan.connect(WLAN.WPA_ENT, auth=(
      'enterprise-ssid-802.1x',  # SSID
      'username',                # Identity
      'password',                # Password
      'anonymous ID',            # Anonymous identity (may be: None)
      WLAN.EAP_PEAP0_MSCHAPv2    # EAP phase 1 and 2 methods (details: drivers/cc3100/inc/wlan.h)
  ))
@noahwilliamsson noahwilliamsson changed the title RFC: cc3200: Support WPA-Enterprise networks (802.1x auth) in WLAN.connect() RFC: cc3200: Support WPA-Enterprise networks (802.1x auth) Nov 6, 2015
@danicampora
Copy link
Member

@noahwilliamsson thanks! I'll take a look. Hopefully we can remove most of the added constants and only keep a few.

@pfalcon pfalcon force-pushed the master branch 6 times, most recently from 9167980 to 1cc81ed Compare April 10, 2016 22:16
nickzoic pushed a commit to nickzoic/micropython that referenced this pull request Mar 2, 2019
final pin names, tested with final release
kadamski added a commit to kadamski/micropython that referenced this pull request Feb 18, 2021
Initial support for machine.RTC on rp2 port. It only supports datetime()
method and nothing else. The method gets/returns a tuple of 8 items,
just like esp32 port, for example, but the usec parameter is ignored as
the RP2 RTC only works up to seconds precision.

The Pico RTC isn't very useful as the time is lost during reset and
there seems to be no way to easily power up just the RTC clock with a
low current voltage, but still there seems to be use-cases for that, see
issues micropython#6831, and a thonny issue micropython#1592. It was also requested for
inclusion on v1.15 roadmap on micropython#6832.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
kadamski added a commit to kadamski/micropython that referenced this pull request Feb 19, 2021
Initial support for machine.RTC on rp2 port. It only supports datetime()
method and nothing else. The method gets/returns a tuple of 8 items,
just like esp32 port, for example, but the usec parameter is ignored as
the RP2 RTC only works up to seconds precision.

The Pico RTC isn't very useful as the time is lost during reset and
there seems to be no way to easily power up just the RTC clock with a
low current voltage, but still there seems to be use-cases for that, see
issues micropython#6831, and a thonny issue micropython#1592. It was also requested for
inclusion on v1.15 roadmap on micropython#6832.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
@dpgeorge
Copy link
Member

I'll close this PR due to inactivity. But WPA enterprise support is definitely a feature that is needed in MicroPython, eg for the esp32 and stm32 ports. So what's needed is to decide on an API that can work across all ports with WLAN support. See related #2778, #5705, #6430

@dpgeorge dpgeorge closed this Apr 20, 2021
kadamski added a commit to kadamski/micropython that referenced this pull request May 23, 2021
Initial support for machine.RTC on rp2 port. It only supports datetime()
method and nothing else. The method gets/returns a tuple of 8 items,
just like esp32 port, for example, but the usec parameter is ignored as
the RP2 RTC only works up to seconds precision.

The Pico RTC isn't very useful as the time is lost during reset and
there seems to be no way to easily power up just the RTC clock with a
low current voltage, but still there seems to be use-cases for that, see
issues micropython#6831, and a thonny issue micropython#1592. It was also requested for
inclusion on v1.15 roadmap on micropython#6832.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
dpgeorge pushed a commit that referenced this pull request Jun 12, 2021
Initial support for machine.RTC on rp2 port. It only supports datetime()
method and nothing else. The method gets/returns a tuple of 8 items, just
like esp32 port, for example, but the usec parameter is ignored as the RP2
RTC only works up to seconds precision.

The Pico RTC isn't very useful as the time is lost during reset and there
seems to be no way to easily power up just the RTC clock with a low current
voltage, but still there seems to be use-cases for that, see issues #6831,
and a Thonny issue #1592. It was also requested for inclusion on v1.15
roadmap on #6832.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0