TheThingsStack V3.8.7 with self-signed certificate -> Forbidden Token exchange refused

Following up: I have managed to set up The Things Stack and log in to the console by following @TheIronNinja’s instructions above and using these steps for setting up https.

I am still having some issues with ttn-lw-cli (it’s trying to hit localhost and my certificate is for my machine’s static IP), but ttn-lw-stack config | grep localhost shows that there are some more config options using localhost which I can probably tweak to fix that.

Also of note is the following github issue which describes the IronNinja has mentioned: https://github.com/TheThingsNetwork/lorawan-stack/issues/1230

Referencing the open source configuration file here

TTN_LW_CONSOLE_UI_AS_BASE_URL: line 86
TTN_LW_CONSOLE_UI_IS_BASE_URL: line 80
TTN_LW_OAUTH_SERVER_ADDRESS: this is not a The Things Stack config option
TTN_LW_IS_OAUTH_UI_CANONICAL_URL: line 27
TTN_LW_IS_OAUTH_UI_IS_BASE_URL: line 29
TTN_LW_APPLICATION_SERVER_GRPC_ADDRESS: this is not a The Things Stack config option
TTN_LW_DEVICE_CLAIMING_SERVER_GRPC_ADDRESS: this is not a The Things Stack config option

1 Like

Thanks for clarifying, I didn’t realise some of those environment variables overlapped with the other settings in the file. I have now got ttn-lw-cli working properly after changing all the config variables in the github issue I linked. I’m going over my tts install process again to see which of these extra variables were needed. Once that’s done I’ll post the full process here so that (a) people googling this in the future can find it and (b) the install documentation can be updated as needed.

I’ve recorded the complete process for setting up TTS open source with a self-signed certificate here. It’s a bit long for a forum post, hence the pastebin link. Note that I’m using solution 1, replacing localhost with the static IP of my machine.

The key parts missing from the current TTS documentation are as follows:

  • Uncomment the custom certs sections at the bottom of docker-compose.yml (@benolayinka is adding this to the docs)
  • Uncomment the custom certs section near the top of ttn-lw-stack-docker.yml and comment out the Let’s Encrypt section (@benolayinka is adding this to the docs)
  • Add additional environment variables to docker-compose.yaml. In particular, I needed to add the following variables:
      TTN_LW_APPLICATION_SERVER_GRPC_ADDRESS: 192.168.1.13:8884
      TTN_LW_DEVICE_TEMPLATE_CONVERTER_GRPC_ADDRESS: 192.168.1.13:8884
      TTN_LW_GATEWAY_SERVER_GRPC_ADDRESS: 192.168.1.13:8884
      TTN_LW_IDENTITY_SERVER_GRPC_ADDRESS: 192.168.1.13:8884
      TTN_LW_JOIN_SERVER_GRPC_ADDRESS: 192.168.1.13:8884
      TTN_LW_NETWORK_SERVER_GRPC_ADDRESS: 192.168.1.13:8884
      TTN_LW_OAUTH_SERVER_ADDRESS: https://192.168.1.13:8885/oauth

         I’ve selected these variables by taking the full list from the relevant github issue and removing the variables which are already specified via config in ttn-lw-stack-docker.yml. Some (or all) of these variables could specified as config in ttn-lw-stack-docker.yml instead of as environment variables.

  • Add port 8885 to is.email.network.console-url and is.email.network.identity-server-url.
  • Add port 8885 to every url nested under console

Would it be possible to add these additional steps to the official configuration docs? I was not able to get my installation working until I found this thread and the linked github issue.

@htdvisser are these configuration options used somewhere? They aren’t documented. Is TTN_LW_NETWORK_SERVER a valid alias for TTN_LW_NS?

https://thethingsstack.io/reference/configuration/network-server/

Those are configurations for ttn-lw-cli: https://thethingsstack.io/reference/configuration/cli/

Ah. @dsmith, how did you configure the CLI? Doing

$ ttn-lw-cli use 192.168.1.13

will configure the CLI to use that IP.

I was configuring the CLI using the environment variables specified in my message, because I was unaware of the use configuration option.

This is important for working with a custom IP so I suggest there should be a link to the CLI config page from the Localhost section of the installation instructions.

EDIT: I am not using use <ip_address> to configure the CLI because I’ve hit an issue with port binding on 8884 and needed to specify a different port. The use configuration didn’t seem to play nicely with this so I’m once again using env vars in docker-compose.yml.

I think it would also be helpful to add this to the config instructions for ttn-lw-stack-docker.yml when using a custom IP, because it is currently not mentioned

Done, great input, thank you → doc: Add localhost certificates note by benolayinka · Pull Request #147 · TheThingsIndustries/lorawan-stack-docs · GitHub

What’s the issue with port binding?

1 Like

SSL Port 443 is redirected to Port 8885 inside the container in our example docker-compose.yml, so this shouldn’t be necessary. What did you experience without adding these?

Something on my windows machine is listening on port 8884 (the process belongs to System so I can’t kill it), so I had to bind 3884:8884 instead of 8884:8884.

I tried ttn-lw-cli use 192.168.1.13:3884 but that didn’t work:

/ # ttn-lw-cli users list
WARN [core]grpc: addrConn.createTransport failed to connect to {192.168.1.13:8884 192.168.1.13:8884 <nil> 0 <nil>}. Err: connection error: desc = "transport: error while dialing: dial tcp 192.168.1.13:8884: connect: connection refused". Reconnecting...
connection error: desc = "transport: error while dialing: dial tcp 192.168.1.13:8884: connect: connection refused"

Specifying 192.168.1.13:3884 in the ttn-lw-cli environment variables worked.

I don’t have my linux machine on hand right now, but I think ttn-lw-cli use x.x.x.x would work fine there as it doesn’t have any clashes on port 8884

You are correct, that adding :8885 to those urls is not necessary. I thought I was getting caught in a redirect loop the other day but I just tried to reproduce it and I cannot, so that must have been a separate issue.