Enable SSL for connections to database
Since the database can be exposed to the outer world, it seems better to have an encrypted connection to it. We automatically generate a self-signed certificate since it's only used to encrypt the connection but one can easily replace it by a custom one, just overwrite `server.crt` and `server.key` in the /var/lib/dokku/services/postgres/DB_NAME/data directory.
This commit is contained in:
5
commands
5
commands
@@ -48,6 +48,11 @@ case "$1" in
|
||||
DATABASE_NAME="$(get_database_name "$SERVICE")"
|
||||
docker exec "$SERVICE_NAME" su - postgres -c "createdb -E utf8 $DATABASE_NAME" 2> /dev/null || echo 'Already exists'
|
||||
|
||||
dokku_log_verbose_quiet "Securing connection to database"
|
||||
service_stop "$SERVICE" > /dev/null
|
||||
docker run --rm -i -v "$SERVICE_ROOT/data:/var/lib/postgresql/data" "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION" bash -s < "$(dirname "$0")/scripts/enable_ssl.sh" &> /dev/null
|
||||
service_start "$SERVICE" > /dev/null
|
||||
|
||||
dokku_log_info2 "$PLUGIN_SERVICE container created: $SERVICE"
|
||||
dokku "$PLUGIN_COMMAND_PREFIX:info" "$SERVICE"
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user