Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 58dc96b

Browse files
committed
Make insecure default for Databroker
Reverts previous change. Short term decision is that we will not change default behavior, KUKSA.val Databroker shall unless indicated by arguments start in insecure mode, i.e.e. accepting non-TLS connections (only). We agreed that this MAY change in the future, so a warning shall be given.
1 parent 9ab495b commit 58dc96b

File tree

3 files changed

+51
-28
lines changed

3 files changed

+51
-28
lines changed

doc/tls.md

+23-9
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ KUKSA.val supports TLS for connection between KUKSA.val Databroker/Server and cl
88

99
General design concept in short:
1010

11-
* KUKSA.val Server and KUKSA.val Databroker by default only accept TLS connection. Insecure connections can be allowed by a configuration setting
12-
* Mutual authentication not supported, i.e. KUKSA.val Server and KUKSA.val Databroker does not authenticate clients
11+
* KUKSA.val Server and KUKSA.val Databroker supports to use either connections secured with TLS or insecure connections.
12+
* You can use configuration settings to control whether Server or databroker shall require secure connections.
13+
* Default connection type may vary between tools, and may be changed in future releases.
14+
* Mutual authentication is not supported, i.e. KUKSA.val Server and KUKSA.val Databroker does not authenticate clients
1315
* A set of example certificates and keys exist in the [kuksa_certificates](kuksa_certificates) repository
1416
* The example certificates are used as default by some applications
1517
* The example certificates shall only be used during development and re not suitable for production use
@@ -19,20 +21,31 @@ General design concept in short:
1921

2022
For more information see the [README.md](kuksa_certificates/README.md).
2123

22-
**NOTE: The example keys and certificates shall not be used in your production environment! **
24+
**NOTE: The example keys and certificates shall not be used in your production environment!**
2325

2426
## Examples using example certificates
2527

2628
This section intends to give guidelines on how you can verify TLS functionality with KUKSA.val.
2729
It is based on using the example certificates.
2830

2931

30-
## KUKSA.val databroker
32+
## KUKSA.val Databroker
3133

3234
KUKSA.val Databroker supports TLS, but not mutual authentication.
33-
You cannot start KUKSA.val Databroker just using default arguments as you either must specify that insecure connections
34-
shall be used (`--insecure`) or provide data for a secure connection.
35-
To use a secure connection specify `--tls-cert`and `--tls-private-key`
35+
As of today, if not specified KUKSA.val Databroker will accept only insecure connecttions.
36+
37+
```
38+
~/kuksa.val/kuksa_databroker$ cargo run --bin databroker -- --metadata ../data/vss-core/vss_release_4.0.json
39+
```
40+
41+
The default behavior may change in the future. By that reason, it is recommended to use the `--insecure` argument
42+
if you want to use insecure connections.
43+
44+
```
45+
~/kuksa.val/kuksa_databroker$ cargo run --bin databroker -- --metadata ../data/vss-core/vss_release_4.0.json --insecure
46+
```
47+
48+
To use a secure connection specify both `--tls-cert`and `--tls-private-key`
3649

3750
```
3851
~/kuksa.val/kuksa_databroker$ cargo run --bin databroker -- --metadata ../data/vss-core/vss_release_4.0.json --tls-cert ../kuksa_certificates/Server.pem --tls-private-key ../kuksa_certificates/Server.key
@@ -64,13 +77,14 @@ docker run --rm -it --net=host -v /home/user/kuksa.val/kuksa_certificates:/certs
6477

6578
## KUKSA.val Server
6679

67-
Uses TLS by default, but doe not support mutual TLS. By default it uses KUKSA.val example certificates/keys `Server.key`, `Server.pem` and `CA.pem`.
80+
KUKSA.val Server uses TLS by default, but does not support mutual TLS.
81+
By default it uses KUKSA.val example certificates/keys `Server.key`, `Server.pem` and `CA.pem`.
6882

6983
```
7084
~/kuksa.val/kuksa-val-server/build/src$ ./kuksa-val-server --vss ./vss_release_4.0.json
7185
```
7286

73-
It is posible to specify a different certificate path, but the file names must be the same as listed above.
87+
It is possible to specify a different certificate path, but the file names must be the same as listed above.
7488

7589
```
7690
~/kuksa.val/kuksa-val-server/build/src$ ./kuksa-val-server --vss ./vss_release_4.0.json -cert-path ../../../kuksa_certificates

kuksa_databroker/README.md

+23-16
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# Kuksa Databroker
22

