Refactor: first iteration of modular and dockerized approach
This commit is contained in:
22
mosquitto/Dockerfile
Normal file
22
mosquitto/Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
||||
FROM eclipse-mosquitto:2.0
|
||||
|
||||
RUN apk add --no-cache \
|
||||
rust \
|
||||
cargo \
|
||||
build-base \
|
||||
openssl-dev \
|
||||
mosquitto-dev \
|
||||
git
|
||||
|
||||
RUN git clone https://github.com/wiomoc/mosquitto-jwt-auth.git /jwt-auth
|
||||
WORKDIR /jwt-auth
|
||||
RUN cargo build --release
|
||||
|
||||
RUN mkdir -p /usr/lib/mosquitto && \
|
||||
cp target/release/libmosquitto_jwt_auth.so /usr/lib/mosquitto/
|
||||
|
||||
RUN apk del build-base git
|
||||
|
||||
COPY mosquitto.conf /mosquitto/config/mosquitto.conf
|
||||
COPY public_key.pem /mosquitto/config/public_key.pem
|
||||
RUN chown -R mosquitto:mosquitto /mosquitto/config
|
||||
9
mosquitto/mosquitto.conf
Normal file
9
mosquitto/mosquitto.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
listener 1883
|
||||
allow_anonymous false
|
||||
|
||||
auth_plugin /usr/lib/mosquitto/libmosquitto_jwt_auth.so
|
||||
auth_opt_jwt_alg RS256
|
||||
auth_opt_jwt_sec_file /mosquitto/config/public_key.pem
|
||||
auth_opt_jwt_iss HydroAPI
|
||||
auth_opt_jwt_validate_exp true
|
||||
auth_opt_jwt_validate_sub_match_username false
|
||||
Reference in New Issue
Block a user