Commit 8c50c63ca970ae36d2bd1b86b3ea998e39efad7e

Authored by Volodymyr Babak
1 parent 43c174cd

Docker SSL support

... ... @@ -19,12 +19,18 @@ server:
19 19 address: "${HTTP_BIND_ADDRESS:0.0.0.0}"
20 20 # Server bind port
21 21 port: "${HTTP_BIND_PORT:8080}"
22   -# Uncomment the following section to enable ssl
23   -# ssl:
24   -# key-store: classpath:keystore/keystore.p12
25   -# key-store-password: thingsboard
26   -# keyStoreType: PKCS12
27   -# keyAlias: tomcat
  22 + # Server SSL configuration
  23 + ssl:
  24 + # Enable/disable SSL support
  25 + enabled: "${SSL_ENABLED:false}"
  26 + # Path to the key store that holds the SSL certificate
  27 + key-store: "${SSL_KEY_STORE:classpath:keystore/keystore.p12}"
  28 + # Password used to access the key store
  29 + key-store-password: "${SSL_KEY_STORE_PASSWORD:thingsboard}"
  30 + # Type of the key store
  31 + key-store-type: "${SSL_KEY_STORE_TYPE:PKCS12}"
  32 + # Alias that identifies the key in the key store
  33 + key-alias: "${SSL_KEY_ALIAS:tomcat}"
28 34
29 35 # Zookeeper connection parameters. Used for service discovery.
30 36 zk:
... ... @@ -60,10 +66,10 @@ plugins:
60 66
61 67 # JWT Token parameters
62 68 security.jwt:
63   - tokenExpirationTime: "${JWT_TOKEN_EXPIRATION_TIME:900}" # Number of seconds (15 mins)
64   - refreshTokenExpTime: "${JWT_REFRESH_TOKEN_EXPIRATION_TIME:3600}" # Seconds (1 hour)
65   - tokenIssuer: "${JWT_TOKEN_ISSUER:thingsboard.io}"
66   - tokenSigningKey: "${JWT_TOKEN_SIGNING_KEY:thingsboardDefaultSigningKey}"
  69 + token-expiration-time: "${JWT_TOKEN_EXPIRATION_TIME:900}" # Number of seconds (15 mins)
  70 + refresh-token-exp-time: "${JWT_REFRESH_TOKEN_EXPIRATION_TIME:3600}" # Seconds (1 hour)
  71 + token-issuer: "${JWT_TOKEN_ISSUER:thingsboard.io}"
  72 + token-signing-key: "${JWT_TOKEN_SIGNING_KEY:thingsboardDefaultSigningKey}"
67 73
68 74 # Device communication protocol parameters
69 75 http:
... ... @@ -72,19 +78,25 @@ http:
72 78 # MQTT server parameters
73 79 mqtt:
74 80 bind_address: "${MQTT_BIND_ADDRESS:0.0.0.0}"
75   - bind_port: "${MQTT_BIND_PORT:1883}"
  81 + bind_port: "${MQTT_BIND_PORT:1884}"
76 82 adaptor: "${MQTT_ADAPTOR_NAME:JsonMqttAdaptor}"
77 83 timeout: "${MQTT_TIMEOUT:10000}"
78 84 netty:
79 85 leak_detector_level: "${NETTY_LEASK_DETECTOR_LVL:DISABLED}"
80 86 boss_group_thread_count: "${NETTY_BOSS_GROUP_THREADS:1}"
81 87 worker_group_thread_count: "${NETTY_WORKER_GROUP_THREADS:12}"
82   -# Uncomment the following lines to enable ssl for MQTT
83   -# ssl:
84   -# key_store: mqttserver.jks
85   -# key_store_password: server_ks_password
86   -# key_password: server_key_password
87   -# key_store_type: JKS
  88 + # MQTT SSL configuration
  89 + ssl:
  90 + # Enable/disable SSL support
  91 + enabled: "${MQTT_SSL_ENABLED:false}"
  92 + # Path to the key store that holds the SSL certificate
  93 + key_store: "${MQTT_SSL_KEY_STORE:mqttserver.jks}"
  94 + # Password used to access the key store
  95 + key_store_password: "${MQTT_SSL_KEY_STORE_PASSWORD:server_ks_password}"
  96 + # Password used to access the key
  97 + key_password: "${MQTT_SSL_KEY_PASSWORD:server_key_password}"
  98 + # Type of the key store
  99 + key_store_type: "${MQTT_SSL_KEY_STORE_TYPE:JKS}"
88 100
89 101 # CoAP server parameters
90 102 coap:
... ...
... ... @@ -45,7 +45,6 @@ public class ServiceCacheConfiguration {
45 45 @Value("${cache.device_credentials.time_to_live}")
46 46 private Integer cacheDeviceCredentialsTTL;
47 47
48   -
49 48 @Value("${zk.enabled}")
50 49 private boolean zkEnabled;
51 50 @Value("${zk.url}")
... ...
... ... @@ -18,13 +18,15 @@ version: '2'
18 18
19 19 services:
20 20 thingsboard:
21   - image: "thingsboard/application:1.2.2"
  21 + image: "thingsboard/application:1.2.3-test"
22 22 ports:
23   - - "8080:8080"
24   - - "1883:1883"
  23 + - "8443:8443"
  24 + - "1884:1883"
25 25 - "5683:5683/udp"
26 26 env_file:
27 27 - thingsboard.env
  28 + volumes:
  29 + - "~/keystore.p12:/root/keystore.p12"
28 30 entrypoint: ./run_thingsboard.sh
29 31 thingsboard-db-schema:
30 32 image: "thingsboard/thingsboard-db-schema:1.2.2"
... ...
... ... @@ -5,4 +5,8 @@ ZOOKEEPER_URL=zk:2181
5 5 MQTT_BIND_ADDRESS=0.0.0.0
6 6 MQTT_BIND_PORT=1883
7 7 COAP_BIND_ADDRESS=0.0.0.0
8   -COAP_BIND_PORT=5683
\ No newline at end of file
  8 +COAP_BIND_PORT=5683
  9 +
  10 +SSL_ENABLED=true
  11 +SSL_KEY_STORE=/root/keystore.p12
  12 +HTTP_BIND_PORT=8443
\ No newline at end of file
... ...
... ... @@ -18,9 +18,4 @@
18 18
19 19 cp ../../application/target/thingsboard.deb thingsboard.deb
20 20
21   -docker build -t thingsboard/application:1.2.2 -t thingsboard/application:latest .
22   -
23   -docker login
24   -
25   -docker push thingsboard/application:1.2.2
26   -docker push thingsboard/application:latest
\ No newline at end of file
  21 +docker build -t thingsboard/application:1.2.3-test .
\ No newline at end of file
... ...
... ... @@ -41,7 +41,7 @@ import java.security.cert.X509Certificate;
41 41 */
42 42 @Slf4j
43 43 @Component("MqttSslHandlerProvider")
44   -@ConditionalOnProperty(prefix = "mqtt.ssl", value = "key-store", havingValue = "", matchIfMissing = false)
  44 +@ConditionalOnProperty(prefix = "mqtt.ssl", value = "enabled", havingValue = "true", matchIfMissing = false)
45 45 public class MqttSslHandlerProvider {
46 46
47 47 public static final String TLS = "TLS";
... ...