3+
## Table of contents
4+
5+
<!-- TOC generated by https://luciopaiva.com/markdown-toc/ with 2 levels -->
6+
37
- [Kuksa Databroker](#kuksa-databroker)
48
- [Intro](#intro)
59
- [Relation to the COVESA Vehicle Signal Specification (VSS)](#relation-to-the-covesa-vehicle-signal-specification-vss)
6-
- [Building](#building)
7-
- [Build all](#build-all)
8-
- [Build all release](#build-all-release)
9-
- [Running](#running)
10-
- [Broker](#databroker)
11-
- [Test the broker - run client/cli](#test-the-databroker)
12-
- [Kuksa Data Broker Query Syntax](#data-broker-query-syntax)
13-
- [Configuration](#configuration)
14-
- [Build and run databroker container](#build-and-run-databroker)
10+
- [Building KUKSA.val Databroker](#building-kuksaval-databroker)
11+
- [Running KUKSA.val Databroker](#running-kuksaval-databroker)
12+
- [Test the Databroker using CLI](#test-the-databroker-using-cli)
13+
- [KUKSA.val Databroker Configuration](#kuksaval-databroker-configuration)
14+
- [Run Databroker test cases](#run-databroker-test-cases)
15+
- [Build and run Databroker using Docker](#build-and-run-databroker-using-docker)
1516
- [Limitations](#limitations)
1617
- [GRPC overview](#grpc-overview)
1718
- [GRPC Interfaces](#grpc-interfaces)
@@ -78,12 +79,14 @@ OPTIONS:
7879
```
7980

8081
Before starting KUKSA.val Databroker you must decide if you want to use TLS for incoming connections or not.
81-
It is is recommended to use TLS and the you must provide server key by `--tls-private-key`
82-
and server certificate by `--tls-cert`. If you want to run without TLS you must give `--insecure`.
82+
It is is recommended to use TLS and then you must provide server key by `--tls-private-key`
83+
and server certificate by `--tls-cert`. If you do not give those arguments KUKSA.val Databroker will only accept
84+
insecure connections. The default behavior may change in the future, so if you want insecure connections it is
85+
recommended to use the `--insecure` argument.
8386

8487
*Note: Unless stated otherwise, the examples below show KUKSA.val Databroker running in insecure mode!*
8588

86-
Run the broker in insecure mode with:
89+
Run the Databroker in insecure mode with:
8790

8891
`cargo run --bin databroker -- --insecure`
8992

@@ -190,7 +193,7 @@ WHERE
190193
Subscription is now running in the background. Received data is identified by [1].
191194
```
192195

193-
### Configuration
196+
## KUKSA.val Databroker Configuration
194197

195198
| parameter | default value | cli parameter | environment variable | description |
196199
|----------------|---------------|------------------|-----------------------------------|----------------------------------------------|
@@ -200,10 +203,10 @@ Subscription is now running in the background. Received data is identified by [1
200203
| listen_port | 55555 | --port | KUKSA_DATA_BROKER_PORT | Listen for rpc calls |
201204
| jwt_public_key | <no active> | --jwt-public-key | <no active> | Public key used to verify JWT access tokens |
202205
| tls_cert | <no active> | --tls-cert | <no active> | TLS certificate file (.pem) |
203-
| tls_private_key | <no active> | --tls-private-key | <no active> | TLS private key file (.pem) |
204-
| insecure | <no active> | --insecure | <no active> | Allow insecure connections |
206+
| tls_private_key | <no active> | --tls-private-key | <no active> | TLS private key file (.key) |
207+
| insecure | <no active> | --insecure | <no active> | Allow insecure connections (default unless tls_cert and tls_private_key given)|
205208

206-
To change the default configuration use the arguments during startup see [run section](#running) or environment variables.
209+
To change the default configuration use the arguments during startup see [run section](#running-kuksaval-databroker) or environment variables.
207210

208211
## Run Databroker test cases
209212

@@ -237,6 +240,7 @@ tar -czvf databroker_x86_64.tar.gz \
237240
target/release/examples/perf_setter \
238241
target/release/examples/perf_subscriber
239242
```
243+
240244
```shell
241245
# For aarch64
242246
tar -czvf databroker_aarch64.tar.gz \
@@ -245,12 +249,15 @@ tar -czvf databroker_aarch64.tar.gz \
245249
target/aarch64-unknown-linux-gnu/release/examples/perf_setter \
246250
target/aarch64-unknown-linux-gnu/release/examples/perf_subscriber
247251
```
252+
248253
To build the image execute following commands from root directory as context.
254+
249255
```shell
250256
docker build -f kuksa_databroker/Dockerfile -t databroker:<tag> .
251257
```
252258

253259
Use following command if buildplatform is required
260+
254261
```shell
255262
DOCKER_BUILDKIT=1 docker build -f kuksa_databroker/Dockerfile -t databroker:<tag> .
256263
```

kuksa_databroker/databroker/src/main.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
1717

1818
use databroker::broker::RegistrationError;
1919
use databroker::grpc::server::{Authorization, ServerTLS};
20-
use tracing::{debug, error, info};
20+
use tracing::{debug, error, info, warn};
2121

2222
use tokio::select;
2323
use tokio::signal::unix::{signal, SignalKind};
@@ -378,9 +378,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
378378
);
379379
}
380380
(None, None) => {
381-
return Err(
382-
"You must either provide TLS certificate and key or request insecure mode by --insecure.".into(),
381+
warn!(
382+
"Default behavior may change in the future, \
383+
please use --insecure if you want an insecure connection!"
383384
);
385+
ServerTLS::Disabled
384386
}
385387
}
386388
};

0 commit comments

Comments
 (0)