Commit a3f85df1a7cf128afbe6843d852dcfd2140288c1

Authored by VoBa
Committed by GitHub
2 parents 0758b664 5da5a1a1

Merge pull request #3 from volodymyr-babak/feature/docker-ssl

Feature/docker ssl
@@ -19,12 +19,18 @@ server: @@ -19,12 +19,18 @@ server:
19 address: "${HTTP_BIND_ADDRESS:0.0.0.0}" 19 address: "${HTTP_BIND_ADDRESS:0.0.0.0}"
20 # Server bind port 20 # Server bind port
21 port: "${HTTP_BIND_PORT:8080}" 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 # Zookeeper connection parameters. Used for service discovery. 35 # Zookeeper connection parameters. Used for service discovery.
30 zk: 36 zk:
@@ -60,10 +66,10 @@ plugins: @@ -60,10 +66,10 @@ plugins:
60 66
61 # JWT Token parameters 67 # JWT Token parameters
62 security.jwt: 68 security.jwt:
63 - tokenExpirationTime: "${JWT_TOKEN_EXPIRATION_TIME:9000000}" # Number of seconds (15 mins)  
64 - refreshTokenExpTime: "${JWT_REFRESH_TOKEN_EXPIRATION_TIME:36000000}" # 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:9000000}" # Number of seconds (15 mins)
  70 + refresh-token-exp-time: "${JWT_REFRESH_TOKEN_EXPIRATION_TIME:36000000}" # Seconds (1 hour)
  71 + token-issuer: "${JWT_TOKEN_ISSUER:thingsboard.io}"
  72 + token-signing-key: "${JWT_TOKEN_SIGNING_KEY:thingsboardDefaultSigningKey}"
67 73
68 # Device communication protocol parameters 74 # Device communication protocol parameters
69 http: 75 http:
@@ -72,19 +78,25 @@ http: @@ -72,19 +78,25 @@ http:
72 # MQTT server parameters 78 # MQTT server parameters
73 mqtt: 79 mqtt:
74 bind_address: "${MQTT_BIND_ADDRESS:0.0.0.0}" 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 adaptor: "${MQTT_ADAPTOR_NAME:JsonMqttAdaptor}" 82 adaptor: "${MQTT_ADAPTOR_NAME:JsonMqttAdaptor}"
77 timeout: "${MQTT_TIMEOUT:10000}" 83 timeout: "${MQTT_TIMEOUT:10000}"
78 netty: 84 netty:
79 leak_detector_level: "${NETTY_LEASK_DETECTOR_LVL:DISABLED}" 85 leak_detector_level: "${NETTY_LEASK_DETECTOR_LVL:DISABLED}"
80 boss_group_thread_count: "${NETTY_BOSS_GROUP_THREADS:1}" 86 boss_group_thread_count: "${NETTY_BOSS_GROUP_THREADS:1}"
81 worker_group_thread_count: "${NETTY_WORKER_GROUP_THREADS:12}" 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 # CoAP server parameters 101 # CoAP server parameters
90 coap: 102 coap:
@@ -45,7 +45,6 @@ public class ServiceCacheConfiguration { @@ -45,7 +45,6 @@ public class ServiceCacheConfiguration {
45 @Value("${cache.device_credentials.time_to_live}") 45 @Value("${cache.device_credentials.time_to_live}")
46 private Integer cacheDeviceCredentialsTTL; 46 private Integer cacheDeviceCredentialsTTL;
47 47
48 -  
49 @Value("${zk.enabled}") 48 @Value("${zk.enabled}")
50 private boolean zkEnabled; 49 private boolean zkEnabled;
51 @Value("${zk.url}") 50 @Value("${zk.url}")
@@ -20,8 +20,8 @@ services: @@ -20,8 +20,8 @@ services:
20 thingsboard: 20 thingsboard:
21 image: "thingsboard/application:1.2.3" 21 image: "thingsboard/application:1.2.3"
22 ports: 22 ports:
23 - - "8080:8080"  
24 - - "1883:1883" 23 + - "8443:8443"
  24 + - "1884:1883"
25 - "5683:5683/udp" 25 - "5683:5683/udp"
26 env_file: 26 env_file:
27 - thingsboard.env 27 - thingsboard.env
@@ -41,7 +41,7 @@ import java.security.cert.X509Certificate; @@ -41,7 +41,7 @@ import java.security.cert.X509Certificate;
41 */ 41 */
42 @Slf4j 42 @Slf4j
43 @Component("MqttSslHandlerProvider") 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 public class MqttSslHandlerProvider { 45 public class MqttSslHandlerProvider {
46 46
47 public static final String TLS = "TLS"; 47 public static final String TLS = "TLS";