I try to setup a RPI based gateway and I would like to use the basicstation software for that. I got the software running as described here https://doc.sm.tc/station/quick.html and the gateway is able to receive messages from LoRa nodes when running the live-s2.sm.tc example. But how to connect basicstation to TTN? There seems no configuration instructions or examples available how to use it.
That is currently not supported. Only TTIG can connect to the Basic Station to TTN bridge.
TTN backend V3 implements BasicStation support but there is no timeline when it will be available on the community network yes.
On the gateway console, register your gateway using the āIām using the legacy packet forwarderā option and enter your EUI.
PS: Yes this is not legacy but we are not going to update the v2 console for this change.
On April 5, I could not connect to TTN LNS: wss://lns.eu.thethings.network:443
Note: Before April 5, I had no problems using the basic station packed forwarder.
When using: wss://lns.us.thethings.network:443
the function mbedtls_ssl_handshake returns the decimal values: -26880 and 0
0 = GOOD, it means ready to run websocket protocol.
For looking into the TLS setup in more detail you can set the environment variable STATION_TLSDBG=4 when executing LBS
return code -0x2700 means:
$ grep -rin 0x2700
include/mbedtls/x509.h:73:#define MBEDTLS_ERR_X509_CERT_VERIFY_FAILED -0x2700 /**< Certificate verification failed, e.g. CRL, CA or signature check failed. */
The reason it does not verify the certificate is because the subject name does not match the hostname (lns.in.thethings.network != lns.eu.thethings.network):
ssl_tls.c:3754 MBEDTLS[2]: <= read record
ssl_tls.c:4524 MBEDTLS[3]: peer certificate #1:
ssl_tls.c:4524 MBEDTLS[3]: cert. version : 3
ssl_tls.c:4524 MBEDTLS[3]: serial number : 03:C0:15:AE:30:BD:E0:20:C1:4D:38:86:90:1D:89:A6:A4:00
ssl_tls.c:4524 MBEDTLS[3]: issuer name : C=US, O=Let's Encrypt, CN=Let's Encrypt Authority X3
ssl_tls.c:4524 MBEDTLS[3]: subject name : CN=lns.in.thethings.network
ssl_tls.c:4524 MBEDTLS[3]: issued on : 2020-01-06 13:02:23
ssl_tls.c:4524 MBEDTLS[3]: expires on : 2020-04-05 13:02:23
ssl_tls.c:4524 MBEDTLS[3]: signed using : RSA with SHA-256
ssl_tls.c:4524 MBEDTLS[3]: RSA key size : 2048 bits
ssl_tls.c:4524 MBEDTLS[3]: basic constraints : CA=false
ssl_tls.c:4524 MBEDTLS[3]: subject alt name : lns.in.thethings.network
ssl_tls.c:4524 MBEDTLS[3]: key usage : Digital Signature, Key Encipherment
ssl_tls.c:4524 MBEDTLS[3]: ext key usage : TLS Web Server Authentication, TLS Web Client Authentication
Your Basic Stationās TLS network client software first resolves the serverās IP address, and then connects to that IP address. If it then does not properly send the name lns.eu.thethings.network when it connects to that nameās IP address, then TTN might just return the wrong certificate to identify itself. I donāt know which certificate will be selected then; maybe the oldest or newest, maybe the one that was last used in a proper SNI-connection by some other gateway, maybe a random one, who knows. So, what (accidentally) works now, might (will) not work at some later time.
So, point is that the TTN server (or load balancer) is handling requests for multiple (sub-)domain names, and the TLS client needs to provide the exact name during the TLS handshake with the server. Thatās what SNI does.
Okay, i think i got what SNI actually does. But i thought, that this is done in the statically linked mbedTLS library. mbedTLS(SNI use) But you say now, that itās a problem with the underlying system?
So, I think you notice that Iām not a network expert. I try to get that stuff running on our embedded machines. I would appreciate it when you could point me in a direction to fix it?
Ok but the certificate received has a different SN. Shouldnāt the client skip this certificate in this case?
(I might clean up here at some later time. Iām not going to duplicate the complete Slack content here, even though it expires fast on Slack. Success!)