mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-10-30 18:27:49 +00:00
Compare commits
9 Commits
v2.7.0-RC4
...
v2.6.0-RC3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8d3079f44 | ||
|
|
81cec762f7 | ||
|
|
f43198f874 | ||
|
|
3134947b57 | ||
|
|
8e8656a6ae | ||
|
|
8863d2ecc9 | ||
|
|
70ddeaf3c1 | ||
|
|
56d7c7c767 | ||
|
|
7e3fb701a0 |
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project(owsec VERSION 2.7.0)
|
project(owsec VERSION 2.6.0)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
@@ -47,7 +47,6 @@ add_definitions(-DAWS_CUSTOM_MEMORY_MANAGEMENT)
|
|||||||
set(BUILD_SHARED_LIBS 1)
|
set(BUILD_SHARED_LIBS 1)
|
||||||
|
|
||||||
add_definitions(-DTIP_SECURITY_SERVICE="1")
|
add_definitions(-DTIP_SECURITY_SERVICE="1")
|
||||||
add_definitions(-DPOCO_LOG_DEBUG="1")
|
|
||||||
|
|
||||||
add_compile_options(-Wall -Wextra)
|
add_compile_options(-Wall -Wextra)
|
||||||
if(ASAN)
|
if(ASAN)
|
||||||
@@ -78,7 +77,6 @@ add_executable( owsec
|
|||||||
src/framework/orm.h
|
src/framework/orm.h
|
||||||
src/framework/StorageClass.h
|
src/framework/StorageClass.h
|
||||||
src/framework/ow_constants.h
|
src/framework/ow_constants.h
|
||||||
src/framework/MicroServiceErrorHandler.h
|
|
||||||
src/framework/WebSocketClientNotifications.h
|
src/framework/WebSocketClientNotifications.h
|
||||||
src/seclibs/qrcode/qrcodegen.hpp src/seclibs/qrcode/qrcodegen.cpp
|
src/seclibs/qrcode/qrcodegen.hpp src/seclibs/qrcode/qrcodegen.cpp
|
||||||
src/seclibs/cpptotp/bytes.cpp src/seclibs/cpptotp/bytes.h
|
src/seclibs/cpptotp/bytes.cpp src/seclibs/cpptotp/bytes.h
|
||||||
@@ -126,7 +124,7 @@ add_executable( owsec
|
|||||||
src/storage/orm_actionLinks.cpp src/storage/orm_actionLinks.h
|
src/storage/orm_actionLinks.cpp src/storage/orm_actionLinks.h
|
||||||
src/storage/orm_avatar.cpp src/storage/orm_avatar.h
|
src/storage/orm_avatar.cpp src/storage/orm_avatar.h
|
||||||
src/SpecialUserHelpers.h
|
src/SpecialUserHelpers.h
|
||||||
src/RESTAPI/RESTAPI_db_helpers.h src/storage/orm_logins.cpp src/storage/orm_logins.h src/RESTAPI/RESTAPI_totp_handler.cpp src/RESTAPI/RESTAPI_totp_handler.h src/TotpCache.h src/RESTAPI/RESTAPI_subtotp_handler.cpp src/RESTAPI/RESTAPI_subtotp_handler.h src/RESTAPI/RESTAPI_signup_handler.cpp src/RESTAPI/RESTAPI_signup_handler.h src/MessagingTemplates.cpp src/MessagingTemplates.h)
|
src/RESTAPI/RESTAPI_db_helpers.h src/storage/orm_logins.cpp src/storage/orm_logins.h src/RESTAPI/RESTAPI_totp_handler.cpp src/RESTAPI/RESTAPI_totp_handler.h src/TotpCache.h src/RESTAPI/RESTAPI_subtotp_handler.cpp src/RESTAPI/RESTAPI_subtotp_handler.h src/RESTAPI/RESTAPI_signup_handler.cpp src/RESTAPI/RESTAPI_signup_handler.h)
|
||||||
|
|
||||||
if(NOT SMALL_BUILD)
|
if(NOT SMALL_BUILD)
|
||||||
target_link_libraries(owsec PUBLIC
|
target_link_libraries(owsec PUBLIC
|
||||||
|
|||||||
69
Dockerfile
69
Dockerfile
@@ -1,24 +1,16 @@
|
|||||||
ARG DEBIAN_VERSION=11.4-slim
|
FROM alpine:3.15 AS build-base
|
||||||
ARG POCO_VERSION=poco-tip-v1
|
|
||||||
ARG FMTLIB_VERSION=9.0.0
|
|
||||||
ARG CPPKAFKA_VERSION=tip-v1
|
|
||||||
ARG JSON_VALIDATOR_VERSION=2.1.0
|
|
||||||
ARG AWS_SDK_VERSION=1.9.315
|
|
||||||
|
|
||||||
FROM debian:$DEBIAN_VERSION AS build-base
|
RUN apk add --update --no-cache \
|
||||||
|
|
||||||
RUN apt-get update && apt-get install --no-install-recommends -y \
|
|
||||||
make cmake g++ git \
|
make cmake g++ git \
|
||||||
libpq-dev libmariadb-dev libmariadbclient-dev-compat \
|
unixodbc-dev postgresql-dev mariadb-dev \
|
||||||
librdkafka-dev libboost-all-dev libssl-dev \
|
librdkafka-dev boost-dev openssl-dev \
|
||||||
zlib1g-dev nlohmann-json3-dev ca-certificates libcurl4-openssl-dev
|
zlib-dev nlohmann-json \
|
||||||
|
curl-dev
|
||||||
|
|
||||||
FROM build-base AS poco-build
|
FROM build-base AS poco-build
|
||||||
|
|
||||||
ARG POCO_VERSION
|
ADD https://api.github.com/repos/stephb9959/poco/git/refs/heads/master version.json
|
||||||
|
RUN git clone https://github.com/stephb9959/poco /poco
|
||||||
ADD https://api.github.com/repos/AriliaWireless/poco/git/refs/tags/${POCO_VERSION} version.json
|
|
||||||
RUN git clone https://github.com/AriliaWireless/poco --branch ${POCO_VERSION} /poco
|
|
||||||
|
|
||||||
WORKDIR /poco
|
WORKDIR /poco
|
||||||
RUN mkdir cmake-build
|
RUN mkdir cmake-build
|
||||||
@@ -29,10 +21,8 @@ RUN cmake --build . --target install
|
|||||||
|
|
||||||
FROM build-base AS fmtlib-build
|
FROM build-base AS fmtlib-build
|
||||||
|
|
||||||
ARG FMTLIB_VERSION
|
ADD https://api.github.com/repos/fmtlib/fmt/git/refs/heads/master version.json
|
||||||
|
RUN git clone https://github.com/fmtlib/fmt /fmtlib
|
||||||
ADD https://api.github.com/repos/fmtlib/fmt/git/refs/tags/${FMTLIB_VERSION} version.json
|
|
||||||
RUN git clone https://github.com/fmtlib/fmt --branch ${FMTLIB_VERSION} /fmtlib
|
|
||||||
|
|
||||||
WORKDIR /fmtlib
|
WORKDIR /fmtlib
|
||||||
RUN mkdir cmake-build
|
RUN mkdir cmake-build
|
||||||
@@ -43,10 +33,8 @@ RUN make install
|
|||||||
|
|
||||||
FROM build-base AS cppkafka-build
|
FROM build-base AS cppkafka-build
|
||||||
|
|
||||||
ARG CPPKAFKA_VERSION
|
ADD https://api.github.com/repos/stephb9959/cppkafka/git/refs/heads/master version.json
|
||||||
|
RUN git clone https://github.com/stephb9959/cppkafka /cppkafka
|
||||||
ADD https://api.github.com/repos/AriliaWireless/cppkafka/git/refs/tags/${CPPKAFKA_VERSION} version.json
|
|
||||||
RUN git clone https://github.com/AriliaWireless/cppkafka --branch ${CPPKAFKA_VERSION} /cppkafka
|
|
||||||
|
|
||||||
WORKDIR /cppkafka
|
WORKDIR /cppkafka
|
||||||
RUN mkdir cmake-build
|
RUN mkdir cmake-build
|
||||||
@@ -57,10 +45,8 @@ RUN cmake --build . --target install
|
|||||||
|
|
||||||
FROM build-base AS json-schema-validator-build
|
FROM build-base AS json-schema-validator-build
|
||||||
|
|
||||||
ARG JSON_VALIDATOR_VERSION
|
ADD https://api.github.com/repos/pboettch/json-schema-validator/git/refs/heads/master version.json
|
||||||
|
RUN git clone https://github.com/pboettch/json-schema-validator /json-schema-validator
|
||||||
ADD https://api.github.com/repos/pboettch/json-schema-validator/git/refs/tags/${JSON_VALIDATOR_VERSION} version.json
|
|
||||||
RUN git clone https://github.com/pboettch/json-schema-validator --branch ${JSON_VALIDATOR_VERSION} /json-schema-validator
|
|
||||||
|
|
||||||
WORKDIR /json-schema-validator
|
WORKDIR /json-schema-validator
|
||||||
RUN mkdir cmake-build
|
RUN mkdir cmake-build
|
||||||
@@ -71,19 +57,14 @@ RUN make install
|
|||||||
|
|
||||||
FROM build-base AS aws-sdk-cpp-build
|
FROM build-base AS aws-sdk-cpp-build
|
||||||
|
|
||||||
ARG AWS_SDK_VERSION
|
ADD https://api.github.com/repos/aws/aws-sdk-cpp/git/refs/heads/main version.json
|
||||||
|
RUN git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp /aws-sdk-cpp
|
||||||
ADD https://api.github.com/repos/aws/aws-sdk-cpp/git/refs/tags/${AWS_SDK_VERSION} version.json
|
|
||||||
RUN git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp --branch ${AWS_SDK_VERSION} /aws-sdk-cpp
|
|
||||||
|
|
||||||
WORKDIR /aws-sdk-cpp
|
WORKDIR /aws-sdk-cpp
|
||||||
RUN mkdir cmake-build
|
RUN mkdir cmake-build
|
||||||
WORKDIR cmake-build
|
WORKDIR cmake-build
|
||||||
RUN cmake .. -DBUILD_ONLY="sns;s3" \
|
RUN cmake .. -DBUILD_ONLY="sns;s3" \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DUSE_OPENSSL=ON \
|
|
||||||
-DCPP_STANDARD=17 \
|
|
||||||
-DBUILD_SHARED_LIBS=ON \
|
|
||||||
-DCMAKE_CXX_FLAGS="-Wno-error=stringop-overflow -Wno-error=uninitialized" \
|
-DCMAKE_CXX_FLAGS="-Wno-error=stringop-overflow -Wno-error=uninitialized" \
|
||||||
-DAUTORUN_UNIT_TESTS=OFF
|
-DAUTORUN_UNIT_TESTS=OFF
|
||||||
RUN cmake --build . --config Release -j8
|
RUN cmake --build . --config Release -j8
|
||||||
@@ -111,24 +92,26 @@ COPY --from=fmtlib-build /usr/local/lib /usr/local/lib
|
|||||||
WORKDIR /owsec
|
WORKDIR /owsec
|
||||||
RUN mkdir cmake-build
|
RUN mkdir cmake-build
|
||||||
WORKDIR /owsec/cmake-build
|
WORKDIR /owsec/cmake-build
|
||||||
RUN cmake ..
|
RUN cmake .. \
|
||||||
|
-Dcrypto_LIBRARY=/usr/lib/libcrypto.so \
|
||||||
|
-DBUILD_SHARED_LIBS=ON
|
||||||
RUN cmake --build . --config Release -j8
|
RUN cmake --build . --config Release -j8
|
||||||
|
|
||||||
FROM debian:$DEBIAN_VERSION
|
FROM alpine:3.15
|
||||||
|
|
||||||
ENV OWSEC_USER=owsec \
|
ENV OWSEC_USER=owsec \
|
||||||
OWSEC_ROOT=/owsec-data \
|
OWSEC_ROOT=/owsec-data \
|
||||||
OWSEC_CONFIG=/owsec-data
|
OWSEC_CONFIG=/owsec-data
|
||||||
|
|
||||||
RUN useradd "$OWSEC_USER"
|
RUN addgroup -S "$OWSEC_USER" && \
|
||||||
|
adduser -S -G "$OWSEC_USER" "$OWSEC_USER"
|
||||||
|
|
||||||
RUN mkdir /openwifi
|
RUN mkdir /openwifi
|
||||||
RUN mkdir -p "$OWSEC_ROOT" "$OWSEC_CONFIG" && \
|
RUN mkdir -p "$OWSEC_ROOT" "$OWSEC_CONFIG" && \
|
||||||
chown "$OWSEC_USER": "$OWSEC_ROOT" "$OWSEC_CONFIG"
|
chown "$OWSEC_USER": "$OWSEC_ROOT" "$OWSEC_CONFIG"
|
||||||
|
|
||||||
RUN apt-get update && apt-get install --no-install-recommends -y \
|
RUN apk add --update --no-cache librdkafka su-exec gettext ca-certificates bash jq curl \
|
||||||
librdkafka++1 gosu gettext ca-certificates bash jq curl wget \
|
mariadb-connector-c libpq unixodbc postgresql-client
|
||||||
libmariadb-dev-compat libpq5 unixodbc postgresql-client
|
|
||||||
|
|
||||||
COPY readiness_check /readiness_check
|
COPY readiness_check /readiness_check
|
||||||
COPY test_scripts/curl/cli /cli
|
COPY test_scripts/curl/cli /cli
|
||||||
@@ -139,7 +122,7 @@ COPY templates /dist/templates
|
|||||||
COPY docker-entrypoint.sh /
|
COPY docker-entrypoint.sh /
|
||||||
COPY wait-for-postgres.sh /
|
COPY wait-for-postgres.sh /
|
||||||
RUN wget https://raw.githubusercontent.com/Telecominfraproject/wlan-cloud-ucentral-deploy/main/docker-compose/certs/restapi-ca.pem \
|
RUN wget https://raw.githubusercontent.com/Telecominfraproject/wlan-cloud-ucentral-deploy/main/docker-compose/certs/restapi-ca.pem \
|
||||||
-O /usr/local/share/ca-certificates/restapi-ca-selfsigned.crt
|
-O /usr/local/share/ca-certificates/restapi-ca-selfsigned.pem
|
||||||
|
|
||||||
COPY --from=owsec-build /owsec/cmake-build/owsec /openwifi/owsec
|
COPY --from=owsec-build /owsec/cmake-build/owsec /openwifi/owsec
|
||||||
COPY --from=cppkafka-build /cppkafka/cmake-build/src/lib/* /usr/local/lib
|
COPY --from=cppkafka-build /cppkafka/cmake-build/src/lib/* /usr/local/lib
|
||||||
@@ -148,8 +131,6 @@ COPY --from=aws-sdk-cpp-build /aws-sdk-cpp/cmake-build/aws-cpp-sdk-core/libaws-c
|
|||||||
COPY --from=aws-sdk-cpp-build /aws-sdk-cpp/cmake-build/aws-cpp-sdk-s3/libaws-cpp-sdk-s3.so /usr/local/lib
|
COPY --from=aws-sdk-cpp-build /aws-sdk-cpp/cmake-build/aws-cpp-sdk-s3/libaws-cpp-sdk-s3.so /usr/local/lib
|
||||||
COPY --from=aws-sdk-cpp-build /aws-sdk-cpp/cmake-build/aws-cpp-sdk-sns/libaws-cpp-sdk-sns.so /usr/local/lib
|
COPY --from=aws-sdk-cpp-build /aws-sdk-cpp/cmake-build/aws-cpp-sdk-sns/libaws-cpp-sdk-sns.so /usr/local/lib
|
||||||
|
|
||||||
RUN ldconfig
|
|
||||||
|
|
||||||
EXPOSE 16001 17001 16101
|
EXPOSE 16001 17001 16101
|
||||||
|
|
||||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
|
|||||||
37
OPERATOR.md
37
OPERATOR.md
@@ -1,37 +0,0 @@
|
|||||||
# Operator Support
|
|
||||||
In order to support multiple tenants and operators, you must prepare the security service to serve
|
|
||||||
customized e-mails and messages.
|
|
||||||
|
|
||||||
## Structure for `templates`
|
|
||||||
Any file in the root of the directory will be used as defaults. The following files must be present:
|
|
||||||
- email_invitation.html/txt : This email message will be sent to a newly added user.
|
|
||||||
- email_verification.html/txt : This email is sent when an email verification is required.
|
|
||||||
- password_reset.html/txt : This is sent when a pasword reset is requested.
|
|
||||||
- verification_code.html/txt : This is used during MFA when email based.
|
|
||||||
- signup_verification.html/txt : This email is send to a new subscriber who signed up for service.
|
|
||||||
- sub_email_verification.html/txt : This is sent to a subscriber requiring an email verification.
|
|
||||||
- sub_verification_code.html/txt : This is used during MFA when email based for a subscriber.
|
|
||||||
- logo.jpg : The default logo to use in any of these emails.
|
|
||||||
|
|
||||||
## Structure for `wwwassets`
|
|
||||||
Any file in the root of the directory will be used as defaults. The following files must be present:
|
|
||||||
- email_verification_error.html : Used when email verification has failed.
|
|
||||||
- email_verification_success.html : Used when emil verification has succeeded.
|
|
||||||
- invitation_error.html :
|
|
||||||
- invitation_success.html :
|
|
||||||
- password_policy.html :
|
|
||||||
- password_reset.html :
|
|
||||||
- password_reset_success.html :
|
|
||||||
- password_reset_error.html :
|
|
||||||
- signup_verification.html :
|
|
||||||
- signup_verification_error.html :
|
|
||||||
- signup_verification_success.html :
|
|
||||||
- favicon.ico : icon for the application
|
|
||||||
- 404_error.html : your customized 404 page
|
|
||||||
- the_logo : the logo to use.
|
|
||||||
|
|
||||||
## For tenants
|
|
||||||
When creating a tenant/operator, you must create a subdirectory inside each `wwwassets` and `templates` and replicate
|
|
||||||
all the files that appear at the root level. You need to use the short Operator name (also known as RegistrantId in the API). This means
|
|
||||||
no spaces, all lowercase characters and numbers. No special characters: 0-9 and a-z.
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ "$SELFSIGNED_CERTS" = 'true' ]; then
|
if [ "$SELFSIGNED_CERTS" = 'true' ]; then
|
||||||
@@ -23,7 +23,6 @@ if [[ "$TEMPLATE_CONFIG" = 'true' ]]; then
|
|||||||
SYSTEM_URI_PRIVATE=${SYSTEM_URI_PRIVATE:-"https://localhost:17001"} \
|
SYSTEM_URI_PRIVATE=${SYSTEM_URI_PRIVATE:-"https://localhost:17001"} \
|
||||||
SYSTEM_URI_PUBLIC=${SYSTEM_URI_PUBLIC:-"https://localhost:16001"} \
|
SYSTEM_URI_PUBLIC=${SYSTEM_URI_PUBLIC:-"https://localhost:16001"} \
|
||||||
SYSTEM_URI_UI=${SYSTEM_URI_UI:-"http://localhost"} \
|
SYSTEM_URI_UI=${SYSTEM_URI_UI:-"http://localhost"} \
|
||||||
SECURITY_RESTAPI_DISABLE=${SECURITY_RESTAPI_DISABLE:-"false"} \
|
|
||||||
SERVICE_KEY=${SERVICE_KEY:-"\$OWSEC_ROOT/certs/restapi-key.pem"} \
|
SERVICE_KEY=${SERVICE_KEY:-"\$OWSEC_ROOT/certs/restapi-key.pem"} \
|
||||||
SERVICE_KEY_PASSWORD=${SERVICE_KEY_PASSWORD:-"mypassword"} \
|
SERVICE_KEY_PASSWORD=${SERVICE_KEY_PASSWORD:-"mypassword"} \
|
||||||
SMSSENDER_ENABLED=${SMSSENDER_ENABLED:-"false"} \
|
SMSSENDER_ENABLED=${SMSSENDER_ENABLED:-"false"} \
|
||||||
@@ -85,7 +84,7 @@ if [ "$1" = '/openwifi/owsec' -a "$(id -u)" = '0' ]; then
|
|||||||
if [ "$RUN_CHOWN" = 'true' ]; then
|
if [ "$RUN_CHOWN" = 'true' ]; then
|
||||||
chown -R "$OWSEC_USER": "$OWSEC_ROOT" "$OWSEC_CONFIG"
|
chown -R "$OWSEC_USER": "$OWSEC_ROOT" "$OWSEC_CONFIG"
|
||||||
fi
|
fi
|
||||||
exec gosu "$OWSEC_USER" "$@"
|
exec su-exec "$OWSEC_USER" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
2
helm/.gitignore
vendored
2
helm/.gitignore
vendored
@@ -1,3 +1 @@
|
|||||||
*.swp
|
*.swp
|
||||||
Chart.lock
|
|
||||||
charts/
|
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ The following table lists the configurable parameters of the chart and their def
|
|||||||
| persistence.size | string | Defines PV size | `'10Gi'` |
|
| persistence.size | string | Defines PV size | `'10Gi'` |
|
||||||
| public_env_variables | hash | Defines list of environment variables to be passed to the Security | |
|
| public_env_variables | hash | Defines list of environment variables to be passed to the Security | |
|
||||||
| configProperties | hash | Configuration properties that should be passed to the application in `owsec.properties`. May be passed by key in set (i.e. `configProperties."rtty\.token"`) | |
|
| configProperties | hash | Configuration properties that should be passed to the application in `owsec.properties`. May be passed by key in set (i.e. `configProperties."rtty\.token"`) | |
|
||||||
| existingCertsSecret | string | Existing Kubernetes secret containing all required certificates and private keys for microservice operation. If set, certificates from `certs` key are ignored | `""` |
|
| certs | hash | Defines files (keys and certificates) that should be passed to the Security (PEM format is adviced to be used) (see `volumes.owsec` on where it is mounted) | |
|
||||||
| certs | hash | Defines files (keys and certificates) that should be passed to the Gateway (PEM format is adviced to be used) (see `volumes.owsec` on where it is mounted). If `existingCertsSecret` is set, certificates passed this way will not be used. | |
|
|
||||||
|
|
||||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
{{- $root := . -}}
|
{{- $root := . -}}
|
||||||
{{- $storageType := index .Values.configProperties "storage.type" -}}
|
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@@ -47,39 +46,6 @@ spec:
|
|||||||
- -timeout
|
- -timeout
|
||||||
- 600s
|
- 600s
|
||||||
|
|
||||||
{{- if eq $storageType "postgresql" }}
|
|
||||||
- name: wait-postgres
|
|
||||||
image: "{{ .Values.images.owsec.repository }}:{{ .Values.images.owsec.tag }}"
|
|
||||||
imagePullPolicy: {{ .Values.images.owsec.pullPolicy }}
|
|
||||||
command:
|
|
||||||
- /wait-for-postgres.sh
|
|
||||||
- {{ index .Values.configProperties "storage.type.postgresql.host" }}
|
|
||||||
- echo
|
|
||||||
- "PostgreSQL is ready"
|
|
||||||
env:
|
|
||||||
- name: KUBERNETES_DEPLOYED
|
|
||||||
value: "{{ now }}"
|
|
||||||
{{- range $key, $value := .Values.public_env_variables }}
|
|
||||||
- name: {{ $key }}
|
|
||||||
value: {{ $value | quote }}
|
|
||||||
{{- end }}
|
|
||||||
{{- range $key, $value := .Values.secret_env_variables }}
|
|
||||||
- name: {{ $key }}
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: {{ include "owsec.fullname" $root }}-env
|
|
||||||
key: {{ $key }}
|
|
||||||
{{- end }}
|
|
||||||
volumeMounts:
|
|
||||||
{{- range .Values.volumes.owsec }}
|
|
||||||
- name: {{ .name }}
|
|
||||||
mountPath: {{ .mountPath }}
|
|
||||||
{{- if .subPath }}
|
|
||||||
subPath: {{ .subPath }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
containers:
|
containers:
|
||||||
|
|
||||||
- name: owsec
|
- name: owsec
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ fullnameOverride: ""
|
|||||||
images:
|
images:
|
||||||
owsec:
|
owsec:
|
||||||
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owsec
|
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owsec
|
||||||
tag: v2.7.0-RC4
|
tag: v2.6.0-RC3
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
# regcred:
|
# regcred:
|
||||||
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
||||||
@@ -71,7 +71,7 @@ volumes:
|
|||||||
mountPath: /owsec-data/certs
|
mountPath: /owsec-data/certs
|
||||||
volumeDefinition: |
|
volumeDefinition: |
|
||||||
secret:
|
secret:
|
||||||
secretName: {{ if .Values.existingCertsSecret }}{{ .Values.existingCertsSecret }}{{ else }}{{ include "owsec.fullname" . }}-certs{{ end }}
|
secretName: {{ include "owsec.fullname" . }}-certs
|
||||||
# Change this if you want to use another volume type
|
# Change this if you want to use another volume type
|
||||||
- name: persist
|
- name: persist
|
||||||
mountPath: /owsec-data/persist
|
mountPath: /owsec-data/persist
|
||||||
@@ -92,7 +92,7 @@ resources: {}
|
|||||||
# memory: 128Mi
|
# memory: 128Mi
|
||||||
|
|
||||||
securityContext:
|
securityContext:
|
||||||
fsGroup: 1000
|
fsGroup: 101
|
||||||
|
|
||||||
nodeSelector: {}
|
nodeSelector: {}
|
||||||
|
|
||||||
@@ -228,9 +228,6 @@ configProperties:
|
|||||||
storage.type.mysql.username: stephb
|
storage.type.mysql.username: stephb
|
||||||
storage.type.mysql.password: snoopy99
|
storage.type.mysql.password: snoopy99
|
||||||
|
|
||||||
# NOTE: List of required certificates may be found in "certs" key. Alternative way to pass required certificates is to create external secret with all required certificates and set secret name in "existingCertsSecret" key. Details may be found in https://github.com/Telecominfraproject/wlan-cloud-ucentral-deploy/tree/main/chart#tldr
|
|
||||||
existingCertsSecret: ""
|
|
||||||
|
|
||||||
certs:
|
certs:
|
||||||
# restapi-ca.pem: ""
|
# restapi-ca.pem: ""
|
||||||
# restapi-cert.pem: ""
|
# restapi-cert.pem: ""
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ openwifi.system.data = $OWSEC_ROOT/data
|
|||||||
openwifi.system.uri.private = https://localhost:17001
|
openwifi.system.uri.private = https://localhost:17001
|
||||||
openwifi.system.uri.public = https://local.dpaas.arilia.com:16001
|
openwifi.system.uri.public = https://local.dpaas.arilia.com:16001
|
||||||
openwifi.system.uri.ui = https://ucentral-ui.arilia.com
|
openwifi.system.uri.ui = https://ucentral-ui.arilia.com
|
||||||
openwifi.security.restapi.disable = false
|
|
||||||
openwifi.system.commandchannel = /tmp/app.ucentralsec
|
openwifi.system.commandchannel = /tmp/app.ucentralsec
|
||||||
openwifi.service.key = $OWSEC_ROOT/certs/restapi-key.pem
|
openwifi.service.key = $OWSEC_ROOT/certs/restapi-key.pem
|
||||||
openwifi.service.key.password = mypassword
|
openwifi.service.key.password = mypassword
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ openwifi.system.data = ${SYSTEM_DATA}
|
|||||||
openwifi.system.uri.private = ${SYSTEM_URI_PRIVATE}
|
openwifi.system.uri.private = ${SYSTEM_URI_PRIVATE}
|
||||||
openwifi.system.uri.public = ${SYSTEM_URI_PUBLIC}
|
openwifi.system.uri.public = ${SYSTEM_URI_PUBLIC}
|
||||||
openwifi.system.uri.ui = ${SYSTEM_URI_UI}
|
openwifi.system.uri.ui = ${SYSTEM_URI_UI}
|
||||||
openwifi.security.restapi.disable = ${SECURITY_RESTAPI_DISABLE}
|
|
||||||
openwifi.system.commandchannel = /tmp/app.ucentralsec
|
openwifi.system.commandchannel = /tmp/app.ucentralsec
|
||||||
openwifi.service.key = ${SERVICE_KEY}
|
openwifi.service.key = ${SERVICE_KEY}
|
||||||
openwifi.service.key.password = ${SERVICE_KEY_PASSWORD}
|
openwifi.service.key.password = ${SERVICE_KEY_PASSWORD}
|
||||||
|
|||||||
@@ -5,25 +5,21 @@
|
|||||||
#include "ActionLinkManager.h"
|
#include "ActionLinkManager.h"
|
||||||
#include "StorageService.h"
|
#include "StorageService.h"
|
||||||
#include "RESTObjects/RESTAPI_SecurityObjects.h"
|
#include "RESTObjects/RESTAPI_SecurityObjects.h"
|
||||||
#include "MessagingTemplates.h"
|
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
|
|
||||||
int ActionLinkManager::Start() {
|
int ActionLinkManager::Start() {
|
||||||
poco_information(Logger(),"Starting...");
|
|
||||||
if(!Running_)
|
if(!Running_)
|
||||||
Thr_.start(*this);
|
Thr_.start(*this);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionLinkManager::Stop() {
|
void ActionLinkManager::Stop() {
|
||||||
poco_information(Logger(),"Stopping...");
|
|
||||||
if(Running_) {
|
if(Running_) {
|
||||||
Running_ = false;
|
Running_ = false;
|
||||||
Thr_.wakeUp();
|
Thr_.wakeUp();
|
||||||
Thr_.join();
|
Thr_.join();
|
||||||
}
|
}
|
||||||
poco_information(Logger(),"Stopped...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionLinkManager::run() {
|
void ActionLinkManager::run() {
|
||||||
@@ -57,59 +53,44 @@ namespace OpenWifi {
|
|||||||
i.action==OpenWifi::SecurityObjects::LinkActions::SUB_SIGNUP ) && !StorageService()->SubDB().GetUserById(i.userId,UInfo)) {
|
i.action==OpenWifi::SecurityObjects::LinkActions::SUB_SIGNUP ) && !StorageService()->SubDB().GetUserById(i.userId,UInfo)) {
|
||||||
StorageService()->ActionLinksDB().CancelAction(i.id);
|
StorageService()->ActionLinksDB().CancelAction(i.id);
|
||||||
continue;
|
continue;
|
||||||
} else if((i.action==OpenWifi::SecurityObjects::LinkActions::EMAIL_INVITATION) &&
|
|
||||||
(OpenWifi::Now()-i.created)>(24*60*60)) {
|
|
||||||
StorageService()->ActionLinksDB().CancelAction(i.id);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(i.action) {
|
switch(i.action) {
|
||||||
case OpenWifi::SecurityObjects::LinkActions::FORGOT_PASSWORD: {
|
case OpenWifi::SecurityObjects::LinkActions::FORGOT_PASSWORD: {
|
||||||
if(AuthService::SendEmailToUser(i.id, UInfo.email, MessagingTemplates::FORGOT_PASSWORD)) {
|
if(AuthService::SendEmailToUser(i.id, UInfo.email, AuthService::FORGOT_PASSWORD)) {
|
||||||
poco_information(Logger(),fmt::format("Send password reset link to {}",UInfo.email));
|
Logger().information(fmt::format("Send password reset link to {}",UInfo.email));
|
||||||
}
|
}
|
||||||
StorageService()->ActionLinksDB().SentAction(i.id);
|
StorageService()->ActionLinksDB().SentAction(i.id);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpenWifi::SecurityObjects::LinkActions::VERIFY_EMAIL: {
|
case OpenWifi::SecurityObjects::LinkActions::VERIFY_EMAIL: {
|
||||||
if(AuthService::SendEmailToUser(i.id, UInfo.email, MessagingTemplates::EMAIL_VERIFICATION)) {
|
if(AuthService::SendEmailToUser(i.id, UInfo.email, AuthService::EMAIL_VERIFICATION)) {
|
||||||
poco_information(Logger(),fmt::format("Send email verification link to {}",UInfo.email));
|
Logger().information(fmt::format("Send email verification link to {}",UInfo.email));
|
||||||
}
|
|
||||||
StorageService()->ActionLinksDB().SentAction(i.id);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OpenWifi::SecurityObjects::LinkActions::EMAIL_INVITATION: {
|
|
||||||
if(AuthService::SendEmailToUser(i.id, UInfo.email, MessagingTemplates::EMAIL_INVITATION)) {
|
|
||||||
poco_information(Logger(),fmt::format("Send new subscriber email invitation link to {}",UInfo.email));
|
|
||||||
}
|
}
|
||||||
StorageService()->ActionLinksDB().SentAction(i.id);
|
StorageService()->ActionLinksDB().SentAction(i.id);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpenWifi::SecurityObjects::LinkActions::SUB_FORGOT_PASSWORD: {
|
case OpenWifi::SecurityObjects::LinkActions::SUB_FORGOT_PASSWORD: {
|
||||||
auto Signup = Poco::StringTokenizer(UInfo.signingUp,":");
|
if(AuthService::SendEmailToSubUser(i.id, UInfo.email, AuthService::FORGOT_PASSWORD)) {
|
||||||
if(AuthService::SendEmailToSubUser(i.id, UInfo.email,MessagingTemplates::SUB_FORGOT_PASSWORD, Signup.count()==1 ? "" : Signup[0])) {
|
Logger().information(fmt::format("Send subscriber password reset link to {}",UInfo.email));
|
||||||
poco_information(Logger(),fmt::format("Send subscriber password reset link to {}",UInfo.email));
|
|
||||||
}
|
}
|
||||||
StorageService()->ActionLinksDB().SentAction(i.id);
|
StorageService()->ActionLinksDB().SentAction(i.id);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpenWifi::SecurityObjects::LinkActions::SUB_VERIFY_EMAIL: {
|
case OpenWifi::SecurityObjects::LinkActions::SUB_VERIFY_EMAIL: {
|
||||||
auto Signup = Poco::StringTokenizer(UInfo.signingUp,":");
|
if(AuthService::SendEmailToSubUser(i.id, UInfo.email, AuthService::EMAIL_VERIFICATION)) {
|
||||||
if(AuthService::SendEmailToSubUser(i.id, UInfo.email, MessagingTemplates::SUB_EMAIL_VERIFICATION, Signup.count()==1 ? "" : Signup[0])) {
|
Logger().information(fmt::format("Send subscriber email verification link to {}",UInfo.email));
|
||||||
poco_information(Logger(),fmt::format("Send subscriber email verification link to {}",UInfo.email));
|
|
||||||
}
|
}
|
||||||
StorageService()->ActionLinksDB().SentAction(i.id);
|
StorageService()->ActionLinksDB().SentAction(i.id);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpenWifi::SecurityObjects::LinkActions::SUB_SIGNUP: {
|
case OpenWifi::SecurityObjects::LinkActions::SUB_SIGNUP: {
|
||||||
auto Signup = Poco::StringTokenizer(UInfo.signingUp,":");
|
if(AuthService::SendEmailToSubUser(i.id, UInfo.email, AuthService::SIGNUP_VERIFICATION)) {
|
||||||
if(AuthService::SendEmailToSubUser(i.id, UInfo.email, MessagingTemplates::SIGNUP_VERIFICATION, Signup.count()==1 ? "" : Signup[0])) {
|
Logger().information(fmt::format("Send new subscriber email verification link to {}",UInfo.email));
|
||||||
poco_information(Logger(),fmt::format("Send new subscriber email verification link to {}",UInfo.email));
|
|
||||||
}
|
}
|
||||||
StorageService()->ActionLinksDB().SentAction(i.id);
|
StorageService()->ActionLinksDB().SentAction(i.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,14 @@ namespace OpenWifi {
|
|||||||
class ActionLinkManager : public SubSystemServer, Poco::Runnable {
|
class ActionLinkManager : public SubSystemServer, Poco::Runnable {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/* enum Actions {
|
||||||
|
FORGOT_PASSWORD,
|
||||||
|
VERIFY_EMAIL,
|
||||||
|
SUB_FORGOT_PASSWORD,
|
||||||
|
SUB_VERIFY_EMAIL,
|
||||||
|
SUB_SIGNUP
|
||||||
|
};
|
||||||
|
*/
|
||||||
static ActionLinkManager * instance() {
|
static ActionLinkManager * instance() {
|
||||||
static auto instance_ = new ActionLinkManager;
|
static auto instance_ = new ActionLinkManager;
|
||||||
return instance_;
|
return instance_;
|
||||||
|
|||||||
@@ -8,21 +8,18 @@
|
|||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
#include "framework/MicroService.h"
|
|
||||||
#include "framework/KafkaTopics.h"
|
|
||||||
|
|
||||||
#include "Poco/Net/OAuth20Credentials.h"
|
#include "Poco/Net/OAuth20Credentials.h"
|
||||||
#include "Poco/JWT/Token.h"
|
#include "Poco/JWT/Token.h"
|
||||||
#include "Poco/JWT/Signer.h"
|
#include "Poco/JWT/Signer.h"
|
||||||
#include "Poco/StringTokenizer.h"
|
#include "Poco/StringTokenizer.h"
|
||||||
|
|
||||||
|
#include "framework/MicroService.h"
|
||||||
#include "StorageService.h"
|
#include "StorageService.h"
|
||||||
#include "AuthService.h"
|
#include "AuthService.h"
|
||||||
|
#include "framework/KafkaTopics.h"
|
||||||
|
|
||||||
#include "SMTPMailerService.h"
|
#include "SMTPMailerService.h"
|
||||||
#include "MFAServer.h"
|
#include "MFAServer.h"
|
||||||
#include "MessagingTemplates.h"
|
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
|
|
||||||
@@ -36,6 +33,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int AuthService::AccessTypeToInt(ACCESS_TYPE T) {
|
int AuthService::AccessTypeToInt(ACCESS_TYPE T) {
|
||||||
switch (T) {
|
switch (T) {
|
||||||
case USERNAME: return 1;
|
case USERNAME: return 1;
|
||||||
@@ -48,25 +46,24 @@ namespace OpenWifi {
|
|||||||
static const std::string DefaultPassword_8_u_l_n_1{"^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[\\{\\}\\(\\)~_\\+\\|\\\\\\[\\]\\;\\:\\<\\>\\.\\,\\/\\?\\\"\\'\\`\\=#?!@$%^&*-]).{8,}$"};
|
static const std::string DefaultPassword_8_u_l_n_1{"^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[\\{\\}\\(\\)~_\\+\\|\\\\\\[\\]\\;\\:\\<\\>\\.\\,\\/\\?\\\"\\'\\`\\=#?!@$%^&*-]).{8,}$"};
|
||||||
|
|
||||||
int AuthService::Start() {
|
int AuthService::Start() {
|
||||||
poco_information(Logger(),"Starting...");
|
Logger().notice("Starting...");
|
||||||
TokenAging_ = (uint64_t) MicroService::instance().ConfigGetInt("authentication.token.ageing", 30 * 24 * 60 * 60);
|
TokenAging_ = (uint64_t) MicroService::instance().ConfigGetInt("authentication.token.ageing", 30 * 24 * 60 * 60);
|
||||||
RefreshTokenLifeSpan_ = (uint64_t) MicroService::instance().ConfigGetInt("authentication.refresh_token.lifespan", 90 * 24 * 60 * 600);
|
RefreshTokenLifeSpan_ = (uint64_t) MicroService::instance().ConfigGetInt("authentication.refresh_token.lifespan", 90 * 24 * 60 * 600);
|
||||||
HowManyOldPassword_ = MicroService::instance().ConfigGetInt("authentication.oldpasswords", 5);
|
HowManyOldPassword_ = MicroService::instance().ConfigGetInt("authentication.oldpasswords", 5);
|
||||||
|
|
||||||
AccessPolicy_ = MicroService::instance().ConfigGetString("openwifi.document.policy.access", "/wwwassets/access_policy.html");
|
AccessPolicy_ = MicroService::instance().ConfigPath("openwifi.document.policy.access", "/wwwassets/access_policy.html");
|
||||||
PasswordPolicy_ = MicroService::instance().ConfigGetString("openwifi.document.policy.password", "/wwwassets/password_policy.html");
|
PasswordPolicy_ = MicroService::instance().ConfigPath("openwifi.document.policy.password", "/wwwassets/password_policy.html");
|
||||||
PasswordValidation_ = PasswordValidationStr_ = MicroService::instance().ConfigGetString("authentication.validation.expression",DefaultPassword_8_u_l_n_1);
|
PasswordValidation_ = PasswordValidationStr_ = MicroService::instance().ConfigGetString("authentication.validation.expression",DefaultPassword_8_u_l_n_1);
|
||||||
|
|
||||||
SubPasswordValidation_ = SubPasswordValidationStr_ = MicroService::instance().ConfigGetString("subscriber.validation.expression",DefaultPassword_8_u_l_n_1);
|
SubPasswordValidation_ = SubPasswordValidationStr_ = MicroService::instance().ConfigGetString("subscriber.validation.expression",DefaultPassword_8_u_l_n_1);
|
||||||
SubAccessPolicy_ = MicroService::instance().ConfigGetString("subscriber.policy.access", "/wwwassets/access_policy.html");
|
SubAccessPolicy_ = MicroService::instance().ConfigPath("subscriber.policy.access", "/wwwassets/access_policy.html");
|
||||||
SubPasswordPolicy_ = MicroService::instance().ConfigGetString("subscriber.policy.password", "/wwwassets/password_policy.html");
|
SubPasswordPolicy_ = MicroService::instance().ConfigPath("subscriber.policy.password", "/wwwassets/password_policy.html");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthService::Stop() {
|
void AuthService::Stop() {
|
||||||
poco_information(Logger(),"Stopping...");
|
Logger().notice("Stopping...");
|
||||||
poco_information(Logger(),"Stopped...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AuthService::RefreshUserToken(Poco::Net::HTTPServerRequest & Request, const std::string & RefreshToken, SecurityObjects::UserInfoAndPolicy & UI) {
|
bool AuthService::RefreshUserToken(Poco::Net::HTTPServerRequest & Request, const std::string & RefreshToken, SecurityObjects::UserInfoAndPolicy & UI) {
|
||||||
@@ -145,20 +142,18 @@ namespace OpenWifi {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AuthService::IsAuthorized(Poco::Net::HTTPServerRequest & Request, std::string & SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo, std::uint64_t TID, bool & Expired )
|
bool AuthService::IsAuthorized(Poco::Net::HTTPServerRequest & Request, std::string & SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo, bool & Expired )
|
||||||
{
|
{
|
||||||
// std::lock_guard Guard(Mutex_);
|
std::lock_guard Guard(Mutex_);
|
||||||
std::string CallToken;
|
|
||||||
Expired = false;
|
Expired = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
std::string CallToken;
|
||||||
Poco::Net::OAuth20Credentials Auth(Request);
|
Poco::Net::OAuth20Credentials Auth(Request);
|
||||||
if (Auth.getScheme() == "Bearer") {
|
if (Auth.getScheme() == "Bearer") {
|
||||||
CallToken = Auth.getBearerToken();
|
CallToken = Auth.getBearerToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CallToken.empty()) {
|
if(CallToken.empty()) {
|
||||||
poco_debug(Logger(), fmt::format("TokenValidation failed for TID={} Token={}", TID, CallToken));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,40 +161,35 @@ namespace OpenWifi {
|
|||||||
uint64_t RevocationDate=0;
|
uint64_t RevocationDate=0;
|
||||||
std::string UserId;
|
std::string UserId;
|
||||||
if(StorageService()->UserTokenDB().GetToken(CallToken, WT, UserId, RevocationDate)) {
|
if(StorageService()->UserTokenDB().GetToken(CallToken, WT, UserId, RevocationDate)) {
|
||||||
if(RevocationDate!=0) {
|
if(RevocationDate!=0)
|
||||||
poco_debug(Logger(), fmt::format("TokenValidation failed for TID={} Token={}", TID, CallToken));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
auto now=OpenWifi::Now();
|
auto now=OpenWifi::Now();
|
||||||
Expired = (WT.created_ + WT.expires_in_) < now;
|
Expired = (WT.created_ + WT.expires_in_) < now;
|
||||||
if(StorageService()->UserDB().GetUserById(UserId,UInfo.userinfo)) {
|
if(StorageService()->UserDB().GetUserById(UserId,UInfo.userinfo)) {
|
||||||
UInfo.webtoken = WT;
|
UInfo.webtoken = WT;
|
||||||
SessionToken = CallToken;
|
SessionToken = CallToken;
|
||||||
poco_debug(Logger(), fmt::format("TokenValidation success for TID={} Token={}", TID, CallToken));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
} catch(const Poco::Exception &E) {
|
} catch(const Poco::Exception &E) {
|
||||||
Logger().log(E);
|
Logger().log(E);
|
||||||
}
|
}
|
||||||
poco_debug(Logger(), fmt::format("TokenValidation failed for TID={} Token={}", TID, CallToken));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AuthService::IsSubAuthorized(Poco::Net::HTTPServerRequest & Request, std::string & SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo, std::uint64_t TID, bool & Expired )
|
bool AuthService::IsSubAuthorized(Poco::Net::HTTPServerRequest & Request, std::string & SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo, bool & Expired )
|
||||||
{
|
{
|
||||||
// std::lock_guard Guard(Mutex_);
|
std::lock_guard Guard(Mutex_);
|
||||||
|
|
||||||
std::string CallToken;
|
|
||||||
Expired = false;
|
Expired = false;
|
||||||
try {
|
try {
|
||||||
|
std::string CallToken;
|
||||||
Poco::Net::OAuth20Credentials Auth(Request);
|
Poco::Net::OAuth20Credentials Auth(Request);
|
||||||
if (Auth.getScheme() == "Bearer") {
|
if (Auth.getScheme() == "Bearer") {
|
||||||
CallToken = Auth.getBearerToken();
|
CallToken = Auth.getBearerToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CallToken.empty()) {
|
if(CallToken.empty()) {
|
||||||
poco_debug(Logger(), fmt::format("TokenValidation failed for TID={} Token={}", TID, CallToken));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,23 +197,20 @@ namespace OpenWifi {
|
|||||||
uint64_t RevocationDate=0;
|
uint64_t RevocationDate=0;
|
||||||
std::string UserId;
|
std::string UserId;
|
||||||
if(StorageService()->SubTokenDB().GetToken(CallToken, WT, UserId, RevocationDate)) {
|
if(StorageService()->SubTokenDB().GetToken(CallToken, WT, UserId, RevocationDate)) {
|
||||||
if(RevocationDate!=0) {
|
if(RevocationDate!=0)
|
||||||
poco_debug(Logger(), fmt::format("TokenValidation failed for TID={} Token={}", TID, CallToken));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
auto now=OpenWifi::Now();
|
auto now=OpenWifi::Now();
|
||||||
Expired = (WT.created_ + WT.expires_in_) < now;
|
Expired = (WT.created_ + WT.expires_in_) < now;
|
||||||
if(StorageService()->SubDB().GetUserById(UserId,UInfo.userinfo)) {
|
if(StorageService()->SubDB().GetUserById(UserId,UInfo.userinfo)) {
|
||||||
UInfo.webtoken = WT;
|
UInfo.webtoken = WT;
|
||||||
SessionToken = CallToken;
|
SessionToken = CallToken;
|
||||||
poco_debug(Logger(), fmt::format("TokenValidation success for TID={} Token={}", TID, CallToken));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
} catch(const Poco::Exception &E) {
|
} catch(const Poco::Exception &E) {
|
||||||
Logger().log(E);
|
Logger().log(E);
|
||||||
}
|
}
|
||||||
poco_debug(Logger(), fmt::format("TokenValidation failed for TID={} Token={}", TID, CallToken));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -527,6 +514,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return INVALID_CREDENTIALS;
|
return INVALID_CREDENTIALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,62 +564,29 @@ namespace OpenWifi {
|
|||||||
return INVALID_CREDENTIALS;
|
return INVALID_CREDENTIALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AuthService::SendEmailChallengeCode(const SecurityObjects::UserInfoAndPolicy &UInfo, const std::string &Challenge) {
|
bool AuthService::SendEmailToUser(const std::string &LinkId, std::string &Email, EMAIL_REASON Reason) {
|
||||||
auto OperatorParts = Poco::StringTokenizer(UInfo.userinfo.signingUp,":");
|
|
||||||
if(UInfo.userinfo.signingUp.empty() || OperatorParts.count()!=2) {
|
|
||||||
MessageAttributes Attrs;
|
|
||||||
Attrs[RECIPIENT_EMAIL] = UInfo.userinfo.email;
|
|
||||||
Attrs[LOGO] = AuthService::GetLogoAssetURI();
|
|
||||||
Attrs[SUBJECT] = "Login validation code";
|
|
||||||
Attrs[CHALLENGE_CODE] = Challenge;
|
|
||||||
return SMTPMailerService()->SendMessage(UInfo.userinfo.email, MessagingTemplates::TemplateName(MessagingTemplates::VERIFICATION_CODE), Attrs);
|
|
||||||
} else {
|
|
||||||
MessageAttributes Attrs;
|
|
||||||
Attrs[RECIPIENT_EMAIL] = UInfo.userinfo.email;
|
|
||||||
Attrs[LOGO] = AuthService::GetLogoAssetURI();
|
|
||||||
Attrs[SUBJECT] = "Login validation code";
|
|
||||||
Attrs[CHALLENGE_CODE] = Challenge;
|
|
||||||
return SMTPMailerService()->SendMessage(UInfo.userinfo.email, MessagingTemplates::TemplateName(MessagingTemplates::SUB_VERIFICATION_CODE,OperatorParts[0]), Attrs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AuthService::SendEmailToUser(const std::string &LinkId, std::string &Email, MessagingTemplates::EMAIL_REASON Reason) {
|
|
||||||
SecurityObjects::UserInfo UInfo;
|
SecurityObjects::UserInfo UInfo;
|
||||||
|
|
||||||
if(StorageService()->UserDB().GetUserByEmail(Email,UInfo)) {
|
if(StorageService()->UserDB().GetUserByEmail(Email,UInfo)) {
|
||||||
switch (Reason) {
|
switch (Reason) {
|
||||||
|
|
||||||
case MessagingTemplates::FORGOT_PASSWORD: {
|
case FORGOT_PASSWORD: {
|
||||||
MessageAttributes Attrs;
|
MessageAttributes Attrs;
|
||||||
Attrs[RECIPIENT_EMAIL] = UInfo.email;
|
Attrs[RECIPIENT_EMAIL] = UInfo.email;
|
||||||
Attrs[LOGO] = GetLogoAssetURI();
|
Attrs[LOGO] = GetLogoAssetURI();
|
||||||
Attrs[SUBJECT] = "Password reset link";
|
Attrs[SUBJECT] = "Password reset link";
|
||||||
Attrs[ACTION_LINK] = MicroService::instance().GetPublicAPIEndPoint() + "/actionLink?action=password_reset&id=" + LinkId ;
|
Attrs[ACTION_LINK] = MicroService::instance().GetPublicAPIEndPoint() + "/actionLink?action=password_reset&id=" + LinkId ;
|
||||||
Attrs[ACTION_LINK_HTML] = "/api/v1/actionLink?action=password_reset&id=" + LinkId ;
|
SMTPMailerService()->SendMessage(UInfo.email, "password_reset.txt", Attrs);
|
||||||
SMTPMailerService()->SendMessage(UInfo.email, MessagingTemplates::TemplateName(MessagingTemplates::FORGOT_PASSWORD), Attrs);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MessagingTemplates::EMAIL_VERIFICATION: {
|
case EMAIL_VERIFICATION: {
|
||||||
MessageAttributes Attrs;
|
MessageAttributes Attrs;
|
||||||
Attrs[RECIPIENT_EMAIL] = UInfo.email;
|
Attrs[RECIPIENT_EMAIL] = UInfo.email;
|
||||||
Attrs[LOGO] = GetLogoAssetURI();
|
Attrs[LOGO] = GetLogoAssetURI();
|
||||||
Attrs[SUBJECT] = "e-mail Address Verification";
|
Attrs[SUBJECT] = "e-mail Address Verification";
|
||||||
Attrs[ACTION_LINK] = MicroService::instance().GetPublicAPIEndPoint() + "/actionLink?action=email_verification&id=" + LinkId ;
|
Attrs[ACTION_LINK] = MicroService::instance().GetPublicAPIEndPoint() + "/actionLink?action=email_verification&id=" + LinkId ;
|
||||||
Attrs[ACTION_LINK_HTML] = "/api/v1/actionLink?action=email_verification&id=" + LinkId ;
|
SMTPMailerService()->SendMessage(UInfo.email, "email_verification.txt", Attrs);
|
||||||
SMTPMailerService()->SendMessage(UInfo.email, MessagingTemplates::TemplateName(MessagingTemplates::EMAIL_VERIFICATION), Attrs);
|
|
||||||
UInfo.waitingForEmailCheck = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MessagingTemplates::EMAIL_INVITATION: {
|
|
||||||
MessageAttributes Attrs;
|
|
||||||
Attrs[RECIPIENT_EMAIL] = UInfo.email;
|
|
||||||
Attrs[LOGO] = GetLogoAssetURI();
|
|
||||||
Attrs[SUBJECT] = "e-mail Invitation";
|
|
||||||
Attrs[ACTION_LINK] = MicroService::instance().GetPublicAPIEndPoint() + "/actionLink?action=email_invitation&id=" + LinkId ;
|
|
||||||
Attrs[ACTION_LINK_HTML] = "/api/v1/actionLink?action=email_invitation&id=" + LinkId ;
|
|
||||||
SMTPMailerService()->SendMessage(UInfo.email, MessagingTemplates::TemplateName(MessagingTemplates::EMAIL_INVITATION), Attrs);
|
|
||||||
UInfo.waitingForEmailCheck = true;
|
UInfo.waitingForEmailCheck = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -644,43 +599,40 @@ namespace OpenWifi {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AuthService::SendEmailToSubUser(const std::string &LinkId, std::string &Email, MessagingTemplates::EMAIL_REASON Reason, const std::string &OperatorName ) {
|
bool AuthService::SendEmailToSubUser(const std::string &LinkId, std::string &Email, EMAIL_REASON Reason) {
|
||||||
SecurityObjects::UserInfo UInfo;
|
SecurityObjects::UserInfo UInfo;
|
||||||
|
|
||||||
if(StorageService()->SubDB().GetUserByEmail(Email,UInfo)) {
|
if(StorageService()->SubDB().GetUserByEmail(Email,UInfo)) {
|
||||||
switch (Reason) {
|
switch (Reason) {
|
||||||
|
|
||||||
case MessagingTemplates::SUB_FORGOT_PASSWORD: {
|
case FORGOT_PASSWORD: {
|
||||||
MessageAttributes Attrs;
|
MessageAttributes Attrs;
|
||||||
Attrs[RECIPIENT_EMAIL] = UInfo.email;
|
Attrs[RECIPIENT_EMAIL] = UInfo.email;
|
||||||
Attrs[LOGO] = GetLogoAssetURI();
|
Attrs[LOGO] = GetLogoAssetURI();
|
||||||
Attrs[SUBJECT] = "Password reset link";
|
Attrs[SUBJECT] = "Password reset link";
|
||||||
Attrs[ACTION_LINK] = MicroService::instance().GetPublicAPIEndPoint() + "/actionLink?action=sub_password_reset&id=" + LinkId ;
|
Attrs[ACTION_LINK] = MicroService::instance().GetPublicAPIEndPoint() + "/actionLink?action=password_reset&id=" + LinkId ;
|
||||||
Attrs[ACTION_LINK_HTML] = "/api/v1/actionLink?action=sub_password_reset&id=" + LinkId ;
|
SMTPMailerService()->SendMessage(UInfo.email, "password_reset.txt", Attrs);
|
||||||
SMTPMailerService()->SendMessage(UInfo.email, MessagingTemplates::TemplateName(MessagingTemplates::SUB_FORGOT_PASSWORD, OperatorName), Attrs);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MessagingTemplates::SUB_EMAIL_VERIFICATION: {
|
case EMAIL_VERIFICATION: {
|
||||||
MessageAttributes Attrs;
|
MessageAttributes Attrs;
|
||||||
Attrs[RECIPIENT_EMAIL] = UInfo.email;
|
Attrs[RECIPIENT_EMAIL] = UInfo.email;
|
||||||
Attrs[LOGO] = GetLogoAssetURI();
|
Attrs[LOGO] = GetLogoAssetURI();
|
||||||
Attrs[SUBJECT] = "e-mail Address Verification";
|
Attrs[SUBJECT] = "e-mail Address Verification";
|
||||||
Attrs[ACTION_LINK] = MicroService::instance().GetPublicAPIEndPoint() + "/actionLink?action=sub_email_verification&id=" + LinkId ;
|
Attrs[ACTION_LINK] = MicroService::instance().GetPublicAPIEndPoint() + "/actionLink?action=email_verification&id=" + LinkId ;
|
||||||
Attrs[ACTION_LINK_HTML] = "/api/v1/actionLink?action=sub_email_verification&id=" + LinkId ;
|
SMTPMailerService()->SendMessage(UInfo.email, "email_verification.txt", Attrs);
|
||||||
SMTPMailerService()->SendMessage(UInfo.email, MessagingTemplates::TemplateName(MessagingTemplates::SUB_EMAIL_VERIFICATION, OperatorName), Attrs);
|
|
||||||
UInfo.waitingForEmailCheck = true;
|
UInfo.waitingForEmailCheck = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MessagingTemplates::SIGNUP_VERIFICATION: {
|
case SIGNUP_VERIFICATION: {
|
||||||
MessageAttributes Attrs;
|
MessageAttributes Attrs;
|
||||||
Attrs[RECIPIENT_EMAIL] = UInfo.email;
|
Attrs[RECIPIENT_EMAIL] = UInfo.email;
|
||||||
Attrs[LOGO] = GetLogoAssetURI();
|
Attrs[LOGO] = GetLogoAssetURI();
|
||||||
Attrs[SUBJECT] = "Signup e-mail Address Verification";
|
Attrs[SUBJECT] = "Signup e-mail Address Verification";
|
||||||
Attrs[ACTION_LINK] = MicroService::instance().GetPublicAPIEndPoint() + "/actionLink?action=signup_verification&id=" + LinkId ;
|
Attrs[ACTION_LINK] = MicroService::instance().GetPublicAPIEndPoint() + "/actionLink?action=signup_verification&id=" + LinkId ;
|
||||||
Attrs[ACTION_LINK_HTML] = "/api/v1/actionLink?action=signup_verification&id=" + LinkId ;
|
SMTPMailerService()->SendMessage(UInfo.email, "signup_verification.txt", Attrs);
|
||||||
SMTPMailerService()->SendMessage(UInfo.email, MessagingTemplates::TemplateName(MessagingTemplates::SIGNUP_VERIFICATION, OperatorName), Attrs);
|
|
||||||
UInfo.waitingForEmailCheck = true;
|
UInfo.waitingForEmailCheck = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -741,8 +693,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// return IsValidSubToken(Token, WebToken, UserInfo, Expired);
|
return IsValidSubToken(Token, WebToken, UserInfo, Expired);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AuthService::IsValidSubToken(const std::string &Token, SecurityObjects::WebToken &WebToken, SecurityObjects::UserInfo &UserInfo, bool & Expired) {
|
bool AuthService::IsValidSubToken(const std::string &Token, SecurityObjects::WebToken &WebToken, SecurityObjects::UserInfo &UserInfo, bool & Expired) {
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
#include "framework/MicroService.h"
|
|
||||||
|
|
||||||
#include "Poco/JSON/Object.h"
|
#include "Poco/JSON/Object.h"
|
||||||
#include "Poco/Net/HTTPServerRequest.h"
|
#include "Poco/Net/HTTPServerRequest.h"
|
||||||
#include "Poco/Net/HTTPServerResponse.h"
|
#include "Poco/Net/HTTPServerResponse.h"
|
||||||
@@ -22,8 +20,8 @@
|
|||||||
#include "Poco/HMACEngine.h"
|
#include "Poco/HMACEngine.h"
|
||||||
#include "Poco/ExpireLRUCache.h"
|
#include "Poco/ExpireLRUCache.h"
|
||||||
|
|
||||||
|
#include "framework/MicroService.h"
|
||||||
#include "RESTObjects/RESTAPI_SecurityObjects.h"
|
#include "RESTObjects/RESTAPI_SecurityObjects.h"
|
||||||
#include "MessagingTemplates.h"
|
|
||||||
|
|
||||||
namespace OpenWifi{
|
namespace OpenWifi{
|
||||||
|
|
||||||
@@ -38,6 +36,12 @@ namespace OpenWifi{
|
|||||||
CUSTOM
|
CUSTOM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum EMAIL_REASON {
|
||||||
|
FORGOT_PASSWORD,
|
||||||
|
EMAIL_VERIFICATION,
|
||||||
|
SIGNUP_VERIFICATION
|
||||||
|
};
|
||||||
|
|
||||||
static ACCESS_TYPE IntToAccessType(int C);
|
static ACCESS_TYPE IntToAccessType(int C);
|
||||||
static int AccessTypeToInt(ACCESS_TYPE T);
|
static int AccessTypeToInt(ACCESS_TYPE T);
|
||||||
|
|
||||||
@@ -49,14 +53,14 @@ namespace OpenWifi{
|
|||||||
int Start() override;
|
int Start() override;
|
||||||
void Stop() override;
|
void Stop() override;
|
||||||
|
|
||||||
[[nodiscard]] bool IsAuthorized(Poco::Net::HTTPServerRequest & Request,std::string &SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo, std::uint64_t TID, bool & Expired);
|
[[nodiscard]] bool IsAuthorized(Poco::Net::HTTPServerRequest & Request,std::string &SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo, bool & Expired);
|
||||||
[[nodiscard]] UNAUTHORIZED_REASON Authorize( std::string & UserName, const std::string & Password, const std::string & NewPassword, SecurityObjects::UserInfoAndPolicy & UInfo, bool & Expired );
|
[[nodiscard]] UNAUTHORIZED_REASON Authorize( std::string & UserName, const std::string & Password, const std::string & NewPassword, SecurityObjects::UserInfoAndPolicy & UInfo, bool & Expired );
|
||||||
void CreateToken(const std::string & UserName, SecurityObjects::UserInfoAndPolicy &UInfo);
|
void CreateToken(const std::string & UserName, SecurityObjects::UserInfoAndPolicy &UInfo);
|
||||||
[[nodiscard]] bool SetPassword(const std::string &Password, SecurityObjects::UserInfo & UInfo);
|
[[nodiscard]] bool SetPassword(const std::string &Password, SecurityObjects::UserInfo & UInfo);
|
||||||
[[nodiscard]] const std:: string & PasswordValidationExpression() const { return PasswordValidationStr_;};
|
[[nodiscard]] const std:: string & PasswordValidationExpression() const { return PasswordValidationStr_;};
|
||||||
void Logout(const std::string &token, bool EraseFromCache=true);
|
void Logout(const std::string &token, bool EraseFromCache=true);
|
||||||
|
|
||||||
[[nodiscard]] bool IsSubAuthorized(Poco::Net::HTTPServerRequest & Request,std::string &SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo, std::uint64_t TID, bool & Expired);
|
[[nodiscard]] bool IsSubAuthorized(Poco::Net::HTTPServerRequest & Request,std::string &SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo, bool & Expired);
|
||||||
[[nodiscard]] UNAUTHORIZED_REASON AuthorizeSub( std::string & UserName, const std::string & Password, const std::string & NewPassword, SecurityObjects::UserInfoAndPolicy & UInfo, bool & Expired );
|
[[nodiscard]] UNAUTHORIZED_REASON AuthorizeSub( std::string & UserName, const std::string & Password, const std::string & NewPassword, SecurityObjects::UserInfoAndPolicy & UInfo, bool & Expired );
|
||||||
void CreateSubToken(const std::string & UserName, SecurityObjects::UserInfoAndPolicy &UInfo);
|
void CreateSubToken(const std::string & UserName, SecurityObjects::UserInfoAndPolicy &UInfo);
|
||||||
[[nodiscard]] bool SetSubPassword(const std::string &Password, SecurityObjects::UserInfo & UInfo);
|
[[nodiscard]] bool SetSubPassword(const std::string &Password, SecurityObjects::UserInfo & UInfo);
|
||||||
@@ -86,12 +90,10 @@ namespace OpenWifi{
|
|||||||
[[nodiscard]] static bool VerifyEmail(SecurityObjects::UserInfo &UInfo);
|
[[nodiscard]] static bool VerifyEmail(SecurityObjects::UserInfo &UInfo);
|
||||||
[[nodiscard]] static bool VerifySubEmail(SecurityObjects::UserInfo &UInfo);
|
[[nodiscard]] static bool VerifySubEmail(SecurityObjects::UserInfo &UInfo);
|
||||||
|
|
||||||
[[nodiscard]] static bool SendEmailToUser(const std::string &LinkId, std::string &Email, MessagingTemplates::EMAIL_REASON Reason);
|
[[nodiscard]] static bool SendEmailToUser(const std::string &LinkId, std::string &Email, EMAIL_REASON Reason);
|
||||||
[[nodiscard]] static bool SendEmailToSubUser(const std::string &LinkId, std::string &Email, MessagingTemplates::EMAIL_REASON Reason, const std::string &OperatorName);
|
[[nodiscard]] static bool SendEmailToSubUser(const std::string &LinkId, std::string &Email, EMAIL_REASON Reason);
|
||||||
[[nodiscard]] bool RequiresMFA(const SecurityObjects::UserInfoAndPolicy &UInfo);
|
[[nodiscard]] bool RequiresMFA(const SecurityObjects::UserInfoAndPolicy &UInfo);
|
||||||
|
|
||||||
[[nodiscard]] bool SendEmailChallengeCode(const SecurityObjects::UserInfoAndPolicy &UInfo, const std::string &code);
|
|
||||||
|
|
||||||
bool DeleteUserFromCache(const std::string &UserName);
|
bool DeleteUserFromCache(const std::string &UserName);
|
||||||
bool DeleteSubUserFromCache(const std::string &UserName);
|
bool DeleteSubUserFromCache(const std::string &UserName);
|
||||||
void RevokeToken(std::string & Token);
|
void RevokeToken(std::string & Token);
|
||||||
@@ -156,11 +158,11 @@ namespace OpenWifi{
|
|||||||
|
|
||||||
inline auto AuthService() { return AuthService::instance(); }
|
inline auto AuthService() { return AuthService::instance(); }
|
||||||
|
|
||||||
[[nodiscard]] inline bool AuthServiceIsAuthorized(Poco::Net::HTTPServerRequest & Request,std::string &SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo , std::uint64_t TID, bool & Expired, bool Sub ) {
|
[[nodiscard]] inline bool AuthServiceIsAuthorized(Poco::Net::HTTPServerRequest & Request,std::string &SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo , bool & Expired, bool Sub ) {
|
||||||
if(Sub)
|
if(Sub)
|
||||||
return AuthService()->IsSubAuthorized(Request, SessionToken, UInfo, TID, Expired );
|
return AuthService()->IsSubAuthorized(Request, SessionToken, UInfo, Expired );
|
||||||
else
|
else
|
||||||
return AuthService()->IsAuthorized(Request, SessionToken, UInfo, TID, Expired );
|
return AuthService()->IsAuthorized(Request, SessionToken, UInfo, Expired );
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of namespace
|
} // end of namespace
|
||||||
|
|||||||
@@ -10,8 +10,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "framework/MicroService.h"
|
|
||||||
|
|
||||||
#include "Poco/Util/Application.h"
|
#include "Poco/Util/Application.h"
|
||||||
#include "Poco/Util/ServerApplication.h"
|
#include "Poco/Util/ServerApplication.h"
|
||||||
#include "Poco/Util/Option.h"
|
#include "Poco/Util/Option.h"
|
||||||
@@ -22,6 +20,7 @@
|
|||||||
#include "Poco/Crypto/CipherFactory.h"
|
#include "Poco/Crypto/CipherFactory.h"
|
||||||
#include "Poco/Crypto/Cipher.h"
|
#include "Poco/Crypto/Cipher.h"
|
||||||
|
|
||||||
|
#include "framework/MicroService.h"
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,10 @@
|
|||||||
// Created by stephane bourque on 2021-10-11.
|
// Created by stephane bourque on 2021-10-11.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "framework/MicroService.h"
|
|
||||||
|
|
||||||
#include "MFAServer.h"
|
#include "MFAServer.h"
|
||||||
#include "SMSSender.h"
|
#include "SMSSender.h"
|
||||||
#include "SMTPMailerService.h"
|
#include "SMTPMailerService.h"
|
||||||
|
#include "framework/MicroService.h"
|
||||||
#include "AuthService.h"
|
#include "AuthService.h"
|
||||||
#include "TotpCache.h"
|
#include "TotpCache.h"
|
||||||
|
|
||||||
@@ -45,7 +44,12 @@ namespace OpenWifi {
|
|||||||
std::string Message = "This is your login code: " + Challenge + " Please enter this in your login screen.";
|
std::string Message = "This is your login code: " + Challenge + " Please enter this in your login screen.";
|
||||||
return SMSSender()->Send(UInfo.userinfo.userTypeProprietaryInfo.mobiles[0].number, Message);
|
return SMSSender()->Send(UInfo.userinfo.userTypeProprietaryInfo.mobiles[0].number, Message);
|
||||||
} else if(Method==MFAMETHODS::EMAIL && SMTPMailerService()->Enabled() && !UInfo.userinfo.email.empty()) {
|
} else if(Method==MFAMETHODS::EMAIL && SMTPMailerService()->Enabled() && !UInfo.userinfo.email.empty()) {
|
||||||
return AuthService()->SendEmailChallengeCode(UInfo,Challenge);
|
MessageAttributes Attrs;
|
||||||
|
Attrs[RECIPIENT_EMAIL] = UInfo.userinfo.email;
|
||||||
|
Attrs[LOGO] = AuthService::GetLogoAssetURI();
|
||||||
|
Attrs[SUBJECT] = "Login validation code";
|
||||||
|
Attrs[CHALLENGE_CODE] = Challenge;
|
||||||
|
return SMTPMailerService()->SendMessage(UInfo.userinfo.email, "verification_code.txt", Attrs);
|
||||||
} else if(Method==MFAMETHODS::AUTHENTICATOR && !UInfo.userinfo.userTypeProprietaryInfo.authenticatorSecret.empty()) {
|
} else if(Method==MFAMETHODS::AUTHENTICATOR && !UInfo.userinfo.userTypeProprietaryInfo.authenticatorSecret.empty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by stephane bourque on 2022-07-25.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "MessagingTemplates.h"
|
|
||||||
|
|
||||||
namespace OpenWifi {
|
|
||||||
} // OpenWifi
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by stephane bourque on 2022-07-25.
|
|
||||||
//
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace OpenWifi {
|
|
||||||
|
|
||||||
class MessagingTemplates {
|
|
||||||
public:
|
|
||||||
static MessagingTemplates & instance() {
|
|
||||||
static auto instance = new MessagingTemplates;
|
|
||||||
return *instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum EMAIL_REASON {
|
|
||||||
FORGOT_PASSWORD = 0,
|
|
||||||
EMAIL_VERIFICATION,
|
|
||||||
SIGNUP_VERIFICATION,
|
|
||||||
EMAIL_INVITATION,
|
|
||||||
VERIFICATION_CODE,
|
|
||||||
SUB_FORGOT_PASSWORD,
|
|
||||||
SUB_EMAIL_VERIFICATION,
|
|
||||||
SUB_VERIFICATION_CODE
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string AddOperator(const std::string & filename, const std::string &OperatorName) {
|
|
||||||
if(OperatorName.empty())
|
|
||||||
return "/" + filename;
|
|
||||||
return "/" + OperatorName + "/" + filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string TemplateName( EMAIL_REASON r , const std::string &OperatorName="") {
|
|
||||||
switch (r) {
|
|
||||||
case FORGOT_PASSWORD: return AddOperator(EmailTemplateNames[FORGOT_PASSWORD],OperatorName);
|
|
||||||
case EMAIL_VERIFICATION: return AddOperator(EmailTemplateNames[EMAIL_VERIFICATION],OperatorName);
|
|
||||||
case SIGNUP_VERIFICATION: return AddOperator(EmailTemplateNames[SIGNUP_VERIFICATION],OperatorName);
|
|
||||||
case EMAIL_INVITATION: return AddOperator(EmailTemplateNames[EMAIL_INVITATION],OperatorName);
|
|
||||||
case VERIFICATION_CODE: return AddOperator(EmailTemplateNames[VERIFICATION_CODE],OperatorName);
|
|
||||||
case SUB_FORGOT_PASSWORD: return AddOperator(EmailTemplateNames[SUB_FORGOT_PASSWORD],OperatorName);
|
|
||||||
case SUB_EMAIL_VERIFICATION: return AddOperator(EmailTemplateNames[SUB_EMAIL_VERIFICATION],OperatorName);
|
|
||||||
case SUB_VERIFICATION_CODE: return AddOperator(EmailTemplateNames[SUB_VERIFICATION_CODE],OperatorName);
|
|
||||||
default:
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string Logo(const std::string &OperatorName = "" ) {
|
|
||||||
return AddOperator("logo.jpg", OperatorName);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string SubLogo(const std::string &OperatorName = "" ) {
|
|
||||||
return AddOperator("sub_logo.jpg", OperatorName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
inline const static std::vector<std::string> EmailTemplateNames = {
|
|
||||||
"password_reset",
|
|
||||||
"email_verification",
|
|
||||||
"signup_verification",
|
|
||||||
"email_invitation",
|
|
||||||
"verification_code",
|
|
||||||
"sub_password_reset",
|
|
||||||
"sub_email_verification",
|
|
||||||
"sub_verification_code"
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
inline MessagingTemplates & MessagingTemplates() { return MessagingTemplates::instance(); }
|
|
||||||
|
|
||||||
} // OpenWifi
|
|
||||||
|
|
||||||
@@ -23,12 +23,8 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
if(Action=="password_reset")
|
if(Action=="password_reset")
|
||||||
return RequestResetPassword(Link);
|
return RequestResetPassword(Link);
|
||||||
else if(Action=="sub_password_reset")
|
|
||||||
return RequestSubResetPassword(Link);
|
|
||||||
else if(Action=="email_verification")
|
else if(Action=="email_verification")
|
||||||
return DoEmailVerification(Link);
|
return DoEmailVerification(Link);
|
||||||
else if(Action=="sub_email_verification")
|
|
||||||
return DoSubEmailVerification(Link);
|
|
||||||
else if(Action=="signup_verification")
|
else if(Action=="signup_verification")
|
||||||
return DoNewSubVerification(Link);
|
return DoNewSubVerification(Link);
|
||||||
else
|
else
|
||||||
@@ -40,12 +36,8 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
if(Action=="password_reset")
|
if(Action=="password_reset")
|
||||||
return CompleteResetPassword();
|
return CompleteResetPassword();
|
||||||
else if(Action=="sub_password_reset")
|
|
||||||
return CompleteResetPassword();
|
|
||||||
else if(Action=="signup_completion")
|
else if(Action=="signup_completion")
|
||||||
return CompleteSubVerification();
|
return CompleteSubVerification();
|
||||||
else if(Action=="email_invitation")
|
|
||||||
return CompleteEmailInvitation();
|
|
||||||
else
|
else
|
||||||
return DoReturnA404();
|
return DoReturnA404();
|
||||||
}
|
}
|
||||||
@@ -207,11 +199,10 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
// Send the update to the provisioning service
|
// Send the update to the provisioning service
|
||||||
Poco::JSON::Object Body;
|
Poco::JSON::Object Body;
|
||||||
auto RawSignup = Poco::StringTokenizer(UInfo.signingUp,":");
|
Body.set("signupUUID", UInfo.signingUp);
|
||||||
Body.set("signupUUID", RawSignup.count()==1 ? UInfo.signingUp : RawSignup[1]);
|
|
||||||
OpenAPIRequestPut ProvRequest(uSERVICE_PROVISIONING,"/api/v1/signup",
|
OpenAPIRequestPut ProvRequest(uSERVICE_PROVISIONING,"/api/v1/signup",
|
||||||
{
|
{
|
||||||
{"signupUUID", RawSignup.count()==1 ? UInfo.signingUp : RawSignup[1]} ,
|
{"signupUUID", UInfo.signingUp} ,
|
||||||
{"operation", "emailVerified"}
|
{"operation", "emailVerified"}
|
||||||
},
|
},
|
||||||
Body,30000);
|
Body,30000);
|
||||||
@@ -247,8 +238,7 @@ namespace OpenWifi {
|
|||||||
return SendHTMLFileBack(FormFile, FormVars);
|
return SendHTMLFileBack(FormFile, FormVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger_.information(fmt::format("EMAIL-VERIFICATION(%s): For ID={}", Request->clientAddress().toString(),
|
Logger_.information(fmt::format("EMAIL-VERIFICATION(%s): For ID={}", Request->clientAddress().toString(), UInfo.email));
|
||||||
UInfo.email));
|
|
||||||
UInfo.waitingForEmailCheck = false;
|
UInfo.waitingForEmailCheck = false;
|
||||||
UInfo.validated = true;
|
UInfo.validated = true;
|
||||||
UInfo.lastEmailCheck = OpenWifi::Now();
|
UInfo.lastEmailCheck = OpenWifi::Now();
|
||||||
@@ -272,16 +262,4 @@ namespace OpenWifi {
|
|||||||
SendHTMLFileBack(FormFile, FormVars);
|
SendHTMLFileBack(FormFile, FormVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RESTAPI_action_links::CompleteEmailInvitation() {
|
|
||||||
/// TODO:
|
|
||||||
}
|
|
||||||
|
|
||||||
void RESTAPI_action_links::RequestSubResetPassword([[maybe_unused]] SecurityObjects::ActionLink &Link) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void RESTAPI_action_links::DoSubEmailVerification([[maybe_unused]] SecurityObjects::ActionLink &Link) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,14 +22,11 @@ namespace OpenWifi {
|
|||||||
true, RateLimit{.Interval=1000,.MaxCalls=10}) {}
|
true, RateLimit{.Interval=1000,.MaxCalls=10}) {}
|
||||||
static auto PathName() { return std::list<std::string>{"/api/v1/actionLink"}; };
|
static auto PathName() { return std::list<std::string>{"/api/v1/actionLink"}; };
|
||||||
void RequestResetPassword(SecurityObjects::ActionLink &Link);
|
void RequestResetPassword(SecurityObjects::ActionLink &Link);
|
||||||
void RequestSubResetPassword(SecurityObjects::ActionLink &Link);
|
|
||||||
void CompleteResetPassword();
|
void CompleteResetPassword();
|
||||||
void CompleteSubVerification();
|
void CompleteSubVerification();
|
||||||
void DoEmailVerification(SecurityObjects::ActionLink &Link);
|
void DoEmailVerification(SecurityObjects::ActionLink &Link);
|
||||||
void DoSubEmailVerification(SecurityObjects::ActionLink &Link);
|
|
||||||
void DoReturnA404();
|
void DoReturnA404();
|
||||||
void DoNewSubVerification(SecurityObjects::ActionLink &Link);
|
void DoNewSubVerification(SecurityObjects::ActionLink &Link);
|
||||||
void CompleteEmailInvitation();
|
|
||||||
|
|
||||||
void DoGet() final;
|
void DoGet() final;
|
||||||
void DoPost() final;
|
void DoPost() final;
|
||||||
|
|||||||
@@ -29,8 +29,7 @@
|
|||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
|
|
||||||
Poco::Net::HTTPRequestHandler * RESTAPI_ExtRouter(const std::string &Path, RESTAPIHandler::BindingMap &Bindings,
|
Poco::Net::HTTPRequestHandler * RESTAPI_ExtRouter(const std::string &Path, RESTAPIHandler::BindingMap &Bindings,
|
||||||
Poco::Logger & L, RESTAPI_GenericServer & S,
|
Poco::Logger & L, RESTAPI_GenericServer & S, uint64_t TransactionId) {
|
||||||
uint64_t TransactionId) {
|
|
||||||
return RESTAPI_Router<
|
return RESTAPI_Router<
|
||||||
RESTAPI_oauth2_handler,
|
RESTAPI_oauth2_handler,
|
||||||
RESTAPI_user_handler,
|
RESTAPI_user_handler,
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ namespace OpenWifi {
|
|||||||
auto UserName = GetParameter("email");
|
auto UserName = GetParameter("email");
|
||||||
auto signupUUID = GetParameter("signupUUID");
|
auto signupUUID = GetParameter("signupUUID");
|
||||||
auto owner = GetParameter("owner");
|
auto owner = GetParameter("owner");
|
||||||
auto operatorName = GetParameter("operatorName");
|
if(UserName.empty() || signupUUID.empty() || owner.empty()) {
|
||||||
if(UserName.empty() || signupUUID.empty() || owner.empty() || operatorName.empty()) {
|
Logger().error("Signup requires: email, signupUUID, and owner.");
|
||||||
Logger().error("Signup requires: email, signupUUID, operatorName, and owner.");
|
|
||||||
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
|
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +37,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SecurityObjects::UserInfo NewSub;
|
SecurityObjects::UserInfo NewSub;
|
||||||
NewSub.signingUp = operatorName + ":" + signupUUID;
|
NewSub.signingUp = signupUUID;
|
||||||
NewSub.waitingForEmailCheck = true;
|
NewSub.waitingForEmailCheck = true;
|
||||||
NewSub.name = UserName;
|
NewSub.name = UserName;
|
||||||
NewSub.modified = OpenWifi::Now();
|
NewSub.modified = OpenWifi::Now();
|
||||||
|
|||||||
@@ -203,10 +203,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj,"kafkaClients", kafkaClients);
|
field_to_json(Obj,"kafkaClients", kafkaClients);
|
||||||
field_to_json(Obj,"kafkaPackets", kafkaPackets);
|
field_to_json(Obj,"kafkaPackets", kafkaPackets);
|
||||||
field_to_json(Obj,"locale", locale);
|
field_to_json(Obj,"locale", locale);
|
||||||
field_to_json(Obj,"started", started);
|
|
||||||
field_to_json(Obj,"sessionId", sessionId);
|
|
||||||
field_to_json(Obj,"connectionCompletionTime", connectionCompletionTime);
|
|
||||||
field_to_json(Obj,"totalConnectionTime", OpenWifi::Now() - started);
|
|
||||||
|
|
||||||
switch(VerifiedCertificate) {
|
switch(VerifiedCertificate) {
|
||||||
case NO_CERTIFICATE:
|
case NO_CERTIFICATE:
|
||||||
@@ -222,21 +218,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceConnectionStatistics::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
field_to_json(Obj,"averageConnectionTime", averageConnectionTime);
|
|
||||||
field_to_json(Obj,"connectedDevices", connectedDevices );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeviceConnectionStatistics::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
field_from_json(Obj,"averageConnectionTime", averageConnectionTime);
|
|
||||||
field_from_json(Obj,"connectedDevices", connectedDevices );
|
|
||||||
return true;
|
|
||||||
} catch (const Poco::Exception &E) {
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RttySessionDetails::to_json(Poco::JSON::Object &Obj) const {
|
void RttySessionDetails::to_json(Poco::JSON::Object &Obj) const {
|
||||||
field_to_json(Obj,"serialNumber", SerialNumber);
|
field_to_json(Obj,"serialNumber", SerialNumber);
|
||||||
field_to_json(Obj,"server", Server);
|
field_to_json(Obj,"server", Server);
|
||||||
@@ -312,6 +293,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
} catch (const Poco::Exception &E) {
|
} catch (const Poco::Exception &E) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadiusProxyPoolList::to_json(Poco::JSON::Object &Obj) const {
|
void RadiusProxyPoolList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
@@ -332,8 +314,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj,"description",description);
|
field_to_json(Obj,"description",description);
|
||||||
field_to_json(Obj,"authConfig",authConfig);
|
field_to_json(Obj,"authConfig",authConfig);
|
||||||
field_to_json(Obj,"acctConfig",acctConfig);
|
field_to_json(Obj,"acctConfig",acctConfig);
|
||||||
field_to_json(Obj,"coaConfig",coaConfig);
|
|
||||||
field_to_json(Obj,"useByDefault",useByDefault);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RadiusProxyPool::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool RadiusProxyPool::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
@@ -342,8 +322,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_from_json(Obj,"description",description);
|
field_from_json(Obj,"description",description);
|
||||||
field_from_json(Obj,"authConfig",authConfig);
|
field_from_json(Obj,"authConfig",authConfig);
|
||||||
field_from_json(Obj,"acctConfig",acctConfig);
|
field_from_json(Obj,"acctConfig",acctConfig);
|
||||||
field_from_json(Obj,"coaConfig",coaConfig);
|
|
||||||
field_from_json(Obj,"useByDefault",useByDefault);
|
|
||||||
return true;
|
return true;
|
||||||
} catch (const Poco::Exception &E) {
|
} catch (const Poco::Exception &E) {
|
||||||
}
|
}
|
||||||
@@ -351,7 +329,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RadiusProxyServerConfig::to_json(Poco::JSON::Object &Obj) const {
|
void RadiusProxyServerConfig::to_json(Poco::JSON::Object &Obj) const {
|
||||||
field_to_json(Obj,"strategy",strategy);
|
field_to_json(Obj,"policy",strategy);
|
||||||
field_to_json(Obj,"monitor",monitor);
|
field_to_json(Obj,"monitor",monitor);
|
||||||
field_to_json(Obj,"monitorMethod",monitorMethod);
|
field_to_json(Obj,"monitorMethod",monitorMethod);
|
||||||
field_to_json(Obj,"methodParameters",methodParameters);
|
field_to_json(Obj,"methodParameters",methodParameters);
|
||||||
@@ -360,7 +338,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
|
|
||||||
bool RadiusProxyServerConfig::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool RadiusProxyServerConfig::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
try {
|
try {
|
||||||
field_from_json(Obj,"strategy",strategy);
|
field_from_json(Obj,"policy",strategy);
|
||||||
field_from_json(Obj,"monitor",monitor);
|
field_from_json(Obj,"monitor",monitor);
|
||||||
field_from_json(Obj,"monitorMethod",monitorMethod);
|
field_from_json(Obj,"monitorMethod",monitorMethod);
|
||||||
field_from_json(Obj,"methodParameters",methodParameters);
|
field_from_json(Obj,"methodParameters",methodParameters);
|
||||||
@@ -376,16 +354,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj,"ip",ip);
|
field_to_json(Obj,"ip",ip);
|
||||||
field_to_json(Obj,"port",port);
|
field_to_json(Obj,"port",port);
|
||||||
field_to_json(Obj,"weight",weight);
|
field_to_json(Obj,"weight",weight);
|
||||||
field_to_json(Obj,"secret",secret);
|
|
||||||
field_to_json(Obj,"certificate",certificate);
|
|
||||||
field_to_json(Obj,"radsec",radsec);
|
|
||||||
field_to_json(Obj,"radsecPort",radsecPort);
|
|
||||||
field_to_json(Obj,"radsecSecret",radsecSecret);
|
|
||||||
field_to_json(Obj,"radsecCacerts",radsecCacerts);
|
|
||||||
field_to_json(Obj,"radsecCert",radsecCert);
|
|
||||||
field_to_json(Obj,"radsecKey",radsecKey);
|
|
||||||
field_to_json(Obj,"radsecRealms",radsecRealms);
|
|
||||||
field_to_json(Obj,"ignore",ignore);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RadiusProxyServerEntry::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool RadiusProxyServerEntry::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
@@ -394,16 +362,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_from_json(Obj,"ip",ip);
|
field_from_json(Obj,"ip",ip);
|
||||||
field_from_json(Obj,"port",port);
|
field_from_json(Obj,"port",port);
|
||||||
field_from_json(Obj,"weight",weight);
|
field_from_json(Obj,"weight",weight);
|
||||||
field_from_json(Obj,"secret",secret);
|
|
||||||
field_from_json(Obj,"certificate",certificate);
|
|
||||||
field_from_json(Obj,"radsec",radsec);
|
|
||||||
field_from_json(Obj,"radsecSecret",radsecSecret);
|
|
||||||
field_from_json(Obj,"radsecPort",radsecPort);
|
|
||||||
field_from_json(Obj,"radsecCacerts",radsecCacerts);
|
|
||||||
field_from_json(Obj,"radsecCert",radsecCert);
|
|
||||||
field_from_json(Obj,"radsecKey",radsecKey);
|
|
||||||
field_from_json(Obj,"radsecRealms",radsecRealms);
|
|
||||||
field_from_json(Obj,"ignore",ignore);
|
|
||||||
return true;
|
return true;
|
||||||
} catch (const Poco::Exception &E) {
|
} catch (const Poco::Exception &E) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,10 +38,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
uint64_t kafkaPackets=0;
|
uint64_t kafkaPackets=0;
|
||||||
uint64_t websocketPackets=0;
|
uint64_t websocketPackets=0;
|
||||||
std::string locale;
|
std::string locale;
|
||||||
uint64_t started=0;
|
|
||||||
uint64_t sessionId=0;
|
|
||||||
double connectionCompletionTime=0.0;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -75,13 +71,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
void Print() const;
|
void Print() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DeviceConnectionStatistics {
|
|
||||||
std::uint64_t connectedDevices = 0;
|
|
||||||
std::uint64_t averageConnectionTime = 0;
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Statistics {
|
struct Statistics {
|
||||||
std::string SerialNumber;
|
std::string SerialNumber;
|
||||||
uint64_t UUID = 0 ;
|
uint64_t UUID = 0 ;
|
||||||
@@ -227,16 +216,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
std::string ip;
|
std::string ip;
|
||||||
uint16_t port=0;
|
uint16_t port=0;
|
||||||
uint64_t weight=0;
|
uint64_t weight=0;
|
||||||
std::string secret;
|
|
||||||
std::string certificate;
|
|
||||||
bool radsec=false;
|
|
||||||
uint16_t radsecPort=2083;
|
|
||||||
std::string radsecSecret;
|
|
||||||
std::string radsecKey;
|
|
||||||
std::string radsecCert;
|
|
||||||
std::vector<std::string> radsecCacerts;
|
|
||||||
std::vector<std::string> radsecRealms;
|
|
||||||
bool ignore=false;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
@@ -258,8 +237,6 @@ namespace OpenWifi::GWObjects {
|
|||||||
std::string description;
|
std::string description;
|
||||||
RadiusProxyServerConfig authConfig;
|
RadiusProxyServerConfig authConfig;
|
||||||
RadiusProxyServerConfig acctConfig;
|
RadiusProxyServerConfig acctConfig;
|
||||||
RadiusProxyServerConfig coaConfig;
|
|
||||||
bool useByDefault=false;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
|||||||
@@ -1,110 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by stephane bourque on 2021-08-31.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "framework/MicroService.h"
|
|
||||||
|
|
||||||
using OpenWifi::RESTAPI_utils::field_to_json;
|
|
||||||
using OpenWifi::RESTAPI_utils::field_from_json;
|
|
||||||
using OpenWifi::RESTAPI_utils::EmbedDocument;
|
|
||||||
|
|
||||||
#include "RESTAPI_OWLSobjects.h"
|
|
||||||
|
|
||||||
// SIM -> 0x53/0x073, 0x49/0x69, 0x4d/0x6d
|
|
||||||
|
|
||||||
namespace OpenWifi::OWLSObjects {
|
|
||||||
|
|
||||||
void SimulationDetails::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
field_to_json(Obj,"id", id);
|
|
||||||
field_to_json(Obj,"name", name);
|
|
||||||
field_to_json(Obj,"gateway", gateway);
|
|
||||||
field_to_json(Obj,"certificate", certificate);
|
|
||||||
field_to_json(Obj,"key", key);
|
|
||||||
field_to_json(Obj,"macPrefix", macPrefix);
|
|
||||||
field_to_json(Obj,"deviceType", deviceType);
|
|
||||||
field_to_json(Obj,"devices", devices);
|
|
||||||
field_to_json(Obj,"healthCheckInterval", healthCheckInterval);
|
|
||||||
field_to_json(Obj,"stateInterval", stateInterval);
|
|
||||||
field_to_json(Obj,"minAssociations", minAssociations);
|
|
||||||
field_to_json(Obj,"maxAssociations", maxAssociations);
|
|
||||||
field_to_json(Obj,"minClients", minClients);
|
|
||||||
field_to_json(Obj,"maxClients", maxClients);
|
|
||||||
field_to_json(Obj,"simulationLength", simulationLength);
|
|
||||||
field_to_json(Obj,"threads", threads);
|
|
||||||
field_to_json(Obj,"clientInterval", clientInterval);
|
|
||||||
field_to_json(Obj,"keepAlive", keepAlive);
|
|
||||||
field_to_json(Obj,"reconnectInterval", reconnectInterval);
|
|
||||||
field_to_json(Obj,"concurrentDevices", concurrentDevices);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SimulationDetails::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
field_from_json(Obj,"id", id);
|
|
||||||
field_from_json(Obj,"name", name);
|
|
||||||
field_from_json(Obj,"gateway", gateway);
|
|
||||||
field_from_json(Obj,"certificate", certificate);
|
|
||||||
field_from_json(Obj,"key", key);
|
|
||||||
field_from_json(Obj,"macPrefix", macPrefix);
|
|
||||||
field_from_json(Obj,"deviceType", deviceType);
|
|
||||||
field_from_json(Obj,"devices", devices);
|
|
||||||
field_from_json(Obj,"healthCheckInterval", healthCheckInterval);
|
|
||||||
field_from_json(Obj,"stateInterval", stateInterval);
|
|
||||||
field_from_json(Obj,"minAssociations", minAssociations);
|
|
||||||
field_from_json(Obj,"maxAssociations", maxAssociations);
|
|
||||||
field_from_json(Obj,"minClients", minClients);
|
|
||||||
field_from_json(Obj,"maxClients", maxClients);
|
|
||||||
field_from_json(Obj,"simulationLength", simulationLength);
|
|
||||||
field_from_json(Obj,"threads", threads);
|
|
||||||
field_from_json(Obj,"clientInterval", clientInterval);
|
|
||||||
field_from_json(Obj,"keepAlive", keepAlive);
|
|
||||||
field_from_json(Obj,"reconnectInterval", reconnectInterval);
|
|
||||||
field_from_json(Obj,"concurrentDevices", concurrentDevices);
|
|
||||||
return true;
|
|
||||||
} catch(...) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimulationDetailsList::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
field_to_json(Obj,"list", list);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SimulationDetailsList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
field_from_json(Obj,"list", list);
|
|
||||||
return true;
|
|
||||||
} catch(...) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimulationStatus::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
field_to_json(Obj,"id", id);
|
|
||||||
field_to_json(Obj,"simulationId", simulationId);
|
|
||||||
field_to_json(Obj,"state", state);
|
|
||||||
field_to_json(Obj,"tx", tx);
|
|
||||||
field_to_json(Obj,"rx", rx);
|
|
||||||
field_to_json(Obj,"msgsTx", msgsTx);
|
|
||||||
field_to_json(Obj,"msgsRx", msgsRx);
|
|
||||||
field_to_json(Obj,"liveDevices", liveDevices);
|
|
||||||
field_to_json(Obj,"timeToFullDevices", timeToFullDevices);
|
|
||||||
field_to_json(Obj,"startTime", startTime);
|
|
||||||
field_to_json(Obj,"endTime", endTime);
|
|
||||||
field_to_json(Obj,"errorDevices", errorDevices);
|
|
||||||
field_to_json(Obj,"owner", owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Dashboard::to_json([[maybe_unused]] Poco::JSON::Object &Obj) const {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Dashboard::from_json([[maybe_unused]] const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Dashboard::reset() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by stephane bourque on 2021-08-31.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef UCENTRALSIM_RESTAPI_OWLSOBJECTS_H
|
|
||||||
#define UCENTRALSIM_RESTAPI_OWLSOBJECTS_H
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include "Poco/JSON/Object.h"
|
|
||||||
|
|
||||||
namespace OpenWifi::OWLSObjects {
|
|
||||||
|
|
||||||
struct SimulationDetails {
|
|
||||||
std::string id;
|
|
||||||
std::string name;
|
|
||||||
std::string gateway;
|
|
||||||
std::string certificate;
|
|
||||||
std::string key;
|
|
||||||
std::string macPrefix;
|
|
||||||
std::string deviceType;
|
|
||||||
uint64_t devices = 5;
|
|
||||||
uint64_t healthCheckInterval = 60;
|
|
||||||
uint64_t stateInterval = 60 ;
|
|
||||||
uint64_t minAssociations = 1;
|
|
||||||
uint64_t maxAssociations = 3;
|
|
||||||
uint64_t minClients = 1 ;
|
|
||||||
uint64_t maxClients = 3;
|
|
||||||
uint64_t simulationLength = 60 * 60;
|
|
||||||
uint64_t threads = 16;
|
|
||||||
uint64_t clientInterval = 1;
|
|
||||||
uint64_t keepAlive = 300;
|
|
||||||
uint64_t reconnectInterval = 30 ;
|
|
||||||
uint64_t concurrentDevices = 5;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SimulationDetailsList {
|
|
||||||
std::vector<SimulationDetails> list;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SimulationStatus {
|
|
||||||
std::string id;
|
|
||||||
std::string simulationId;
|
|
||||||
std::string state;
|
|
||||||
uint64_t tx;
|
|
||||||
uint64_t rx;
|
|
||||||
uint64_t msgsTx;
|
|
||||||
uint64_t msgsRx;
|
|
||||||
uint64_t liveDevices;
|
|
||||||
uint64_t timeToFullDevices;
|
|
||||||
uint64_t startTime;
|
|
||||||
uint64_t endTime;
|
|
||||||
uint64_t errorDevices;
|
|
||||||
std::string owner;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct Dashboard {
|
|
||||||
int O;
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif //UCENTRALSIM_RESTAPI_OWLSOBJECTS_H
|
|
||||||
@@ -251,8 +251,7 @@ namespace OpenWifi {
|
|||||||
VERIFY_EMAIL,
|
VERIFY_EMAIL,
|
||||||
SUB_FORGOT_PASSWORD,
|
SUB_FORGOT_PASSWORD,
|
||||||
SUB_VERIFY_EMAIL,
|
SUB_VERIFY_EMAIL,
|
||||||
SUB_SIGNUP,
|
SUB_SIGNUP
|
||||||
EMAIL_INVITATION
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ActionLink {
|
struct ActionLink {
|
||||||
|
|||||||
@@ -2,14 +2,16 @@
|
|||||||
// Created by stephane bourque on 2021-10-09.
|
// Created by stephane bourque on 2021-10-09.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <aws/sns/SNSClient.h>
|
||||||
|
#include <aws/sns/model/PublishRequest.h>
|
||||||
#include <aws/sns/model/PublishResult.h>
|
#include <aws/sns/model/PublishResult.h>
|
||||||
|
#include <aws/sns/model/GetSMSAttributesRequest.h>
|
||||||
#include "framework/MicroService.h"
|
|
||||||
|
|
||||||
#include "MFAServer.h"
|
#include "MFAServer.h"
|
||||||
#include "SMS_provider_aws.h"
|
#include "SMS_provider_aws.h"
|
||||||
#include "SMS_provider_twilio.h"
|
#include "SMS_provider_twilio.h"
|
||||||
#include "SMSSender.h"
|
#include "SMSSender.h"
|
||||||
|
#include "framework/MicroService.h"
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
|
|
||||||
@@ -83,7 +85,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
bool SMSSender::Send(const std::string &PhoneNumber, const std::string &Message) {
|
bool SMSSender::Send(const std::string &PhoneNumber, const std::string &Message) {
|
||||||
if(!Enabled_) {
|
if(!Enabled_) {
|
||||||
poco_information(Logger(),"SMS has not been enabled. Messages cannot be sent.");
|
Logger().information("SMS has not been enabled. Messages cannot be sent.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return ProviderImpl_->Send(PhoneNumber,Message);
|
return ProviderImpl_->Send(PhoneNumber,Message);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace OpenWifi {
|
|||||||
Region_ = MicroService::instance().ConfigGetString("smssender.aws.region","");
|
Region_ = MicroService::instance().ConfigGetString("smssender.aws.region","");
|
||||||
|
|
||||||
if(SecretKey_.empty() || AccessKey_.empty() || Region_.empty()) {
|
if(SecretKey_.empty() || AccessKey_.empty() || Region_.empty()) {
|
||||||
poco_debug(Logger(),"SMSSender is disabled. Please provide key, secret, and region.");
|
Logger().debug("SMSSender is disabled. Please provide key, secret, and region.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Running_=true;
|
Running_=true;
|
||||||
@@ -51,16 +51,16 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
auto psms_out = sns.Publish(psms_req);
|
auto psms_out = sns.Publish(psms_req);
|
||||||
if (psms_out.IsSuccess()) {
|
if (psms_out.IsSuccess()) {
|
||||||
poco_debug(Logger(),fmt::format("SMS sent to {}",PhoneNumber));
|
Logger().debug(fmt::format("SMS sent to {}",PhoneNumber));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
std::string ErrMsg{psms_out.GetError().GetMessage()};
|
std::string ErrMsg{psms_out.GetError().GetMessage()};
|
||||||
poco_debug(Logger(),fmt::format("SMS NOT sent to {}: {}",PhoneNumber, ErrMsg));
|
Logger().debug(fmt::format("SMS NOT sent to {}: {}",PhoneNumber, ErrMsg));
|
||||||
return false;
|
return false;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
|
||||||
}
|
}
|
||||||
poco_debug(Logger(),fmt::format("SMS NOT sent to {}: failure in SMS service",PhoneNumber));
|
Logger().debug(fmt::format("SMS NOT sent to {}: failure in SMS service",PhoneNumber));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,12 @@
|
|||||||
|
|
||||||
#include "SMS_provider_twilio.h"
|
#include "SMS_provider_twilio.h"
|
||||||
|
|
||||||
#include "framework/MicroService.h"
|
|
||||||
|
|
||||||
#include "Poco/Net/HTTPBasicCredentials.h"
|
#include "Poco/Net/HTTPBasicCredentials.h"
|
||||||
#include "Poco/URI.h"
|
#include "Poco/URI.h"
|
||||||
#include "Poco/Net/HTMLForm.h"
|
#include "Poco/Net/HTMLForm.h"
|
||||||
#include "Poco/Net/HTTPSClientSession.h"
|
#include "Poco/Net/HTTPSClientSession.h"
|
||||||
#include "Poco/Net/HTTPResponse.h"
|
#include "Poco/Net/HTTPResponse.h"
|
||||||
|
#include "framework/MicroService.h"
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
bool SMS_provider_twilio::Initialize() {
|
bool SMS_provider_twilio::Initialize() {
|
||||||
@@ -19,7 +18,7 @@ namespace OpenWifi {
|
|||||||
PhoneNumber_ = MicroService::instance().ConfigGetString("smssender.twilio.phonenumber","");
|
PhoneNumber_ = MicroService::instance().ConfigGetString("smssender.twilio.phonenumber","");
|
||||||
|
|
||||||
if(Sid_.empty() || Token_.empty() || PhoneNumber_.empty()) {
|
if(Sid_.empty() || Token_.empty() || PhoneNumber_.empty()) {
|
||||||
poco_debug(Logger(),"SMSSender is disabled. Please provide SID, TOKEN, and PHONE NUMBER.");
|
Logger().debug("SMSSender is disabled. Please provide SID, TOKEN, and PHONE NUMBER.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Running_=true;
|
Running_=true;
|
||||||
@@ -65,12 +64,12 @@ namespace OpenWifi {
|
|||||||
std::istream& rs = session.receiveResponse(res);
|
std::istream& rs = session.receiveResponse(res);
|
||||||
|
|
||||||
if(res.getStatus()==Poco::Net::HTTPResponse::HTTP_OK) {
|
if(res.getStatus()==Poco::Net::HTTPResponse::HTTP_OK) {
|
||||||
poco_information(Logger(),fmt::format("Message sent to {}", PhoneNumber));
|
Logger().information(fmt::format("Message sent to {}", PhoneNumber));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
Poco::StreamCopier::copyStream(rs,os);
|
Poco::StreamCopier::copyStream(rs,os);
|
||||||
poco_information(Logger(),fmt::format("Message was not to {}: Error:{}", PhoneNumber, os.str()));
|
Logger().information(fmt::format("Message was not to {}: Error:{}", PhoneNumber, os.str()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
// Created by stephane bourque on 2021-06-17.
|
// Created by stephane bourque on 2021-06-17.
|
||||||
//
|
//
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
#include "framework/MicroService.h"
|
|
||||||
|
|
||||||
#include "Poco/Net/MailMessage.h"
|
#include "Poco/Net/MailMessage.h"
|
||||||
#include "Poco/Net/MailRecipient.h"
|
#include "Poco/Net/MailRecipient.h"
|
||||||
@@ -13,9 +12,9 @@
|
|||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
#include "Poco/Net/SSLManager.h"
|
#include "Poco/Net/SSLManager.h"
|
||||||
#include "Poco/Net/Context.h"
|
#include "Poco/Net/Context.h"
|
||||||
#include "Poco/Net/NetException.h"
|
|
||||||
|
|
||||||
#include "SMTPMailerService.h"
|
#include "SMTPMailerService.h"
|
||||||
|
#include "framework/MicroService.h"
|
||||||
#include "AuthService.h"
|
#include "AuthService.h"
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
@@ -32,9 +31,7 @@ namespace OpenWifi {
|
|||||||
TemplateDir_ = MicroService::instance().ConfigPath("mailer.templates", MicroService::instance().DataDir());
|
TemplateDir_ = MicroService::instance().ConfigPath("mailer.templates", MicroService::instance().DataDir());
|
||||||
MailRetry_ = MicroService::instance().ConfigGetInt("mailer.retry",2*60);
|
MailRetry_ = MicroService::instance().ConfigGetInt("mailer.retry",2*60);
|
||||||
MailAbandon_ = MicroService::instance().ConfigGetInt("mailer.abandon",2*60*60);
|
MailAbandon_ = MicroService::instance().ConfigGetInt("mailer.abandon",2*60*60);
|
||||||
UseHTML_ = MicroService::instance().ConfigGetBool("mailer.html",false);
|
|
||||||
Enabled_ = (!MailHost_.empty() && !SenderLoginPassword_.empty() && !SenderLoginUserName_.empty());
|
Enabled_ = (!MailHost_.empty() && !SenderLoginPassword_.empty() && !SenderLoginUserName_.empty());
|
||||||
EmailLogo_ = TemplateDir_ + "/" + MicroService::instance().ConfigGetString("mailer.logo","logo.jpg");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +49,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
void SMTPMailerService::reinitialize([[maybe_unused]] Poco::Util::Application &self) {
|
void SMTPMailerService::reinitialize([[maybe_unused]] Poco::Util::Application &self) {
|
||||||
MicroService::instance().LoadConfigurationFile();
|
MicroService::instance().LoadConfigurationFile();
|
||||||
poco_information(Logger(),"Reinitializing.");
|
Logger().information("Reinitializing.");
|
||||||
LoadMyConfig();
|
LoadMyConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +58,7 @@ namespace OpenWifi {
|
|||||||
PendingMessages_.push_back(MessageEvent{.Posted= OpenWifi::Now(),
|
PendingMessages_.push_back(MessageEvent{.Posted= OpenWifi::Now(),
|
||||||
.LastTry=0,
|
.LastTry=0,
|
||||||
.Sent=0,
|
.Sent=0,
|
||||||
.TemplateName=Name,
|
.File=Poco::File(TemplateDir_ + "/" +Name),
|
||||||
.Attrs=Attrs});
|
.Attrs=Attrs});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -86,23 +83,15 @@ namespace OpenWifi {
|
|||||||
auto Recipient = i->Attrs.find(RECIPIENT_EMAIL)->second;
|
auto Recipient = i->Attrs.find(RECIPIENT_EMAIL)->second;
|
||||||
uint64_t now = OpenWifi::Now();
|
uint64_t now = OpenWifi::Now();
|
||||||
if((i->LastTry==0 || (now-i->LastTry)>MailRetry_)) {
|
if((i->LastTry==0 || (now-i->LastTry)>MailRetry_)) {
|
||||||
switch(SendIt(*i)) {
|
if (SendIt(*i)) {
|
||||||
case MessageSendStatus::msg_sent: {
|
Logger().information(fmt::format("Attempting to deliver for mail '{}'.", Recipient));
|
||||||
poco_information(Logger(),fmt::format("Attempting to deliver for mail '{}'.", Recipient));
|
|
||||||
i = Messages_.erase(i);
|
i = Messages_.erase(i);
|
||||||
} break;
|
} else {
|
||||||
case MessageSendStatus::msg_not_sent_but_resend: {
|
|
||||||
poco_information(Logger(),fmt::format("Mail for '{}' was not. We will retry later.", Recipient));
|
|
||||||
i->LastTry = now;
|
i->LastTry = now;
|
||||||
++i;
|
++i;
|
||||||
} break;
|
|
||||||
case MessageSendStatus::msg_not_sent_but_do_not_resend: {
|
|
||||||
poco_information(Logger(),fmt::format("Mail for '{}' will not be sent. Check email address", Recipient));
|
|
||||||
i = Messages_.erase(i);
|
|
||||||
} break;
|
|
||||||
}
|
}
|
||||||
} else if ((now-i->Posted)>MailAbandon_) {
|
} else if ((now-i->Posted)>MailAbandon_) {
|
||||||
poco_information(Logger(),fmt::format("Mail for '{}' has timed out and will not be sent.", Recipient));
|
Logger().information(fmt::format("Mail for '{}' has timed out and will not be sent.", Recipient));
|
||||||
i = Messages_.erase(i);
|
i = Messages_.erase(i);
|
||||||
} else {
|
} else {
|
||||||
++i;
|
++i;
|
||||||
@@ -117,12 +106,14 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageSendStatus SMTPMailerService::SendIt(const MessageEvent &Msg) {
|
bool SMTPMailerService::SendIt(const MessageEvent &Msg) {
|
||||||
|
|
||||||
std::string Recipient;
|
std::string Recipient;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Poco::Net::MailMessage Message;
|
||||||
|
Recipient = Msg.Attrs.find(RECIPIENT_EMAIL)->second;
|
||||||
|
|
||||||
auto H1 = Msg.Attrs.find(SENDER);
|
auto H1 = Msg.Attrs.find(SENDER);
|
||||||
std::string TheSender;
|
std::string TheSender;
|
||||||
if(H1!=Msg.Attrs.end()) {
|
if(H1!=Msg.Attrs.end()) {
|
||||||
@@ -130,40 +121,34 @@ namespace OpenWifi {
|
|||||||
} else {
|
} else {
|
||||||
TheSender = Sender_ ;
|
TheSender = Sender_ ;
|
||||||
}
|
}
|
||||||
|
Message.setSender( TheSender );
|
||||||
auto Message = std::make_unique<Poco::Net::MailMessage>();
|
Logger().information(fmt::format("Sending message to:{} from {}",Recipient,TheSender));
|
||||||
|
Message.addRecipient(Poco::Net::MailRecipient(Poco::Net::MailRecipient::PRIMARY_RECIPIENT, Recipient));
|
||||||
Recipient = Msg.Attrs.find(RECIPIENT_EMAIL)->second;
|
Message.setSubject(Msg.Attrs.find(SUBJECT)->second);
|
||||||
Message->setSender( TheSender );
|
|
||||||
Message->addRecipient(Poco::Net::MailRecipient(Poco::Net::MailRecipient::PRIMARY_RECIPIENT, Recipient));
|
|
||||||
Message->setSubject(Msg.Attrs.find(SUBJECT)->second);
|
|
||||||
|
|
||||||
poco_information(Logger(),fmt::format("Sending message to:{} from {}",Recipient,TheSender));
|
|
||||||
|
|
||||||
if(Msg.Attrs.find(TEXT) != Msg.Attrs.end()) {
|
if(Msg.Attrs.find(TEXT) != Msg.Attrs.end()) {
|
||||||
std::string Content = Msg.Attrs.find(TEXT)->second;
|
std::string Content = Msg.Attrs.find(TEXT)->second;
|
||||||
Message->addContent(new Poco::Net::StringPartSource(Content));
|
Message.addContent(new Poco::Net::StringPartSource(Content));
|
||||||
} else {
|
} else {
|
||||||
for(const auto &format:{"html","txt"}) {
|
std::string Content = Utils::LoadFile(Msg.File);
|
||||||
std::string Content = Utils::LoadFile(TemplateDir_ + Msg.TemplateName + "." + format );
|
// std::cout << "Mailing " << Content << std::endl;
|
||||||
Types::StringPairVec Variables;
|
Types::StringPairVec Variables;
|
||||||
FillVariables(Msg.Attrs, Variables);
|
FillVariables(Msg.Attrs, Variables);
|
||||||
Utils::ReplaceVariables(Content, Variables);
|
Utils::ReplaceVariables(Content, Variables);
|
||||||
Message->addContent(
|
// std::cout << "Mailing " << Content << std::endl;
|
||||||
new Poco::Net::StringPartSource(Content, (strcmp(format,"html") == 0 ? "text/html" : "text/plain") ));
|
Message.addContent(new Poco::Net::StringPartSource(Content));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Logo = Msg.Attrs.find(LOGO);
|
auto Logo = Msg.Attrs.find(LOGO);
|
||||||
if(Logo!=Msg.Attrs.end()) {
|
if(Logo!=Msg.Attrs.end()) {
|
||||||
try {
|
try {
|
||||||
Poco::File LogoFile(EmailLogo_);
|
Poco::File LogoFile(AuthService::GetLogoAssetFileName());
|
||||||
std::ifstream IF(LogoFile.path());
|
std::ifstream IF(LogoFile.path());
|
||||||
std::ostringstream OS;
|
std::ostringstream OS;
|
||||||
Poco::StreamCopier::copyStream(IF, OS);
|
Poco::StreamCopier::copyStream(IF, OS);
|
||||||
Message->addAttachment("logo", new Poco::Net::StringPartSource(OS.str(), "image/png"));
|
Message.addAttachment("logo", new Poco::Net::StringPartSource(OS.str(), "image/png"));
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
poco_warning(Logger(),fmt::format("Cannot add '{}' logo in email",AuthService::GetLogoAssetFileName()));
|
Logger().warning(fmt::format("Cannot add '{}' logo in email",AuthService::GetLogoAssetFileName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,23 +169,18 @@ namespace OpenWifi {
|
|||||||
SenderLoginUserName_,
|
SenderLoginUserName_,
|
||||||
SenderLoginPassword_
|
SenderLoginPassword_
|
||||||
);
|
);
|
||||||
session.sendMessage(*Message);
|
session.sendMessage(Message);
|
||||||
session.close();
|
session.close();
|
||||||
return MessageSendStatus::msg_sent;
|
return true;
|
||||||
}
|
|
||||||
catch (const Poco::Net::SMTPException &S) {
|
|
||||||
Logger().log(S);
|
|
||||||
return MessageSendStatus::msg_not_sent_but_do_not_resend;
|
|
||||||
}
|
}
|
||||||
catch (const Poco::Exception& E)
|
catch (const Poco::Exception& E)
|
||||||
{
|
{
|
||||||
Logger().log(E);
|
Logger().log(E);
|
||||||
return MessageSendStatus::msg_not_sent_but_resend;
|
|
||||||
}
|
}
|
||||||
catch (const std::exception &E) {
|
catch (const std::exception &E) {
|
||||||
poco_warning(Logger(),fmt::format("Cannot send message to:{}, error: {}",Recipient, E.what()));
|
Logger().warning(fmt::format("Cannot send message to:{}, error: {}",Recipient, E.what()));
|
||||||
return MessageSendStatus::msg_not_sent_but_do_not_resend;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ namespace OpenWifi {
|
|||||||
LOGO,
|
LOGO,
|
||||||
TEXT,
|
TEXT,
|
||||||
CHALLENGE_CODE,
|
CHALLENGE_CODE,
|
||||||
SENDER,
|
SENDER
|
||||||
ACTION_LINK_HTML
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const std::map<MESSAGE_ATTRIBUTES,const std::string>
|
static const std::map<MESSAGE_ATTRIBUTES,const std::string>
|
||||||
@@ -45,8 +44,7 @@ namespace OpenWifi {
|
|||||||
{ LOGO, "LOGO"},
|
{ LOGO, "LOGO"},
|
||||||
{ TEXT, "TEXT"},
|
{ TEXT, "TEXT"},
|
||||||
{ CHALLENGE_CODE, "CHALLENGE_CODE"},
|
{ CHALLENGE_CODE, "CHALLENGE_CODE"},
|
||||||
{ SENDER, "SENDER"},
|
{ SENDER, "SENDER"}
|
||||||
{ ACTION_LINK_HTML, "ACTION_LINK_HTML"},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline const std::string & MessageAttributeToVar(MESSAGE_ATTRIBUTES Attr) {
|
inline const std::string & MessageAttributeToVar(MESSAGE_ATTRIBUTES Attr) {
|
||||||
@@ -58,12 +56,6 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
typedef std::map<MESSAGE_ATTRIBUTES, std::string> MessageAttributes;
|
typedef std::map<MESSAGE_ATTRIBUTES, std::string> MessageAttributes;
|
||||||
|
|
||||||
enum class MessageSendStatus {
|
|
||||||
msg_sent,
|
|
||||||
msg_not_sent_but_resend,
|
|
||||||
msg_not_sent_but_do_not_resend
|
|
||||||
};
|
|
||||||
|
|
||||||
class SMTPMailerService : public SubSystemServer, Poco::Runnable {
|
class SMTPMailerService : public SubSystemServer, Poco::Runnable {
|
||||||
public:
|
public:
|
||||||
static SMTPMailerService *instance() {
|
static SMTPMailerService *instance() {
|
||||||
@@ -75,7 +67,7 @@ namespace OpenWifi {
|
|||||||
uint64_t Posted=0;
|
uint64_t Posted=0;
|
||||||
uint64_t LastTry=0;
|
uint64_t LastTry=0;
|
||||||
uint64_t Sent=0;
|
uint64_t Sent=0;
|
||||||
std::string TemplateName;
|
Poco::File File;
|
||||||
MessageAttributes Attrs;
|
MessageAttributes Attrs;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,7 +76,7 @@ namespace OpenWifi {
|
|||||||
void Stop() override;
|
void Stop() override;
|
||||||
|
|
||||||
bool SendMessage(const std::string &Recipient, const std::string &Name, const MessageAttributes &Attrs);
|
bool SendMessage(const std::string &Recipient, const std::string &Name, const MessageAttributes &Attrs);
|
||||||
MessageSendStatus SendIt(const MessageEvent &Msg);
|
bool SendIt(const MessageEvent &Msg);
|
||||||
void LoadMyConfig();
|
void LoadMyConfig();
|
||||||
void reinitialize(Poco::Util::Application &self) override;
|
void reinitialize(Poco::Util::Application &self) override;
|
||||||
bool Enabled() const { return Enabled_; }
|
bool Enabled() const { return Enabled_; }
|
||||||
@@ -104,8 +96,6 @@ namespace OpenWifi {
|
|||||||
Poco::Thread SenderThr_;
|
Poco::Thread SenderThr_;
|
||||||
std::atomic_bool Running_=false;
|
std::atomic_bool Running_=false;
|
||||||
bool Enabled_=false;
|
bool Enabled_=false;
|
||||||
bool UseHTML_=false;
|
|
||||||
std::string EmailLogo_{"logo.jpg"};
|
|
||||||
|
|
||||||
SMTPMailerService() noexcept:
|
SMTPMailerService() noexcept:
|
||||||
SubSystemServer("SMTPMailer", "MAILER-SVR", "smtpmailer")
|
SubSystemServer("SMTPMailer", "MAILER-SVR", "smtpmailer")
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
int StorageService::Start() {
|
int StorageService::Start() {
|
||||||
std::lock_guard Guard(Mutex_);
|
std::lock_guard Guard(Mutex_);
|
||||||
poco_information(Logger(),"Starting...");
|
|
||||||
|
|
||||||
StorageClass::Start();
|
StorageClass::Start();
|
||||||
|
|
||||||
@@ -52,20 +51,19 @@ namespace OpenWifi {
|
|||||||
Archivercallback_ = std::make_unique<Poco::TimerCallback<Archiver>>(Archiver_,&Archiver::onTimer);
|
Archivercallback_ = std::make_unique<Poco::TimerCallback<Archiver>>(Archiver_,&Archiver::onTimer);
|
||||||
Timer_.setStartInterval( 5 * 60 * 1000); // first run in 5 minutes
|
Timer_.setStartInterval( 5 * 60 * 1000); // first run in 5 minutes
|
||||||
Timer_.setPeriodicInterval(1 * 60 * 60 * 1000); // 1 hours
|
Timer_.setPeriodicInterval(1 * 60 * 60 * 1000); // 1 hours
|
||||||
Timer_.start(*Archivercallback_, MicroService::instance().TimerPool());
|
Timer_.start(*Archivercallback_);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StorageService::Stop() {
|
void StorageService::Stop() {
|
||||||
poco_information(Logger(),"Stopping...");
|
Logger().notice("Stopping.");
|
||||||
Timer_.stop();
|
Timer_.stop();
|
||||||
StorageClass::Stop();
|
StorageClass::Stop();
|
||||||
poco_information(Logger(),"Stopped...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Archiver::onTimer([[maybe_unused]] Poco::Timer &timer) {
|
void Archiver::onTimer([[maybe_unused]] Poco::Timer &timer) {
|
||||||
Utils::SetThreadName("strg-arch");
|
Utils::SetThreadName("archiver");
|
||||||
Poco::Logger &logger = Poco::Logger::get("STORAGE-ARCHIVER");
|
Poco::Logger &logger = Poco::Logger::get("STORAGE-ARCHIVER");
|
||||||
logger.information("Squiggy the DB: removing old tokens.");
|
logger.information("Squiggy the DB: removing old tokens.");
|
||||||
StorageService()->SubTokenDB().CleanExpiredTokens();
|
StorageService()->SubTokenDB().CleanExpiredTokens();
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#define OWSEC_TOTPCACHE_H
|
#define OWSEC_TOTPCACHE_H
|
||||||
|
|
||||||
#include "framework/MicroService.h"
|
#include "framework/MicroService.h"
|
||||||
|
|
||||||
#include "seclibs/cpptotp/bytes.h"
|
#include "seclibs/cpptotp/bytes.h"
|
||||||
#include "seclibs/qrcode/qrcodegen.hpp"
|
#include "seclibs/qrcode/qrcodegen.hpp"
|
||||||
#include "seclibs/cpptotp/otp.h"
|
#include "seclibs/cpptotp/otp.h"
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ static json DefaultUCentralSchema = R"(
|
|||||||
"switch": {
|
"switch": {
|
||||||
"$ref": "#/$defs/switch"
|
"$ref": "#/$defs/switch"
|
||||||
},
|
},
|
||||||
"radiosgrep": {
|
"radios": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/$defs/radio"
|
"$ref": "#/$defs/radio"
|
||||||
|
|||||||
@@ -23,13 +23,6 @@
|
|||||||
#include <queue>
|
#include <queue>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
|
|
||||||
|
|
||||||
// This must be defined for poco_debug and poco_trace macros to function.
|
|
||||||
|
|
||||||
#ifndef POCO_LOG_DEBUG
|
|
||||||
#define POCO_LOG_DEBUG true
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace OpenWifi {
|
namespace OpenWifi {
|
||||||
inline uint64_t Now() { return std::time(nullptr); };
|
inline uint64_t Now() { return std::time(nullptr); };
|
||||||
}
|
}
|
||||||
@@ -96,10 +89,8 @@ using namespace std::chrono_literals;
|
|||||||
#include "Poco/NObserver.h"
|
#include "Poco/NObserver.h"
|
||||||
#include "Poco/Net/SocketNotification.h"
|
#include "Poco/Net/SocketNotification.h"
|
||||||
#include "Poco/Base64Decoder.h"
|
#include "Poco/Base64Decoder.h"
|
||||||
#include "Poco/ThreadLocal.h"
|
|
||||||
#include "cppkafka/cppkafka.h"
|
#include "cppkafka/cppkafka.h"
|
||||||
|
|
||||||
#include "framework/MicroServiceErrorHandler.h"
|
|
||||||
#include "framework/OpenWifiTypes.h"
|
#include "framework/OpenWifiTypes.h"
|
||||||
#include "framework/KafkaTopics.h"
|
#include "framework/KafkaTopics.h"
|
||||||
#include "framework/ow_constants.h"
|
#include "framework/ow_constants.h"
|
||||||
@@ -669,19 +660,6 @@ namespace OpenWifi::RESTAPI_utils {
|
|||||||
|
|
||||||
namespace OpenWifi::Utils {
|
namespace OpenWifi::Utils {
|
||||||
|
|
||||||
inline bool NormalizeMac(std::string & Mac) {
|
|
||||||
Poco::replaceInPlace(Mac,":","");
|
|
||||||
Poco::replaceInPlace(Mac,"-","");
|
|
||||||
if(Mac.size()!=12)
|
|
||||||
return false;
|
|
||||||
for(const auto &i:Mac) {
|
|
||||||
if(!std::isxdigit(i))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Poco::toLowerInPlace(Mac);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void SetThreadName(const char *name) {
|
inline void SetThreadName(const char *name) {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
Poco::Thread::current()->setName(name);
|
Poco::Thread::current()->setName(name);
|
||||||
@@ -725,19 +703,6 @@ namespace OpenWifi::Utils {
|
|||||||
return (std::all_of(UUID.begin(),UUID.end(),[&](auto i){ if(i=='-') dashes++; return i=='-' || std::isxdigit(i);})) && (dashes>0);
|
return (std::all_of(UUID.begin(),UUID.end(),[&](auto i){ if(i=='-') dashes++; return i=='-' || std::isxdigit(i);})) && (dashes>0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ...Args> std::string ComputeHash(Args&&... args) {
|
|
||||||
Poco::SHA2Engine E;
|
|
||||||
auto as_string = [](auto p) {
|
|
||||||
if constexpr(std::is_arithmetic_v<decltype(p)>) {
|
|
||||||
return std::to_string(p);
|
|
||||||
} else {
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
(E.update(as_string(args)),...);
|
|
||||||
return Poco::SHA2Engine::digestToHex(E.digest());
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] inline std::vector<std::string> Split(const std::string &List, char Delimiter=',' ) {
|
[[nodiscard]] inline std::vector<std::string> Split(const std::string &List, char Delimiter=',' ) {
|
||||||
std::vector<std::string> ReturnList;
|
std::vector<std::string> ReturnList;
|
||||||
|
|
||||||
@@ -1361,19 +1326,36 @@ namespace OpenWifi {
|
|||||||
Poco::ExpireLRUCache<KeyType,Record> Cache_{Size,Expiry};
|
Poco::ExpireLRUCache<KeyType,Record> Cache_{Size,Expiry};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MyErrorHandler : public Poco::ErrorHandler {
|
||||||
|
public:
|
||||||
|
explicit MyErrorHandler(Poco::Util::Application &App) : App_(App) {}
|
||||||
|
inline void exception(const Poco::Exception & E) {
|
||||||
|
Poco::Thread * CurrentThread = Poco::Thread::current();
|
||||||
|
App_.logger().log(E);
|
||||||
|
App_.logger().error(fmt::format("Exception occurred in {}",CurrentThread->getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void exception(const std::exception & E) {
|
||||||
|
Poco::Thread * CurrentThread = Poco::Thread::current();
|
||||||
|
App_.logger().warning(fmt::format("std::exception in {}: {}",CurrentThread->getName(),E.what()));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void exception() {
|
||||||
|
Poco::Thread * CurrentThread = Poco::Thread::current();
|
||||||
|
App_.logger().warning(fmt::format("exception in {}",CurrentThread->getName()));
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
Poco::Util::Application &App_;
|
||||||
|
};
|
||||||
|
|
||||||
class BusEventManager : public Poco::Runnable {
|
class BusEventManager : public Poco::Runnable {
|
||||||
public:
|
public:
|
||||||
explicit BusEventManager(Poco::Logger &L) : Logger_(L) {
|
|
||||||
|
|
||||||
}
|
|
||||||
inline void run() final;
|
inline void run() final;
|
||||||
inline void Start();
|
inline void Start();
|
||||||
inline void Stop();
|
inline void Stop();
|
||||||
inline Poco::Logger & Logger() { return Logger_; }
|
|
||||||
private:
|
private:
|
||||||
mutable std::atomic_bool Running_ = false;
|
mutable std::atomic_bool Running_ = false;
|
||||||
Poco::Thread Thread_;
|
Poco::Thread Thread_;
|
||||||
Poco::Logger &Logger_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MyPrivateKeyPassphraseHandler : public Poco::Net::PrivateKeyPassphraseHandler {
|
class MyPrivateKeyPassphraseHandler : public Poco::Net::PrivateKeyPassphraseHandler {
|
||||||
@@ -1387,7 +1369,6 @@ namespace OpenWifi {
|
|||||||
Logger_.information("Returning key passphrase.");
|
Logger_.information("Returning key passphrase.");
|
||||||
privateKey = Password_;
|
privateKey = Password_;
|
||||||
};
|
};
|
||||||
inline Poco::Logger & Logger() { return Logger_; }
|
|
||||||
private:
|
private:
|
||||||
std::string Password_;
|
std::string Password_;
|
||||||
Poco::Logger & Logger_;
|
Poco::Logger & Logger_;
|
||||||
@@ -1418,14 +1399,13 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
[[nodiscard]] inline const std::string &Address() const { return address_; };
|
[[nodiscard]] inline const std::string &Address() const { return address_; };
|
||||||
[[nodiscard]] inline uint32_t Port() const { return port_; };
|
[[nodiscard]] inline uint32_t Port() const { return port_; };
|
||||||
[[nodiscard]] inline auto KeyFile() const { return key_file_; };
|
[[nodiscard]] inline const std::string &KeyFile() const { return key_file_; };
|
||||||
[[nodiscard]] inline auto CertFile() const { return cert_file_; };
|
[[nodiscard]] inline const std::string &CertFile() const { return cert_file_; };
|
||||||
[[nodiscard]] inline auto RootCA() const { return root_ca_; };
|
[[nodiscard]] inline const std::string &RootCA() const { return root_ca_; };
|
||||||
[[nodiscard]] inline auto KeyFilePassword() const { return key_file_password_; };
|
[[nodiscard]] inline const std::string &KeyFilePassword() const { return key_file_password_; };
|
||||||
[[nodiscard]] inline auto IssuerCertFile() const { return issuer_cert_file_; };
|
[[nodiscard]] inline const std::string &IssuerCertFile() const { return issuer_cert_file_; };
|
||||||
[[nodiscard]] inline auto Name() const { return name_; };
|
[[nodiscard]] inline const std::string &Name() const { return name_; };
|
||||||
[[nodiscard]] inline int Backlog() const { return backlog_; }
|
[[nodiscard]] inline int Backlog() const { return backlog_; }
|
||||||
[[nodiscard]] inline auto Cas() const { return cas_; }
|
|
||||||
|
|
||||||
[[nodiscard]] inline Poco::Net::SecureServerSocket CreateSecureSocket(Poco::Logger &L) const {
|
[[nodiscard]] inline Poco::Net::SecureServerSocket CreateSecureSocket(Poco::Logger &L) const {
|
||||||
Poco::Net::Context::Params P;
|
Poco::Net::Context::Params P;
|
||||||
@@ -1656,14 +1636,14 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
class SubSystemServer : public Poco::Util::Application::Subsystem {
|
class SubSystemServer : public Poco::Util::Application::Subsystem {
|
||||||
public:
|
public:
|
||||||
SubSystemServer(const std::string & Name, const std::string &LoggingPrefix,
|
SubSystemServer(std::string Name, const std::string &LoggingPrefix,
|
||||||
const std::string & SubSystemConfigPrefix);
|
std::string SubSystemConfigPrefix);
|
||||||
|
|
||||||
inline void initialize(Poco::Util::Application &self) override;
|
inline void initialize(Poco::Util::Application &self) override;
|
||||||
inline void uninitialize() override {
|
inline void uninitialize() override {
|
||||||
}
|
}
|
||||||
inline void reinitialize([[maybe_unused]] Poco::Util::Application &self) override {
|
inline void reinitialize([[maybe_unused]] Poco::Util::Application &self) override {
|
||||||
Logger_->L_.information("Reloading of this subsystem is not supported.");
|
Logger().information("Reloading of this subsystem is not supported.");
|
||||||
}
|
}
|
||||||
inline void defineOptions([[maybe_unused]] Poco::Util::OptionSet &options) override {
|
inline void defineOptions([[maybe_unused]] Poco::Util::OptionSet &options) override {
|
||||||
}
|
}
|
||||||
@@ -1672,27 +1652,27 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline const PropertiesFileServerEntry & Host(uint64_t index) { return ConfigServersList_[index]; };
|
inline const PropertiesFileServerEntry & Host(uint64_t index) { return ConfigServersList_[index]; };
|
||||||
inline uint64_t HostSize() const { return ConfigServersList_.size(); }
|
inline uint64_t HostSize() const { return ConfigServersList_.size(); }
|
||||||
inline Poco::Logger & Logger() const { return Logger_->L_; }
|
inline Poco::Logger &Logger() { if(Log_)
|
||||||
inline void SetLoggingLevel(const std::string & levelName) {
|
return Log_->L;
|
||||||
Logger_->L_.setLevel(Poco::Logger::parseLevel(levelName));
|
return Poco::Logger::get("tmp");
|
||||||
}
|
};
|
||||||
inline int GetLoggingLevel() { return Logger_->L_.getLevel(); }
|
inline void SetLoggingLevel(Poco::Message::Priority NewPriority) { Logger().setLevel(NewPriority); }
|
||||||
|
inline int GetLoggingLevel() { return Logger().getLevel(); }
|
||||||
|
|
||||||
virtual int Start() = 0;
|
virtual int Start() = 0;
|
||||||
virtual void Stop() = 0;
|
virtual void Stop() = 0;
|
||||||
|
|
||||||
struct LoggerWrapper {
|
struct LoggerWrapper {
|
||||||
Poco::Logger & L_;
|
Poco::Logger &L;
|
||||||
LoggerWrapper(Poco::Logger &L) :
|
explicit inline LoggerWrapper(Poco::Logger &Logger) : L(Logger) {}
|
||||||
L_(L) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::recursive_mutex Mutex_;
|
std::recursive_mutex Mutex_;
|
||||||
std::vector<PropertiesFileServerEntry> ConfigServersList_;
|
std::vector<PropertiesFileServerEntry> ConfigServersList_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<LoggerWrapper> Logger_;
|
std::unique_ptr<LoggerWrapper> Log_;
|
||||||
|
// Poco::Logger &Logger_;
|
||||||
std::string Name_;
|
std::string Name_;
|
||||||
std::string LoggerPrefix_;
|
std::string LoggerPrefix_;
|
||||||
std::string SubSystemConfigPrefix_;
|
std::string SubSystemConfigPrefix_;
|
||||||
@@ -1829,7 +1809,7 @@ namespace OpenWifi {
|
|||||||
E->Count++;
|
E->Count++;
|
||||||
Cache_.update(H,E);
|
Cache_.update(H,E);
|
||||||
if(E->Count > MaxCalls) {
|
if(E->Count > MaxCalls) {
|
||||||
poco_warning(Logger(),fmt::format("RATE-LIMIT-EXCEEDED: from '{}'", R.clientAddress().toString()));
|
Logger().warning(fmt::format("RATE-LIMIT-EXCEEDED: from '{}'", R.clientAddress().toString()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -1905,8 +1885,8 @@ namespace OpenWifi {
|
|||||||
Request = &RequestIn;
|
Request = &RequestIn;
|
||||||
Response = &ResponseIn;
|
Response = &ResponseIn;
|
||||||
|
|
||||||
// std::string th_name = "restsvr_" + std::to_string(TransactionId_);
|
std::string th_name = "restsvr_" + std::to_string(TransactionId_);
|
||||||
// Utils::SetThreadName(th_name.c_str());
|
Utils::SetThreadName(th_name.c_str());
|
||||||
|
|
||||||
if(Request->getContentLength()>0) {
|
if(Request->getContentLength()>0) {
|
||||||
if(Request->getContentType().find("application/json")!=std::string::npos) {
|
if(Request->getContentType().find("application/json")!=std::string::npos) {
|
||||||
@@ -2171,16 +2151,12 @@ namespace OpenWifi {
|
|||||||
SetCommonHeaders(CloseConnection);
|
SetCommonHeaders(CloseConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void BadRequest(const OpenWifi::RESTAPI::Errors::msg &E, const std::string & Extra="") {
|
inline void BadRequest(const OpenWifi::RESTAPI::Errors::msg &E) {
|
||||||
PrepareResponse(Poco::Net::HTTPResponse::HTTP_BAD_REQUEST);
|
PrepareResponse(Poco::Net::HTTPResponse::HTTP_BAD_REQUEST);
|
||||||
Poco::JSON::Object ErrorObject;
|
Poco::JSON::Object ErrorObject;
|
||||||
ErrorObject.set("ErrorCode",400);
|
ErrorObject.set("ErrorCode",400);
|
||||||
ErrorObject.set("ErrorDetails",Request->getMethod());
|
ErrorObject.set("ErrorDetails",Request->getMethod());
|
||||||
if(Extra.empty())
|
|
||||||
ErrorObject.set("ErrorDescription",fmt::format("{}: {}",E.err_num,E.err_txt)) ;
|
ErrorObject.set("ErrorDescription",fmt::format("{}: {}",E.err_num,E.err_txt)) ;
|
||||||
else
|
|
||||||
ErrorObject.set("ErrorDescription",fmt::format("{}: {} ({})",E.err_num,E.err_txt, Extra)) ;
|
|
||||||
|
|
||||||
std::ostream &Answer = Response->send();
|
std::ostream &Answer = Response->send();
|
||||||
Poco::JSON::Stringifier::stringify(ErrorObject, Answer);
|
Poco::JSON::Stringifier::stringify(ErrorObject, Answer);
|
||||||
}
|
}
|
||||||
@@ -2224,7 +2200,7 @@ namespace OpenWifi {
|
|||||||
ErrorObject.set("ErrorDescription",fmt::format("{}: {}",E.err_num,E.err_txt)) ;
|
ErrorObject.set("ErrorDescription",fmt::format("{}: {}",E.err_num,E.err_txt)) ;
|
||||||
std::ostream &Answer = Response->send();
|
std::ostream &Answer = Response->send();
|
||||||
Poco::JSON::Stringifier::stringify(ErrorObject, Answer);
|
Poco::JSON::Stringifier::stringify(ErrorObject, Answer);
|
||||||
poco_debug(Logger_,fmt::format("RES-NOTFOUND: User='{}@{}' Method='{}' Path='{}",
|
Logger_.debug(fmt::format("RES-NOTFOUND: User='{}@{}' Method='{}' Path='{}",
|
||||||
UserInfo_.userinfo.email,
|
UserInfo_.userinfo.email,
|
||||||
Utils::FormatIPv6(Request->clientAddress().toString()),
|
Utils::FormatIPv6(Request->clientAddress().toString()),
|
||||||
Request->getMethod(),
|
Request->getMethod(),
|
||||||
@@ -2456,7 +2432,6 @@ namespace OpenWifi {
|
|||||||
Poco::Net::HTTPServerResponse *Response= nullptr;
|
Poco::Net::HTTPServerResponse *Response= nullptr;
|
||||||
SecurityObjects::UserInfoAndPolicy UserInfo_;
|
SecurityObjects::UserInfoAndPolicy UserInfo_;
|
||||||
QueryBlock QB_;
|
QueryBlock QB_;
|
||||||
const std::string & Requester() const { return REST_Requester_; }
|
|
||||||
protected:
|
protected:
|
||||||
BindingMap Bindings_;
|
BindingMap Bindings_;
|
||||||
Poco::URI::QueryParameters Parameters_;
|
Poco::URI::QueryParameters Parameters_;
|
||||||
@@ -2473,7 +2448,6 @@ namespace OpenWifi {
|
|||||||
RateLimit MyRates_;
|
RateLimit MyRates_;
|
||||||
uint64_t TransactionId_;
|
uint64_t TransactionId_;
|
||||||
Poco::JSON::Object::Ptr ParsedBody_;
|
Poco::JSON::Object::Ptr ParsedBody_;
|
||||||
std::string REST_Requester_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RESTAPI_UnknownRequestHandler : public RESTAPIHandler {
|
class RESTAPI_UnknownRequestHandler : public RESTAPIHandler {
|
||||||
@@ -2738,7 +2712,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline void run() override {
|
inline void run() override {
|
||||||
Poco::AutoPtr<Poco::Notification> Note(Queue_.waitDequeueNotification());
|
Poco::AutoPtr<Poco::Notification> Note(Queue_.waitDequeueNotification());
|
||||||
Utils::SetThreadName("kafka:dispatch");
|
Utils::SetThreadName("kafka-dispatch");
|
||||||
while(Note && Running_) {
|
while(Note && Running_) {
|
||||||
auto Msg = dynamic_cast<KafkaMessage*>(Note.get());
|
auto Msg = dynamic_cast<KafkaMessage*>(Note.get());
|
||||||
if(Msg!= nullptr) {
|
if(Msg!= nullptr) {
|
||||||
@@ -2793,11 +2767,9 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline void Stop() override {
|
inline void Stop() override {
|
||||||
if(KafkaEnabled_) {
|
if(KafkaEnabled_) {
|
||||||
poco_information(Logger(),"Stopping...");
|
|
||||||
Dispatcher_.Stop();
|
Dispatcher_.Stop();
|
||||||
ProducerThr_.Stop();
|
ProducerThr_.Stop();
|
||||||
ConsumerThr_.Stop();
|
ConsumerThr_.Stop();
|
||||||
poco_information(Logger(),"Stopped...");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2875,13 +2847,12 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void Stop() override {
|
inline void Stop() override {
|
||||||
poco_information(Logger(),"Stopping...");
|
|
||||||
std::lock_guard G(Mutex_);
|
std::lock_guard G(Mutex_);
|
||||||
Cache_.clear();
|
Cache_.clear();
|
||||||
poco_information(Logger(),"Stopped...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void RemovedCachedToken(const std::string &Token) {
|
inline void RemovedCachedToken(const std::string &Token) {
|
||||||
|
std::lock_guard G(Mutex_);
|
||||||
Cache_.remove(Token);
|
Cache_.remove(Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2891,7 +2862,6 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline bool RetrieveTokenInformation(const std::string & SessionToken,
|
inline bool RetrieveTokenInformation(const std::string & SessionToken,
|
||||||
SecurityObjects::UserInfoAndPolicy & UInfo,
|
SecurityObjects::UserInfoAndPolicy & UInfo,
|
||||||
std::uint64_t TID,
|
|
||||||
bool & Expired, bool & Contacted, bool Sub=false) {
|
bool & Expired, bool & Contacted, bool Sub=false) {
|
||||||
try {
|
try {
|
||||||
Types::StringPairVec QueryData;
|
Types::StringPairVec QueryData;
|
||||||
@@ -2917,6 +2887,7 @@ namespace OpenWifi {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Expired = false;
|
Expired = false;
|
||||||
|
std::lock_guard G(Mutex_);
|
||||||
Cache_.update(SessionToken, UInfo);
|
Cache_.update(SessionToken, UInfo);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -2924,15 +2895,14 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
poco_error(Logger(),fmt::format("Failed to retrieve token={} for TID={}", SessionToken, TID));
|
|
||||||
}
|
}
|
||||||
Expired = false;
|
Expired = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsAuthorized(const std::string &SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo,
|
inline bool IsAuthorized(const std::string &SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo,
|
||||||
std::uint64_t TID,
|
|
||||||
bool & Expired, bool & Contacted, bool Sub = false) {
|
bool & Expired, bool & Contacted, bool Sub = false) {
|
||||||
|
std::lock_guard G(Mutex_);
|
||||||
auto User = Cache_.get(SessionToken);
|
auto User = Cache_.get(SessionToken);
|
||||||
if(!User.isNull()) {
|
if(!User.isNull()) {
|
||||||
if(IsTokenExpired(User->webtoken)) {
|
if(IsTokenExpired(User->webtoken)) {
|
||||||
@@ -2943,7 +2913,7 @@ namespace OpenWifi {
|
|||||||
UInfo = *User;
|
UInfo = *User;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return RetrieveTokenInformation(SessionToken, UInfo, TID, Expired, Contacted, Sub);
|
return RetrieveTokenInformation(SessionToken, UInfo, Expired, Contacted, Sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -2961,12 +2931,12 @@ namespace OpenWifi {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleRequest([[maybe_unused]] Poco::Net::HTTPServerRequest& Request, Poco::Net::HTTPServerResponse& Response) override
|
void handleRequest(Poco::Net::HTTPServerRequest& Request, Poco::Net::HTTPServerResponse& Response) override
|
||||||
{
|
{
|
||||||
Utils::SetThreadName("alb-request");
|
Utils::SetThreadName("alb-request");
|
||||||
try {
|
try {
|
||||||
if((id_ % 100) == 0) {
|
if((id_ % 100) == 0) {
|
||||||
poco_debug(Logger_,fmt::format("ALB-REQUEST({}): ALB Request {}.",
|
Logger_.debug(fmt::format("ALB-REQUEST({}): ALB Request {}.",
|
||||||
Request.clientAddress().toString(), id_));
|
Request.clientAddress().toString(), id_));
|
||||||
}
|
}
|
||||||
Response.setChunkedTransferEncoding(true);
|
Response.setChunkedTransferEncoding(true);
|
||||||
@@ -3024,10 +2994,8 @@ namespace OpenWifi {
|
|||||||
inline int Start() override;
|
inline int Start() override;
|
||||||
|
|
||||||
inline void Stop() override {
|
inline void Stop() override {
|
||||||
poco_information(Logger(),"Stopping...");
|
|
||||||
if(Running_)
|
if(Running_)
|
||||||
Server_->stopAll(true);
|
Server_->stop();
|
||||||
poco_information(Logger(),"Stopped...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -3054,32 +3022,30 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
int Start() override;
|
int Start() override;
|
||||||
inline void Stop() override {
|
inline void Stop() override {
|
||||||
Logger().information("Stopping...");
|
Logger().information("Stopping ");
|
||||||
for( const auto & svr : RESTServers_ )
|
for( const auto & svr : RESTServers_ )
|
||||||
svr->stopAll(true);
|
svr->stop();
|
||||||
Pool_.stopAll();
|
Pool_.stopAll();
|
||||||
Pool_.joinAll();
|
Pool_.joinAll();
|
||||||
RESTServers_.clear();
|
RESTServers_.clear();
|
||||||
Logger().information("Stopped...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void reinitialize(Poco::Util::Application &self) override;
|
inline void reinitialize(Poco::Util::Application &self) override;
|
||||||
|
|
||||||
inline Poco::Net::HTTPRequestHandler *CallServer(const std::string &Path, uint64_t Id) {
|
inline Poco::Net::HTTPRequestHandler *CallServer(const std::string &Path, uint64_t Id) {
|
||||||
RESTAPIHandler::BindingMap Bindings;
|
RESTAPIHandler::BindingMap Bindings;
|
||||||
Utils::SetThreadName(fmt::format("x-rest:{}",Id).c_str());
|
Utils::SetThreadName(fmt::format("rest_ext_{}",Id).c_str());
|
||||||
return RESTAPI_ExtRouter(Path, Bindings, Logger(), Server_, Id);
|
return RESTAPI_ExtRouter(Path, Bindings, Logger(), Server_, Id);
|
||||||
}
|
}
|
||||||
const Poco::ThreadPool & Pool() { return Pool_; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_;
|
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_;
|
||||||
Poco::ThreadPool Pool_{"x-rest",32,128};
|
Poco::ThreadPool Pool_;
|
||||||
RESTAPI_GenericServer Server_;
|
RESTAPI_GenericServer Server_;
|
||||||
|
|
||||||
RESTAPI_ExtServer() noexcept:
|
RESTAPI_ExtServer() noexcept:
|
||||||
SubSystemServer("RESTAPI_ExtServer", "REST-XSRV", "openwifi.restapi")
|
SubSystemServer("RESTAPI_ExtServer", "RESTAPIServer", "openwifi.restapi"),
|
||||||
|
Pool_("RESTAPI_ExtServer",4,50,120)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -3092,16 +3058,15 @@ namespace OpenWifi {
|
|||||||
inline Poco::Net::HTTPRequestHandler *createRequestHandler(const Poco::Net::HTTPServerRequest &Request) override {
|
inline Poco::Net::HTTPRequestHandler *createRequestHandler(const Poco::Net::HTTPServerRequest &Request) override {
|
||||||
try {
|
try {
|
||||||
Poco::URI uri(Request.getURI());
|
Poco::URI uri(Request.getURI());
|
||||||
auto TID = NextTransactionId_++;
|
Utils::SetThreadName(fmt::format("rest_ext_{}",TransactionId_).c_str());
|
||||||
Utils::SetThreadName(fmt::format("x-rest:{}",TID).c_str());
|
return RESTAPI_ExtServer()->CallServer(uri.getPath(), TransactionId_++);
|
||||||
return RESTAPI_ExtServer()->CallServer(uri.getPath(), TID);
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
static inline std::atomic_uint64_t NextTransactionId_ = 1;
|
static inline std::atomic_uint64_t TransactionId_ = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LogMuxer : public Poco::Channel {
|
class LogMuxer : public Poco::Channel {
|
||||||
@@ -3191,29 +3156,28 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline int Start() override;
|
inline int Start() override;
|
||||||
inline void Stop() override {
|
inline void Stop() override {
|
||||||
Logger().information("Stopping...");
|
Logger().information("Stopping ");
|
||||||
for( const auto & svr : RESTServers_ )
|
for( const auto & svr : RESTServers_ )
|
||||||
svr->stopAll(true);
|
svr->stop();
|
||||||
Pool_.stopAll();
|
Pool_.stopAll();
|
||||||
Pool_.joinAll();
|
Pool_.joinAll();
|
||||||
Logger().information("Stopped...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void reinitialize(Poco::Util::Application &self) override;
|
inline void reinitialize(Poco::Util::Application &self) override;
|
||||||
|
|
||||||
inline Poco::Net::HTTPRequestHandler *CallServer(const std::string &Path, uint64_t Id) {
|
inline Poco::Net::HTTPRequestHandler *CallServer(const std::string &Path, uint64_t Id) {
|
||||||
RESTAPIHandler::BindingMap Bindings;
|
RESTAPIHandler::BindingMap Bindings;
|
||||||
Utils::SetThreadName(fmt::format("i-rest:{}",Id).c_str());
|
Utils::SetThreadName(fmt::format("rest_int_{}",Id).c_str());
|
||||||
return RESTAPI_IntRouter(Path, Bindings, Logger(), Server_, Id);
|
return RESTAPI_IntRouter(Path, Bindings, Logger(), Server_, Id);
|
||||||
}
|
}
|
||||||
const Poco::ThreadPool & Pool() { return Pool_; }
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_;
|
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_;
|
||||||
Poco::ThreadPool Pool_{"i-rest",32,96};
|
Poco::ThreadPool Pool_;
|
||||||
RESTAPI_GenericServer Server_;
|
RESTAPI_GenericServer Server_;
|
||||||
|
|
||||||
RESTAPI_IntServer() noexcept:
|
RESTAPI_IntServer() noexcept:
|
||||||
SubSystemServer("RESTAPI_IntServer", "REST-ISRV", "openwifi.internal.restapi")
|
SubSystemServer("RESTAPI_IntServer", "REST-ISRV", "openwifi.internal.restapi"),
|
||||||
|
Pool_("RESTAPI_IntServer",4,50,120)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -3224,13 +3188,11 @@ namespace OpenWifi {
|
|||||||
public:
|
public:
|
||||||
inline IntRequestHandlerFactory() = default;
|
inline IntRequestHandlerFactory() = default;
|
||||||
inline Poco::Net::HTTPRequestHandler *createRequestHandler(const Poco::Net::HTTPServerRequest &Request) override {
|
inline Poco::Net::HTTPRequestHandler *createRequestHandler(const Poco::Net::HTTPServerRequest &Request) override {
|
||||||
auto TID=NextTransactionId_++;
|
|
||||||
Utils::SetThreadName(fmt::format("i-rest:{}",TID).c_str());
|
|
||||||
Poco::URI uri(Request.getURI());
|
Poco::URI uri(Request.getURI());
|
||||||
return RESTAPI_IntServer()->CallServer(uri.getPath(), TID);
|
return RESTAPI_IntServer()->CallServer(uri.getPath(), TransactionId_);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
static inline std::atomic_uint64_t NextTransactionId_ = 1;
|
static inline std::atomic_uint64_t TransactionId_ = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MicroServiceMeta {
|
struct MicroServiceMeta {
|
||||||
@@ -3269,6 +3231,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] std::string Version() { return Version_; }
|
[[nodiscard]] std::string Version() { return Version_; }
|
||||||
|
// [[nodiscard]] const Poco::SharedPtr<Poco::Crypto::RSAKey> & Key() { return AppKey_; }
|
||||||
[[nodiscard]] inline const std::string & DataDir() { return DataDir_; }
|
[[nodiscard]] inline const std::string & DataDir() { return DataDir_; }
|
||||||
[[nodiscard]] inline const std::string & WWWAssetsDir() { return WWWAssetsDir_; }
|
[[nodiscard]] inline const std::string & WWWAssetsDir() { return WWWAssetsDir_; }
|
||||||
[[nodiscard]] bool Debug() const { return DebugMode_; }
|
[[nodiscard]] bool Debug() const { return DebugMode_; }
|
||||||
@@ -3291,7 +3254,7 @@ namespace OpenWifi {
|
|||||||
return ((RandomEngine_() % (max-min)) + min);
|
return ((RandomEngine_() % (max-min)) + min);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* inline Poco::Logger & GetLogger(const std::string &Name) {
|
inline Poco::Logger & GetLogger(const std::string &Name) {
|
||||||
static auto initialized = false;
|
static auto initialized = false;
|
||||||
|
|
||||||
if(!initialized) {
|
if(!initialized) {
|
||||||
@@ -3300,11 +3263,6 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
return Poco::Logger::get(Name);
|
return Poco::Logger::get(Name);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
virtual void GetExtraConfiguration(Poco::JSON::Object & Cfg) {
|
|
||||||
Cfg.set("additionalConfiguration",false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline void Exit(int Reason);
|
static inline void Exit(int Reason);
|
||||||
inline void BusMessageReceived(const std::string &Key, const std::string & Payload);
|
inline void BusMessageReceived(const std::string &Key, const std::string & Payload);
|
||||||
@@ -3342,6 +3300,7 @@ namespace OpenWifi {
|
|||||||
inline std::string ConfigPath(const std::string &Key);
|
inline std::string ConfigPath(const std::string &Key);
|
||||||
inline std::string Encrypt(const std::string &S);
|
inline std::string Encrypt(const std::string &S);
|
||||||
inline std::string Decrypt(const std::string &S);
|
inline std::string Decrypt(const std::string &S);
|
||||||
|
inline std::string CreateHash(const std::string &S);
|
||||||
inline std::string MakeSystemEventMessage( const std::string & Type ) const;
|
inline std::string MakeSystemEventMessage( const std::string & Type ) const;
|
||||||
[[nodiscard]] inline bool IsValidAPIKEY(const Poco::Net::HTTPServerRequest &Request);
|
[[nodiscard]] inline bool IsValidAPIKEY(const Poco::Net::HTTPServerRequest &Request);
|
||||||
inline static void SavePID();
|
inline static void SavePID();
|
||||||
@@ -3371,9 +3330,6 @@ namespace OpenWifi {
|
|||||||
return Signer_.sign(T,Algo);
|
return Signer_.sign(T,Algo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Poco::ThreadPool & TimerPool() { return TimerPool_; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static MicroService * instance_;
|
static MicroService * instance_;
|
||||||
bool HelpRequested_ = false;
|
bool HelpRequested_ = false;
|
||||||
@@ -3387,12 +3343,14 @@ namespace OpenWifi {
|
|||||||
std::string WWWAssetsDir_;
|
std::string WWWAssetsDir_;
|
||||||
Poco::Crypto::CipherFactory & CipherFactory_ = Poco::Crypto::CipherFactory::defaultFactory();
|
Poco::Crypto::CipherFactory & CipherFactory_ = Poco::Crypto::CipherFactory::defaultFactory();
|
||||||
Poco::Crypto::Cipher * Cipher_ = nullptr;
|
Poco::Crypto::Cipher * Cipher_ = nullptr;
|
||||||
|
Poco::SHA2Engine SHA2_;
|
||||||
MicroServiceMetaMap Services_;
|
MicroServiceMetaMap Services_;
|
||||||
std::string MyHash_;
|
std::string MyHash_;
|
||||||
std::string MyPrivateEndPoint_;
|
std::string MyPrivateEndPoint_;
|
||||||
std::string MyPublicEndPoint_;
|
std::string MyPublicEndPoint_;
|
||||||
std::string UIURI_;
|
std::string UIURI_;
|
||||||
std::string Version_{ OW_VERSION::VERSION + "("+ OW_VERSION::BUILD + ")" + " - " + OW_VERSION::HASH };
|
std::string Version_{ OW_VERSION::VERSION + "("+ OW_VERSION::BUILD + ")" + " - " + OW_VERSION::HASH };
|
||||||
|
BusEventManager BusEventManager_;
|
||||||
std::recursive_mutex InfraMutex_;
|
std::recursive_mutex InfraMutex_;
|
||||||
std::default_random_engine RandomEngine_;
|
std::default_random_engine RandomEngine_;
|
||||||
Poco::Util::PropertyFileConfiguration * PropConfigurationFile_ = nullptr;
|
Poco::Util::PropertyFileConfiguration * PropConfigurationFile_ = nullptr;
|
||||||
@@ -3406,8 +3364,6 @@ namespace OpenWifi {
|
|||||||
bool NoBuiltInCrypto_=false;
|
bool NoBuiltInCrypto_=false;
|
||||||
Poco::JWT::Signer Signer_;
|
Poco::JWT::Signer Signer_;
|
||||||
Poco::Logger &Logger_;
|
Poco::Logger &Logger_;
|
||||||
Poco::ThreadPool TimerPool_{"timer:pool",2,16};
|
|
||||||
std::unique_ptr<BusEventManager> BusEventManager_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void MicroService::Exit(int Reason) {
|
inline void MicroService::Exit(int Reason) {
|
||||||
@@ -3488,7 +3444,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (const Poco::Exception &E) {
|
} catch (const Poco::Exception &E) {
|
||||||
logger().log(E);
|
Logger_.log(E);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3557,7 +3513,7 @@ namespace OpenWifi {
|
|||||||
MyPrivateEndPoint_ = ConfigGetString("openwifi.system.uri.private");
|
MyPrivateEndPoint_ = ConfigGetString("openwifi.system.uri.private");
|
||||||
MyPublicEndPoint_ = ConfigGetString("openwifi.system.uri.public");
|
MyPublicEndPoint_ = ConfigGetString("openwifi.system.uri.public");
|
||||||
UIURI_ = ConfigGetString("openwifi.system.uri.ui");
|
UIURI_ = ConfigGetString("openwifi.system.uri.ui");
|
||||||
MyHash_ = Utils::ComputeHash(MyPublicEndPoint_);
|
MyHash_ = CreateHash(MyPublicEndPoint_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MicroServicePostInitialization();
|
void MicroServicePostInitialization();
|
||||||
@@ -3571,7 +3527,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
auto LoggingDestination = MicroService::instance().ConfigGetString("logging.type", "file");
|
auto LoggingDestination = MicroService::instance().ConfigGetString("logging.type", "file");
|
||||||
auto LoggingFormat = MicroService::instance().ConfigGetString("logging.format",
|
auto LoggingFormat = MicroService::instance().ConfigGetString("logging.format",
|
||||||
"%Y-%m-%d %H:%M:%S.%i %s: [%p][thr:%I] %t");
|
"%Y-%m-%d %H:%M:%S %s: [%p] %t");
|
||||||
if (LoggingDestination == "console") {
|
if (LoggingDestination == "console") {
|
||||||
Poco::AutoPtr<Poco::ConsoleChannel> Console(new Poco::ConsoleChannel);
|
Poco::AutoPtr<Poco::ConsoleChannel> Console(new Poco::ConsoleChannel);
|
||||||
Poco::AutoPtr<Poco::AsyncChannel> Async(new Poco::AsyncChannel(Console));
|
Poco::AutoPtr<Poco::AsyncChannel> Async(new Poco::AsyncChannel(Console));
|
||||||
@@ -3620,6 +3576,8 @@ namespace OpenWifi {
|
|||||||
void DaemonPostInitialization(Poco::Util::Application &self);
|
void DaemonPostInitialization(Poco::Util::Application &self);
|
||||||
|
|
||||||
inline void MicroService::initialize(Poco::Util::Application &self) {
|
inline void MicroService::initialize(Poco::Util::Application &self) {
|
||||||
|
// Utils::SetThreadName("microservice");
|
||||||
|
|
||||||
// add the default services
|
// add the default services
|
||||||
LoadConfigurationFile();
|
LoadConfigurationFile();
|
||||||
InitializeLoggingSystem();
|
InitializeLoggingSystem();
|
||||||
@@ -3628,9 +3586,7 @@ namespace OpenWifi {
|
|||||||
SubSystems_.push_back(ALBHealthCheckServer());
|
SubSystems_.push_back(ALBHealthCheckServer());
|
||||||
SubSystems_.push_back(RESTAPI_ExtServer());
|
SubSystems_.push_back(RESTAPI_ExtServer());
|
||||||
SubSystems_.push_back(RESTAPI_IntServer());
|
SubSystems_.push_back(RESTAPI_IntServer());
|
||||||
#ifndef TIP_SECURITY_SERVICE
|
|
||||||
SubSystems_.push_back(AuthClient());
|
|
||||||
#endif
|
|
||||||
Poco::Net::initializeSSL();
|
Poco::Net::initializeSSL();
|
||||||
Poco::Net::HTTPStreamFactory::registerFactory();
|
Poco::Net::HTTPStreamFactory::registerFactory();
|
||||||
Poco::Net::HTTPSStreamFactory::registerFactory();
|
Poco::Net::HTTPSStreamFactory::registerFactory();
|
||||||
@@ -3741,23 +3697,21 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void MicroService::InitializeSubSystemServers() {
|
inline void MicroService::InitializeSubSystemServers() {
|
||||||
for(auto i:SubSystems_) {
|
for(auto i:SubSystems_)
|
||||||
addSubsystem(i);
|
addSubsystem(i);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
inline void MicroService::StartSubSystemServers() {
|
inline void MicroService::StartSubSystemServers() {
|
||||||
AddActivity("Starting");
|
AddActivity("Starting");
|
||||||
for(auto i:SubSystems_) {
|
for(auto i:SubSystems_) {
|
||||||
i->Start();
|
i->Start();
|
||||||
}
|
}
|
||||||
BusEventManager_ = std::make_unique<BusEventManager>(Poco::Logger::create("BusEventManager",Poco::Logger::root().getChannel(),Poco::Logger::root().getLevel()));
|
BusEventManager_.Start();
|
||||||
BusEventManager_->Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MicroService::StopSubSystemServers() {
|
inline void MicroService::StopSubSystemServers() {
|
||||||
AddActivity("Stopping");
|
AddActivity("Stopping");
|
||||||
BusEventManager_->Stop();
|
BusEventManager_.Stop();
|
||||||
for(auto i=SubSystems_.rbegin(); i!=SubSystems_.rend(); ++i) {
|
for(auto i=SubSystems_.rbegin(); i!=SubSystems_.rend(); ++i) {
|
||||||
(*i)->Stop();
|
(*i)->Stop();
|
||||||
}
|
}
|
||||||
@@ -3898,6 +3852,11 @@ namespace OpenWifi {
|
|||||||
return Cipher_->decryptString(S, Poco::Crypto::Cipher::Cipher::ENC_BASE64);;
|
return Cipher_->decryptString(S, Poco::Crypto::Cipher::Cipher::ENC_BASE64);;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline std::string MicroService::CreateHash(const std::string &S) {
|
||||||
|
SHA2_.update(S);
|
||||||
|
return Utils::ToHex(SHA2_.digest());
|
||||||
|
}
|
||||||
|
|
||||||
inline std::string MicroService::MakeSystemEventMessage( const std::string & Type ) const {
|
inline std::string MicroService::MakeSystemEventMessage( const std::string & Type ) const {
|
||||||
Poco::JSON::Object Obj;
|
Poco::JSON::Object Obj;
|
||||||
Obj.set(KafkaTopics::ServiceEvents::Fields::EVENT,Type);
|
Obj.set(KafkaTopics::ServiceEvents::Fields::EVENT,Type);
|
||||||
@@ -3934,15 +3893,14 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline SubSystemServer::SubSystemServer(const std::string &Name, const std::string &LoggingPrefix,
|
inline SubSystemServer::SubSystemServer(std::string Name, const std::string &LoggingPrefix,
|
||||||
const std::string &SubSystemConfigPrefix):
|
std::string SubSystemConfigPrefix):
|
||||||
Name_(Name),
|
Name_(std::move(Name)),
|
||||||
LoggerPrefix_(LoggingPrefix),
|
LoggerPrefix_(LoggingPrefix),
|
||||||
SubSystemConfigPrefix_(SubSystemConfigPrefix) {
|
SubSystemConfigPrefix_(std::move(SubSystemConfigPrefix)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int RESTAPI_ExtServer::Start() {
|
inline int RESTAPI_ExtServer::Start() {
|
||||||
Logger().information("Starting.");
|
|
||||||
Server_.InitLogging();
|
Server_.InitLogging();
|
||||||
|
|
||||||
for(const auto & Svr: ConfigServersList_) {
|
for(const auto & Svr: ConfigServersList_) {
|
||||||
@@ -3958,8 +3916,9 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Poco::Net::HTTPServerParams::Ptr Params = new Poco::Net::HTTPServerParams;
|
Poco::Net::HTTPServerParams::Ptr Params = new Poco::Net::HTTPServerParams;
|
||||||
|
Params->setMaxThreads(50);
|
||||||
|
Params->setMaxQueued(200);
|
||||||
Params->setKeepAlive(true);
|
Params->setKeepAlive(true);
|
||||||
Params->setName("ws:xrest");
|
|
||||||
|
|
||||||
std::unique_ptr<Poco::Net::HTTPServer> NewServer;
|
std::unique_ptr<Poco::Net::HTTPServer> NewServer;
|
||||||
if(MicroService::instance().NoAPISecurity()) {
|
if(MicroService::instance().NoAPISecurity()) {
|
||||||
@@ -3972,6 +3931,7 @@ namespace OpenWifi {
|
|||||||
NewServer->start();
|
NewServer->start();
|
||||||
RESTServers_.push_back(std::move(NewServer));
|
RESTServers_.push_back(std::move(NewServer));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3992,8 +3952,9 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto Params = new Poco::Net::HTTPServerParams;
|
auto Params = new Poco::Net::HTTPServerParams;
|
||||||
|
Params->setMaxThreads(50);
|
||||||
|
Params->setMaxQueued(200);
|
||||||
Params->setKeepAlive(true);
|
Params->setKeepAlive(true);
|
||||||
Params->setName("ws:irest");
|
|
||||||
|
|
||||||
std::unique_ptr<Poco::Net::HTTPServer> NewServer;
|
std::unique_ptr<Poco::Net::HTTPServer> NewServer;
|
||||||
if(MicroService::instance().NoAPISecurity()) {
|
if(MicroService::instance().NoAPISecurity()) {
|
||||||
@@ -4011,7 +3972,9 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline int MicroService::main([[maybe_unused]] const ArgVec &args) {
|
inline int MicroService::main([[maybe_unused]] const ArgVec &args) {
|
||||||
MicroServiceErrorHandler ErrorHandler(*this);
|
|
||||||
|
// Utils::SetThreadName("main");
|
||||||
|
MyErrorHandler ErrorHandler(*this);
|
||||||
Poco::ErrorHandler::set(&ErrorHandler);
|
Poco::ErrorHandler::set(&ErrorHandler);
|
||||||
|
|
||||||
if (!HelpRequested_) {
|
if (!HelpRequested_) {
|
||||||
@@ -4059,11 +4022,7 @@ namespace OpenWifi {
|
|||||||
auto i = 0;
|
auto i = 0;
|
||||||
bool good = true;
|
bool good = true;
|
||||||
|
|
||||||
auto NewLevel = MicroService::instance().ConfigGetString("logging.level." + Name_, "");
|
Log_ = std::make_unique<LoggerWrapper>(Poco::Logger::get(LoggerPrefix_));
|
||||||
if(NewLevel.empty())
|
|
||||||
Logger_ = std::make_unique<LoggerWrapper>(Poco::Logger::create(LoggerPrefix_, Poco::Logger::root().getChannel(), Poco::Logger::root().getLevel()));
|
|
||||||
else
|
|
||||||
Logger_ = std::make_unique<LoggerWrapper>(Poco::Logger::create(LoggerPrefix_, Poco::Logger::root().getChannel(), Poco::Logger::parseLevel(NewLevel)));
|
|
||||||
|
|
||||||
ConfigServersList_.clear();
|
ConfigServersList_.clear();
|
||||||
while (good) {
|
while (good) {
|
||||||
@@ -4121,7 +4080,6 @@ namespace OpenWifi {
|
|||||||
Port_ = (int)MicroService::instance().ConfigGetInt("alb.port",15015);
|
Port_ = (int)MicroService::instance().ConfigGetInt("alb.port",15015);
|
||||||
Socket_ = std::make_unique<Poco::Net::ServerSocket>(Port_);
|
Socket_ = std::make_unique<Poco::Net::ServerSocket>(Port_);
|
||||||
auto Params = new Poco::Net::HTTPServerParams;
|
auto Params = new Poco::Net::HTTPServerParams;
|
||||||
Params->setName("ws:alb");
|
|
||||||
Server_ = std::make_unique<Poco::Net::HTTPServer>(new ALBRequestHandlerFactory(Logger()), *Socket_, Params);
|
Server_ = std::make_unique<Poco::Net::HTTPServer>(new ALBRequestHandlerFactory(Logger()), *Socket_, Params);
|
||||||
Server_->start();
|
Server_->start();
|
||||||
}
|
}
|
||||||
@@ -4131,7 +4089,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline void BusEventManager::run() {
|
inline void BusEventManager::run() {
|
||||||
Running_ = true;
|
Running_ = true;
|
||||||
Utils::SetThreadName("fmwk:EventMgr");
|
Utils::SetThreadName("BusEventManager");
|
||||||
auto Msg = MicroService::instance().MakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_JOIN);
|
auto Msg = MicroService::instance().MakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_JOIN);
|
||||||
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS,MicroService::instance().PrivateEndPoint(),Msg, false);
|
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS,MicroService::instance().PrivateEndPoint(),Msg, false);
|
||||||
while(Running_) {
|
while(Running_) {
|
||||||
@@ -4153,11 +4111,9 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline void BusEventManager::Stop() {
|
inline void BusEventManager::Stop() {
|
||||||
if(KafkaManager()->Enabled()) {
|
if(KafkaManager()->Enabled()) {
|
||||||
poco_information(Logger(),"Stopping...");
|
|
||||||
Running_ = false;
|
Running_ = false;
|
||||||
Thread_.wakeUp();
|
Thread_.wakeUp();
|
||||||
Thread_.join();
|
Thread_.join();
|
||||||
poco_information(Logger(),"Stopped...");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4169,37 +4125,37 @@ namespace OpenWifi {
|
|||||||
inline void KafkaLoggerFun([[maybe_unused]] cppkafka::KafkaHandleBase & handle, int level, const std::string & facility, const std::string &message) {
|
inline void KafkaLoggerFun([[maybe_unused]] cppkafka::KafkaHandleBase & handle, int level, const std::string & facility, const std::string &message) {
|
||||||
switch ((cppkafka::LogLevel) level) {
|
switch ((cppkafka::LogLevel) level) {
|
||||||
case cppkafka::LogLevel::LogNotice: {
|
case cppkafka::LogLevel::LogNotice: {
|
||||||
poco_notice(KafkaManager()->Logger(),fmt::format("kafka-log: facility: {} message: {}",facility, message));
|
KafkaManager()->Logger().notice(fmt::format("kafka-log: facility: {} message: {}",facility, message));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case cppkafka::LogLevel::LogDebug: {
|
case cppkafka::LogLevel::LogDebug: {
|
||||||
poco_debug(KafkaManager()->Logger(),fmt::format("kafka-log: facility: {} message: {}",facility, message));
|
KafkaManager()->Logger().debug(fmt::format("kafka-log: facility: {} message: {}",facility, message));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case cppkafka::LogLevel::LogInfo: {
|
case cppkafka::LogLevel::LogInfo: {
|
||||||
poco_information(KafkaManager()->Logger(),fmt::format("kafka-log: facility: {} message: {}",facility, message));
|
KafkaManager()->Logger().information(fmt::format("kafka-log: facility: {} message: {}",facility, message));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case cppkafka::LogLevel::LogWarning: {
|
case cppkafka::LogLevel::LogWarning: {
|
||||||
poco_warning(KafkaManager()->Logger(), fmt::format("kafka-log: facility: {} message: {}",facility, message));
|
KafkaManager()->Logger().warning(fmt::format("kafka-log: facility: {} message: {}",facility, message));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case cppkafka::LogLevel::LogAlert:
|
case cppkafka::LogLevel::LogAlert:
|
||||||
case cppkafka::LogLevel::LogCrit: {
|
case cppkafka::LogLevel::LogCrit: {
|
||||||
poco_critical(KafkaManager()->Logger(),fmt::format("kafka-log: facility: {} message: {}",facility, message));
|
KafkaManager()->Logger().critical(fmt::format("kafka-log: facility: {} message: {}",facility, message));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case cppkafka::LogLevel::LogErr:
|
case cppkafka::LogLevel::LogErr:
|
||||||
case cppkafka::LogLevel::LogEmerg:
|
case cppkafka::LogLevel::LogEmerg:
|
||||||
default: {
|
default: {
|
||||||
poco_error(KafkaManager()->Logger(),fmt::format("kafka-log: facility: {} message: {}",facility, message));
|
KafkaManager()->Logger().error(fmt::format("kafka-log: facility: {} message: {}",facility, message));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void KafkaErrorFun([[maybe_unused]] cppkafka::KafkaHandleBase & handle, int error, const std::string &reason) {
|
inline void KafkaErrorFun([[maybe_unused]] cppkafka::KafkaHandleBase & handle, int error, const std::string &reason) {
|
||||||
poco_error(KafkaManager()->Logger(),fmt::format("kafka-error: {}, reason: {}", error, reason));
|
KafkaManager()->Logger().error(fmt::format("kafka-error: {}, reason: {}", error, reason));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void AddKafkaSecurity(cppkafka::Configuration & Config) {
|
inline void AddKafkaSecurity(cppkafka::Configuration & Config) {
|
||||||
@@ -4220,7 +4176,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline void KafkaProducer::run() {
|
inline void KafkaProducer::run() {
|
||||||
|
|
||||||
Utils::SetThreadName("Kafka:Prod");
|
Utils::SetThreadName("KafkaProducer");
|
||||||
cppkafka::Configuration Config({
|
cppkafka::Configuration Config({
|
||||||
{ "client.id", MicroService::instance().ConfigGetString("openwifi.kafka.client.id") },
|
{ "client.id", MicroService::instance().ConfigGetString("openwifi.kafka.client.id") },
|
||||||
{ "metadata.broker.list", MicroService::instance().ConfigGetString("openwifi.kafka.brokerlist") }
|
{ "metadata.broker.list", MicroService::instance().ConfigGetString("openwifi.kafka.brokerlist") }
|
||||||
@@ -4248,18 +4204,18 @@ namespace OpenWifi {
|
|||||||
cppkafka::MessageBuilder(Msg->Topic()).key(Msg->Key()).payload(Msg->Payload()));
|
cppkafka::MessageBuilder(Msg->Topic()).key(Msg->Key()).payload(Msg->Payload()));
|
||||||
}
|
}
|
||||||
} catch (const cppkafka::HandleException &E) {
|
} catch (const cppkafka::HandleException &E) {
|
||||||
poco_warning(KafkaManager()->Logger(),fmt::format("Caught a Kafka exception (producer): {}", E.what()));
|
KafkaManager()->Logger().warning(fmt::format("Caught a Kafka exception (producer): {}", E.what()));
|
||||||
} catch( const Poco::Exception &E) {
|
} catch( const Poco::Exception &E) {
|
||||||
KafkaManager()->Logger().log(E);
|
KafkaManager()->Logger().log(E);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
poco_error(KafkaManager()->Logger(),"std::exception");
|
KafkaManager()->Logger().error("std::exception");
|
||||||
}
|
}
|
||||||
Note = Queue_.waitDequeueNotification();
|
Note = Queue_.waitDequeueNotification();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void KafkaConsumer::run() {
|
inline void KafkaConsumer::run() {
|
||||||
Utils::SetThreadName("Kafka:Cons");
|
Utils::SetThreadName("KafkaConsumer");
|
||||||
|
|
||||||
cppkafka::Configuration Config({
|
cppkafka::Configuration Config({
|
||||||
{ "client.id", MicroService::instance().ConfigGetString("openwifi.kafka.client.id") },
|
{ "client.id", MicroService::instance().ConfigGetString("openwifi.kafka.client.id") },
|
||||||
@@ -4312,7 +4268,7 @@ namespace OpenWifi {
|
|||||||
continue;
|
continue;
|
||||||
if (Msg.get_error()) {
|
if (Msg.get_error()) {
|
||||||
if (!Msg.is_eof()) {
|
if (!Msg.is_eof()) {
|
||||||
poco_error(KafkaManager()->Logger(),fmt::format("Error: {}", Msg.get_error().to_string()));
|
KafkaManager()->Logger().error(fmt::format("Error: {}", Msg.get_error().to_string()));
|
||||||
}
|
}
|
||||||
if(!AutoCommit)
|
if(!AutoCommit)
|
||||||
Consumer.async_commit(Msg);
|
Consumer.async_commit(Msg);
|
||||||
@@ -4323,11 +4279,11 @@ namespace OpenWifi {
|
|||||||
Consumer.async_commit(Msg);
|
Consumer.async_commit(Msg);
|
||||||
}
|
}
|
||||||
} catch (const cppkafka::HandleException &E) {
|
} catch (const cppkafka::HandleException &E) {
|
||||||
poco_warning(KafkaManager()->Logger(),fmt::format("Caught a Kafka exception (consumer): {}", E.what()));
|
KafkaManager()->Logger().warning(fmt::format("Caught a Kafka exception (consumer): {}", E.what()));
|
||||||
} catch (const Poco::Exception &E) {
|
} catch (const Poco::Exception &E) {
|
||||||
KafkaManager()->Logger().log(E);
|
KafkaManager()->Logger().log(E);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
poco_error(KafkaManager()->Logger(),"std::exception");
|
KafkaManager()->Logger().error("std::exception");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Consumer.unsubscribe();
|
Consumer.unsubscribe();
|
||||||
@@ -4399,11 +4355,6 @@ namespace OpenWifi {
|
|||||||
Answer.set("certificates", Certificates);
|
Answer.set("certificates", Certificates);
|
||||||
return ReturnObject(Answer);
|
return ReturnObject(Answer);
|
||||||
}
|
}
|
||||||
if(GetBoolParameter("extraConfiguration")) {
|
|
||||||
Poco::JSON::Object Answer;
|
|
||||||
MicroService::instance().GetExtraConfiguration(Answer);
|
|
||||||
return ReturnObject(Answer);
|
|
||||||
}
|
|
||||||
BadRequest(RESTAPI::Errors::InvalidCommand);
|
BadRequest(RESTAPI::Errors::InvalidCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4771,27 +4722,22 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TIP_SECURITY_SERVICE
|
#ifdef TIP_SECURITY_SERVICE
|
||||||
[[nodiscard]] bool AuthServiceIsAuthorized(Poco::Net::HTTPServerRequest & Request,std::string &SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo, std::uint64_t TID, bool & Expired , bool Sub );
|
[[nodiscard]] bool AuthServiceIsAuthorized(Poco::Net::HTTPServerRequest & Request,std::string &SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo, bool & Expired , bool Sub );
|
||||||
#endif
|
#endif
|
||||||
inline bool RESTAPIHandler::IsAuthorized( bool & Expired , [[maybe_unused]] bool & Contacted , bool Sub ) {
|
inline bool RESTAPIHandler::IsAuthorized( bool & Expired , [[maybe_unused]] bool & Contacted , bool Sub ) {
|
||||||
if(Internal_ && Request->has("X-INTERNAL-NAME")) {
|
if(Internal_ && Request->has("X-INTERNAL-NAME")) {
|
||||||
auto Allowed = MicroService::instance().IsValidAPIKEY(*Request);
|
auto Allowed = MicroService::instance().IsValidAPIKEY(*Request);
|
||||||
Contacted = true;
|
|
||||||
if(!Allowed) {
|
if(!Allowed) {
|
||||||
if(Server_.LogBadTokens(false)) {
|
if(Server_.LogBadTokens(false)) {
|
||||||
poco_debug(Logger_,fmt::format("I-REQ-DENIED({}): TID={} Method={} Path={}",
|
Logger_.debug(fmt::format("I-REQ-DENIED({}): Method={} Path={}",
|
||||||
Utils::FormatIPv6(Request->clientAddress().toString()),
|
Utils::FormatIPv6(Request->clientAddress().toString()),
|
||||||
TransactionId_,
|
|
||||||
Request->getMethod(), Request->getURI()));
|
Request->getMethod(), Request->getURI()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto Id = Request->get("X-INTERNAL-NAME", "unknown");
|
auto Id = Request->get("X-INTERNAL-NAME", "unknown");
|
||||||
REST_Requester_ = Id;
|
|
||||||
if(Server_.LogIt(Request->getMethod(),true)) {
|
if(Server_.LogIt(Request->getMethod(),true)) {
|
||||||
poco_debug(Logger_,fmt::format("I-REQ-ALLOWED({}): TID={} User='{}' Method={} Path={}",
|
Logger_.debug(fmt::format("I-REQ-ALLOWED({}): User='{}' Method={} Path={}",
|
||||||
Utils::FormatIPv6(Request->clientAddress().toString()),
|
Utils::FormatIPv6(Request->clientAddress().toString()), Id,
|
||||||
TransactionId_,
|
|
||||||
Id,
|
|
||||||
Request->getMethod(), Request->getURI()));
|
Request->getMethod(), Request->getURI()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4808,15 +4754,13 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef TIP_SECURITY_SERVICE
|
#ifdef TIP_SECURITY_SERVICE
|
||||||
if (AuthServiceIsAuthorized(*Request, SessionToken_, UserInfo_, TransactionId_, Expired, Sub)) {
|
if (AuthServiceIsAuthorized(*Request, SessionToken_, UserInfo_, Expired, Sub)) {
|
||||||
#else
|
#else
|
||||||
if (AuthClient()->IsAuthorized( SessionToken_, UserInfo_, TransactionId_, Expired, Contacted, Sub)) {
|
if (AuthClient()->IsAuthorized( SessionToken_, UserInfo_, Expired, Contacted, Sub)) {
|
||||||
#endif
|
#endif
|
||||||
REST_Requester_ = UserInfo_.userinfo.email;
|
|
||||||
if(Server_.LogIt(Request->getMethod(),true)) {
|
if(Server_.LogIt(Request->getMethod(),true)) {
|
||||||
poco_debug(Logger_,fmt::format("X-REQ-ALLOWED({}): TID={} User='{}@{}' Method={} Path={}",
|
Logger_.debug(fmt::format("X-REQ-ALLOWED({}): User='{}@{}' Method={} Path={}",
|
||||||
UserInfo_.userinfo.email,
|
UserInfo_.userinfo.email,
|
||||||
TransactionId_,
|
|
||||||
Utils::FormatIPv6(Request->clientAddress().toString()),
|
Utils::FormatIPv6(Request->clientAddress().toString()),
|
||||||
Request->clientAddress().toString(),
|
Request->clientAddress().toString(),
|
||||||
Request->getMethod(),
|
Request->getMethod(),
|
||||||
@@ -4825,11 +4769,9 @@ namespace OpenWifi {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if(Server_.LogBadTokens(true)) {
|
if(Server_.LogBadTokens(true)) {
|
||||||
poco_debug(Logger_,fmt::format("X-REQ-DENIED({}): TID={} Method={} Path={}",
|
Logger_.debug(fmt::format("X-REQ-DENIED({}): Method={} Path={}",
|
||||||
Utils::FormatIPv6(Request->clientAddress().toString()),
|
Utils::FormatIPv6(Request->clientAddress().toString()),
|
||||||
TransactionId_,
|
Request->getMethod(), Request->getURI()));
|
||||||
Request->getMethod(),
|
|
||||||
Request->getURI()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -4898,7 +4840,7 @@ namespace OpenWifi {
|
|||||||
void run() override;
|
void run() override;
|
||||||
// MyParallelSocketReactor &ReactorPool();
|
// MyParallelSocketReactor &ReactorPool();
|
||||||
Poco::Net::SocketReactor & Reactor() { return Reactor_; }
|
Poco::Net::SocketReactor & Reactor() { return Reactor_; }
|
||||||
void NewClient(Poco::Net::WebSocket &WS, const std::string &Id, const std::string &UserName);
|
void NewClient(Poco::Net::WebSocket &WS, const std::string &Id);
|
||||||
bool Register(WebSocketClient *Client, const std::string &Id);
|
bool Register(WebSocketClient *Client, const std::string &Id);
|
||||||
void SetProcessor(WebSocketClientProcessor *F);
|
void SetProcessor(WebSocketClientProcessor *F);
|
||||||
void UnRegister(const std::string &Id);
|
void UnRegister(const std::string &Id);
|
||||||
@@ -4949,10 +4891,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
class WebSocketClient {
|
class WebSocketClient {
|
||||||
public:
|
public:
|
||||||
explicit WebSocketClient(Poco::Net::WebSocket &WS,
|
explicit WebSocketClient(Poco::Net::WebSocket &WS, const std::string &Id, Poco::Logger &L,
|
||||||
const std::string &Id,
|
|
||||||
const std::string &UserName,
|
|
||||||
Poco::Logger &L,
|
|
||||||
WebSocketClientProcessor *Processor);
|
WebSocketClientProcessor *Processor);
|
||||||
virtual ~WebSocketClient();
|
virtual ~WebSocketClient();
|
||||||
[[nodiscard]] inline const std::string &Id();
|
[[nodiscard]] inline const std::string &Id();
|
||||||
@@ -4962,9 +4901,8 @@ namespace OpenWifi {
|
|||||||
std::unique_ptr<Poco::Net::WebSocket> WS_;
|
std::unique_ptr<Poco::Net::WebSocket> WS_;
|
||||||
Poco::Net::SocketReactor &Reactor_;
|
Poco::Net::SocketReactor &Reactor_;
|
||||||
std::string Id_;
|
std::string Id_;
|
||||||
std::string UserName_;
|
|
||||||
Poco::Logger &Logger_;
|
Poco::Logger &Logger_;
|
||||||
std::atomic_bool Authenticated_ = false;
|
bool Authenticated_ = false;
|
||||||
SecurityObjects::UserInfoAndPolicy UserInfo_;
|
SecurityObjects::UserInfoAndPolicy UserInfo_;
|
||||||
WebSocketClientProcessor *Processor_ = nullptr;
|
WebSocketClientProcessor *Processor_ = nullptr;
|
||||||
void OnSocketReadable(const Poco::AutoPtr<Poco::Net::ReadableNotification> &pNf);
|
void OnSocketReadable(const Poco::AutoPtr<Poco::Net::ReadableNotification> &pNf);
|
||||||
@@ -4972,9 +4910,33 @@ namespace OpenWifi {
|
|||||||
void OnSocketError(const Poco::AutoPtr<Poco::Net::ErrorNotification> &pNf);
|
void OnSocketError(const Poco::AutoPtr<Poco::Net::ErrorNotification> &pNf);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void WebSocketClientServer::NewClient(Poco::Net::WebSocket & WS, const std::string &Id, const std::string &UserName ) {
|
/* inline MyParallelSocketReactor::MyParallelSocketReactor(uint32_t NumReactors) :
|
||||||
|
NumReactors_(NumReactors)
|
||||||
|
{
|
||||||
|
Reactors_ = new Poco::Net::SocketReactor[NumReactors_];
|
||||||
|
for(uint32_t i=0;i<NumReactors_;i++) {
|
||||||
|
ReactorPool_.start(Reactors_[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline MyParallelSocketReactor::~MyParallelSocketReactor() {
|
||||||
|
for(uint32_t i=0;i<NumReactors_;i++) {
|
||||||
|
Reactors_[i].stop();
|
||||||
|
}
|
||||||
|
ReactorPool_.stopAll();
|
||||||
|
ReactorPool_.joinAll();
|
||||||
|
delete [] Reactors_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Poco::Net::SocketReactor & MyParallelSocketReactor::Reactor() {
|
||||||
|
return Reactors_[ rand() % NumReactors_ ];
|
||||||
|
}
|
||||||
|
|
||||||
|
// inline MyParallelSocketReactor & WebSocketClientServer::ReactorPool() { return *ReactorPool_; }
|
||||||
|
*/
|
||||||
|
inline void WebSocketClientServer::NewClient(Poco::Net::WebSocket & WS, const std::string &Id) {
|
||||||
std::lock_guard G(Mutex_);
|
std::lock_guard G(Mutex_);
|
||||||
auto Client = new WebSocketClient(WS,Id,UserName,Logger(), Processor_);
|
auto Client = new WebSocketClient(WS,Id,Logger(), Processor_);
|
||||||
Clients_[Id] = std::make_pair(Client,"");
|
Clients_[Id] = std::make_pair(Client,"");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5004,13 +4966,13 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
[[nodiscard]] inline bool SendToUser(const std::string &userName, const std::string &Payload);
|
[[nodiscard]] inline bool SendToUser(const std::string &userName, const std::string &Payload);
|
||||||
inline WebSocketClientServer::WebSocketClientServer() noexcept:
|
inline WebSocketClientServer::WebSocketClientServer() noexcept:
|
||||||
SubSystemServer("WebSocketClientServer", "UI-WSCLNT-SVR", "websocketclients")
|
SubSystemServer("WebSocketClientServer", "WSCLNT-SVR", "websocketclients")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void WebSocketClientServer::run() {
|
inline void WebSocketClientServer::run() {
|
||||||
Running_ = true ;
|
Running_ = true ;
|
||||||
Utils::SetThreadName("ws:uiclnt-svr");
|
Utils::SetThreadName("ws:clnt-svr");
|
||||||
while(Running_) {
|
while(Running_) {
|
||||||
Poco::Thread::trySleep(2000);
|
Poco::Thread::trySleep(2000);
|
||||||
|
|
||||||
@@ -5091,7 +5053,6 @@ namespace OpenWifi {
|
|||||||
auto Op = flags & Poco::Net::WebSocket::FRAME_OP_BITMASK;
|
auto Op = flags & Poco::Net::WebSocket::FRAME_OP_BITMASK;
|
||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
poco_debug(Logger(),fmt::format("CLOSE({}): {} UI Client is closing WS connection.", Id_, UserName_));
|
|
||||||
return delete this;
|
return delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5104,7 +5065,7 @@ namespace OpenWifi {
|
|||||||
case Poco::Net::WebSocket::FRAME_OP_PONG: {
|
case Poco::Net::WebSocket::FRAME_OP_PONG: {
|
||||||
} break;
|
} break;
|
||||||
case Poco::Net::WebSocket::FRAME_OP_CLOSE: {
|
case Poco::Net::WebSocket::FRAME_OP_CLOSE: {
|
||||||
poco_debug(Logger(),fmt::format("CLOSE({}): {} UI Client is closing WS connection.", Id_, UserName_));
|
Logger().warning(Poco::format("CLOSE(%s): Client is closing its connection.", Id_));
|
||||||
Done = true;
|
Done = true;
|
||||||
} break;
|
} break;
|
||||||
case Poco::Net::WebSocket::FRAME_OP_TEXT: {
|
case Poco::Net::WebSocket::FRAME_OP_TEXT: {
|
||||||
@@ -5114,10 +5075,8 @@ namespace OpenWifi {
|
|||||||
auto Tokens = Utils::Split(Frame, ':');
|
auto Tokens = Utils::Split(Frame, ':');
|
||||||
bool Expired = false, Contacted = false;
|
bool Expired = false, Contacted = false;
|
||||||
if (Tokens.size() == 2 &&
|
if (Tokens.size() == 2 &&
|
||||||
AuthClient()->IsAuthorized(Tokens[1], UserInfo_, 0, Expired, Contacted)) {
|
AuthClient()->IsAuthorized(Tokens[1], UserInfo_, Expired, Contacted)) {
|
||||||
Authenticated_ = true;
|
Authenticated_ = true;
|
||||||
UserName_ = UserInfo_.userinfo.email;
|
|
||||||
poco_debug(Logger(),fmt::format("START({}): {} UI Client is starting WS connection.", Id_, UserName_));
|
|
||||||
std::string S{"Welcome! Bienvenue! Bienvenidos!"};
|
std::string S{"Welcome! Bienvenue! Bienvenidos!"};
|
||||||
WS_->sendFrame(S.c_str(), S.size());
|
WS_->sendFrame(S.c_str(), S.size());
|
||||||
WebSocketClientServer()->SetUser(Id_, UserInfo_.userinfo.email);
|
WebSocketClientServer()->SetUser(Id_, UserInfo_.userinfo.email);
|
||||||
@@ -5163,10 +5122,9 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline WebSocketClient::WebSocketClient( Poco::Net::WebSocket & WS , const std::string &Id, const std::string &UserName, Poco::Logger & L, WebSocketClientProcessor * Processor) :
|
inline WebSocketClient::WebSocketClient( Poco::Net::WebSocket & WS , const std::string &Id, Poco::Logger & L, WebSocketClientProcessor * Processor) :
|
||||||
Reactor_(WebSocketClientServer()->Reactor()),
|
Reactor_(WebSocketClientServer()->Reactor()),
|
||||||
Id_(Id),
|
Id_(Id),
|
||||||
UserName_(UserName),
|
|
||||||
Logger_(L),
|
Logger_(L),
|
||||||
Processor_(Processor) {
|
Processor_(Processor) {
|
||||||
try {
|
try {
|
||||||
@@ -5180,10 +5138,7 @@ namespace OpenWifi {
|
|||||||
Reactor_.addEventHandler(*WS_,
|
Reactor_.addEventHandler(*WS_,
|
||||||
Poco::NObserver<WebSocketClient, Poco::Net::ErrorNotification>(
|
Poco::NObserver<WebSocketClient, Poco::Net::ErrorNotification>(
|
||||||
*this, &WebSocketClient::OnSocketError));
|
*this, &WebSocketClient::OnSocketError));
|
||||||
WS_->setNoDelay(true);
|
// WebSocketClientServer()->Register(this, Id_);
|
||||||
WS_->setKeepAlive(true);
|
|
||||||
WS_->setBlocking(false);
|
|
||||||
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
@@ -5203,6 +5158,7 @@ namespace OpenWifi {
|
|||||||
Poco::Net::ErrorNotification>(*this,&WebSocketClient::OnSocketError));
|
Poco::Net::ErrorNotification>(*this,&WebSocketClient::OnSocketError));
|
||||||
(*WS_).shutdown();
|
(*WS_).shutdown();
|
||||||
(*WS_).close();
|
(*WS_).close();
|
||||||
|
WebSocketClientServer()->UnRegister(Id_);
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5248,8 +5204,9 @@ namespace OpenWifi {
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Poco::Net::WebSocket WS(*Request, *Response);
|
Poco::Net::WebSocket WS(*Request, *Response);
|
||||||
|
Logger().information("WebSocket connection established.");
|
||||||
auto Id = MicroService::CreateUUID();
|
auto Id = MicroService::CreateUUID();
|
||||||
WebSocketClientServer()->NewClient(WS,Id,UserInfo_.userinfo.email);
|
WebSocketClientServer()->NewClient(WS,Id);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
std::cout << "Cannot create websocket client..." << std::endl;
|
std::cout << "Cannot create websocket client..." << std::endl;
|
||||||
|
|||||||
@@ -1,169 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by stephane bourque on 2022-09-29.
|
|
||||||
//
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "fmt/format.h"
|
|
||||||
#include "Poco/Util/Application.h"
|
|
||||||
#include "Poco/ErrorHandler.h"
|
|
||||||
#include "Poco/Net/NetException.h"
|
|
||||||
#include "Poco/Net/SSLException.h"
|
|
||||||
#include "Poco/JSON/Template.h"
|
|
||||||
#include "Poco/Thread.h"
|
|
||||||
|
|
||||||
namespace OpenWifi {
|
|
||||||
|
|
||||||
class MicroServiceErrorHandler : public Poco::ErrorHandler {
|
|
||||||
public:
|
|
||||||
explicit MicroServiceErrorHandler(Poco::Util::Application &App) : App_(App) {
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void exception(const Poco::Exception & Base) override {
|
|
||||||
try {
|
|
||||||
if(Poco::Thread::current()!= nullptr) {
|
|
||||||
t_name = Poco::Thread::current()->getName();
|
|
||||||
t_id = Poco::Thread::current()->id();
|
|
||||||
} else {
|
|
||||||
t_name = "startup_code";
|
|
||||||
t_id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
App_.logger().log(Base);
|
|
||||||
Base.rethrow();
|
|
||||||
|
|
||||||
} catch (const Poco::Net::InvalidCertificateException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::Net::InvalidCertificateException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
} catch (const Poco::Net::InvalidSocketException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::Net::InvalidSocketException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
} catch (const Poco::Net::WebSocketException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::Net::WebSocketException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
} catch (const Poco::Net::ConnectionResetException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::Net::ConnectionResetException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
} catch (const Poco::Net::CertificateValidationException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::Net::CertificateValidationException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
} catch (const Poco::Net::SSLConnectionUnexpectedlyClosedException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::Net::SSLConnectionUnexpectedlyClosedException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
} catch (const Poco::Net::SSLContextException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::Net::SSLContextException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
} catch (const Poco::Net::SSLException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::Net::SSLException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
|
|
||||||
} catch (const Poco::Net::InvalidAddressException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::Net::InvalidAddressException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
|
|
||||||
} catch (const Poco::Net::NetException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::Net::NetException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
|
|
||||||
} catch (const Poco::IOException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::IOException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
} catch (const Poco::RuntimeException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::RuntimeException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
} catch (const Poco::JSON::JSONTemplateException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::JSON::JSONTemplateException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
} catch (const Poco::JSON::JSONException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::JSON::JSONException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
} catch (const Poco::ApplicationException &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::ApplicationException thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
} catch (const Poco::Exception &E) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco::Exception thr_name={} thr_id={} code={} text={} msg={} what={}",
|
|
||||||
t_name, t_id, E.code(),
|
|
||||||
E.displayText(),
|
|
||||||
E.message(),
|
|
||||||
E.what()));
|
|
||||||
} catch (...) {
|
|
||||||
poco_error(App_.logger(), fmt::format("Poco:Generic thr_name={}",t_name, t_id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void exception(const std::exception & E) override {
|
|
||||||
if(Poco::Thread::current()!= nullptr) {
|
|
||||||
t_name = Poco::Thread::current()->getName();
|
|
||||||
t_id = Poco::Thread::current()->id();
|
|
||||||
} else {
|
|
||||||
t_name = "startup_code";
|
|
||||||
t_id = 0;
|
|
||||||
}
|
|
||||||
poco_warning(App_.logger(), fmt::format("std::exception in {}: {} thr_id={}",
|
|
||||||
t_name,E.what(),
|
|
||||||
t_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void exception() override {
|
|
||||||
if(Poco::Thread::current()!= nullptr) {
|
|
||||||
t_name = Poco::Thread::current()->getName();
|
|
||||||
t_id = Poco::Thread::current()->id();
|
|
||||||
} else {
|
|
||||||
t_name = "startup_code";
|
|
||||||
t_id = 0;
|
|
||||||
}
|
|
||||||
poco_warning(App_.logger(), fmt::format("generic exception in {} thr_id={}",
|
|
||||||
t_name, t_id));
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
Poco::Util::Application &App_;
|
|
||||||
std::string t_name;
|
|
||||||
int t_id=0;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -33,6 +33,7 @@ namespace OpenWifi {
|
|||||||
int Start() override {
|
int Start() override {
|
||||||
std::lock_guard Guard(Mutex_);
|
std::lock_guard Guard(Mutex_);
|
||||||
|
|
||||||
|
Logger().setLevel(Poco::Message::PRIO_INFORMATION);
|
||||||
Logger().notice("Starting.");
|
Logger().notice("Starting.");
|
||||||
std::string DBType = MicroService::instance().ConfigGetString("storage.type");
|
std::string DBType = MicroService::instance().ConfigGetString("storage.type");
|
||||||
|
|
||||||
|
|||||||
@@ -146,10 +146,6 @@ namespace OpenWifi {
|
|||||||
WebSocketClientServer()->SendUserNotification(User,N);
|
WebSocketClientServer()->SendUserNotification(User,N);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////
|
|
||||||
/////
|
|
||||||
/////
|
|
||||||
|
|
||||||
struct WebSocketNotificationRebootList {
|
struct WebSocketNotificationRebootList {
|
||||||
std::string title,
|
std::string title,
|
||||||
details,
|
details,
|
||||||
@@ -193,58 +189,5 @@ namespace OpenWifi {
|
|||||||
WebSocketClientServer()->SendUserNotification(User,N);
|
WebSocketClientServer()->SendUserNotification(User,N);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////
|
|
||||||
/////
|
|
||||||
/////
|
|
||||||
|
|
||||||
struct WebSocketNotificationUpgradeList {
|
|
||||||
std::string title,
|
|
||||||
details,
|
|
||||||
jobId;
|
|
||||||
std::vector<std::string> success,
|
|
||||||
skipped,
|
|
||||||
no_firmware,
|
|
||||||
not_connected;
|
|
||||||
uint64_t timeStamp=OpenWifi::Now();
|
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
|
||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef WebSocketNotification<WebSocketNotificationUpgradeList> WebSocketClientNotificationVenueUpgradeList_t;
|
|
||||||
|
|
||||||
inline void WebSocketNotificationUpgradeList::to_json(Poco::JSON::Object &Obj) const {
|
|
||||||
RESTAPI_utils::field_to_json(Obj,"title",title);
|
|
||||||
RESTAPI_utils::field_to_json(Obj,"jobId",jobId);
|
|
||||||
RESTAPI_utils::field_to_json(Obj,"success",success);
|
|
||||||
RESTAPI_utils::field_to_json(Obj,"notConnected",not_connected);
|
|
||||||
RESTAPI_utils::field_to_json(Obj,"noFirmware",no_firmware);
|
|
||||||
RESTAPI_utils::field_to_json(Obj,"skipped",skipped);
|
|
||||||
RESTAPI_utils::field_to_json(Obj,"timeStamp",timeStamp);
|
|
||||||
RESTAPI_utils::field_to_json(Obj,"details",details);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool WebSocketNotificationUpgradeList::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
|
||||||
try {
|
|
||||||
RESTAPI_utils::field_from_json(Obj,"title",title);
|
|
||||||
RESTAPI_utils::field_from_json(Obj,"jobId",jobId);
|
|
||||||
RESTAPI_utils::field_from_json(Obj,"success",success);
|
|
||||||
RESTAPI_utils::field_from_json(Obj,"notConnected",not_connected);
|
|
||||||
RESTAPI_utils::field_from_json(Obj,"noFirmware",no_firmware);
|
|
||||||
RESTAPI_utils::field_from_json(Obj,"skipped",skipped);
|
|
||||||
RESTAPI_utils::field_from_json(Obj,"timeStamp",timeStamp);
|
|
||||||
RESTAPI_utils::field_from_json(Obj,"details",details);
|
|
||||||
return true;
|
|
||||||
} catch(...) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void WebSocketClientNotificationVenueUpgradeCompletionToUser( const std::string & User, WebSocketClientNotificationVenueUpgradeList_t &N) {
|
|
||||||
N.type = "venue_upgrader";
|
|
||||||
WebSocketClientServer()->SendUserNotification(User,N);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace OpenWifi
|
} // namespace OpenWifi
|
||||||
|
|
||||||
|
|||||||
@@ -196,8 +196,6 @@ namespace OpenWifi::RESTAPI::Errors {
|
|||||||
static const struct msg InvalidRadiusServerEntry{1142,"RADIUS Server IP address invalid or port missing."};
|
static const struct msg InvalidRadiusServerEntry{1142,"RADIUS Server IP address invalid or port missing."};
|
||||||
static const struct msg InvalidRadiusServerWeigth{1143,"RADIUS Server IP weight cannot be 0."};
|
static const struct msg InvalidRadiusServerWeigth{1143,"RADIUS Server IP weight cannot be 0."};
|
||||||
|
|
||||||
static const struct msg MaximumRTTYSessionsReached{1144,"Too many RTTY sessions currently active"};
|
|
||||||
static const struct msg DeviceIsAlreadyBusy{1145,"Device is already executing a command. Please try later."};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -430,7 +428,6 @@ namespace OpenWifi::uCentralProtocol {
|
|||||||
static const char *RADIUSDATA = "data";
|
static const char *RADIUSDATA = "data";
|
||||||
static const char *RADIUSACCT = "acct";
|
static const char *RADIUSACCT = "acct";
|
||||||
static const char *RADIUSAUTH = "auth";
|
static const char *RADIUSAUTH = "auth";
|
||||||
static const char *RADIUSCOA = "coa";
|
|
||||||
static const char *RADIUSDST = "dst";
|
static const char *RADIUSDST = "dst";
|
||||||
static const char *IES = "ies";
|
static const char *IES = "ies";
|
||||||
}
|
}
|
||||||
@@ -447,7 +444,6 @@ namespace OpenWifi::uCentralProtocol::Events {
|
|||||||
static const char *RECOVERY = "recovery";
|
static const char *RECOVERY = "recovery";
|
||||||
static const char *TELEMETRY = "telemetry";
|
static const char *TELEMETRY = "telemetry";
|
||||||
static const char *DEVICEUPDATE = "deviceupdate";
|
static const char *DEVICEUPDATE = "deviceupdate";
|
||||||
static const char *VENUE_BROADCAST = "venue_broadcast";
|
|
||||||
|
|
||||||
enum EVENT_MSG {
|
enum EVENT_MSG {
|
||||||
ET_UNKNOWN,
|
ET_UNKNOWN,
|
||||||
@@ -460,8 +456,7 @@ namespace OpenWifi::uCentralProtocol::Events {
|
|||||||
ET_CFGPENDING,
|
ET_CFGPENDING,
|
||||||
ET_RECOVERY,
|
ET_RECOVERY,
|
||||||
ET_DEVICEUPDATE,
|
ET_DEVICEUPDATE,
|
||||||
ET_TELEMETRY,
|
ET_TELEMETRY
|
||||||
ET_VENUEBROADCAST
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline EVENT_MSG EventFromString(const std::string & Method) {
|
inline EVENT_MSG EventFromString(const std::string & Method) {
|
||||||
@@ -485,8 +480,6 @@ namespace OpenWifi::uCentralProtocol::Events {
|
|||||||
return ET_RECOVERY;
|
return ET_RECOVERY;
|
||||||
else if(strcmp(TELEMETRY,Method.c_str())==0)
|
else if(strcmp(TELEMETRY,Method.c_str())==0)
|
||||||
return ET_TELEMETRY;
|
return ET_TELEMETRY;
|
||||||
else if(strcmp(VENUE_BROADCAST,Method.c_str())==0)
|
|
||||||
return ET_VENUEBROADCAST;
|
|
||||||
return ET_UNKNOWN;
|
return ET_UNKNOWN;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static std::string MakeSessionId(const std::string & token) {
|
static std::string MakeSessionId(const std::string & token) {
|
||||||
return Utils::ComputeHash(token);
|
return MicroService::instance().CreateHash(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoginDB::AddLogin( const std::string & userId, const std::string & email, const std::string &token) {
|
void LoginDB::AddLogin( const std::string & userId, const std::string & email, const std::string &token) {
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>eMail Invitation</title>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
Dear ${RECIPIENT_EMAIL},
|
|
||||||
|
|
||||||
You have been invited to join the OpenWifi system. Please click below and follow the instructions
|
|
||||||
|
|
||||||
${ACTION_LINK}
|
|
||||||
|
|
||||||
Thank you!
|
|
||||||
@@ -2,10 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>eMail Verification</title>
|
<title>Title</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Password Reset</title>
|
<title>Title</title>
|
||||||
|
|
||||||
<form action="${ACTION_LINK_HTML}">
|
|
||||||
<label for="fname">First name: </label>
|
|
||||||
<input type="text" id="fname" name="fname"><br><br>
|
|
||||||
<label for="lname">Last name: </label>
|
|
||||||
<input type="text" id="lname" name="lname"><br><br>
|
|
||||||
<input type="submit" value="Submit">
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|||||||
@@ -1,441 +0,0 @@
|
|||||||
<!doctype html><html><head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width">
|
|
||||||
<title>Project Groups now available to join - Telecom Infra Project</title>
|
|
||||||
<style>
|
|
||||||
/* -------------------------------------
|
|
||||||
GLOBAL RESETS
|
|
||||||
------------------------------------- */
|
|
||||||
/*All the styling goes here*/
|
|
||||||
img {
|
|
||||||
border: none;
|
|
||||||
-ms-interpolation-mode: bicubic;
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
color: #414141;
|
|
||||||
background-color: #f6f6f6;
|
|
||||||
font-family: sans-serif;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
font-size: 14px;
|
|
||||||
line-height: 1.4;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
-ms-text-size-adjust: 100%;
|
|
||||||
-webkit-text-size-adjust: 100%;
|
|
||||||
}
|
|
||||||
table {
|
|
||||||
border-collapse: separate;
|
|
||||||
mso-table-lspace: 0pt;
|
|
||||||
mso-table-rspace: 0pt;
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
table td {
|
|
||||||
font-family: sans-serif;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #414141;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
/* -------------------------------------
|
|
||||||
BODY & CONTAINER
|
|
||||||
------------------------------------- */
|
|
||||||
.body {
|
|
||||||
background-color: white;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something
|
|
||||||
*/
|
|
||||||
.container {
|
|
||||||
display: block;
|
|
||||||
margin: 0 auto !important;
|
|
||||||
/* makes it centered */
|
|
||||||
max-width: 580px;
|
|
||||||
padding: 10px;
|
|
||||||
width: 580px;
|
|
||||||
}
|
|
||||||
/* This should also be a block element, so that it will fill 100% of the container */
|
|
||||||
.content {
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: block;
|
|
||||||
margin: 0 auto;
|
|
||||||
max-width: 580px;
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
/* -------------------------------------
|
|
||||||
HEADER, FOOTER, MAIN
|
|
||||||
------------------------------------- */
|
|
||||||
.main {
|
|
||||||
background: #ffffff;
|
|
||||||
border-radius: 0px;
|
|
||||||
width: 600px;
|
|
||||||
max-width: 100%;
|
|
||||||
border: 1px solid #d4d4d4;
|
|
||||||
padding-left: 45px;
|
|
||||||
padding-right: 45px;
|
|
||||||
}
|
|
||||||
.wrapper {
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding: 40px 20px;
|
|
||||||
}
|
|
||||||
.content-block {
|
|
||||||
padding-bottom: 10px;
|
|
||||||
padding-top: 10px;
|
|
||||||
}
|
|
||||||
.footer {
|
|
||||||
clear: both;
|
|
||||||
margin-top: 10px;
|
|
||||||
text-align: center;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.footer td,
|
|
||||||
.footer p,
|
|
||||||
.footer span,
|
|
||||||
.footer a {
|
|
||||||
color: #999999;
|
|
||||||
font-size: 12px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
/* -------------------------------------
|
|
||||||
TYPOGRAPHY
|
|
||||||
------------------------------------- */
|
|
||||||
h1,
|
|
||||||
h2,
|
|
||||||
h3,
|
|
||||||
h4 {
|
|
||||||
color: #414141;
|
|
||||||
font-family: sans-serif;
|
|
||||||
font-weight: 400;
|
|
||||||
line-height: 1.4;
|
|
||||||
margin: 0;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
h2 {
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 35px;
|
|
||||||
font-weight: 300;
|
|
||||||
text-align: center;
|
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
|
||||||
p,
|
|
||||||
ul,
|
|
||||||
ol {
|
|
||||||
font-family: sans-serif;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: normal;
|
|
||||||
margin: 0;
|
|
||||||
color: #414141;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
p li,
|
|
||||||
ul li,
|
|
||||||
ol li {
|
|
||||||
list-style-position: inside;
|
|
||||||
margin-left: 5px;
|
|
||||||
color: #414141;
|
|
||||||
}
|
|
||||||
a {
|
|
||||||
color: #29818c !important;
|
|
||||||
text-decoration: none;
|
|
||||||
border-bottom: 1px solid #d2d2d2;
|
|
||||||
}
|
|
||||||
.footer a {
|
|
||||||
color: #999999 !important;
|
|
||||||
}
|
|
||||||
/* -------------------------------------
|
|
||||||
BUTTONS
|
|
||||||
------------------------------------- */
|
|
||||||
.btn {
|
|
||||||
box-sizing: border-box;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
tbody {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
.btn > tbody > tr > td {
|
|
||||||
padding-bottom: 15px;
|
|
||||||
}
|
|
||||||
.btn table {
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
.btn table td {
|
|
||||||
background-color: #ffffff;
|
|
||||||
border-radius: 20px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.btn a {
|
|
||||||
background-color: #ffffff;
|
|
||||||
border: solid 1px #489e94;
|
|
||||||
border-radius: 5px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
color: #29818c;
|
|
||||||
cursor: pointer;
|
|
||||||
display: inline-block;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: bold;
|
|
||||||
margin: 0;
|
|
||||||
padding: 12px 120px;
|
|
||||||
text-decoration: none;
|
|
||||||
font-weight:600;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
.btn-primary table td {
|
|
||||||
/* background-color: #29818c;*/
|
|
||||||
}
|
|
||||||
.btn-primary a {
|
|
||||||
transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
|
|
||||||
box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
|
|
||||||
border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
||||||
margin: auto;
|
|
||||||
background-color: #29818c;
|
|
||||||
border-color: #29818c;
|
|
||||||
color: #ffffff !important;
|
|
||||||
}
|
|
||||||
/* -------------------------------------
|
|
||||||
OTHER STYLES THAT MIGHT BE USEFUL
|
|
||||||
------------------------------------- */
|
|
||||||
.last {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
.first {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
.align-center {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.align-right {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
.align-left {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
.clear {
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
.mt0 {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
.mb0 {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
.preheader {
|
|
||||||
color: transparent;
|
|
||||||
display: none;
|
|
||||||
height: 0;
|
|
||||||
max-height: 0;
|
|
||||||
max-width: 0;
|
|
||||||
opacity: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
mso-hide: all;
|
|
||||||
visibility: hidden;
|
|
||||||
width: 0;
|
|
||||||
}
|
|
||||||
.powered-by a {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
hr {
|
|
||||||
border: 0;
|
|
||||||
border-bottom: 1px solid #d4d4d4;
|
|
||||||
margin: 20px 0;
|
|
||||||
}
|
|
||||||
.grayFont {
|
|
||||||
color: #999999;
|
|
||||||
}
|
|
||||||
.bold {
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
/* -------------------------------------
|
|
||||||
RESPONSIVE AND MOBILE FRIENDLY STYLES
|
|
||||||
------------------------------------- */
|
|
||||||
@media only screen and (max-width: 620px) {
|
|
||||||
table[class="body"] h1 {
|
|
||||||
font-size: 28px !important;
|
|
||||||
margin-bottom: 10px !important;
|
|
||||||
}
|
|
||||||
table[class="body"] p,
|
|
||||||
table[class="body"] ul,
|
|
||||||
table[class="body"] ol,
|
|
||||||
table[class="body"] td,
|
|
||||||
table[class="body"] span,
|
|
||||||
table[class="body"] a {
|
|
||||||
font-size: 16px !important;
|
|
||||||
}
|
|
||||||
table[class="body"] .wrapper,
|
|
||||||
table[class="body"] .article {
|
|
||||||
padding: 10px !important;
|
|
||||||
}
|
|
||||||
table[class="body"] .content {
|
|
||||||
padding: 0 !important;
|
|
||||||
}
|
|
||||||
table[class="body"] .container {
|
|
||||||
padding: 0 !important;
|
|
||||||
width: 100% !important;
|
|
||||||
}
|
|
||||||
table[class="body"] .main {
|
|
||||||
border-left-width: 0 !important;
|
|
||||||
border-radius: 0 !important;
|
|
||||||
border-right-width: 0 !important;
|
|
||||||
}
|
|
||||||
table[class="body"] .btn table {
|
|
||||||
width: 100% !important;
|
|
||||||
}
|
|
||||||
table[class="body"] .btn a {
|
|
||||||
width: 100% !important;
|
|
||||||
}
|
|
||||||
table[class="body"] .img-responsive {
|
|
||||||
height: auto !important;
|
|
||||||
max-width: 100% !important;
|
|
||||||
width: auto !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* -------------------------------------
|
|
||||||
PRESERVE THESE STYLES IN THE HEAD
|
|
||||||
------------------------------------- */
|
|
||||||
@media all {
|
|
||||||
.ExternalClass {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.ExternalClass,
|
|
||||||
.ExternalClass p,
|
|
||||||
.ExternalClass span,
|
|
||||||
.ExternalClass font,
|
|
||||||
.ExternalClass td,
|
|
||||||
.ExternalClass div {
|
|
||||||
line-height: 100%;
|
|
||||||
}
|
|
||||||
.apple-link a {
|
|
||||||
color: inherit !important;
|
|
||||||
font-family: inherit !important;
|
|
||||||
font-size: inherit !important;
|
|
||||||
font-weight: inherit !important;
|
|
||||||
line-height: inherit !important;
|
|
||||||
text-decoration: none !important;
|
|
||||||
}
|
|
||||||
.btn-primary table td:hover {
|
|
||||||
/* background-color: rgb(50, 110, 103) !important; */
|
|
||||||
}
|
|
||||||
.btn-primary a:hover {
|
|
||||||
background-color: rgb(50, 110, 103) !important;
|
|
||||||
border-color: rgb(50, 110, 103) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body class="">
|
|
||||||
<span class="preheader"></span>
|
|
||||||
<table d="" role="presentation" border="0" cellpadding="0" cellspacing="0" class="body">
|
|
||||||
<tr>
|
|
||||||
<td> </td>
|
|
||||||
<td class="container">
|
|
||||||
<div class="content">
|
|
||||||
<!-- START CENTERED WHITE CONTAINER -->
|
|
||||||
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td valign="top" style="padding:0px">
|
|
||||||
<table align="left" width="100%" border="0" cellpadding="0" cellspacing="0" style="min-width:100%">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td valign="top" style="padding-right:0px;padding-left:0px;padding-top:0;padding-bottom:0;text-align:center">
|
|
||||||
<img align="center" alt="Telecom Infra Project" src="https://gallery.mailchimp.com/d068b19c9ce4cd81f132f1844/images/f4ac7418-c41c-4aee-890b-efe01f3302cb.png"
|
|
||||||
width="600" style="max-width:100%;padding-bottom:0;display:inline!important;vertical-align:bottom">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<table role="presentation" class="main">
|
|
||||||
<!-- START MAIN CONTENT AREA -->
|
|
||||||
<tr>
|
|
||||||
<td class="wrapper">
|
|
||||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<h2>Project Groups now available to join - Telecom Infra Project</h2>
|
|
||||||
<p>Dear Jaspreet Sachdev,</p>
|
|
||||||
<p>
|
|
||||||
Facebook is now a member of the following TIP Project Group,
|
|
||||||
which means they are available for you to join:
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<ul style="text-align: left;margin: auto;display: inline-block;">
|
|
||||||
<li><a href="https://urldefense.com/" target="_blank">Wi-Fi</a></li>
|
|
||||||
</ul>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
If you would like to participate in any of these groups, you may join
|
|
||||||
by logging in to your TIP Membership Account and navigating to My Project
|
|
||||||
Groups.
|
|
||||||
</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="https://urldefense.com/v3/" target="_blank">Account Login</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<p>Questions? <a href="https://urldefense.com/v3/" target="_blank">Contact TIP Support</a> or email support@telecominfraproject.com.</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<p>Sincerely,</p>
|
|
||||||
<p>Telecom Infra Project</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<!-- END MAIN CONTENT AREA -->
|
|
||||||
</table>
|
|
||||||
=09
|
|
||||||
<!-- END CENTERED WHITE CONTAINER -->
|
|
||||||
<div class="footer">
|
|
||||||
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100;margin-top:30px;">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td valign="top" style="padding:0px">
|
|
||||||
<table align="left" width="100%" border="0" cellpadding="0" cellspacing="0" style="min-width:100%">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<tr>
|
|
||||||
<p style="text-align:center">
|
|
||||||
Copyright =C2=A9 2021 Telecom Infra Project, All rights reserved.
|
|
||||||
</p>
|
|
||||||
<a href="https://urldefense.com/v3/" target="_blank">www.telecominfraproject.com</a>
|
|
||||||
</tr>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td> </td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<img src="https://mandrillapp.com/track/open.php?u=31039844&id=6424f96bfb88484685c7229756fee3fb" height="1" width="1"></body>
|
|
||||||
</html>
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
# wait-for-postgres.sh
|
# wait-for-postgres.sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
@@ -20,7 +20,7 @@ if [ "$1" = '/openwifi/owsec' -a "$(id -u)" = '0' ]; then
|
|||||||
if [ "$RUN_CHOWN" = 'true' ]; then
|
if [ "$RUN_CHOWN" = 'true' ]; then
|
||||||
chown -R "$OWSEC_USER": "$OWSEC_ROOT" "$OWSEC_CONFIG"
|
chown -R "$OWSEC_USER": "$OWSEC_ROOT" "$OWSEC_CONFIG"
|
||||||
fi
|
fi
|
||||||
exec gosu "$OWSEC_USER" "$@"
|
exec su-exec "$OWSEC_USER" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
|
|
||||||
<div class="logo-grid">
|
<div class="logo-grid">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div><img src="/wwwassets/logo.png" alt="OpenWifi"></div>
|
<div><img src="/wwwassets/the_logo.png" alt="OpenWifi"></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
|
|
||||||
<div class="logo-grid">
|
<div class="logo-grid">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div><img src="/wwwassets/logo.png" alt="OpenWifi"></div>
|
<div><img src="/wwwassets/the_logo.png" alt="OpenWifi"></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
|
|
||||||
<div class="logo-grid">
|
<div class="logo-grid">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div><img src="/wwwassets/logo.png" alt="OpenWifi"></div>
|
<div><img src="/wwwassets/the_logo.png" alt="OpenWifi"></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 KiB |
@@ -101,7 +101,7 @@
|
|||||||
|
|
||||||
<div class="logo-grid">
|
<div class="logo-grid">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div><img src="/wwwassets/logo.png" alt="OpenWifi"></div>
|
<div><img src="/wwwassets/the_logo.png" alt="OpenWifi"></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@
|
|||||||
|
|
||||||
<div class="logo-grid">
|
<div class="logo-grid">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div><img src="/wwwassets/logo.png" alt="OpenWifi"></div>
|
<div><img src="/wwwassets/the_logo.png" alt="OpenWifi"></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
|
|
||||||
<div class="logo-grid">
|
<div class="logo-grid">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div><img src="/wwwassets/logo.png" alt="OpenWifi"></div>
|
<div><img src="/wwwassets/the_logo.png" alt="OpenWifi"></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div class="logo-grid">
|
<div class="logo-grid">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div><img src="/wwwassets/logo.png" alt="OpenWifi"></div>
|
<div><img src="/wwwassets/the_logo.png" alt="OpenWifi"></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@
|
|||||||
|
|
||||||
<div class="logo-grid">
|
<div class="logo-grid">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div><img src="/wwwassets/sub_logo.png" alt="OpenWifi"></div>
|
<div><img src="/wwwassets/the_logo.png" alt="OpenWifi"></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
|
|
||||||
<div class="logo-grid">
|
<div class="logo-grid">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div><img src="/wwwassets/sub_logo.png" alt="OpenWifi"></div>
|
<div><img src="/wwwassets/the_logo.png" alt="OpenWifi"></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div class="logo-grid">
|
<div class="logo-grid">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div><img src="/wwwassets/sub_logo.png" alt="OpenWifi"></div>
|
<div><img src="/wwwassets/the_logo.png" alt="OpenWifi"></div>
|
||||||
<div></div>
|
<div></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 202 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 KiB |
Reference in New Issue
Block a user