Docker SSL support

This commit is contained in:
Volodymyr Babak 2017-05-23 09:25:31 +03:00
parent 43c174cdbd
commit 8c50c63ca9
6 changed files with 41 additions and 29 deletions

View File

@ -19,12 +19,18 @@ server:
address: "${HTTP_BIND_ADDRESS:0.0.0.0}" address: "${HTTP_BIND_ADDRESS:0.0.0.0}"
# Server bind port # Server bind port
port: "${HTTP_BIND_PORT:8080}" port: "${HTTP_BIND_PORT:8080}"
# Uncomment the following section to enable ssl # Server SSL configuration
# ssl: ssl:
# key-store: classpath:keystore/keystore.p12 # Enable/disable SSL support
# key-store-password: thingsboard enabled: "${SSL_ENABLED:false}"
# keyStoreType: PKCS12 # Path to the key store that holds the SSL certificate
# keyAlias: tomcat key-store: "${SSL_KEY_STORE:classpath:keystore/keystore.p12}"
# Password used to access the key store
key-store-password: "${SSL_KEY_STORE_PASSWORD:thingsboard}"
# Type of the key store
key-store-type: "${SSL_KEY_STORE_TYPE:PKCS12}"
# Alias that identifies the key in the key store
key-alias: "${SSL_KEY_ALIAS:tomcat}"
# Zookeeper connection parameters. Used for service discovery. # Zookeeper connection parameters. Used for service discovery.
zk: zk:
@ -60,10 +66,10 @@ plugins:
# JWT Token parameters # JWT Token parameters
security.jwt: security.jwt:
tokenExpirationTime: "${JWT_TOKEN_EXPIRATION_TIME:900}" # Number of seconds (15 mins) token-expiration-time: "${JWT_TOKEN_EXPIRATION_TIME:900}" # Number of seconds (15 mins)
refreshTokenExpTime: "${JWT_REFRESH_TOKEN_EXPIRATION_TIME:3600}" # Seconds (1 hour) refresh-token-exp-time: "${JWT_REFRESH_TOKEN_EXPIRATION_TIME:3600}" # Seconds (1 hour)
tokenIssuer: "${JWT_TOKEN_ISSUER:thingsboard.io}" token-issuer: "${JWT_TOKEN_ISSUER:thingsboard.io}"
tokenSigningKey: "${JWT_TOKEN_SIGNING_KEY:thingsboardDefaultSigningKey}" token-signing-key: "${JWT_TOKEN_SIGNING_KEY:thingsboardDefaultSigningKey}"
# Device communication protocol parameters # Device communication protocol parameters
http: http:
@ -72,19 +78,25 @@ http:
# MQTT server parameters # MQTT server parameters
mqtt: mqtt:
bind_address: "${MQTT_BIND_ADDRESS:0.0.0.0}" bind_address: "${MQTT_BIND_ADDRESS:0.0.0.0}"
bind_port: "${MQTT_BIND_PORT:1883}" bind_port: "${MQTT_BIND_PORT:1884}"
adaptor: "${MQTT_ADAPTOR_NAME:JsonMqttAdaptor}" adaptor: "${MQTT_ADAPTOR_NAME:JsonMqttAdaptor}"
timeout: "${MQTT_TIMEOUT:10000}" timeout: "${MQTT_TIMEOUT:10000}"
netty: netty:
leak_detector_level: "${NETTY_LEASK_DETECTOR_LVL:DISABLED}" leak_detector_level: "${NETTY_LEASK_DETECTOR_LVL:DISABLED}"
boss_group_thread_count: "${NETTY_BOSS_GROUP_THREADS:1}" boss_group_thread_count: "${NETTY_BOSS_GROUP_THREADS:1}"
worker_group_thread_count: "${NETTY_WORKER_GROUP_THREADS:12}" worker_group_thread_count: "${NETTY_WORKER_GROUP_THREADS:12}"
# Uncomment the following lines to enable ssl for MQTT # MQTT SSL configuration
# ssl: ssl:
# key_store: mqttserver.jks # Enable/disable SSL support
# key_store_password: server_ks_password enabled: "${MQTT_SSL_ENABLED:false}"
# key_password: server_key_password # Path to the key store that holds the SSL certificate
# key_store_type: JKS key_store: "${MQTT_SSL_KEY_STORE:mqttserver.jks}"
# Password used to access the key store
key_store_password: "${MQTT_SSL_KEY_STORE_PASSWORD:server_ks_password}"
# Password used to access the key
key_password: "${MQTT_SSL_KEY_PASSWORD:server_key_password}"
# Type of the key store
key_store_type: "${MQTT_SSL_KEY_STORE_TYPE:JKS}"
# CoAP server parameters # CoAP server parameters
coap: coap:

View File

@ -45,7 +45,6 @@ public class ServiceCacheConfiguration {
@Value("${cache.device_credentials.time_to_live}") @Value("${cache.device_credentials.time_to_live}")
private Integer cacheDeviceCredentialsTTL; private Integer cacheDeviceCredentialsTTL;
@Value("${zk.enabled}") @Value("${zk.enabled}")
private boolean zkEnabled; private boolean zkEnabled;
@Value("${zk.url}") @Value("${zk.url}")

View File

@ -18,13 +18,15 @@ version: '2'
services: services:
thingsboard: thingsboard:
image: "thingsboard/application:1.2.2" image: "thingsboard/application:1.2.3-test"
ports: ports:
- "8080:8080" - "8443:8443"
- "1883:1883" - "1884:1883"
- "5683:5683/udp" - "5683:5683/udp"
env_file: env_file:
- thingsboard.env - thingsboard.env
volumes:
- "~/keystore.p12:/root/keystore.p12"
entrypoint: ./run_thingsboard.sh entrypoint: ./run_thingsboard.sh
thingsboard-db-schema: thingsboard-db-schema:
image: "thingsboard/thingsboard-db-schema:1.2.2" image: "thingsboard/thingsboard-db-schema:1.2.2"

View File

@ -6,3 +6,7 @@ MQTT_BIND_ADDRESS=0.0.0.0
MQTT_BIND_PORT=1883 MQTT_BIND_PORT=1883
COAP_BIND_ADDRESS=0.0.0.0 COAP_BIND_ADDRESS=0.0.0.0
COAP_BIND_PORT=5683 COAP_BIND_PORT=5683
SSL_ENABLED=true
SSL_KEY_STORE=/root/keystore.p12
HTTP_BIND_PORT=8443

View File

@ -18,9 +18,4 @@
cp ../../application/target/thingsboard.deb thingsboard.deb cp ../../application/target/thingsboard.deb thingsboard.deb
docker build -t thingsboard/application:1.2.2 -t thingsboard/application:latest . docker build -t thingsboard/application:1.2.3-test .
docker login
docker push thingsboard/application:1.2.2
docker push thingsboard/application:latest

View File

@ -41,7 +41,7 @@ import java.security.cert.X509Certificate;
*/ */
@Slf4j @Slf4j
@Component("MqttSslHandlerProvider") @Component("MqttSslHandlerProvider")
@ConditionalOnProperty(prefix = "mqtt.ssl", value = "key-store", havingValue = "", matchIfMissing = false) @ConditionalOnProperty(prefix = "mqtt.ssl", value = "enabled", havingValue = "true", matchIfMissing = false)
public class MqttSslHandlerProvider { public class MqttSslHandlerProvider {
public static final String TLS = "TLS"; public static final String TLS = "TLS";