chore(auth): configuration format of unified authentication plug-in
This commit is contained in:
parent
7df1dea4db
commit
9e03d6fea1
|
@ -17,6 +17,7 @@ jobs:
|
|||
runs-on: ubuntu-20.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
ldap_tag:
|
||||
- 2.4.50
|
||||
|
@ -36,12 +37,12 @@ jobs:
|
|||
if: matrix.network_type == 'ipv4'
|
||||
run: |
|
||||
server_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ldap)
|
||||
sed -i "/auth.ldap.servers/c auth.ldap.servers = $server_address" apps/emqx_auth_ldap/etc/emqx_auth_ldap.conf
|
||||
sed -i "s|^[#[:space:]]*auth.ldap.servers[[:space:]]*=.*|auth.ldap.servers = $server_address|g" apps/emqx_auth_ldap/etc/emqx_auth_ldap.conf
|
||||
- name: setup
|
||||
if: matrix.network_type == 'ipv6'
|
||||
run: |
|
||||
server_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' ldap)
|
||||
sed -i "/auth.ldap.servers/c auth.ldap.servers = $server_address" apps/emqx_auth_ldap/etc/emqx_auth_ldap.conf
|
||||
sed -i "s|^[#[:space:]]*auth.ldap.servers[[:space:]]*=.*|auth.ldap.servers = $server_address|g" apps/emqx_auth_ldap/etc/emqx_auth_ldap.conf
|
||||
- name: run test cases
|
||||
run: |
|
||||
docker exec -i erlang sh -c "make ensure-rebar3"
|
||||
|
@ -57,6 +58,7 @@ jobs:
|
|||
runs-on: ubuntu-20.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
mongo_tag:
|
||||
- 3
|
||||
|
@ -76,10 +78,10 @@ jobs:
|
|||
if: matrix.connect_type == 'tls'
|
||||
run: |
|
||||
docker-compose -f .ci/compatibility_tests/docker-compose-mongo-tls.yaml up -d
|
||||
echo 'auth.mongo.ssl = on' >> apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
echo 'auth.mongo.ssl.cacertfile = /emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/ca.pem' >> apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
echo 'auth.mongo.ssl.certfile = /emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-cert.pem' >> apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
echo 'auth.mongo.ssl.keyfile = /emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-key.pem' >> apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mongo.ssl[[:space:]]*=.*|auth.mongo.ssl = on|g' apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mongo.cacertfile[[:space:]]*=.*|auth.mongo.cacertfile = /emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/ca.pem|g' apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mongo.certfile[[:space:]]*=.*|auth.mongo.certfile = /emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-cert.pem|g' apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mongo.keyfile[[:space:]]*=.*|auth.mongo.keyfile = /emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-key.pem|g' apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
- name: setup
|
||||
env:
|
||||
MONGO_TAG: ${{ matrix.mongo_tag }}
|
||||
|
@ -89,12 +91,12 @@ jobs:
|
|||
if: matrix.network_type == 'ipv4'
|
||||
run: |
|
||||
server_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mongo)
|
||||
sed -i "/auth.mongo.server/c auth.mongo.server = $server_address:27017" apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
sed -i "s|^[#[:space:]]*auth.mongo.server[[:space:]]*=.*|auth.mongo.server = $server_address:27017|g" apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
- name: setup
|
||||
if: matrix.network_type == 'ipv6'
|
||||
run: |
|
||||
server_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' mongo)
|
||||
sed -i "/auth.mongo.server/c auth.mongo.server = $server_address:27017" apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
sed -i "s|^[#[:space:]]*auth.mongo.server[[:space:]]*=.*|auth.mongo.server = $server_address:27017|g" apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
- name: run test cases
|
||||
run: |
|
||||
docker exec -i erlang sh -c "make ensure-rebar3"
|
||||
|
@ -110,6 +112,7 @@ jobs:
|
|||
runs-on: ubuntu-20.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
mysql_tag:
|
||||
- 5.7
|
||||
|
@ -129,11 +132,10 @@ jobs:
|
|||
if: matrix.connect_type == 'tls'
|
||||
run: |
|
||||
docker-compose -f .ci/compatibility_tests/docker-compose-mysql-tls.yaml up -d
|
||||
echo '\n' >> apps/emqx_auth_mongo/etc/emqx_auth_mysql.conf
|
||||
sed -i '/auth.mysql.ssl = off/c auth.mysql.ssl = on' apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
echo "auth.mysql.ssl.cafile = /emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/ca.pem" >> apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
echo "auth.mysql.ssl.certfile = /emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/client-cert.pem" >> apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
echo "auth.mysql.ssl.keyfile = /emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/client-key.pem" >> apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mysql.ssl[[:space:]]*=.*|auth.mysql.ssl = on|g' apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mysql.cacertfile[[:space:]]*=.*|auth.mysql.cacertfile = /emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/ca.pem|g' apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mysql.certfile[[:space:]]*=.*|auth.mysql.certfile = /emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/client-cert.pem|g' apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mysql.keyfile[[:space:]]*=.*|auth.mysql.keyfile = /emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/client-key.pem|g' apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
- name: setup
|
||||
env:
|
||||
MYSQL_TAG: ${{ matrix.mysql_tag }}
|
||||
|
@ -149,6 +151,11 @@ jobs:
|
|||
run: |
|
||||
server_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' mysql)
|
||||
sed -i "/auth.mysql.server/c auth.mysql.server = $server_address:3306" apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
- name: setup
|
||||
run: |
|
||||
sed -i 's|^[#[:space:]]*auth.mysql.username[[:space:]]*=.*|auth.mysql.username = root|g' apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mysql.password[[:space:]]*=.*|auth.mysql.password = public|g' apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mysql.database[[:space:]]*=.*|auth.mysql.database = mqtt|g' apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
- name: run test cases
|
||||
run: |
|
||||
docker exec -i erlang sh -c "make ensure-rebar3"
|
||||
|
@ -164,6 +171,7 @@ jobs:
|
|||
runs-on: ubuntu-20.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
pgsql_tag:
|
||||
- 9
|
||||
|
@ -186,27 +194,30 @@ jobs:
|
|||
run: |
|
||||
docker-compose -f .ci/compatibility_tests/docker-compose-pgsql-tls.yaml build --no-cache
|
||||
docker-compose -f .ci/compatibility_tests/docker-compose-pgsql-tls.yaml up -d
|
||||
sed -i 's|auth.pgsql.username[ \t]*=.*|auth.pgsql.username = postgres|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i 's|auth.pgsql.password[ \t]*=.*|auth.pgsql.password = postgres|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i 's|auth.pgsql.database[ \t]*=.*|auth.pgsql.database= postgres|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i 's|auth.pgsql.ssl[ \t]*=.*|auth.pgsql.ssl = on|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
echo '\n' >> apps/emqx_auth_mongo/etc/emqx_auth_pgsql.conf
|
||||
echo 'auth.pgsql.ssl.cacertfile = /emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/root.crt' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.pgsql.username[ \t]*=.*|auth.pgsql.username = postgres|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.pgsql.password[ \t]*=.*|auth.pgsql.password = postgres|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.pgsql.database[ \t]*=.*|auth.pgsql.database = postgres|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.pgsql.ssl[ \t]*=.*|auth.pgsql.ssl = on|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.pgsql.cacertfile[ \t]*=.*|auth.pgsql.cacertfile = /emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/root.crt|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
- name: setup
|
||||
env:
|
||||
PGSQL_TAG: ${{ matrix.pgsql_tag }}
|
||||
if: matrix.connect_type == 'tcp'
|
||||
run: docker-compose -f .ci/compatibility_tests/docker-compose-pgsql.yaml up -d
|
||||
run: |
|
||||
docker-compose -f .ci/compatibility_tests/docker-compose-pgsql.yaml up -d
|
||||
sed -i 's|^[#[:space:]]*auth.pgsql.username[ \t]*=.*|auth.pgsql.username = root|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.pgsql.password[ \t]*=.*|auth.pgsql.password = public|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.pgsql.database[ \t]*=.*|auth.pgsql.database = mqtt|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
- name: setup
|
||||
if: matrix.network_type == 'ipv4'
|
||||
run: |
|
||||
server_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pgsql)
|
||||
sed -i "/auth.pgsql.server/c auth.pgsql.server = $server_address:5432" apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i "s|^[#[:space:]]*auth.pgsql.server[[:space:]]*=.*|auth.pgsql.server = $server_address:5432|g" apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
- name: setup
|
||||
if: matrix.network_type == 'ipv6'
|
||||
run: |
|
||||
server_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' pgsql)
|
||||
sed -i "/auth.pgsql.server/c auth.pgsql.server = $server_address:5432" apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i "s|^[#[:space:]]*auth.pgsql.server[[:space:]]*=.*|auth.pgsql.server = $server_address:5432|g" apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
- name: run test cases
|
||||
run: |
|
||||
docker exec -i erlang sh -c "make ensure-rebar3"
|
||||
|
@ -222,6 +233,7 @@ jobs:
|
|||
runs-on: ubuntu-20.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
redis_tag:
|
||||
- 5
|
||||
|
@ -245,11 +257,10 @@ jobs:
|
|||
run: |
|
||||
set -exu
|
||||
docker-compose -f .ci/compatibility_tests/docker-compose-redis-${{ matrix.node_type }}-tls.yaml up -d
|
||||
echo '\n' >> apps/emqx_auth_mongo/etc/emqx_auth_redis.conf
|
||||
echo 'auth.redis.ssl = on' >> apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
echo 'auth.redis.ssl.cafile = /emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/ca.crt' >> apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
echo 'auth.redis.ssl.certfile = /emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/redis.crt' >> apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
echo 'auth.redis.ssl.keyfile = /emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/redis.key' >> apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
sed -i 's|^[#[:space:]]*auth.redis.ssl[[:space:]]*=.*|auth.redis.ssl = on|g' apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
sed -i 's|^[#[:space:]]*auth.redis.ssl.cacertfile[[:space:]]*=.*|auth.redis.ssl.cacertfile = /emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/ca.crt|g' apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
sed -i 's|^[#[:space:]]*auth.redis.ssl.certfile[[:space:]]*=.*|auth.redis.ssl.certfile = /emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/redis.crt|g' apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
sed -i 's|^[#[:space:]]*auth.redis.ssl.keyfile[[:space:]]*=.*|auth.redis.ssl.keyfile = /emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/redis.key|g' apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
- name: setup
|
||||
env:
|
||||
REDIS_TAG: ${{ matrix.redis_tag }}
|
||||
|
@ -267,24 +278,24 @@ jobs:
|
|||
if: matrix.node_type == 'singer' && matrix.connect_type == 'tcp'
|
||||
run: |
|
||||
set -exu
|
||||
sed -i "/auth.redis.server/c auth.redis.server = ${redis_${{ matrix.network_type }}_address}:6379" apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
sed -i "s|^[#[:space:]]*auth.redis.server[[:space:]]*=.*|auth.redis.server = ${redis_${{ matrix.network_type }}_address}:6379|g" apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
- name: setup
|
||||
if: matrix.node_type == 'singer' && matrix.connect_type == 'tls' && matrix.redis_tag != '5'
|
||||
run: |
|
||||
set -exu
|
||||
sed -i "/auth.redis.server/c auth.redis.server = ${redis_${{ matrix.network_type }}_address}:6380" apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
sed -i "s|^[#[:space:]]*auth.redis.server[[:space:]]*=.*|auth.redis.server = ${redis_${{ matrix.network_type }}_address}:6380|g" apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
- name: setup
|
||||
if: matrix.node_type == 'cluster' && matrix.connect_type == 'tcp'
|
||||
run: |
|
||||
set -exu
|
||||
sed -i "/auth.redis.type/c auth.redis.type = cluster" apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
sed -i "/auth.redis.server/c auth.redis.server = ${redis_${{ matrix.network_type }}_address}:7000, ${redis_${{ matrix.network_type }}_address}:7001, ${redis_${{ matrix.network_type }}_address}:7002" apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
sed -i 's|^[#[:space:]]*auth.redis.type[[:space:]]*=.*|auth.redis.type = cluster|g' apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
sed -i "s|^[#[:space:]]*auth.redis.server[[:space:]]*=.*|auth.redis.server = ${redis_${{ matrix.network_type }}_address}:7000, ${redis_${{ matrix.network_type }}_address}:7001, ${redis_${{ matrix.network_type }}_address}:7002|g" apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
- name: setup
|
||||
if: matrix.node_type == 'cluster' && matrix.connect_type == 'tls' && matrix.redis_tag != '5'
|
||||
run: |
|
||||
set -exu
|
||||
sed -i "/auth.redis.type/c auth.redis.type = cluster" apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
sed -i "/auth.redis.server/c auth.redis.server = ${redis_${{ matrix.network_type }}_address}:8000, ${redis_${{ matrix.network_type }}_address}:8001, ${redis_${{ matrix.network_type }}_address}:8002" apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
sed -i 's|^[#[:space:]]*auth.redis.type[[:space:]]*=.*|auth.redis.type = cluster|g' apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
sed -i "s|^[#[:space:]]*auth.redis.server[[:space:]]*=.*|auth.redis.server = ${redis_${{ matrix.network_type }}_address}:8000, ${redis_${{ matrix.network_type }}_address}:8001, ${redis_${{ matrix.network_type }}_address}:8002|g" apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
- name: run test cases
|
||||
if: matrix.connect_type == 'tcp' || (matrix.connect_type == 'tls' && matrix.redis_tag != '5')
|
||||
run: |
|
||||
|
|
|
@ -30,11 +30,19 @@ jobs:
|
|||
docker-compose -f .ci/apps_tests/docker-compose.yaml up -d
|
||||
- name: set config files
|
||||
run: |
|
||||
sed -i "/auth.mysql.server/c auth.mysql.server = mysql_server:3306" apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
sed -i "/auth.redis.server/c auth.redis.server = redis_server:6379" apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
sed -i "/auth.mongo.server/c auth.mongo.server = mongo_server:27017" apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
sed -i "/auth.pgsql.server/c auth.pgsql.server = pgsql_server:5432" apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i "/auth.ldap.servers/c auth.ldap.servers = ldap_server" apps/emqx_auth_ldap/etc/emqx_auth_ldap.conf
|
||||
sed -i 's|^[#[:space:]]*auth.ldap.servers[[:space:]]*=.*|auth.ldap.servers = ldap_server|g' apps/emqx_auth_ldap/etc/emqx_auth_ldap.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mongo.server[[:space:]]*=.*|auth.mongo.server = mongo_server:27017|g' apps/emqx_auth_mongo/etc/emqx_auth_mongo.conf
|
||||
sed -i 's|^[#[:space:]]*auth.redis.server[[:space:]]*=.*|auth.redis.server = redis_server:6379|g' apps/emqx_auth_redis/etc/emqx_auth_redis.conf
|
||||
|
||||
sed -i 's|^[#[:space:]]*auth.mysql.server[[:space:]]*=.*|auth.mysql.server = mysql_server:3306|g' apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mysql.username[[:space:]]*=.*|auth.mysql.username = root|g' apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mysql.password[[:space:]]*=.*|auth.mysql.password = public|g' apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.mysql.database[[:space:]]*=.*|auth.mysql.database = mqtt|g' apps/emqx_auth_mysql/etc/emqx_auth_mysql.conf
|
||||
|
||||
sed -i 's|^[#[:space:]]*auth.pgsql.server[[:space:]]*=.*|auth.pgsql.server = pgsql_server:5432|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.pgsql.username[[:space:]]*=.*|auth.pgsql.username = root|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.pgsql.password[[:space:]]*=.*|auth.pgsql.password = public|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
sed -i 's|^[#[:space:]]*auth.pgsql.database[[:space:]]*=.*|auth.pgsql.database = mqtt|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
|
||||
- name: run tests
|
||||
run: |
|
||||
docker exec -i erlang bash -c "make xref"
|
||||
|
|
|
@ -27,7 +27,7 @@ auth.mongo.pool = 8
|
|||
## MongoDB login user.
|
||||
##
|
||||
## Value: String
|
||||
## auth.mongo.login =
|
||||
# auth.mongo.username =
|
||||
|
||||
## MongoDB password.
|
||||
##
|
||||
|
|
|
@ -21,11 +21,17 @@
|
|||
{datatype, integer}
|
||||
]}.
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
{mapping, "auth.mongo.login", "emqx_auth_mongo.server", [
|
||||
{default, ""},
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
{mapping, "auth.mongo.username", "emqx_auth_mongo.server", [
|
||||
{default, ""},
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
{mapping, "auth.mongo.password", "emqx_auth_mongo.server", [
|
||||
{default, ""},
|
||||
{datatype, string}
|
||||
|
@ -43,7 +49,7 @@
|
|||
|
||||
{mapping, "auth.mongo.ssl", "emqx_auth_mongo.server", [
|
||||
{default, off},
|
||||
{datatype, flag}
|
||||
{datatype, {enum, [on, off, true, false]}} %% FIXME: ture/false is compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
]}.
|
||||
|
||||
{mapping, "auth.mongo.ssl.keyfile", "emqx_auth_mongo.server", [
|
||||
|
@ -58,6 +64,21 @@
|
|||
{datatype, string}
|
||||
]}.
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
{mapping, "auth.mongo.ssl_opts.keyfile", "emqx_auth_mongo.server", [
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
{mapping, "auth.mongo.ssl_opts.certfile", "emqx_auth_mongo.server", [
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
{mapping, "auth.mongo.ssl_opts.cacertfile", "emqx_auth_mongo.server", [
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
{mapping, "auth.mongo.w_mode", "emqx_auth_mongo.server", [
|
||||
{default, undef},
|
||||
{datatype, {enum, [safe, unsafe, undef]}}
|
||||
|
@ -77,7 +98,10 @@
|
|||
Hosts = string:tokens(H, ","),
|
||||
Type0 = cuttlefish:conf_get("auth.mongo.type", Conf),
|
||||
Pool = cuttlefish:conf_get("auth.mongo.pool", Conf),
|
||||
Login = cuttlefish:conf_get("auth.mongo.login", Conf),
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
Login = cuttlefish:conf_get("auth.mongo.username", Conf,
|
||||
cuttlefish:conf_get("auth.mongo.login", Conf)
|
||||
),
|
||||
Passwd = cuttlefish:conf_get("auth.mongo.password", Conf),
|
||||
DB = cuttlefish:conf_get("auth.mongo.database", Conf),
|
||||
AuthSrc = cuttlefish:conf_get("auth.mongo.auth_source", Conf),
|
||||
|
@ -99,18 +123,28 @@
|
|||
true -> [];
|
||||
false -> [{r_mode, R}]
|
||||
end,
|
||||
|
||||
Filter = fun(Opts) -> [{K, V} || {K, V} <- Opts, V =/= undefined] end,
|
||||
SslOpts = fun(Prefix) ->
|
||||
Filter([{keyfile, cuttlefish:conf_get(Prefix ++ ".keyfile", Conf, undefined)},
|
||||
{certfile, cuttlefish:conf_get(Prefix ++ ".certfile", Conf, undefined)},
|
||||
{cacertfile, cuttlefish:conf_get(Prefix ++ ".cacertfile", Conf, undefined)}])
|
||||
end,
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
GenSsl = case cuttlefish:conf_get("auth.mongo.ssl.cacertfile", Conf, undefined) of
|
||||
undefined -> [{ssl, true}, {ssl_opts, SslOpts("auth.mongo.ssl_opts")}];
|
||||
_ -> [{ssl, true}, {ssl_opts, SslOpts("auth.mongo.ssl")}]
|
||||
end,
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
Ssl = case cuttlefish:conf_get("auth.mongo.ssl", Conf) of
|
||||
true ->
|
||||
Filter = fun(Opts) -> [{K, V} || {K, V} <- Opts, V =/= undefined] end,
|
||||
SslOpts = fun(Prefix) ->
|
||||
Filter([{keyfile, cuttlefish:conf_get(Prefix ++ ".keyfile", Conf, undefined)},
|
||||
{certfile, cuttlefish:conf_get(Prefix ++ ".certfile", Conf, undefined)},
|
||||
{cacertfile, cuttlefish:conf_get(Prefix ++ ".cacertfile", Conf, undefined)}])
|
||||
end,
|
||||
[{ssl, true}, {ssl_opts, SslOpts("auth.mongo.ssl")}];
|
||||
false ->
|
||||
[]
|
||||
end,
|
||||
on -> GenSsl;
|
||||
off -> [];
|
||||
true -> GenSsl;
|
||||
false -> []
|
||||
end,
|
||||
|
||||
WorkerOptions = [{database, list_to_binary(DB)}, {auth_source, list_to_binary(AuthSrc)}]
|
||||
++ Login0 ++ Passwd0 ++ W0 ++ R0 ++ Ssl,
|
||||
|
||||
|
|
|
@ -17,12 +17,12 @@ auth.mysql.pool = 8
|
|||
## MySQL username.
|
||||
##
|
||||
## Value: String
|
||||
auth.mysql.username = root
|
||||
# auth.mysql.username =
|
||||
|
||||
## MySQL password.
|
||||
##
|
||||
## Value: String
|
||||
auth.mysql.password = public
|
||||
# auth.mysql.password =
|
||||
|
||||
## MySQL database.
|
||||
##
|
||||
|
@ -103,7 +103,7 @@ auth.mysql.acl_query = select allow, ipaddr, username, clientid, access, topic f
|
|||
## CA certificate.
|
||||
##
|
||||
## Value: File
|
||||
## auth.mysql.ssl.cafile = path to your ca file
|
||||
# auth.mysql.ssl.cacertfile = /path/to/ca.pem
|
||||
|
||||
## Client ssl certificate.
|
||||
##
|
||||
|
|
|
@ -40,6 +40,12 @@
|
|||
{datatype, string}
|
||||
]}.
|
||||
|
||||
{mapping, "auth.mysql.ssl.cacertfile", "emqx_auth_mysql.server", [
|
||||
{default, ""},
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
{mapping, "auth.mysql.ssl.certfile", "emqx_auth_mysql.server", [
|
||||
{default, ""},
|
||||
{datatype, string}
|
||||
|
@ -84,7 +90,10 @@
|
|||
Options1 =
|
||||
case cuttlefish:conf_get("auth.mysql.ssl", Conf) of
|
||||
true ->
|
||||
CA = cuttlefish:conf_get("auth.mysql.ssl.cafile", Conf),
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
CA = cuttlefish:conf_get("auth.mysql.ssl.cacertfile", Conf,
|
||||
cuttlefish:conf_get("auth.mysql.ssl.cafile", Conf)
|
||||
),
|
||||
Cert = cuttlefish:conf_get("auth.mysql.ssl.certfile", Conf),
|
||||
Key = cuttlefish:conf_get("auth.mysql.ssl.keyfile", Conf),
|
||||
Options ++ [{ssl, {server_name_indication, disable},
|
||||
|
|
|
@ -22,7 +22,7 @@ auth.pgsql.username = root
|
|||
## PostgreSQL password.
|
||||
##
|
||||
## Value: String
|
||||
auth.pgsql.password = public
|
||||
# auth.pgsql.password =
|
||||
|
||||
## PostgreSQL database.
|
||||
##
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
{mapping, "auth.pgsql.ssl", "emqx_auth_pgsql.server", [
|
||||
{default, off},
|
||||
{datatype, flag}
|
||||
{datatype, {enum, [on, off, true, false]}} %% FIXME: true/fasle is compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
]}.
|
||||
|
||||
{mapping, "auth.pgsql.ssl.keyfile", "emqx_auth_pgsql.server", [
|
||||
|
@ -47,6 +47,21 @@
|
|||
{datatype, string}
|
||||
]}.
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
{mapping, "auth.pgsql.ssl_opts.keyfile", "emqx_auth_pgsql.server", [
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
{mapping, "auth.pgsql.ssl_opts.certfile", "emqx_auth_pgsql.server", [
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
{mapping, "auth.pgsql.ssl_opts.cacertfile", "emqx_auth_pgsql.server", [
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
{translation, "emqx_auth_pgsql.server", fun(Conf) ->
|
||||
{PgHost, PgPort} =
|
||||
case cuttlefish:conf_get("auth.pgsql.server", Conf) of
|
||||
|
@ -61,7 +76,6 @@
|
|||
Passwd = cuttlefish:conf_get("auth.pgsql.password", Conf, ""),
|
||||
DB = cuttlefish:conf_get("auth.pgsql.database", Conf),
|
||||
Encoding = cuttlefish:conf_get("auth.pgsql.encoding", Conf),
|
||||
Ssl = cuttlefish:conf_get("auth.pgsql.ssl", Conf),
|
||||
|
||||
Filter = fun(Opts) -> [{K, V} || {K, V} <- Opts, V =/= undefined] end,
|
||||
SslOpts = fun(Prefix) ->
|
||||
|
@ -70,6 +84,20 @@
|
|||
{cacertfile, cuttlefish:conf_get(Prefix ++ ".cacertfile", Conf, undefined)}])
|
||||
end,
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
GenSsl = case cuttlefish:conf_get("auth.pgsql.ssl.cacertfile", Conf, undefined) of
|
||||
undefined -> [{ssl, true}, {ssl_opts, SslOpts("auth.pgsql.ssl_opts")}];
|
||||
_ -> [{ssl, true}, {ssl_opts, SslOpts("auth.pgsql.ssl")}]
|
||||
end,
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
Ssl = case cuttlefish:conf_get("auth.pgsql.ssl", Conf) of
|
||||
on -> GenSsl;
|
||||
off -> [];
|
||||
true -> GenSsl;
|
||||
false -> []
|
||||
end,
|
||||
|
||||
TempHost = case inet:parse_address(PgHost) of
|
||||
{ok, IpAddr} ->
|
||||
IpAddr;
|
||||
|
@ -83,9 +111,7 @@
|
|||
{username, Username},
|
||||
{password, Passwd},
|
||||
{database, DB},
|
||||
{encoding, Encoding},
|
||||
{ssl, Ssl},
|
||||
{ssl_opts, SslOpts("auth.pgsql.ssl")}]
|
||||
{encoding, Encoding}] ++ Ssl
|
||||
end}.
|
||||
|
||||
{mapping, "auth.pgsql.auth_query", "emqx_auth_pgsql.auth_query", [
|
||||
|
|
|
@ -103,7 +103,7 @@ auth.redis.acl_cmd = HGETALL mqtt_acl:%u
|
|||
## CA certificate.
|
||||
##
|
||||
## Value: File
|
||||
#auth.redis.ssl.cafile = path/to/your/cafile
|
||||
# auth.redis.ssl.cacertfile = path/to/your/cafile.pem
|
||||
|
||||
## Client ssl certificate.
|
||||
##
|
||||
|
|
|
@ -38,11 +38,12 @@
|
|||
{datatype, flag}
|
||||
]}.
|
||||
|
||||
{mapping, "auth.redis.ssl.cafile", "emqx_auth_redis.options", [
|
||||
{mapping, "auth.redis.ssl.cacertfile", "emqx_auth_redis.options", [
|
||||
{default, ""},
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
{mapping, "auth.redis.ssl.certfile", "emqx_auth_redis.options", [
|
||||
{default, ""},
|
||||
{datatype, string}
|
||||
|
@ -53,16 +54,39 @@
|
|||
{datatype, string}
|
||||
]}.
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
{mapping, "auth.redis.cafile", "emqx_auth_redis.options", [
|
||||
{default, ""},
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
{mapping, "auth.redis.certfile", "emqx_auth_redis.options", [
|
||||
{default, ""},
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
{mapping, "auth.redis.keyfile", "emqx_auth_redis.options", [
|
||||
{default, ""},
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
{translation, "emqx_auth_redis.options", fun(Conf) ->
|
||||
Ssl = cuttlefish:conf_get("auth.redis.ssl", Conf, false),
|
||||
case Ssl of
|
||||
true ->
|
||||
CA = cuttlefish:conf_get("auth.redis.ssl.cafile", Conf),
|
||||
Cert = cuttlefish:conf_get("auth.redis.ssl.certfile", Conf),
|
||||
Key = cuttlefish:conf_get("auth.redis.ssl.keyfile", Conf),
|
||||
[{options, [{ssl_options, [{cacertfile, CA},
|
||||
{certfile, Cert},
|
||||
{keyfile, Key}]}]}];
|
||||
%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0
|
||||
Prefix = case cuttlefish:conf_get("auth.redis.ssl.cacertfile", Conf, undefined) of
|
||||
undefined -> "auth.redis";
|
||||
_ -> "auth.redis.ssl"
|
||||
end,
|
||||
CA = cuttlefish:conf_get(Prefix ++ ".cacertfile", Conf),
|
||||
Cert = cuttlefish:conf_get(Prefix ++ ".certfile", Conf),
|
||||
Key = cuttlefish:conf_get(Prefix ++ ".keyfile", Conf),
|
||||
[{options, [{ssl_options, [{cacertfile, CA},
|
||||
{certfile, Cert},
|
||||
{keyfile, Key}]}]}];
|
||||
_ -> [{options, []}]
|
||||
end
|
||||
end}.
|
||||
|
|
Loading…
Reference in New Issue