mirror of
				https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
				synced 2025-10-31 18:57:51 +00:00 
			
		
		
		
	Compare commits
	
		
			64 Commits
		
	
	
		
			v2.9.0-RC1
			...
			release/v3
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 1527773a7a | ||
|   | f9dd5864fb | ||
|   | 20258c5885 | ||
|   | c782981ca7 | ||
|   | ca3691e665 | ||
|   | be2ffc86ec | ||
|   | 75ebc0771c | ||
|   | fadb7405c5 | ||
|   | 6394fee9c0 | ||
|   | 8166b75412 | ||
|   | d050635a99 | ||
|   | e3592b5fe6 | ||
|   | 9eec54effb | ||
|   | 6a7ae342dc | ||
|   | 5b3205823e | ||
|   | db45a01bce | ||
|   | d2f70ec82d | ||
|   | 2b01453970 | ||
|   | 68ccc4da93 | ||
|   | 1063080859 | ||
|   | 1b4a58c95c | ||
|   | bd20abacdf | ||
|   | f0ca087d48 | ||
|   | 21bf1ff148 | ||
|   | 66c010dd28 | ||
|   | 0fb18e8a32 | ||
|   | da21df49ce | ||
|   | 54d6565411 | ||
|   | 5052a818ff | ||
|   | 5e1f3e0e31 | ||
|   | c0740a9760 | ||
|   | 88ebeead8c | ||
|   | 41c155c332 | ||
|   | aaf6c933b5 | ||
|   | 5e58f7ef37 | ||
|   | 9fdd0019c1 | ||
|   | f94e4b3aed | ||
|   | b2b183f95c | ||
|   | 2cfa5040dc | ||
|   | 3112e2ad36 | ||
|   | 0e45f3700b | ||
|   | 78d9e508fc | ||
|   | 81ff75f1cc | ||
|   | ab276bb474 | ||
|   | 2a8f09cb46 | ||
|   | 239dcffc98 | ||
|   | 5fb32934fa | ||
|   | 38010d4628 | ||
|   | 669f7f3433 | ||
|   | 3576d5516f | ||
|   | 0781f15bae | ||
|   | e87f4d6476 | ||
|   | dd7d5e8ab6 | ||
|   | 776ecabf81 | ||
|   | 5c6814852e | ||
|   | 90c700702e | ||
|   | 7c3ae1b5b9 | ||
|   | 15c2f6a4fc | ||
|   | 9d5855bc6e | ||
|   | b7d72474da | ||
|   | 33650f5cea | ||
|   | e8955454f7 | ||
|   | 6e0cf66008 | ||
|   | 6d305636a0 | 
							
								
								
									
										62
									
								
								BUILDING.md
									
									
									
									
									
								
							
							
						
						
									
										62
									
								
								BUILDING.md
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| # Building from source | # Building from source | ||||||
|  |  | ||||||
| In order to build the OWSEC, you will need to install its dependencies, which includes the following: | In order to build OWSEC, you will need to install its dependencies, which includes the following: | ||||||
| - cmake | - cmake | ||||||
| - boost | - boost | ||||||
| - POCO 1.10.1 or later | - POCO 1.10.1 or later | ||||||
| @@ -13,43 +13,43 @@ In order to build the OWSEC, you will need to install its dependencies, which in | |||||||
|  |  | ||||||
| The build is done in 2 parts. The first part is to build a local copy of the framework tailored to your environment. This | The build is done in 2 parts. The first part is to build a local copy of the framework tailored to your environment. This | ||||||
| framework is called [Poco](https://github.com/pocoproject/poco). The version used in this project has a couple of fixes | framework is called [Poco](https://github.com/pocoproject/poco). The version used in this project has a couple of fixes | ||||||
| from the master copy needed for cmake. Please use the version of this [Poco fix](https://github.com/AriliaWireless/poco). Building | from the master copy needed for cmake. Please use the version of this [Poco fix](https://github.com/Telecominfraproject/wlan-cloud-lib-poco). Building | ||||||
| Poco may take several minutes depending on the platform you are building on. | Poco may take several minutes depending on the platform you are building on. | ||||||
|  |  | ||||||
| ## Ubuntu | ## Ubuntu | ||||||
| These instructions have proven to work on Ubuntu 20.4. | These instructions have proven to work on Ubuntu 20.4. | ||||||
| ```bash | ```bash | ||||||
| sudo apt install git cmake g++ libssl-dev libmariadb-dev  | sudo apt install git cmake g++ libssl-dev libmariadb-dev \ | ||||||
| sudo apt install libpq-dev libaprutil1-dev apache2-dev libboost-all-dev |     libpq-dev libaprutil1-dev apache2-dev libboost-all-dev \ | ||||||
| sudo apt install librdkafka-dev default-libmysqlclient-dev |     librdkafka-dev default-libmysqlclient-dev \ | ||||||
| sudo apt install nlohmann-json-dev |     nlohmann-json-dev | ||||||
|  |  | ||||||
| cd ~ | git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch poco-tip-v1 poco | ||||||
| git clone https://github.com/AriliaWireless/poco --branch poco-tip-v1 |  | ||||||
| cd poco | cd poco | ||||||
| mkdir cmake-build | mkdir cmake-build | ||||||
| cd cmake-build | cd cmake-build | ||||||
| cmake .. | cmake .. | ||||||
| cmake --build . --config Release | cmake --build . --config Release | ||||||
| sudo cmake --build . --target install | sudo cmake --build . --target install | ||||||
|  | cd ../.. | ||||||
|  |  | ||||||
| cd ~ | git clone https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka --branch tip-v1 cppkafka | ||||||
| git clone https://github.com/AriliaWireless/cppkafka --branch tip-v1 |  | ||||||
| cd cppkafka | cd cppkafka | ||||||
| mkdir cmake-build | mkdir cmake-build | ||||||
| cd cmake-build | cd cmake-build | ||||||
| cmake .. | cmake .. | ||||||
| cmake --build . --config Release | cmake --build . --config Release | ||||||
| sudo cmake --build . --target install | sudo cmake --build . --target install | ||||||
|  | cd ../.. | ||||||
|  |  | ||||||
| cd ~ | git clone https://github.com/Telecominfraproject/wlan-cloud-lib-valijson --branch tip-v1 valijson | ||||||
| git clone https://github.com/AriliaWireless/valijson --branch tip-v1 |  | ||||||
| cd valijson | cd valijson | ||||||
| mkdir cmake-build | mkdir cmake-build | ||||||
| cd cmake-build | cd cmake-build | ||||||
| cmake .. | cmake .. | ||||||
| cmake --build . --config Release | cmake --build . --config Release | ||||||
| sudo cmake --build . --target install | sudo cmake --build . --target install | ||||||
|  | cd ../.. | ||||||
|  |  | ||||||
| git clone https://github.com/fmtlib/fmt --branch 9.0.0 /fmtlib | git clone https://github.com/fmtlib/fmt --branch 9.0.0 /fmtlib | ||||||
| cd fmtlib | cd fmtlib | ||||||
| @@ -58,56 +58,59 @@ cd cmake-build | |||||||
| cmake .. | cmake .. | ||||||
| make | make | ||||||
| make install | make install | ||||||
|  | cd ../.. | ||||||
|  |  | ||||||
| cd ~ |  | ||||||
| git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralsec | git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralsec | ||||||
| cd wlan-cloud-ucentralsec | cd wlan-cloud-ucentralsec | ||||||
| mkdir cmake-build | mkdir cmake-build | ||||||
| cd cmake-build | cd cmake-build | ||||||
| cmake .. | cmake .. | ||||||
| make -j 8 | make -j 8 | ||||||
|  | cd ../.. | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| ## Fedora | ## Fedora | ||||||
| The following instructions have proven to work on Fedora 33 | The following instructions have proven to work on Fedora 33 | ||||||
| ```bash | ```bash | ||||||
| sudo yum install cmake g++ openssl-devel mysql-devel mysql apr-util-devel boost boost-devel | sudo yum install cmake g++ openssl-devel mysql-devel mysql apr-util-devel boost boost-devel \ | ||||||
| sudo yum install yaml-cpp-devel lua-devel  |     yaml-cpp-devel lua-devel | ||||||
| sudo dnf install postgresql.x86_64 librdkafka-devel | sudo dnf install postgresql.x86_64 librdkafka-devel | ||||||
| sudo dnf install postgresql-devel json-devel | sudo dnf install postgresql-devel json-devel | ||||||
|  |  | ||||||
| git clone https://github.com/AriliaWireless/poco --branch poco-tip-v1 | git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch poco-tip-v1 poco | ||||||
| cd poco | cd poco | ||||||
| mkdir cmake-build | mkdir cmake-build | ||||||
| cd cmake-build | cd cmake-build | ||||||
| cmake .. | cmake .. | ||||||
| cmake --build . --config Release | cmake --build . --config Release | ||||||
| sudo cmake --build . --target install | sudo cmake --build . --target install | ||||||
|  | cd ../.. | ||||||
|  |  | ||||||
| git clone https://github.com/AriliaWireless/cppkafka --branch tip-v1 | git clone https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka --branch tip-v1 cppkafka | ||||||
| cd cppkafka | cd cppkafka | ||||||
| mkdir cmake-build | mkdir cmake-build | ||||||
| cd cmake-build | cd cmake-build | ||||||
| cmake .. | cmake .. | ||||||
| cmake --build . --config Release | cmake --build . --config Release | ||||||
| sudo cmake --build . --target install | sudo cmake --build . --target install | ||||||
|  | cd ../.. | ||||||
|  |  | ||||||
| cd ~ | git clone https://github.com/Telecominfraproject/wlan-cloud-lib-valijson --branch tip-v1 valijson | ||||||
| git clone https://github.com/AriliaWireless/valijson --branch tip-v1 |  | ||||||
| cd valijson | cd valijson | ||||||
| mkdir cmake-build | mkdir cmake-build | ||||||
| cd cmake-build | cd cmake-build | ||||||
| cmake .. | cmake .. | ||||||
| cmake --build . --config Release | cmake --build . --config Release | ||||||
| sudo cmake --build . --target install | sudo cmake --build . --target install | ||||||
|  | cd ../.. | ||||||
|  |  | ||||||
| cd ~ |  | ||||||
| git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralsec | git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralsec | ||||||
| cd wlan-cloud-ucentralsec | cd wlan-cloud-ucentralsec | ||||||
| mkdir cmake-build | mkdir cmake-build | ||||||
| cd cmake-build | cd cmake-build | ||||||
| cmake .. | cmake .. | ||||||
| make | make | ||||||
|  | cd ../.. | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| ## macOS Build | ## macOS Build | ||||||
| @@ -126,7 +129,7 @@ brew install openssl \ | |||||||
| 	nlohmann-json \ | 	nlohmann-json \ | ||||||
| 	fmt | 	fmt | ||||||
|  |  | ||||||
| git clone https://github.com/AriliaWireless/poco --branch poco-tip-v1 | git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch poco-tip-v1 poco | ||||||
| pushd poco | pushd poco | ||||||
| mkdir cmake-build | mkdir cmake-build | ||||||
| push cmake-build | push cmake-build | ||||||
| @@ -136,7 +139,7 @@ sudo cmake --build . --target install | |||||||
| popd | popd | ||||||
| popd | popd | ||||||
|  |  | ||||||
| git clone https://github.com/AriliaWireless/cppkafka --branch tip-v1 | git clone https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka --branch tip-v1 cppkafka | ||||||
| pushd cppkafka | pushd cppkafka | ||||||
| mkdir cmake-build | mkdir cmake-build | ||||||
| pushd cmake-build | pushd cmake-build | ||||||
| @@ -146,10 +149,10 @@ sudo cmake --build . --target install | |||||||
| popd | popd | ||||||
| popd | popd | ||||||
|  |  | ||||||
| git clone https://github.com/AriliaWireless/valijson --branch tip-v1 | git clone https://github.com/Telecominfraproject/wlan-cloud-lib-valijson --branch tip-v1 valijson | ||||||
| cd valijson | pushd valijson | ||||||
| mkdir cmake-build | mkdir cmake-build | ||||||
| cd cmake-build | pushd cmake-build | ||||||
| cmake .. | cmake .. | ||||||
| cmake --build . --config Release | cmake --build . --config Release | ||||||
| sudo cmake --build . --target install | sudo cmake --build . --target install | ||||||
| @@ -172,20 +175,23 @@ support. You can build with only SQLite support by not installing the packages f | |||||||
| adding -DSMALL_BUILD=1 on the cmake build line. | adding -DSMALL_BUILD=1 on the cmake build line. | ||||||
|  |  | ||||||
| ```bash | ```bash | ||||||
| sudo apt install git cmake g++ libssl-dev libaprutil1-dev apache2-dev libboost-all-dev libyaml-cpp-dev | sudo apt install git cmake g++ libssl-dev libaprutil1-dev apache2-dev \ | ||||||
| git clone https://github.com/stephb9959/poco |     libboost-all-dev libyaml-cpp-dev | ||||||
|  |  | ||||||
|  | git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch poco-tip-v1 poco | ||||||
| cd poco | cd poco | ||||||
| mkdir cmake-build | mkdir cmake-build | ||||||
| cd cmake-build | cd cmake-build | ||||||
| cmake .. | cmake .. | ||||||
| cmake --build . --config Release | cmake --build . --config Release | ||||||
| sudo cmake --build . --target install | sudo cmake --build . --target install | ||||||
|  | cd ../.. | ||||||
|  |  | ||||||
| cd ~ |  | ||||||
| git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralsec | git clone https://github.com/Telecominfraproject/wlan-cloud-ucentralsec | ||||||
| cd wlan-cloud-ucentralsec | cd wlan-cloud-ucentralsec | ||||||
| mkdir cmake-build | mkdir cmake-build | ||||||
| cd cmake-build | cd cmake-build | ||||||
| cmake -DSMALL_BUILD=1 .. | cmake -DSMALL_BUILD=1 .. | ||||||
| make | make | ||||||
|  | cd ../.. | ||||||
| ``` | ``` | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| cmake_minimum_required(VERSION 3.13) | cmake_minimum_required(VERSION 3.13) | ||||||
| project(owsec VERSION 2.9.0) | project(owsec VERSION 3.0.0) | ||||||
|  |  | ||||||
| set(CMAKE_CXX_STANDARD 17) | set(CMAKE_CXX_STANDARD 17) | ||||||
|  |  | ||||||
| @@ -42,7 +42,7 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") | |||||||
|     string(REGEX REPLACE "\n$" "" GIT_HASH "${GIT_HASH}") |     string(REGEX REPLACE "\n$" "" GIT_HASH "${GIT_HASH}") | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| add_definitions(-DAWS_CUSTOM_MEMORY_MANAGEMENT) | add_definitions(-DAWS_CUSTOM_MEMORY_MANAGEMENT -DBOOST_NO_CXX98_FUNCTION_BASE=1) | ||||||
|  |  | ||||||
| set(BUILD_SHARED_LIBS 1) | set(BUILD_SHARED_LIBS 1) | ||||||
|  |  | ||||||
| @@ -118,7 +118,7 @@ add_executable( owsec | |||||||
|         src/framework/RESTAPI_PartHandler.h |         src/framework/RESTAPI_PartHandler.h | ||||||
|         src/framework/MicroService.cpp |         src/framework/MicroService.cpp | ||||||
|         src/framework/MicroServiceExtra.h |         src/framework/MicroServiceExtra.h | ||||||
|  |         src/framework/default_device_types.h | ||||||
|         src/RESTObjects/RESTAPI_SecurityObjects.h src/RESTObjects/RESTAPI_SecurityObjects.cpp |         src/RESTObjects/RESTAPI_SecurityObjects.h src/RESTObjects/RESTAPI_SecurityObjects.cpp | ||||||
|         src/RESTObjects/RESTAPI_GWobjects.h src/RESTObjects/RESTAPI_GWobjects.cpp |         src/RESTObjects/RESTAPI_GWobjects.h src/RESTObjects/RESTAPI_GWobjects.cpp | ||||||
|         src/RESTObjects/RESTAPI_FMSObjects.h src/RESTObjects/RESTAPI_FMSObjects.cpp |         src/RESTObjects/RESTAPI_FMSObjects.h src/RESTObjects/RESTAPI_FMSObjects.cpp | ||||||
| @@ -185,6 +185,7 @@ if(NOT SMALL_BUILD) | |||||||
|             CppKafka::cppkafka |             CppKafka::cppkafka | ||||||
|             ${AWSSDK_LINK_LIBRARIES} |             ${AWSSDK_LINK_LIBRARIES} | ||||||
|             fmt::fmt |             fmt::fmt | ||||||
|  |             resolv | ||||||
|             ) |             ) | ||||||
|     if(UNIX AND NOT APPLE) |     if(UNIX AND NOT APPLE) | ||||||
|         target_link_libraries(owsec PUBLIC PocoJSON) |         target_link_libraries(owsec PUBLIC PocoJSON) | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								Dockerfile
									
									
									
									
									
								
							| @@ -15,8 +15,8 @@ FROM build-base AS poco-build | |||||||
|  |  | ||||||
| ARG POCO_VERSION | ARG POCO_VERSION | ||||||
|  |  | ||||||
| ADD https://api.github.com/repos/AriliaWireless/poco/git/refs/tags/${POCO_VERSION} version.json | ADD https://api.github.com/repos/Telecominfraproject/wlan-cloud-lib-poco/git/refs/tags/${POCO_VERSION} version.json | ||||||
| RUN git clone https://github.com/AriliaWireless/poco --branch ${POCO_VERSION} /poco | RUN git clone https://github.com/Telecominfraproject/wlan-cloud-lib-poco --branch ${POCO_VERSION} /poco | ||||||
|  |  | ||||||
| WORKDIR /poco | WORKDIR /poco | ||||||
| RUN mkdir cmake-build | RUN mkdir cmake-build | ||||||
| @@ -29,8 +29,8 @@ FROM build-base AS cppkafka-build | |||||||
|  |  | ||||||
| ARG CPPKAFKA_VERSION | ARG CPPKAFKA_VERSION | ||||||
|  |  | ||||||
| ADD https://api.github.com/repos/AriliaWireless/cppkafka/git/refs/tags/${CPPKAFKA_VERSION} version.json | ADD https://api.github.com/repos/Telecominfraproject/wlan-cloud-lib-cppkafka/git/refs/tags/${CPPKAFKA_VERSION} version.json | ||||||
| RUN git clone https://github.com/AriliaWireless/cppkafka --branch ${CPPKAFKA_VERSION} /cppkafka | RUN git clone https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka --branch ${CPPKAFKA_VERSION} /cppkafka | ||||||
|  |  | ||||||
| WORKDIR /cppkafka | WORKDIR /cppkafka | ||||||
| RUN mkdir cmake-build | RUN mkdir cmake-build | ||||||
| @@ -43,8 +43,8 @@ FROM build-base AS valijson-build | |||||||
|  |  | ||||||
| ARG VALIJASON_VERSION | ARG VALIJASON_VERSION | ||||||
|  |  | ||||||
| ADD https://api.github.com/repos/AriliaWireless/valijson/git/refs/tags/${VALIJASON_VERSION} version.json | ADD https://api.github.com/repos/Telecominfraproject/wlan-cloud-lib-valijson/git/refs/tags/${VALIJASON_VERSION} version.json | ||||||
| RUN git clone https://github.com/AriliaWireless/valijson --branch ${VALIJASON_VERSION} /valijson | RUN git clone https://github.com/Telecominfraproject/wlan-cloud-lib-valijson --branch ${VALIJASON_VERSION} /valijson | ||||||
|  |  | ||||||
| WORKDIR /valijson | WORKDIR /valijson | ||||||
| RUN mkdir cmake-build | RUN mkdir cmake-build | ||||||
|   | |||||||
| @@ -60,6 +60,16 @@ if [[ "$TEMPLATE_CONFIG" = 'true' ]]; then | |||||||
|   STORAGE_TYPE_MYSQL_PASSWORD=${STORAGE_TYPE_MYSQL_PASSWORD:-"owsec"} \ |   STORAGE_TYPE_MYSQL_PASSWORD=${STORAGE_TYPE_MYSQL_PASSWORD:-"owsec"} \ | ||||||
|   STORAGE_TYPE_MYSQL_DATABASE=${STORAGE_TYPE_MYSQL_DATABASE:-"owsec"} \ |   STORAGE_TYPE_MYSQL_DATABASE=${STORAGE_TYPE_MYSQL_DATABASE:-"owsec"} \ | ||||||
|   STORAGE_TYPE_MYSQL_PORT=${STORAGE_TYPE_MYSQL_PORT:-"3306"} \ |   STORAGE_TYPE_MYSQL_PORT=${STORAGE_TYPE_MYSQL_PORT:-"3306"} \ | ||||||
|  |   USER_HELPER_EMAIL=${USER_HELPER_EMAIL:-"openwifi@telecominfraproject.com"} \ | ||||||
|  |   SUB_HELPER_EMAIL=${SUB_HELPER_EMAIL:-"openwifi@telecominfraproject.com"} \ | ||||||
|  |   GLOBAL_USER_HELPER_EMAIL=${GLOBAL_USER_HELPER_EMAIL:-"openwifi@telecominfraproject.com"} \ | ||||||
|  |   GLOBAL_SUB_HELPER_EMAIL=${GLOBAL_SUB_HELPER_EMAIL:-"openwifi@telecominfraproject.com"} \ | ||||||
|  |   USER_HELPER_SITE=${USER_HELPER_SITE:-"https://openwifi.telecominfraproject.com"} \ | ||||||
|  |   SUB_HELPER_SITE=${SUB_HELPER_SITE:-"https://openwifi.telecominfraproject.com"} \ | ||||||
|  |   USER_SYSTEM_LOGIN=${USER_SYSTEM_LOGIN:-"https://openwifi.telecominfraproject.com"} \ | ||||||
|  |   SUB_SYSTEM_LOGIN=${SUB_SYSTEM_LOGIN:-"https://openwifi.telecominfraproject.com"} \ | ||||||
|  |   USER_SIGNATURE=${USER_SIGNATURE:-"Telecom Infra Project"} \ | ||||||
|  |   SUB_SIGNATURE=${SUB_SIGNATURE:-"Telecom Infra Project"} \ | ||||||
|   envsubst < /owsec.properties.tmpl > $OWSEC_CONFIG/owsec.properties |   envsubst < /owsec.properties.tmpl > $OWSEC_CONFIG/owsec.properties | ||||||
| fi | fi | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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.9.0-RC1 |     tag: v3.0.2-RC1 | ||||||
|     pullPolicy: Always |     pullPolicy: Always | ||||||
| #    regcred: | #    regcred: | ||||||
| #      registry: tip-tip-wlan-cloud-ucentral.jfrog.io | #      registry: tip-tip-wlan-cloud-ucentral.jfrog.io | ||||||
|   | |||||||
| @@ -565,12 +565,6 @@ components: | |||||||
|             - $ref: '#/components/schemas/StringList' |             - $ref: '#/components/schemas/StringList' | ||||||
|             - $ref: '#/components/schemas/TagValuePairList' |             - $ref: '#/components/schemas/TagValuePairList' | ||||||
|  |  | ||||||
|     SystemCommandResults: |  | ||||||
|       type: object |  | ||||||
|       oneOf: |  | ||||||
|         - $ref: '#/components/schemas/StringList' |  | ||||||
|         - $ref: '#/components/schemas/TagValuePairList' |  | ||||||
|  |  | ||||||
|     SystemInfoResults: |     SystemInfoResults: | ||||||
|       type: object |       type: object | ||||||
|       properties: |       properties: | ||||||
| @@ -599,6 +593,33 @@ components: | |||||||
|                 type: integer |                 type: integer | ||||||
|                 format: int64 |                 format: int64 | ||||||
|  |  | ||||||
|  |     SystemResources: | ||||||
|  |       type: object | ||||||
|  |       properties: | ||||||
|  |         numberOfFileDescriptors: | ||||||
|  |           type: integer | ||||||
|  |           format: int64 | ||||||
|  |         currRealMem: | ||||||
|  |           type: integer | ||||||
|  |           format: int64 | ||||||
|  |         peakRealMem: | ||||||
|  |           type: integer | ||||||
|  |           format: int64 | ||||||
|  |         currVirtMem: | ||||||
|  |           type: integer | ||||||
|  |           format: int64 | ||||||
|  |         peakVirtMem: | ||||||
|  |           type: integer | ||||||
|  |           format: int64 | ||||||
|  |  | ||||||
|  |     SystemCommandResults: | ||||||
|  |       type: object | ||||||
|  |       oneOf: | ||||||
|  |         - $ref: '#/components/schemas/SystemResources' | ||||||
|  |         - $ref: '#/components/schemas/SystemInfoResults' | ||||||
|  |         - $ref: '#/components/schemas/StringList' | ||||||
|  |         - $ref: '#/components/schemas/TagValuePairList' | ||||||
|  |  | ||||||
|     ProfileAction: |     ProfileAction: | ||||||
|       type: object |       type: object | ||||||
|       properties: |       properties: | ||||||
| @@ -1110,6 +1131,12 @@ paths: | |||||||
|             type: string |             type: string | ||||||
|             format: uuid |             format: uuid | ||||||
|           required: true |           required: true | ||||||
|  |         - in: query | ||||||
|  |           description: When used, signifies the the id is actually the email address of the user, and not its uuid | ||||||
|  |           name: byEmail | ||||||
|  |           schema: | ||||||
|  |             type: boolean | ||||||
|  |           required: false | ||||||
|       responses: |       responses: | ||||||
|         200: |         200: | ||||||
|           $ref: '#/components/schemas/UserInfo' |           $ref: '#/components/schemas/UserInfo' | ||||||
| @@ -1226,6 +1253,12 @@ paths: | |||||||
|             type: string |             type: string | ||||||
|             format: uuid |             format: uuid | ||||||
|           required: true |           required: true | ||||||
|  |         - in: query | ||||||
|  |           description: When used, signifies the the id is actually the email address of the user, and not its uuid | ||||||
|  |           name: byEmail | ||||||
|  |           schema: | ||||||
|  |             type: boolean | ||||||
|  |           required: false | ||||||
|       responses: |       responses: | ||||||
|         200: |         200: | ||||||
|           $ref: '#/components/schemas/UserInfo' |           $ref: '#/components/schemas/UserInfo' | ||||||
| @@ -1849,19 +1882,6 @@ paths: | |||||||
|   ######################################################################################### |   ######################################################################################### | ||||||
|   ##  The following calls are restricted to the private system side APIs |   ##  The following calls are restricted to the private system side APIs | ||||||
|   ######################################################################################### |   ######################################################################################### | ||||||
|   /systemServices: |  | ||||||
|     get: |  | ||||||
|       tags: |  | ||||||
|         - Security |  | ||||||
|       summary: Retrieve the basic system information. This information is used between services only. |  | ||||||
|       operationId: getSystemServices |  | ||||||
|       responses: |  | ||||||
|         200: |  | ||||||
|           $ref: '#/components/schemas/InternalSystemServices' |  | ||||||
|         403: |  | ||||||
|           $ref: '#/components/responses/Unauthorized' |  | ||||||
|         404: |  | ||||||
|           $ref: '#/components/responses/NotFound' |  | ||||||
|  |  | ||||||
|   /validateToken: |   /validateToken: | ||||||
|     get: |     get: | ||||||
| @@ -1968,16 +1988,12 @@ paths: | |||||||
|             type: string |             type: string | ||||||
|             enum: |             enum: | ||||||
|               - info |               - info | ||||||
|  |               - extraConfiguration | ||||||
|  |               - resources | ||||||
|           required: true |           required: true | ||||||
|  |  | ||||||
|       responses: |       responses: | ||||||
|         200: |         200: | ||||||
|           description: Successful command execution |           $ref: '#/components/schemas/SystemCommandResults' | ||||||
|           content: |  | ||||||
|             application/json: |  | ||||||
|               schema: |  | ||||||
|                 oneOf: |  | ||||||
|                   - $ref: '#/components/schemas/SystemInfoResults' |  | ||||||
|         403: |         403: | ||||||
|           $ref: '#/components/responses/Unauthorized' |           $ref: '#/components/responses/Unauthorized' | ||||||
|         404: |         404: | ||||||
| @@ -1985,6 +2001,8 @@ paths: | |||||||
|  |  | ||||||
|   /systemSecret/{secret}: |   /systemSecret/{secret}: | ||||||
|     get: |     get: | ||||||
|  |       tags: | ||||||
|  |         - System Secrets | ||||||
|       description: Retrieve a specific secret |       description: Retrieve a specific secret | ||||||
|       operationId: getSecret |       operationId: getSecret | ||||||
|       parameters: |       parameters: | ||||||
| @@ -2029,6 +2047,8 @@ paths: | |||||||
|           $ref: '#/components/responses/NotFound' |           $ref: '#/components/responses/NotFound' | ||||||
|  |  | ||||||
|     put: |     put: | ||||||
|  |       tags: | ||||||
|  |         - System Secrets | ||||||
|       description: Modify a specific secret |       description: Modify a specific secret | ||||||
|       operationId: modifySecret |       operationId: modifySecret | ||||||
|       parameters: |       parameters: | ||||||
|   | |||||||
| @@ -34,8 +34,8 @@ authentication.default.username = tip@ucentral.com | |||||||
| authentication.default.password = 13268b7daa751240369d125e79c873bd8dd3bef7981bdfd38ea03dbb1fbe7dcf | authentication.default.password = 13268b7daa751240369d125e79c873bd8dd3bef7981bdfd38ea03dbb1fbe7dcf | ||||||
| openwifi.system.data = $OWSEC_ROOT/data | 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://main.server.com:16001 | ||||||
| openwifi.system.uri.ui = https://ucentral-ui.arilia.com | openwifi.system.uri.ui = https://ucentral-ui.main.server.com | ||||||
| openwifi.security.restapi.disable = false | 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 | ||||||
| @@ -64,9 +64,19 @@ mailer.loginmethod = login | |||||||
| mailer.port = 587 | mailer.port = 587 | ||||||
| mailer.templates = $OWSEC_ROOT/templates | mailer.templates = $OWSEC_ROOT/templates | ||||||
|  |  | ||||||
|  | helper.user.email = openwifi@telecominfraproject.com | ||||||
|  | helper.sub.email = openwifi@telecominfraproject.com | ||||||
|  | helper.user.global.email = openwifi@telecominfraproject.com | ||||||
|  | helper.sub.global.email = openwifi@telecominfraproject.com | ||||||
|  | helper.user.site = https://openwifi.telecominfraproject.com | ||||||
|  | helper.sub.site = https://openwifi.telecominfraproject.com | ||||||
|  | helper.user.login = https://openwifi.telecominfraproject.com | ||||||
|  | helper.sub.login = https://openwifi.telecominfraproject.com | ||||||
|  | helper.user.signature = Telecom Infra Project | ||||||
|  | helper.sub.signature = Telecom Infra Project | ||||||
|  |  | ||||||
| ############################# | ############################# | ||||||
| # Generic information for all micro services | # Generic information for all micro-services | ||||||
| ############################# | ############################# | ||||||
| # | # | ||||||
| # NLB Support | # NLB Support | ||||||
| @@ -80,7 +90,7 @@ alb.port = 16101 | |||||||
| openwifi.kafka.group.id = security | openwifi.kafka.group.id = security | ||||||
| openwifi.kafka.client.id = security1 | openwifi.kafka.client.id = security1 | ||||||
| openwifi.kafka.enable = true | openwifi.kafka.enable = true | ||||||
| openwifi.kafka.brokerlist = a1.arilia.com:9092 | openwifi.kafka.brokerlist = kafka:9092 | ||||||
| openwifi.kafka.auto.commit = false | openwifi.kafka.auto.commit = false | ||||||
| openwifi.kafka.queue.buffering.max.ms = 50 | openwifi.kafka.queue.buffering.max.ms = 50 | ||||||
| openwifi.kafka.ssl.ca.location = | openwifi.kafka.ssl.ca.location = | ||||||
| @@ -110,18 +120,18 @@ storage.type.sqlite.maxsessions = 128 | |||||||
| storage.type.postgresql.maxsessions = 64 | storage.type.postgresql.maxsessions = 64 | ||||||
| storage.type.postgresql.idletime = 60 | storage.type.postgresql.idletime = 60 | ||||||
| storage.type.postgresql.host = localhost | storage.type.postgresql.host = localhost | ||||||
| storage.type.postgresql.username = stephb | storage.type.postgresql.username = owsec | ||||||
| storage.type.postgresql.password = snoopy99 | storage.type.postgresql.password = owsec | ||||||
| storage.type.postgresql.database = ucentral | storage.type.postgresql.database = owsec | ||||||
| storage.type.postgresql.port = 5432 | storage.type.postgresql.port = 5432 | ||||||
| storage.type.postgresql.connectiontimeout = 60 | storage.type.postgresql.connectiontimeout = 60 | ||||||
|  |  | ||||||
| storage.type.mysql.maxsessions = 64 | storage.type.mysql.maxsessions = 64 | ||||||
| storage.type.mysql.idletime = 60 | storage.type.mysql.idletime = 60 | ||||||
| storage.type.mysql.host = localhost | storage.type.mysql.host = localhost | ||||||
| storage.type.mysql.username = stephb | storage.type.mysql.username = owsec | ||||||
| storage.type.mysql.password = snoopy99 | storage.type.mysql.password = owsec | ||||||
| storage.type.mysql.database = ucentral | storage.type.mysql.database = owsec | ||||||
| storage.type.mysql.port = 3306 | storage.type.mysql.port = 3306 | ||||||
| storage.type.mysql.connectiontimeout = 60 | storage.type.mysql.connectiontimeout = 60 | ||||||
|  |  | ||||||
|   | |||||||
| @@ -64,6 +64,16 @@ mailer.loginmethod = login | |||||||
| mailer.port = ${MAILER_PORT} | mailer.port = ${MAILER_PORT} | ||||||
| mailer.templates = ${MAILER_TEMPLATES} | mailer.templates = ${MAILER_TEMPLATES} | ||||||
|  |  | ||||||
|  | helper.user.email = ${USER_HELPER_EMAIL} | ||||||
|  | helper.sub.email = ${SUB_HELPER_EMAIL} | ||||||
|  | helper.user.global.email = ${GLOBAL_USER_HELPER_EMAIL} | ||||||
|  | helper.sub.global.email = ${GLOBAL_SUB_HELPER_EMAIL} | ||||||
|  | helper.user.site = ${USER_HELPER_SITE} | ||||||
|  | helper.sub.site = ${SUB_HELPER_SITE} | ||||||
|  | helper.user.login = ${USER_SYSTEM_LOGIN} | ||||||
|  | helper.sub.login = ${SUB_SYSTEM_LOGIN} | ||||||
|  | helper.user.signature = ${USER_SIGNATURE} | ||||||
|  | helper.sub.signature = ${SUB_SIGNATURE} | ||||||
|  |  | ||||||
| ############################# | ############################# | ||||||
| # Generic information for all micro services | # Generic information for all micro services | ||||||
|   | |||||||
| @@ -28,10 +28,13 @@ namespace OpenWifi { | |||||||
| 		poco_information(Logger(), "Stopped..."); | 		poco_information(Logger(), "Stopped..."); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
|     void ActionLinkManager::run() { |     void ActionLinkManager::run() { | ||||||
| 		Running_ = true; | 		Running_ = true; | ||||||
| 		Utils::SetThreadName("action-mgr"); | 		Utils::SetThreadName("action-mgr"); | ||||||
|  |  | ||||||
|  |         Poco::Thread::trySleep(10000); | ||||||
|  |  | ||||||
| 		while (Running_) { | 		while (Running_) { | ||||||
| 			Poco::Thread::trySleep(2000); | 			Poco::Thread::trySleep(2000); | ||||||
| 			if (!Running_) | 			if (!Running_) | ||||||
| @@ -98,10 +101,8 @@ namespace OpenWifi { | |||||||
| 				} 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, | 					if (AuthService()->SendEmailToSubUser(i.id, UInfo.email, | ||||||
| 														  MessagingTemplates::SUB_FORGOT_PASSWORD, | 														  MessagingTemplates::SUB_FORGOT_PASSWORD,"")) { | ||||||
| 														  Signup.count() == 1 ? "" : Signup[0])) { |  | ||||||
| 						poco_information( | 						poco_information( | ||||||
| 							Logger(), | 							Logger(), | ||||||
| 							fmt::format("Send subscriber password reset link to {}", UInfo.email)); | 							fmt::format("Send subscriber password reset link to {}", UInfo.email)); | ||||||
| @@ -110,10 +111,8 @@ namespace OpenWifi { | |||||||
| 				} 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( | 					if (AuthService()->SendEmailToSubUser( | ||||||
| 							i.id, UInfo.email, MessagingTemplates::SUB_EMAIL_VERIFICATION, | 							i.id, UInfo.email, MessagingTemplates::SUB_EMAIL_VERIFICATION,"")) { | ||||||
| 							Signup.count() == 1 ? "" : Signup[0])) { |  | ||||||
| 						poco_information( | 						poco_information( | ||||||
| 							Logger(), fmt::format("Send subscriber email verification link to {}", | 							Logger(), fmt::format("Send subscriber email verification link to {}", | ||||||
| 												  UInfo.email)); | 												  UInfo.email)); | ||||||
|   | |||||||
| @@ -218,7 +218,7 @@ namespace OpenWifi { | |||||||
| 				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; | ||||||
| 					poco_debug(Logger(), fmt::format("TokenValidation success for TID={} Token={}", | 					poco_trace(Logger(), fmt::format("TokenValidation success for TID={} Token={}", | ||||||
| 													 TID, Utils::SanitizeToken(CallToken))); | 													 TID, Utils::SanitizeToken(CallToken))); | ||||||
| 					return true; | 					return true; | ||||||
| 				} | 				} | ||||||
| @@ -342,10 +342,8 @@ namespace OpenWifi { | |||||||
| 				Obj.set("event", "remove-token"); | 				Obj.set("event", "remove-token"); | ||||||
| 				Obj.set("id", MicroServiceID()); | 				Obj.set("id", MicroServiceID()); | ||||||
| 				Obj.set("token", token); | 				Obj.set("token", token); | ||||||
| 				std::stringstream ResultText; |  | ||||||
| 				Poco::JSON::Stringifier::stringify(Obj, ResultText); |  | ||||||
| 				KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, | 				KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, | ||||||
| 											MicroServicePrivateEndPoint(), ResultText.str(), false); | 											MicroServicePrivateEndPoint(), Obj, false); | ||||||
| 			} | 			} | ||||||
| 		} catch (const Poco::Exception &E) { | 		} catch (const Poco::Exception &E) { | ||||||
| 			Logger().log(E); | 			Logger().log(E); | ||||||
| @@ -800,7 +798,6 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 		if (StorageService()->SubDB().GetUserByEmail(Email, UInfo)) { | 		if (StorageService()->SubDB().GetUserByEmail(Email, UInfo)) { | ||||||
| 			switch (Reason) { | 			switch (Reason) { | ||||||
|  |  | ||||||
| 			case MessagingTemplates::SUB_FORGOT_PASSWORD: { | 			case MessagingTemplates::SUB_FORGOT_PASSWORD: { | ||||||
| 				MessageAttributes Attrs; | 				MessageAttributes Attrs; | ||||||
| 				Attrs[RECIPIENT_EMAIL] = UInfo.email; | 				Attrs[RECIPIENT_EMAIL] = UInfo.email; | ||||||
|   | |||||||
| @@ -37,9 +37,9 @@ namespace OpenWifi { | |||||||
| 			instance_ = | 			instance_ = | ||||||
| 				new Daemon(vDAEMON_PROPERTIES_FILENAME, vDAEMON_ROOT_ENV_VAR, | 				new Daemon(vDAEMON_PROPERTIES_FILENAME, vDAEMON_ROOT_ENV_VAR, | ||||||
| 						   vDAEMON_CONFIG_ENV_VAR, vDAEMON_APP_NAME, vDAEMON_BUS_TIMER, | 						   vDAEMON_CONFIG_ENV_VAR, vDAEMON_APP_NAME, vDAEMON_BUS_TIMER, | ||||||
| 						   SubSystemVec{StorageService(), SMSSender(), ActionLinkManager(), | 						   SubSystemVec{StorageService(), SMSSender(), AuthService(), ActionLinkManager(), | ||||||
| 										SMTPMailerService(), RESTAPI_RateLimiter(), TotpCache(), | 										SMTPMailerService(), RESTAPI_RateLimiter(), TotpCache(), | ||||||
| 										AuthService(), UI_WebSocketClientServer(), SecretStore()}); | 										UI_WebSocketClientServer(), SecretStore()}); | ||||||
| 		} | 		} | ||||||
| 		return instance_; | 		return instance_; | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -37,11 +37,11 @@ namespace OpenWifi { | |||||||
| 		if (Action == "password_reset") | 		if (Action == "password_reset") | ||||||
| 			return RequestResetPassword(Link); | 			return RequestResetPassword(Link); | ||||||
| 		else if (Action == "sub_password_reset") | 		else if (Action == "sub_password_reset") | ||||||
| 			return RequestSubResetPassword(Link); | 			return RequestResetPassword(Link); | ||||||
| 		else if (Action == "email_verification") | 		else if (Action == "email_verification") | ||||||
| 			return DoEmailVerification(Link); | 			return DoEmailVerification(Link); | ||||||
| 		else if (Action == "sub_email_verification") | 		else if (Action == "sub_email_verification") | ||||||
| 			return DoSubEmailVerification(Link); | 			return DoEmailVerification(Link); | ||||||
| 		else if (Action == "signup_verification") | 		else if (Action == "signup_verification") | ||||||
| 			return DoNewSubVerification(Link); | 			return DoNewSubVerification(Link); | ||||||
| 		else | 		else | ||||||
| @@ -101,7 +101,6 @@ namespace OpenWifi { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void RESTAPI_action_links::CompleteResetPassword() { | 	void RESTAPI_action_links::CompleteResetPassword() { | ||||||
| 		//  form has been posted... |  | ||||||
| 		RESTAPI_PartHandler PartHandler; | 		RESTAPI_PartHandler PartHandler; | ||||||
| 		Poco::Net::HTMLForm Form(*Request, Request->stream(), PartHandler); | 		Poco::Net::HTMLForm Form(*Request, Request->stream(), PartHandler); | ||||||
| 		if (!Form.empty()) { | 		if (!Form.empty()) { | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| // |  // | ||||||
| // Created by stephane bourque on 2021-10-23. | // Created by stephane bourque on 2021-10-23. | ||||||
| // | // | ||||||
|  |  | ||||||
|   | |||||||
| @@ -34,7 +34,9 @@ namespace OpenWifi { | |||||||
| 			return BadRequest(RESTAPI::Errors::SMSCouldNotValidate); | 			return BadRequest(RESTAPI::Errors::SMSCouldNotValidate); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (UserInfo_.userinfo.userRole != SecurityObjects::ROOT && |         if(Internal_) { | ||||||
|  |             poco_information(Logger(),fmt::format("Internal SMS request: TID={}", TransactionId_)); | ||||||
|  |         } else if (UserInfo_.userinfo.userRole != SecurityObjects::ROOT && | ||||||
| 			UserInfo_.userinfo.userRole != SecurityObjects::PARTNER && | 			UserInfo_.userinfo.userRole != SecurityObjects::PARTNER && | ||||||
| 			UserInfo_.userinfo.userRole != SecurityObjects::ADMIN) { | 			UserInfo_.userinfo.userRole != SecurityObjects::ADMIN) { | ||||||
| 			return UnAuthorized(RESTAPI::Errors::ACCESS_DENIED); | 			return UnAuthorized(RESTAPI::Errors::ACCESS_DENIED); | ||||||
|   | |||||||
| @@ -185,7 +185,7 @@ namespace OpenWifi { | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (GetBoolParameter("forgotPassword")) { | 		if (GetBoolParameter("forgotPassword") || GetBoolParameter("resetPassword")) { | ||||||
| 			Existing.changePassword = true; | 			Existing.changePassword = true; | ||||||
| 			Logger_.information(fmt::format("FORGOTTEN-PASSWORD({}): Request for {}", | 			Logger_.information(fmt::format("FORGOTTEN-PASSWORD({}): Request for {}", | ||||||
| 											Request->clientAddress().toString(), Existing.email)); | 											Request->clientAddress().toString(), Existing.email)); | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ namespace OpenWifi { | |||||||
| 			return NotFound(); | 			return NotFound(); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (!ACLProcessor::Can(UserInfo_.userinfo, UInfo, ACLProcessor::READ)) { | 		if (!Internal_ && !ACLProcessor::Can(UserInfo_.userinfo, UInfo, ACLProcessor::READ)) { | ||||||
| 			return UnAuthorized(RESTAPI::Errors::ACCESS_DENIED); | 			return UnAuthorized(RESTAPI::Errors::ACCESS_DENIED); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -13,6 +13,7 @@ | |||||||
| #ifdef TIP_GATEWAY_SERVICE | #ifdef TIP_GATEWAY_SERVICE | ||||||
| #include "AP_WS_Server.h" | #include "AP_WS_Server.h" | ||||||
| #include "CapabilitiesCache.h" | #include "CapabilitiesCache.h" | ||||||
|  | #include "RADIUSSessionTracker.h" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include "RESTAPI_GWobjects.h" | #include "RESTAPI_GWobjects.h" | ||||||
| @@ -29,6 +30,7 @@ namespace OpenWifi::GWObjects { | |||||||
| 		field_to_json(Obj, "serialNumber", SerialNumber); | 		field_to_json(Obj, "serialNumber", SerialNumber); | ||||||
| #ifdef TIP_GATEWAY_SERVICE | #ifdef TIP_GATEWAY_SERVICE | ||||||
| 		field_to_json(Obj, "deviceType", CapabilitiesCache::instance()->GetPlatform(Compatible)); | 		field_to_json(Obj, "deviceType", CapabilitiesCache::instance()->GetPlatform(Compatible)); | ||||||
|  | 		field_to_json(Obj, "hasRADIUSSessions", RADIUSSessionTracker()->HasSessions(SerialNumber)); | ||||||
| #endif | #endif | ||||||
| 		field_to_json(Obj, "macAddress", MACAddress); | 		field_to_json(Obj, "macAddress", MACAddress); | ||||||
| 		field_to_json(Obj, "manufacturer", Manufacturer); | 		field_to_json(Obj, "manufacturer", Manufacturer); | ||||||
| @@ -54,6 +56,9 @@ namespace OpenWifi::GWObjects { | |||||||
| 		field_to_json(Obj, "pendingConfiguration", pendingConfiguration); | 		field_to_json(Obj, "pendingConfiguration", pendingConfiguration); | ||||||
| 		field_to_json(Obj, "pendingConfigurationCmd", pendingConfigurationCmd); | 		field_to_json(Obj, "pendingConfigurationCmd", pendingConfigurationCmd); | ||||||
| 		field_to_json(Obj, "restrictionDetails", restrictionDetails); | 		field_to_json(Obj, "restrictionDetails", restrictionDetails); | ||||||
|  | 		field_to_json(Obj, "pendingUUID", pendingUUID); | ||||||
|  | 		field_to_json(Obj, "simulated", simulated); | ||||||
|  | 		field_to_json(Obj, "lastRecordedContact", lastRecordedContact); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void Device::to_json_with_status(Poco::JSON::Object &Obj) const { | 	void Device::to_json_with_status(Poco::JSON::Object &Obj) const { | ||||||
| @@ -63,7 +68,7 @@ namespace OpenWifi::GWObjects { | |||||||
| 		ConnectionState ConState; | 		ConnectionState ConState; | ||||||
|  |  | ||||||
| 		if (AP_WS_Server()->GetState(SerialNumber, ConState)) { | 		if (AP_WS_Server()->GetState(SerialNumber, ConState)) { | ||||||
| 			ConState.to_json(Obj); | 			ConState.to_json(SerialNumber,Obj); | ||||||
| 		} else { | 		} else { | ||||||
| 			field_to_json(Obj, "ipAddress", ""); | 			field_to_json(Obj, "ipAddress", ""); | ||||||
| 			field_to_json(Obj, "txBytes", (uint64_t)0); | 			field_to_json(Obj, "txBytes", (uint64_t)0); | ||||||
| @@ -75,6 +80,13 @@ namespace OpenWifi::GWObjects { | |||||||
| 			field_to_json(Obj, "associations_2G", (uint64_t)0); | 			field_to_json(Obj, "associations_2G", (uint64_t)0); | ||||||
| 			field_to_json(Obj, "associations_5G", (uint64_t)0); | 			field_to_json(Obj, "associations_5G", (uint64_t)0); | ||||||
| 			field_to_json(Obj, "associations_6G", (uint64_t)0); | 			field_to_json(Obj, "associations_6G", (uint64_t)0); | ||||||
|  | 			field_to_json(Obj, "hasRADIUSSessions", false); | ||||||
|  | 			field_to_json(Obj, "hasGPS", ConState.hasGPS); | ||||||
|  | 			field_to_json(Obj, "sanity", ConState.sanity); | ||||||
|  | 			field_to_json(Obj, "memoryUsed", ConState.memoryUsed); | ||||||
|  | 			field_to_json(Obj, "sanity", ConState.sanity); | ||||||
|  | 			field_to_json(Obj, "load", ConState.load); | ||||||
|  | 			field_to_json(Obj, "temperature", ConState.temperature); | ||||||
| 		} | 		} | ||||||
| #endif | #endif | ||||||
| 	} | 	} | ||||||
| @@ -84,20 +96,32 @@ namespace OpenWifi::GWObjects { | |||||||
| 			field_from_json(Obj, "serialNumber", SerialNumber); | 			field_from_json(Obj, "serialNumber", SerialNumber); | ||||||
| 			field_from_json(Obj, "deviceType", DeviceType); | 			field_from_json(Obj, "deviceType", DeviceType); | ||||||
| 			field_from_json(Obj, "macAddress", MACAddress); | 			field_from_json(Obj, "macAddress", MACAddress); | ||||||
|  | 			field_from_json(Obj, "manufacturer", Manufacturer); | ||||||
|  | 			field_from_json(Obj, "UUID", UUID); | ||||||
| 			field_from_json(Obj, "configuration", Configuration); | 			field_from_json(Obj, "configuration", Configuration); | ||||||
| 			field_from_json(Obj, "notes", Notes); | 			field_from_json(Obj, "notes", Notes); | ||||||
| 			field_from_json(Obj, "manufacturer", Manufacturer); | 			field_from_json(Obj, "createdTimestamp", CreationTimestamp); | ||||||
|  | 			field_from_json(Obj, "lastConfigurationChange", LastConfigurationChange); | ||||||
|  | 			field_from_json(Obj, "lastConfigurationDownload", LastConfigurationDownload); | ||||||
|  | 			field_from_json(Obj, "lastFWUpdate", LastFWUpdate); | ||||||
| 			field_from_json(Obj, "owner", Owner); | 			field_from_json(Obj, "owner", Owner); | ||||||
| 			field_from_json(Obj, "location", Location); | 			field_from_json(Obj, "location", Location); | ||||||
| 			field_from_json(Obj, "venue", Venue); | 			field_from_json(Obj, "venue", Venue); | ||||||
|  | 			field_from_json(Obj, "firmware", Firmware); | ||||||
| 			field_from_json(Obj, "compatible", Compatible); | 			field_from_json(Obj, "compatible", Compatible); | ||||||
|  | 			field_from_json(Obj, "fwUpdatePolicy", FWUpdatePolicy); | ||||||
|  | 			field_from_json(Obj, "devicePassword", DevicePassword); | ||||||
| 			field_from_json(Obj, "subscriber", subscriber); | 			field_from_json(Obj, "subscriber", subscriber); | ||||||
| 			field_from_json(Obj, "entity", entity); | 			field_from_json(Obj, "entity", entity); | ||||||
|  | 			field_from_json(Obj, "modified", modified); | ||||||
| 			field_from_json(Obj, "locale", locale); | 			field_from_json(Obj, "locale", locale); | ||||||
| 			field_from_json(Obj, "restrictedDevice", restrictedDevice); | 			field_from_json(Obj, "restrictedDevice", restrictedDevice); | ||||||
| 			field_from_json(Obj, "pendingConfiguration", pendingConfiguration); | 			field_from_json(Obj, "pendingConfiguration", pendingConfiguration); | ||||||
| 			field_from_json(Obj, "pendingConfigurationCmd", pendingConfigurationCmd); | 			field_from_json(Obj, "pendingConfigurationCmd", pendingConfigurationCmd); | ||||||
| 			field_from_json(Obj, "restrictionDetails", restrictionDetails); | 			field_from_json(Obj, "restrictionDetails", restrictionDetails); | ||||||
|  | 			field_from_json(Obj, "pendingUUID", pendingUUID); | ||||||
|  | 			field_from_json(Obj, "simulated", simulated); | ||||||
|  | 			field_from_json(Obj, "lastRecordedContact", lastRecordedContact); | ||||||
| 			return true; | 			return true; | ||||||
| 		} catch (const Poco::Exception &E) { | 		} catch (const Poco::Exception &E) { | ||||||
| 		} | 		} | ||||||
| @@ -147,6 +171,31 @@ namespace OpenWifi::GWObjects { | |||||||
| 		field_to_json(Obj, "lastModified", LastModified); | 		field_to_json(Obj, "lastModified", LastModified); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	void DefaultFirmware::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  | 		field_to_json(Obj, "deviceType", deviceType); | ||||||
|  | 		field_to_json(Obj, "description", Description); | ||||||
|  | 		field_to_json(Obj, "uri", uri); | ||||||
|  | 		field_to_json(Obj, "revision", revision); | ||||||
|  | 		field_to_json(Obj, "imageCreationDate", imageCreationDate); | ||||||
|  | 		field_to_json(Obj, "created", Created); | ||||||
|  | 		field_to_json(Obj, "lastModified", LastModified); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	bool DefaultFirmware::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
|  | 		try { | ||||||
|  | 			field_from_json(Obj, "deviceType", deviceType); | ||||||
|  | 			field_from_json(Obj, "description", Description); | ||||||
|  | 			field_from_json(Obj, "uri", uri); | ||||||
|  | 			field_from_json(Obj, "revision", revision); | ||||||
|  | 			field_from_json(Obj, "imageCreationDate", imageCreationDate); | ||||||
|  | 			field_from_json(Obj, "created", Created); | ||||||
|  | 			field_from_json(Obj, "lastModified", LastModified); | ||||||
|  | 			return true; | ||||||
|  | 		} catch (const Poco::Exception &E) { | ||||||
|  | 		} | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	void CommandDetails::to_json(Poco::JSON::Object &Obj) const { | 	void CommandDetails::to_json(Poco::JSON::Object &Obj) const { | ||||||
| 		EmbedDocument("details", Obj, Details); | 		EmbedDocument("details", Obj, Details); | ||||||
| 		EmbedDocument("results", Obj, Results); | 		EmbedDocument("results", Obj, Results); | ||||||
| @@ -165,6 +214,8 @@ namespace OpenWifi::GWObjects { | |||||||
| 		field_to_json(Obj, "waitingForFile", WaitingForFile); | 		field_to_json(Obj, "waitingForFile", WaitingForFile); | ||||||
| 		field_to_json(Obj, "attachFile", AttachDate); | 		field_to_json(Obj, "attachFile", AttachDate); | ||||||
| 		field_to_json(Obj, "executionTime", executionTime); | 		field_to_json(Obj, "executionTime", executionTime); | ||||||
|  | 		field_to_json(Obj, "lastTry", lastTry); | ||||||
|  | 		field_to_json(Obj, "deferred", deferred); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	bool DefaultConfiguration::from_json(const Poco::JSON::Object::Ptr &Obj) { | 	bool DefaultConfiguration::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
| @@ -198,7 +249,7 @@ namespace OpenWifi::GWObjects { | |||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void ConnectionState::to_json(Poco::JSON::Object &Obj) const { | 	void ConnectionState::to_json([[maybe_unused]] const std::string &SerialNumber, Poco::JSON::Object &Obj)  { | ||||||
| 		field_to_json(Obj, "ipAddress", Address); | 		field_to_json(Obj, "ipAddress", Address); | ||||||
| 		field_to_json(Obj, "txBytes", TX); | 		field_to_json(Obj, "txBytes", TX); | ||||||
| 		field_to_json(Obj, "rxBytes", RX); | 		field_to_json(Obj, "rxBytes", RX); | ||||||
| @@ -220,6 +271,22 @@ namespace OpenWifi::GWObjects { | |||||||
| 		field_to_json(Obj, "connectionCompletionTime", connectionCompletionTime); | 		field_to_json(Obj, "connectionCompletionTime", connectionCompletionTime); | ||||||
| 		field_to_json(Obj, "totalConnectionTime", Utils::Now() - started); | 		field_to_json(Obj, "totalConnectionTime", Utils::Now() - started); | ||||||
| 		field_to_json(Obj, "certificateExpiryDate", certificateExpiryDate); | 		field_to_json(Obj, "certificateExpiryDate", certificateExpiryDate); | ||||||
|  | 		field_to_json(Obj, "connectReason", connectReason); | ||||||
|  |  | ||||||
|  | #ifdef TIP_GATEWAY_SERVICE | ||||||
|  | 		hasRADIUSSessions = RADIUSSessionTracker()->HasSessions(SerialNumber); | ||||||
|  | 		AP_WS_Server()->ExtendedAttributes(SerialNumber, hasGPS, sanity, | ||||||
|  | 										   memoryUsed, | ||||||
|  | 										   load, | ||||||
|  | 										   temperature); | ||||||
|  | #endif | ||||||
|  | 		field_to_json(Obj, "hasRADIUSSessions", hasRADIUSSessions ); | ||||||
|  | 		field_to_json(Obj, "hasGPS", hasGPS); | ||||||
|  | 		field_to_json(Obj, "sanity", sanity); | ||||||
|  | 		field_to_json(Obj, "memoryUsed", memoryUsed); | ||||||
|  | 		field_to_json(Obj, "sanity", sanity); | ||||||
|  | 		field_to_json(Obj, "load", load); | ||||||
|  | 		field_to_json(Obj, "temperature", temperature); | ||||||
|  |  | ||||||
| 		switch (VerifiedCertificate) { | 		switch (VerifiedCertificate) { | ||||||
| 		case NO_CERTIFICATE: | 		case NO_CERTIFICATE: | ||||||
| @@ -234,6 +301,9 @@ namespace OpenWifi::GWObjects { | |||||||
| 		case VERIFIED: | 		case VERIFIED: | ||||||
| 			field_to_json(Obj, "verifiedCertificate", "VERIFIED"); | 			field_to_json(Obj, "verifiedCertificate", "VERIFIED"); | ||||||
| 			break; | 			break; | ||||||
|  | 		case SIMULATED: | ||||||
|  | 			field_to_json(Obj, "verifiedCertificate", "SIMULATED"); | ||||||
|  | 			break; | ||||||
| 		default: | 		default: | ||||||
| 			field_to_json(Obj, "verifiedCertificate", "NO_CERTIFICATE"); | 			field_to_json(Obj, "verifiedCertificate", "NO_CERTIFICATE"); | ||||||
| 			break; | 			break; | ||||||
| @@ -360,6 +430,10 @@ namespace OpenWifi::GWObjects { | |||||||
| 		field_to_json(Obj, "acctConfig", acctConfig); | 		field_to_json(Obj, "acctConfig", acctConfig); | ||||||
| 		field_to_json(Obj, "coaConfig", coaConfig); | 		field_to_json(Obj, "coaConfig", coaConfig); | ||||||
| 		field_to_json(Obj, "useByDefault", useByDefault); | 		field_to_json(Obj, "useByDefault", useByDefault); | ||||||
|  | 		field_to_json(Obj, "radsecKeepAlive", radsecKeepAlive); | ||||||
|  | 		field_to_json(Obj, "poolProxyIp", poolProxyIp); | ||||||
|  | 		field_to_json(Obj, "radsecPoolType", radsecPoolType); | ||||||
|  | 		field_to_json(Obj, "enabled", enabled); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	bool RadiusProxyPool::from_json(const Poco::JSON::Object::Ptr &Obj) { | 	bool RadiusProxyPool::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
| @@ -370,6 +444,10 @@ namespace OpenWifi::GWObjects { | |||||||
| 			field_from_json(Obj, "acctConfig", acctConfig); | 			field_from_json(Obj, "acctConfig", acctConfig); | ||||||
| 			field_from_json(Obj, "coaConfig", coaConfig); | 			field_from_json(Obj, "coaConfig", coaConfig); | ||||||
| 			field_from_json(Obj, "useByDefault", useByDefault); | 			field_from_json(Obj, "useByDefault", useByDefault); | ||||||
|  | 			field_from_json(Obj, "radsecKeepAlive", radsecKeepAlive); | ||||||
|  | 			field_from_json(Obj, "poolProxyIp", poolProxyIp); | ||||||
|  | 			field_from_json(Obj, "radsecPoolType", radsecPoolType); | ||||||
|  | 			field_from_json(Obj, "enabled", enabled); | ||||||
| 			return true; | 			return true; | ||||||
| 		} catch (const Poco::Exception &E) { | 		} catch (const Poco::Exception &E) { | ||||||
| 		} | 		} | ||||||
| @@ -490,6 +568,29 @@ namespace OpenWifi::GWObjects { | |||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	void RangeOptions::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  | 		field_to_json(Obj, "NO_IR", NO_IR); | ||||||
|  | 		field_to_json(Obj, "AUTO_BW", AUTO_BW); | ||||||
|  | 		field_to_json(Obj, "DFS", DFS); | ||||||
|  | 		field_to_json(Obj, "NO_OUTDOOR", NO_OUTDOOR); | ||||||
|  | 		field_to_json(Obj, "wmmrule_ETSI", wmmrule_ETSI); | ||||||
|  | 		field_to_json(Obj, "NO_OFDM", NO_OFDM); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	void FrequencyRange::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  | 		field_to_json(Obj, "from", from); | ||||||
|  | 		field_to_json(Obj, "to", to); | ||||||
|  | 		field_to_json(Obj, "channelWidth", channelWidth); | ||||||
|  | 		field_to_json(Obj, "powerDb", powerDb); | ||||||
|  | 		field_to_json(Obj, "options", options); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	void RegulatoryCountryInfo::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  | 		field_to_json(Obj, "country", country); | ||||||
|  | 		field_to_json(Obj, "domain", domain); | ||||||
|  | 		field_to_json(Obj, "ranges", ranges); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	void DeviceRestrictionsKeyInfo::to_json(Poco::JSON::Object &Obj) const { | 	void DeviceRestrictionsKeyInfo::to_json(Poco::JSON::Object &Obj) const { | ||||||
| 		field_to_json(Obj, "vendor", vendor); | 		field_to_json(Obj, "vendor", vendor); | ||||||
| 		field_to_json(Obj, "algo", algo); | 		field_to_json(Obj, "algo", algo); | ||||||
| @@ -544,4 +645,74 @@ namespace OpenWifi::GWObjects { | |||||||
| 				(T.commands != commands) || (T.developer != developer) || (T.ssh != ssh) || | 				(T.commands != commands) || (T.developer != developer) || (T.ssh != ssh) || | ||||||
| 				(T.key_info != key_info) || (T.country != country)); | 				(T.key_info != key_info) || (T.country != country)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	void RADIUSSession::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  | 		field_to_json(Obj, "started", started); | ||||||
|  | 		field_to_json(Obj, "lastTransaction", lastTransaction); | ||||||
|  | 		field_to_json(Obj, "destination", destination); | ||||||
|  | 		field_to_json(Obj, "serialNumber", serialNumber); | ||||||
|  | 		field_to_json(Obj, "userName", userName); | ||||||
|  | 		field_to_json(Obj, "accountingSessionId", accountingSessionId); | ||||||
|  | 		field_to_json(Obj, "accountingMultiSessionId", accountingMultiSessionId); | ||||||
|  | 		field_to_json(Obj, "inputPackets", inputPackets); | ||||||
|  | 		field_to_json(Obj, "outputPackets", outputPackets); | ||||||
|  | 		field_to_json(Obj, "inputOctets", inputOctets); | ||||||
|  | 		field_to_json(Obj, "outputOctets", outputOctets); | ||||||
|  | 		field_to_json(Obj, "inputGigaWords", inputGigaWords); | ||||||
|  | 		field_to_json(Obj, "outputGigaWords", outputGigaWords); | ||||||
|  | 		field_to_json(Obj, "sessionTime", sessionTime); | ||||||
|  | 		field_to_json(Obj, "callingStationId", callingStationId); | ||||||
|  | 		field_to_json(Obj, "chargeableUserIdentity", chargeableUserIdentity); | ||||||
|  | 		field_to_json(Obj, "interface", interface); | ||||||
|  | 		field_to_json(Obj, "secret", secret); | ||||||
|  | 		field_to_json(Obj, "nasId", nasId); | ||||||
|  | 		field_to_json(Obj, "calledStationId", calledStationId); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	void RADIUSSessionList::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  | 		field_to_json(Obj, "sessions", sessions); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	void RadiusCoADMParameters::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  | 		field_to_json(Obj, "accountingSessionId", accountingSessionId); | ||||||
|  | 		field_to_json(Obj, "accountingMultiSessionId", accountingMultiSessionId); | ||||||
|  | 		field_to_json(Obj, "callingStationId", callingStationId); | ||||||
|  | 		field_to_json(Obj, "chargeableUserIdentity", chargeableUserIdentity); | ||||||
|  | 		field_to_json(Obj, "userName", userName); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	bool RadiusCoADMParameters::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
|  | 		try { | ||||||
|  | 			field_from_json(Obj, "accountingSessionId", accountingSessionId); | ||||||
|  | 			field_from_json(Obj, "accountingMultiSessionId", accountingMultiSessionId); | ||||||
|  | 			field_from_json(Obj, "callingStationId", callingStationId); | ||||||
|  | 			field_from_json(Obj, "chargeableUserIdentity", chargeableUserIdentity); | ||||||
|  | 			field_from_json(Obj, "userName", userName); | ||||||
|  | 			return true; | ||||||
|  | 		} catch (const Poco::Exception &E) { | ||||||
|  | 		} | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	bool DeviceTransferRequest::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
|  | 		try { | ||||||
|  | 			field_from_json(Obj, "serialNumber", serialNumber); | ||||||
|  | 			field_from_json(Obj, "server", server); | ||||||
|  | 			field_from_json(Obj, "port", port); | ||||||
|  | 			return true; | ||||||
|  | 		} catch (const Poco::Exception &E) { | ||||||
|  | 		} | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	bool DeviceCertificateUpdateRequest::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
|  | 		try { | ||||||
|  | 			field_from_json(Obj, "serialNumber", serialNumber); | ||||||
|  | 			field_from_json(Obj, "encodedCertificate", encodedCertificate); | ||||||
|  | 			return true; | ||||||
|  | 		} catch (const Poco::Exception &E) { | ||||||
|  | 		} | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| } // namespace OpenWifi::GWObjects | } // namespace OpenWifi::GWObjects | ||||||
|   | |||||||
| @@ -11,9 +11,13 @@ | |||||||
| #include "Poco/JSON/Object.h" | #include "Poco/JSON/Object.h" | ||||||
| #include "RESTAPI_SecurityObjects.h" | #include "RESTAPI_SecurityObjects.h" | ||||||
|  |  | ||||||
|  | #ifdef TIP_GATEWAY_SERVICE | ||||||
|  | #include <RADIUS_helpers.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| namespace OpenWifi::GWObjects { | namespace OpenWifi::GWObjects { | ||||||
|  |  | ||||||
| 	enum CertificateValidation { NO_CERTIFICATE, VALID_CERTIFICATE, MISMATCH_SERIAL, VERIFIED }; | 	enum CertificateValidation { NO_CERTIFICATE, VALID_CERTIFICATE, MISMATCH_SERIAL, VERIFIED, SIMULATED }; | ||||||
|  |  | ||||||
| 	struct ConnectionState { | 	struct ConnectionState { | ||||||
| 		uint64_t MessageCount = 0; | 		uint64_t MessageCount = 0; | ||||||
| @@ -38,8 +42,15 @@ namespace OpenWifi::GWObjects { | |||||||
| 		uint64_t sessionId = 0; | 		uint64_t sessionId = 0; | ||||||
| 		double connectionCompletionTime = 0.0; | 		double connectionCompletionTime = 0.0; | ||||||
| 		std::uint64_t certificateExpiryDate = 0; | 		std::uint64_t certificateExpiryDate = 0; | ||||||
|  | 		std::uint64_t hasRADIUSSessions = 0; | ||||||
|  | 		bool hasGPS = false; | ||||||
|  | 		std::uint64_t sanity=0; | ||||||
|  | 		std::double_t memoryUsed=0.0; | ||||||
|  | 		std::double_t load=0.0; | ||||||
|  | 		std::double_t temperature=0.0; | ||||||
|  | 		std::string 	connectReason; | ||||||
|  |  | ||||||
| 		void to_json(Poco::JSON::Object &Obj) const; | 		void to_json(const std::string &SerialNumber, Poco::JSON::Object &Obj) ; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	struct DeviceRestrictionsKeyInfo { | 	struct DeviceRestrictionsKeyInfo { | ||||||
| @@ -96,6 +107,9 @@ namespace OpenWifi::GWObjects { | |||||||
| 		std::string pendingConfiguration; | 		std::string pendingConfiguration; | ||||||
| 		std::string pendingConfigurationCmd; | 		std::string pendingConfigurationCmd; | ||||||
| 		DeviceRestrictions restrictionDetails; | 		DeviceRestrictions restrictionDetails; | ||||||
|  | 		std::uint64_t pendingUUID = 0; | ||||||
|  | 		bool simulated=false; | ||||||
|  | 		std::uint64_t lastRecordedContact=0; | ||||||
|  |  | ||||||
| 		void to_json(Poco::JSON::Object &Obj) const; | 		void to_json(Poco::JSON::Object &Obj) const; | ||||||
| 		void to_json_with_status(Poco::JSON::Object &Obj) const; | 		void to_json_with_status(Poco::JSON::Object &Obj) const; | ||||||
| @@ -168,6 +182,26 @@ namespace OpenWifi::GWObjects { | |||||||
| 		bool from_json(const Poco::JSON::Object::Ptr &Obj); | 		bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
|  | 	struct DefaultFirmware { | ||||||
|  | 		std::string deviceType; | ||||||
|  | 		std::string Description; | ||||||
|  | 		std::string uri; | ||||||
|  | 		std::string revision; | ||||||
|  | 		uint64_t imageCreationDate; | ||||||
|  | 		uint64_t Created; | ||||||
|  | 		uint64_t LastModified; | ||||||
|  |  | ||||||
|  | 		void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  | 		bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	struct DefaultFirmwareList { | ||||||
|  | 		std::vector<DefaultFirmware>	firmwares; | ||||||
|  |  | ||||||
|  | 		void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  | 		bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
|  | 	}; | ||||||
|  |  | ||||||
| 	struct CommandDetails { | 	struct CommandDetails { | ||||||
| 		std::string UUID; | 		std::string UUID; | ||||||
| 		std::string SerialNumber; | 		std::string SerialNumber; | ||||||
| @@ -188,7 +222,11 @@ namespace OpenWifi::GWObjects { | |||||||
| 		uint64_t AttachSize = 0; | 		uint64_t AttachSize = 0; | ||||||
| 		std::string AttachType; | 		std::string AttachType; | ||||||
| 		double executionTime = 0.0; | 		double executionTime = 0.0; | ||||||
|  | 		std::uint64_t lastTry = 0; | ||||||
|  | 		bool deferred = 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); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	struct BlackListedDevice { | 	struct BlackListedDevice { | ||||||
| @@ -322,6 +360,10 @@ namespace OpenWifi::GWObjects { | |||||||
| 		RadiusProxyServerConfig acctConfig; | 		RadiusProxyServerConfig acctConfig; | ||||||
| 		RadiusProxyServerConfig coaConfig; | 		RadiusProxyServerConfig coaConfig; | ||||||
| 		bool useByDefault = false; | 		bool useByDefault = false; | ||||||
|  | 		std::string 	radsecPoolType; | ||||||
|  | 		std::string 	poolProxyIp; | ||||||
|  | 		std::uint64_t 	radsecKeepAlive=25; | ||||||
|  | 		bool			enabled=true; | ||||||
|  |  | ||||||
| 		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); | ||||||
| @@ -334,4 +376,139 @@ namespace OpenWifi::GWObjects { | |||||||
| 		bool from_json(const Poco::JSON::Object::Ptr &Obj); | 		bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
|  | 	struct RangeOptions { | ||||||
|  | 		bool NO_IR=false; | ||||||
|  | 		bool AUTO_BW=false; | ||||||
|  | 		bool DFS=false; | ||||||
|  | 		bool NO_OUTDOOR=false; | ||||||
|  | 		bool wmmrule_ETSI=false; | ||||||
|  | 		bool NO_OFDM=false; | ||||||
|  |  | ||||||
|  | 		void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	struct FrequencyRange { | ||||||
|  | 		float from = 0.0; | ||||||
|  | 		float to = 0.0; | ||||||
|  | 		int channelWidth = 0; | ||||||
|  | 		int powerDb = 0; | ||||||
|  | 		RangeOptions    options; | ||||||
|  |  | ||||||
|  | 		void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	struct RegulatoryCountryInfo { | ||||||
|  | 		std::string country; | ||||||
|  | 		std::string domain; | ||||||
|  | 		std::vector<FrequencyRange>   ranges; | ||||||
|  |  | ||||||
|  | 		void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	using RegulatoryInfoCountryMap = std::map<std::string,RegulatoryCountryInfo>; | ||||||
|  |  | ||||||
|  | 	struct RADIUSSession { | ||||||
|  | 		std::uint64_t 			started=0, | ||||||
|  | 								lastTransaction=0; | ||||||
|  | 		std::string 			serialNumber, | ||||||
|  | 								destination, | ||||||
|  | 								userName, | ||||||
|  | 					 			accountingSessionId, | ||||||
|  | 								accountingMultiSessionId, | ||||||
|  | 					 			callingStationId, | ||||||
|  | 								chargeableUserIdentity, | ||||||
|  | 								secret, | ||||||
|  | 								interface, | ||||||
|  | 								nasId; | ||||||
|  | 		std::uint64_t 			inputPackets = 0, | ||||||
|  | 								outputPackets = 0, | ||||||
|  | 								inputOctets = 0, | ||||||
|  | 								outputOctets = 0, | ||||||
|  | 								inputGigaWords = 0, | ||||||
|  | 								outputGigaWords = 0; | ||||||
|  | 		std::uint32_t 			sessionTime = 0; | ||||||
|  | 		std::string 			calledStationId; | ||||||
|  |  | ||||||
|  | #ifdef TIP_GATEWAY_SERVICE | ||||||
|  | 		RADIUS::RadiusPacket	accountingPacket; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | 		void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	struct RADIUSSessionList { | ||||||
|  | 		std::vector<RADIUSSession>	sessions; | ||||||
|  | 		void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	struct RadiusCoADMParameters { | ||||||
|  | 		std::string 			accountingSessionId, | ||||||
|  | 								accountingMultiSessionId, | ||||||
|  | 								callingStationId, | ||||||
|  | 								chargeableUserIdentity, | ||||||
|  | 								userName; | ||||||
|  |  | ||||||
|  | 		bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
|  | 		void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	enum class RadiusPoolStrategy { | ||||||
|  | 		round_robin, random, weighted, unknown | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	enum class RadiusEndpointType { | ||||||
|  | 		generic, radsec, globalreach, orion, unknown | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	static inline RadiusEndpointType RadiusEndpointType(const std::string &T) { | ||||||
|  | 		if(T=="generic") return RadiusEndpointType::generic; | ||||||
|  | 		if(T=="radsec") return RadiusEndpointType::radsec; | ||||||
|  | 		if(T=="globalreach") return RadiusEndpointType::globalreach; | ||||||
|  | 		if(T=="orion") return RadiusEndpointType::orion; | ||||||
|  | 		return RadiusEndpointType::unknown; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	static inline RadiusPoolStrategy RadiusPoolStrategy(const std::string &T) { | ||||||
|  | 		if(T=="round_robin") return RadiusPoolStrategy::round_robin; | ||||||
|  | 		if(T=="random") return RadiusPoolStrategy::random; | ||||||
|  | 		if(T=="weighted") return RadiusPoolStrategy::weighted; | ||||||
|  | 		return RadiusPoolStrategy::unknown; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	static inline std::string to_string(enum RadiusEndpointType T) { | ||||||
|  | 		switch(T) { | ||||||
|  | 		case RadiusEndpointType::generic: return "generic"; | ||||||
|  | 		case RadiusEndpointType::radsec: return "radsec"; | ||||||
|  | 		case RadiusEndpointType::globalreach: return "globalreach"; | ||||||
|  | 		case RadiusEndpointType::orion: return "orion"; | ||||||
|  | 		default: | ||||||
|  | 			return "unknown"; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	static inline std::string to_string(enum RadiusPoolStrategy T) { | ||||||
|  | 		switch(T) { | ||||||
|  | 		case RadiusPoolStrategy::round_robin: return "round_robin"; | ||||||
|  | 		case RadiusPoolStrategy::random: return "random"; | ||||||
|  | 		case RadiusPoolStrategy::weighted: return "weighted"; | ||||||
|  | 		default: | ||||||
|  | 			return "unknown"; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	struct DeviceTransferRequest { | ||||||
|  | 		std::string 	serialNumber; | ||||||
|  | 		std::string 	server; | ||||||
|  | 		std::uint64_t 	port; | ||||||
|  |  | ||||||
|  | 		bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  | 	struct DeviceCertificateUpdateRequest { | ||||||
|  | 		std::string 	serialNumber; | ||||||
|  | 		std::string 	encodedCertificate; | ||||||
|  |  | ||||||
|  | 		bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
|  | 	}; | ||||||
|  |  | ||||||
| } // namespace OpenWifi::GWObjects | } // namespace OpenWifi::GWObjects | ||||||
|   | |||||||
| @@ -92,6 +92,7 @@ namespace OpenWifi::OWLSObjects { | |||||||
|         field_to_json(Obj, "endTime", endTime); |         field_to_json(Obj, "endTime", endTime); | ||||||
|         field_to_json(Obj, "errorDevices", errorDevices); |         field_to_json(Obj, "errorDevices", errorDevices); | ||||||
|         field_to_json(Obj, "owner", owner); |         field_to_json(Obj, "owner", owner); | ||||||
|  |         field_to_json(Obj, "expectedDevices", expectedDevices); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| 	void Dashboard::to_json([[maybe_unused]] Poco::JSON::Object &Obj) const {} | 	void Dashboard::to_json([[maybe_unused]] Poco::JSON::Object &Obj) const {} | ||||||
|   | |||||||
| @@ -57,6 +57,7 @@ namespace OpenWifi::OWLSObjects { | |||||||
|         uint64_t endTime; |         uint64_t endTime; | ||||||
|         uint64_t errorDevices; |         uint64_t errorDevices; | ||||||
|         std::string owner; |         std::string owner; | ||||||
|  |         uint64_t expectedDevices; | ||||||
|  |  | ||||||
|         void to_json(Poco::JSON::Object &Obj) const; |         void to_json(Poco::JSON::Object &Obj) const; | ||||||
|     }; |     }; | ||||||
|   | |||||||
| @@ -587,6 +587,9 @@ namespace OpenWifi::ProvObjects { | |||||||
| 		field_to_json(Obj, "locale", locale); | 		field_to_json(Obj, "locale", locale); | ||||||
| 		field_to_json(Obj, "realMacAddress", realMacAddress); | 		field_to_json(Obj, "realMacAddress", realMacAddress); | ||||||
| 		field_to_json(Obj, "doNotAllowOverrides", doNotAllowOverrides); | 		field_to_json(Obj, "doNotAllowOverrides", doNotAllowOverrides); | ||||||
|  |         field_to_json(Obj, "imported", imported); | ||||||
|  |         field_to_json(Obj, "connected", connected); | ||||||
|  |         field_to_json(Obj, "platform", platform); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	bool InventoryTag::from_json(const Poco::JSON::Object::Ptr &Obj) { | 	bool InventoryTag::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
| @@ -609,6 +612,9 @@ namespace OpenWifi::ProvObjects { | |||||||
| 			field_from_json(Obj, "locale", locale); | 			field_from_json(Obj, "locale", locale); | ||||||
| 			field_from_json(Obj, "realMacAddress", realMacAddress); | 			field_from_json(Obj, "realMacAddress", realMacAddress); | ||||||
| 			field_from_json(Obj, "doNotAllowOverrides", doNotAllowOverrides); | 			field_from_json(Obj, "doNotAllowOverrides", doNotAllowOverrides); | ||||||
|  |             field_from_json(Obj, "imported", imported); | ||||||
|  |             field_from_json(Obj, "connected", connected); | ||||||
|  |             field_from_json(Obj, "platform", platform); | ||||||
| 			return true; | 			return true; | ||||||
| 		} catch (...) { | 		} catch (...) { | ||||||
| 		} | 		} | ||||||
| @@ -1194,4 +1200,243 @@ namespace OpenWifi::ProvObjects { | |||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |     void GLBLRAccountInfo::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  |         info.to_json(Obj); | ||||||
|  |         field_to_json(Obj, "privateKey", privateKey); | ||||||
|  |         field_to_json(Obj, "country", country); | ||||||
|  |         field_to_json(Obj, "province", province); | ||||||
|  |         field_to_json(Obj, "city", city); | ||||||
|  |         field_to_json(Obj, "organization", organization); | ||||||
|  |         field_to_json(Obj, "commonName", commonName); | ||||||
|  |         field_to_json(Obj, "CSR", CSR); | ||||||
|  |         field_to_json(Obj, "CSRPrivateKey", CSRPrivateKey); | ||||||
|  |         field_to_json(Obj, "CSRPublicKey", CSRPublicKey); | ||||||
|  |         field_to_json(Obj, "GlobalReachAcctId", GlobalReachAcctId); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool GLBLRAccountInfo::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
|  |         try { | ||||||
|  |             info.from_json(Obj); | ||||||
|  |             field_from_json(Obj, "privateKey", privateKey); | ||||||
|  |             field_from_json(Obj, "country", country); | ||||||
|  |             field_from_json(Obj, "province", province); | ||||||
|  |             field_from_json(Obj, "city", city); | ||||||
|  |             field_from_json(Obj, "organization", organization); | ||||||
|  |             field_from_json(Obj, "commonName", commonName); | ||||||
|  |             field_from_json(Obj, "CSR", CSR); | ||||||
|  |             field_from_json(Obj, "CSRPrivateKey", CSRPrivateKey); | ||||||
|  |             field_from_json(Obj, "CSRPublicKey", CSRPublicKey); | ||||||
|  |             field_from_json(Obj, "GlobalReachAcctId", GlobalReachAcctId); | ||||||
|  |             return true; | ||||||
|  |         } catch (const Poco::Exception &E) { | ||||||
|  |  | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     void GLBLRCertificateInfo::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  |         field_to_json(Obj, "id", id); | ||||||
|  |         field_to_json(Obj, "name", name); | ||||||
|  |         field_to_json(Obj, "accountId", accountId); | ||||||
|  |         field_to_json(Obj, "csr", csr); | ||||||
|  |         field_to_json(Obj, "certificate", certificate); | ||||||
|  |         field_to_json(Obj, "certificateChain", certificateChain); | ||||||
|  |         field_to_json(Obj, "certificateId", certificateId); | ||||||
|  |         field_to_json(Obj, "expiresAt", expiresAt); | ||||||
|  |         field_to_json(Obj, "created", created); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool GLBLRCertificateInfo::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, "accountId", accountId); | ||||||
|  |             field_from_json(Obj, "csr", csr); | ||||||
|  |             field_from_json(Obj, "certificate", certificate); | ||||||
|  |             field_from_json(Obj, "certificateChain", certificateChain); | ||||||
|  |             field_from_json(Obj, "certificateId", certificateId); | ||||||
|  |             field_from_json(Obj, "expiresAt", expiresAt); | ||||||
|  |             field_from_json(Obj, "created", created); | ||||||
|  |             return true; | ||||||
|  |         } catch (const Poco::Exception &E) { | ||||||
|  |  | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     void GooglOrionAccountInfo::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  |         info.to_json(Obj); | ||||||
|  |         field_to_json(Obj, "privateKey", privateKey); | ||||||
|  |         field_to_json(Obj, "certificate", certificate); | ||||||
|  |         field_to_json(Obj, "cacerts", cacerts); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool GooglOrionAccountInfo::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
|  |         try { | ||||||
|  |             info.from_json(Obj); | ||||||
|  |             field_from_json(Obj, "privateKey", privateKey); | ||||||
|  |             field_from_json(Obj, "certificate", certificate); | ||||||
|  |             field_from_json(Obj, "cacerts", cacerts); | ||||||
|  |             return true; | ||||||
|  |         } catch (const Poco::Exception &E) { | ||||||
|  |  | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     void RADIUSServer::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  |         field_to_json(Obj, "Hostname", Hostname); | ||||||
|  |         field_to_json(Obj, "IP", IP); | ||||||
|  |         field_to_json(Obj, "Port", Port); | ||||||
|  |         field_to_json(Obj, "Secret", Secret); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool RADIUSServer::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
|  |         try { | ||||||
|  |             field_from_json(Obj, "Hostname", Hostname); | ||||||
|  |             field_from_json(Obj, "IP", IP); | ||||||
|  |             field_from_json(Obj, "Port", Port); | ||||||
|  |             field_from_json(Obj, "Secret", Secret); | ||||||
|  |             return true; | ||||||
|  |         } catch (const Poco::Exception &E) { | ||||||
|  |  | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     void RADIUSEndPointRadiusType::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  |         field_to_json(Obj, "Authentication", Authentication); | ||||||
|  |         field_to_json(Obj, "Accounting", Accounting); | ||||||
|  |         field_to_json(Obj, "CoA", CoA); | ||||||
|  |         field_to_json(Obj, "AccountingInterval", AccountingInterval); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool RADIUSEndPointRadiusType::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
|  |         try { | ||||||
|  |             field_from_json(Obj, "Authentication", Authentication); | ||||||
|  |             field_from_json(Obj, "Accounting", Accounting); | ||||||
|  |             field_from_json(Obj, "CoA", CoA); | ||||||
|  |             field_from_json(Obj, "AccountingInterval", AccountingInterval); | ||||||
|  |             return true; | ||||||
|  |         } catch (const Poco::Exception &E) { | ||||||
|  |  | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     void RADIUSEndPointRadsecType::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  |         field_to_json(Obj, "Hostname", Hostname); | ||||||
|  |         field_to_json(Obj, "IP", IP); | ||||||
|  |         field_to_json(Obj, "Port", Port); | ||||||
|  |         field_to_json(Obj, "Secret", Secret); | ||||||
|  |         field_to_json(Obj, "OpenRoamingType", OpenRoamingType); | ||||||
|  |         field_to_json(Obj, "UseOpenRoamingAccount", UseOpenRoamingAccount); | ||||||
|  |         field_to_json(Obj, "Weight", Weight); | ||||||
|  |         field_to_json(Obj, "Certificate", Certificate); | ||||||
|  |         field_to_json(Obj, "PrivateKey", PrivateKey); | ||||||
|  |         field_to_json(Obj, "CaCerts", CaCerts); | ||||||
|  |         field_to_json(Obj, "AllowSelfSigned", AllowSelfSigned); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool RADIUSEndPointRadsecType::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
|  |         try { | ||||||
|  |             field_from_json(Obj, "Hostname", Hostname); | ||||||
|  |             field_from_json(Obj, "IP", IP); | ||||||
|  |             field_from_json(Obj, "Port", Port); | ||||||
|  |             field_from_json(Obj, "Secret", Secret); | ||||||
|  |             field_from_json(Obj, "OpenRoamingType", OpenRoamingType); | ||||||
|  |             field_from_json(Obj, "UseOpenRoamingAccount", UseOpenRoamingAccount); | ||||||
|  |             field_from_json(Obj, "Weight", Weight); | ||||||
|  |             field_from_json(Obj, "Certificate", Certificate); | ||||||
|  |             field_from_json(Obj, "PrivateKey", PrivateKey); | ||||||
|  |             field_from_json(Obj, "CaCerts", CaCerts); | ||||||
|  |             field_from_json(Obj, "AllowSelfSigned", AllowSelfSigned); | ||||||
|  |             return true; | ||||||
|  |         } catch (const Poco::Exception &E) { | ||||||
|  |  | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     void RADIUSEndPoint::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  |         info.to_json(Obj); | ||||||
|  |         field_to_json(Obj, "Type", Type); | ||||||
|  |         field_to_json(Obj, "RadsecServers", RadsecServers); | ||||||
|  |         field_to_json(Obj, "RadiusServers", RadiusServers); | ||||||
|  |         field_to_json(Obj, "PoolStrategy", PoolStrategy); | ||||||
|  |         field_to_json(Obj, "Index", Index); | ||||||
|  |         field_to_json(Obj, "UsedBy", UsedBy); | ||||||
|  |         field_to_json(Obj, "UseGWProxy", UseGWProxy); | ||||||
|  |         field_to_json(Obj, "NasIdentifier", NasIdentifier); | ||||||
|  |         field_to_json(Obj, "AccountingInterval", AccountingInterval); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool RADIUSEndPoint::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
|  |         try { | ||||||
|  |             info.from_json(Obj); | ||||||
|  |             field_from_json(Obj, "Type", Type); | ||||||
|  |             field_from_json(Obj, "RadsecServers", RadsecServers); | ||||||
|  |             field_from_json(Obj, "RadiusServers", RadiusServers); | ||||||
|  |             field_from_json(Obj, "PoolStrategy", PoolStrategy); | ||||||
|  |             field_from_json(Obj, "Index", Index); | ||||||
|  |             field_from_json(Obj, "UsedBy", UsedBy); | ||||||
|  |             field_from_json(Obj, "UseGWProxy", UseGWProxy); | ||||||
|  |             field_from_json(Obj, "NasIdentifier", NasIdentifier); | ||||||
|  |             field_from_json(Obj, "AccountingInterval", AccountingInterval); | ||||||
|  |             return true; | ||||||
|  |         } catch (const Poco::Exception &E) { | ||||||
|  |  | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     void RADIUSEndpointUpdateStatus::to_json(Poco::JSON::Object &Obj) const { | ||||||
|  |         field_to_json(Obj, "lastUpdate", lastUpdate); | ||||||
|  |         field_to_json(Obj, "lastConfigurationChange", lastConfigurationChange); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool RADIUSEndpointUpdateStatus::from_json(const Poco::JSON::Object::Ptr &Obj) { | ||||||
|  |         try { | ||||||
|  |             field_from_json(Obj, "lastUpdate", lastUpdate); | ||||||
|  |             field_from_json(Obj, "lastConfigurationChange", lastConfigurationChange); | ||||||
|  |             return true; | ||||||
|  |         } catch (const Poco::Exception &E) { | ||||||
|  |  | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool RADIUSEndpointUpdateStatus::Read() { | ||||||
|  |         Poco::File  F(OpenWifi::MicroServiceDataDirectory()+"/RADIUSEndpointUpdateStatus.json"); | ||||||
|  |         try { | ||||||
|  |             if (F.exists()) { | ||||||
|  |                 Poco::JSON::Parser P; | ||||||
|  |                 std::ifstream ifs(F.path(), std::ios_base::in | std::ios_base::binary); | ||||||
|  |                 auto Obj = P.parse(ifs); | ||||||
|  |                 return from_json(Obj.extract<Poco::JSON::Object::Ptr>()); | ||||||
|  |             } | ||||||
|  |         } catch (...) { | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool RADIUSEndpointUpdateStatus::Save() { | ||||||
|  |         Poco::File  F(OpenWifi::MicroServiceDataDirectory()+"/RADIUSEndpointUpdateStatus.json"); | ||||||
|  |         try { | ||||||
|  |             Poco::JSON::Object Obj; | ||||||
|  |             to_json(Obj); | ||||||
|  |             std::ofstream O(F.path(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary); | ||||||
|  |             Poco::JSON::Stringifier::stringify(Obj, O); | ||||||
|  |             return true; | ||||||
|  |         } catch (...) { | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool RADIUSEndpointUpdateStatus::ChangeConfiguration() { | ||||||
|  |         Read(); | ||||||
|  |         lastConfigurationChange = Utils::Now(); | ||||||
|  |         return Save(); | ||||||
|  |     } | ||||||
|  |  | ||||||
| } // namespace OpenWifi::ProvObjects | } // namespace OpenWifi::ProvObjects | ||||||
|   | |||||||
| @@ -29,6 +29,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::TagList tags; |         Types::TagList tags; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -36,6 +37,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::UUIDvec_t serialNumbers; |         Types::UUIDvec_t serialNumbers; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -46,6 +48,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string policy; |         std::string policy; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -57,14 +60,18 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::UUID_t venue; |         Types::UUID_t venue; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     typedef std::vector<ManagementPolicy> ManagementPolicyVec; |     typedef std::vector<ManagementPolicy> ManagementPolicyVec; | ||||||
|  |  | ||||||
|     struct RRMAlgorithmDetails { |     struct RRMAlgorithmDetails { | ||||||
|         std::string name; |         std::string name; | ||||||
|         std::string parameters; |         std::string parameters; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -72,7 +79,9 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string vendor; |         std::string vendor; | ||||||
|         std::string schedule; |         std::string schedule; | ||||||
|         std::vector<RRMAlgorithmDetails> algorithms; |         std::vector<RRMAlgorithmDetails> algorithms; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -82,6 +91,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string firmwareUpgrade{"inherit"}; |         std::string firmwareUpgrade{"inherit"}; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -104,8 +114,10 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::UUIDvec_t configurations; |         Types::UUIDvec_t configurations; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     typedef std::vector<Entity> EntityVec; |     typedef std::vector<Entity> EntityVec; | ||||||
|  |  | ||||||
|     struct DiGraphEntry { |     struct DiGraphEntry { | ||||||
| @@ -113,6 +125,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::UUID_t child; |         Types::UUID_t child; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -140,8 +153,10 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::UUIDvec_t boards; |         Types::UUIDvec_t boards; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     typedef std::vector<Venue> VenueVec; |     typedef std::vector<Venue> VenueVec; | ||||||
|  |  | ||||||
|     struct UserInfoDigest { |     struct UserInfoDigest { | ||||||
| @@ -150,6 +165,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string userType; |         std::string userType; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -162,8 +178,10 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::UUID_t venue; |         Types::UUID_t venue; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     typedef std::vector<ManagementRole> ManagementRoleVec; |     typedef std::vector<ManagementRole> ManagementRoleVec; | ||||||
|  |  | ||||||
|     enum LocationType { |     enum LocationType { | ||||||
| @@ -232,8 +250,10 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::UUID_t managementPolicy; |         Types::UUID_t managementPolicy; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     typedef std::vector<Location> LocationVec; |     typedef std::vector<Location> LocationVec; | ||||||
|  |  | ||||||
|     struct OperatorLocation { |     struct OperatorLocation { | ||||||
| @@ -253,8 +273,10 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::UUID_t managementPolicy; |         Types::UUID_t managementPolicy; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     typedef std::vector<Location> LocationVec; |     typedef std::vector<Location> LocationVec; | ||||||
|  |  | ||||||
|     struct SubLocation { |     struct SubLocation { | ||||||
| @@ -270,6 +292,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string geoCode; |         std::string geoCode; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -277,6 +300,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::vector<OperatorLocation> locations; |         std::vector<OperatorLocation> locations; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -356,8 +380,10 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::UUID_t managementPolicy; |         Types::UUID_t managementPolicy; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     typedef std::vector<Contact> ContactVec; |     typedef std::vector<Contact> ContactVec; | ||||||
|  |  | ||||||
|     struct OperatorContact { |     struct OperatorContact { | ||||||
| @@ -379,6 +405,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::UUID_t managementPolicy; |         Types::UUID_t managementPolicy; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -397,6 +424,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string accessPIN; |         std::string accessPIN; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -404,6 +432,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::vector<OperatorContact> contacts; |         std::vector<OperatorContact> contacts; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -416,8 +445,10 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string configuration; |         std::string configuration; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     typedef std::vector<DeviceConfigurationElement> DeviceConfigurationElementVec; |     typedef std::vector<DeviceConfigurationElement> DeviceConfigurationElementVec; | ||||||
|  |  | ||||||
|     struct DeviceConfiguration { |     struct DeviceConfiguration { | ||||||
| @@ -434,8 +465,10 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string subscriber; |         std::string subscriber; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     typedef std::vector<DeviceConfiguration> DeviceConfigurationVec; |     typedef std::vector<DeviceConfiguration> DeviceConfigurationVec; | ||||||
|  |  | ||||||
|     struct InventoryTag { |     struct InventoryTag { | ||||||
| @@ -457,6 +490,9 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string locale; |         std::string locale; | ||||||
|         std::string realMacAddress; |         std::string realMacAddress; | ||||||
|         bool doNotAllowOverrides = false; |         bool doNotAllowOverrides = false; | ||||||
|  |         std::uint64_t imported=0; | ||||||
|  |         std::uint64_t connected=0; | ||||||
|  |         std::string platform{"AP"}; | ||||||
|  |  | ||||||
|         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); | ||||||
| @@ -468,6 +504,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         InventoryTagVec taglist; |         InventoryTagVec taglist; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -478,6 +515,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         uint64_t errorCode; |         uint64_t errorCode; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -486,6 +524,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::CountedMap tenants; |         Types::CountedMap tenants; | ||||||
|  |  | ||||||
|         void reset(); |         void reset(); | ||||||
|  |  | ||||||
|         void to_json(Poco::JSON::Object &Obj) const; |         void to_json(Poco::JSON::Object &Obj) const; | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -495,6 +534,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string description; |         std::string description; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -503,6 +543,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::vector<ExpandedUseEntry> entries; |         std::vector<ExpandedUseEntry> entries; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -510,6 +551,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::vector<ExpandedUseEntryList> entries; |         std::vector<ExpandedUseEntryList> entries; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -517,17 +559,21 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::UUIDvec_t list; |         Types::UUIDvec_t list; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| 	enum ACLACCESS { NONE = 0, READ = 1, MODIFY = 2, CREATE = 3, DELETE = 4 }; |     enum ACLACCESS { | ||||||
|  |         NONE = 0, READ = 1, MODIFY = 2, CREATE = 3, DELETE = 4 | ||||||
|  |     }; | ||||||
|  |  | ||||||
|     struct ObjectACL { |     struct ObjectACL { | ||||||
|         UuidList users; |         UuidList users; | ||||||
|         UuidList roles; |         UuidList roles; | ||||||
| 		uint64_t access = (uint64_t)NONE; |         uint64_t access = (uint64_t) NONE; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -535,6 +581,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::vector<ObjectACL> list; |         std::vector<ObjectACL> list; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -549,6 +596,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string venue; |         std::string venue; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -556,6 +604,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::vector<Map> list; |         std::vector<Map> list; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -585,6 +634,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string operatorId; |         std::string operatorId; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -595,6 +645,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string value; |         std::string value; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -602,6 +653,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::vector<Variable> variables; |         std::vector<Variable> variables; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -616,6 +668,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::UUID_t managementPolicy; |         Types::UUID_t managementPolicy; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -623,6 +676,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::vector<VariableBlock> variableBlocks; |         std::vector<VariableBlock> variableBlocks; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -637,6 +691,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string registrationId; |         std::string registrationId; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -644,6 +699,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::vector<Operator> operators; |         std::vector<Operator> operators; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -654,6 +710,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         Types::UUIDvec_t devices; |         Types::UUIDvec_t devices; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -669,6 +726,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         bool defaultService = false; |         bool defaultService = 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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -676,6 +734,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::vector<ServiceClass> serviceClasses; |         std::vector<ServiceClass> serviceClasses; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -686,6 +745,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string firmwareRCOnly{"inherit"}; |         std::string firmwareRCOnly{"inherit"}; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -710,6 +770,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::string realMacAddress; |         std::string realMacAddress; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -717,6 +778,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::vector<SubscriberDevice> subscriberDevices; |         std::vector<SubscriberDevice> subscriberDevices; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -729,6 +791,7 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::uint64_t modified; |         std::uint64_t modified; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -738,12 +801,119 @@ namespace OpenWifi::ProvObjects { | |||||||
|         std::vector<ConfigurationOverride> overrides; |         std::vector<ConfigurationOverride> overrides; | ||||||
|  |  | ||||||
|         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); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|     bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, |     bool UpdateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, | ||||||
|                           ObjectInfo &I); |                           ObjectInfo &I); | ||||||
|  |  | ||||||
|     bool CreateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, |     bool CreateObjectInfo(const Poco::JSON::Object::Ptr &O, const SecurityObjects::UserInfo &U, | ||||||
|                           ObjectInfo &I); |                           ObjectInfo &I); | ||||||
|  |  | ||||||
|     bool CreateObjectInfo(const SecurityObjects::UserInfo &U, ObjectInfo &I); |     bool CreateObjectInfo(const SecurityObjects::UserInfo &U, ObjectInfo &I); | ||||||
|  |  | ||||||
|  |     struct GLBLRAccountInfo { | ||||||
|  |         ObjectInfo info; | ||||||
|  |         std::string privateKey; | ||||||
|  |         std::string country, province, city, organization, commonName; | ||||||
|  |         std::string CSR, CSRPrivateKey, CSRPublicKey; | ||||||
|  |         std::string GlobalReachAcctId; | ||||||
|  |  | ||||||
|  |         void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  |  | ||||||
|  |         bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     struct GLBLRCertificateInfo { | ||||||
|  |         std::string id; | ||||||
|  |         std::string name; | ||||||
|  |         std::string accountId; | ||||||
|  |         std::string csr; | ||||||
|  |         std::string certificate; | ||||||
|  |         std::string certificateChain; | ||||||
|  |         std::string certificateId; | ||||||
|  |         std::uint64_t expiresAt = 0; | ||||||
|  |         std::uint64_t created = 0; | ||||||
|  |  | ||||||
|  |         void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  |  | ||||||
|  |         bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     struct GooglOrionAccountInfo { | ||||||
|  |         ObjectInfo info; | ||||||
|  |         std::string privateKey; | ||||||
|  |         std::string certificate; | ||||||
|  |         std::vector<std::string> cacerts; | ||||||
|  |  | ||||||
|  |         void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  |         bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     struct RADIUSServer { | ||||||
|  |         std::string     Hostname; | ||||||
|  |         std::string     IP; | ||||||
|  |         std::uint64_t   Port=0; | ||||||
|  |         std::string     Secret; | ||||||
|  |  | ||||||
|  |         void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  |         bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     struct RADIUSEndPointRadiusType { | ||||||
|  |         std::vector<RADIUSServer>    Authentication; | ||||||
|  |         std::vector<RADIUSServer>    Accounting; | ||||||
|  |         std::vector<RADIUSServer>    CoA; | ||||||
|  |         std::uint64_t AccountingInterval = 60; | ||||||
|  |  | ||||||
|  |         void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  |         bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     struct RADIUSEndPointRadsecType { | ||||||
|  |         std::string     Hostname; | ||||||
|  |         std::string     IP; | ||||||
|  |         std::uint64_t   Port=2083; | ||||||
|  |         std::string     Secret{"radsec"}; | ||||||
|  |         std::string     OpenRoamingType; | ||||||
|  |         std::string     UseOpenRoamingAccount; | ||||||
|  |         std::uint64_t   Weight=0; | ||||||
|  |         std::string     Certificate; | ||||||
|  |         std::string     PrivateKey; | ||||||
|  |         std::vector<std::string>    CaCerts; | ||||||
|  |         bool AllowSelfSigned=false; | ||||||
|  |  | ||||||
|  |         void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  |         bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     struct RADIUSEndPoint { | ||||||
|  |         ObjectInfo                  info; | ||||||
|  |         std::string                 Type{"radius"}; | ||||||
|  |         std::string                 PoolStrategy{"none"}; | ||||||
|  |         bool                        UseGWProxy=true; | ||||||
|  |         std::string                 Index; | ||||||
|  |         std::vector<std::string>    UsedBy; | ||||||
|  |         std::vector<RADIUSEndPointRadiusType>   RadiusServers; | ||||||
|  |         std::vector<RADIUSEndPointRadsecType>   RadsecServers; | ||||||
|  |         std::string                 NasIdentifier; | ||||||
|  |         std::uint64_t               AccountingInterval=600; | ||||||
|  |  | ||||||
|  |         void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  |         bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     struct RADIUSEndpointUpdateStatus { | ||||||
|  |         std::uint64_t   lastUpdate=0; | ||||||
|  |         std::uint64_t   lastConfigurationChange=0; | ||||||
|  |  | ||||||
|  |         void to_json(Poco::JSON::Object &Obj) const; | ||||||
|  |         bool from_json(const Poco::JSON::Object::Ptr &Obj); | ||||||
|  |         bool Read(); | ||||||
|  |         bool Save(); | ||||||
|  |         bool ChangeConfiguration(); | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |  | ||||||
| }; // namespace OpenWifi::ProvObjects | }; // namespace OpenWifi::ProvObjects | ||||||
|   | |||||||
| @@ -26,7 +26,7 @@ namespace OpenWifi { | |||||||
| 			Response.set("Connection", "keep-alive"); | 			Response.set("Connection", "keep-alive"); | ||||||
| 			Response.setVersion(Poco::Net::HTTPMessage::HTTP_1_1); | 			Response.setVersion(Poco::Net::HTTPMessage::HTTP_1_1); | ||||||
| 			std::ostream &Answer = Response.send(); | 			std::ostream &Answer = Response.send(); | ||||||
| 			Answer << "process Alive and kicking!"; | 			Answer << ALBHealthCheckServer()->CallbackText(); | ||||||
| 		} catch (...) { | 		} catch (...) { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -37,6 +37,8 @@ namespace OpenWifi { | |||||||
| 		inline static std::atomic_uint64_t req_id_ = 1; | 		inline static std::atomic_uint64_t req_id_ = 1; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
|  | 	typedef std::string ALBHealthMessageCallback(); | ||||||
|  |  | ||||||
| 	class ALBHealthCheckServer : public SubSystemServer { | 	class ALBHealthCheckServer : public SubSystemServer { | ||||||
| 	  public: | 	  public: | ||||||
| 		ALBHealthCheckServer(); | 		ALBHealthCheckServer(); | ||||||
| @@ -48,10 +50,22 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 		int Start() override; | 		int Start() override; | ||||||
| 		void Stop() override; | 		void Stop() override; | ||||||
|  | 		inline void RegisterExtendedHealthMessage(ALBHealthMessageCallback *F) { | ||||||
|  | 			Callback_=F; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		inline std::string CallbackText() { | ||||||
|  | 			if(Callback_== nullptr) { | ||||||
|  | 				return "process Alive and kicking!"; | ||||||
|  | 			} else { | ||||||
|  | 				return Callback_(); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 	  private: | 	  private: | ||||||
| 		std::unique_ptr<Poco::Net::HTTPServer> Server_; | 		std::unique_ptr<Poco::Net::HTTPServer> Server_; | ||||||
| 		std::unique_ptr<Poco::Net::ServerSocket> Socket_; | 		std::unique_ptr<Poco::Net::ServerSocket> Socket_; | ||||||
|  | 		ALBHealthMessageCallback	*Callback_= nullptr; | ||||||
| 		int Port_ = 0; | 		int Port_ = 0; | ||||||
| 		mutable std::atomic_bool Running_ = false; | 		mutable std::atomic_bool Running_ = false; | ||||||
| 	}; | 	}; | ||||||
|   | |||||||
| @@ -11,10 +11,12 @@ | |||||||
|  |  | ||||||
| #include "Poco/File.h" | #include "Poco/File.h" | ||||||
| #include "Poco/StreamCopier.h" | #include "Poco/StreamCopier.h" | ||||||
|  | #include "Poco/JSON/Object.h" | ||||||
|  | #include "Poco/JSON/Parser.h" | ||||||
|  |  | ||||||
| #include "framework/MicroServiceFuncs.h" | #include "framework/MicroServiceFuncs.h" | ||||||
|  |  | ||||||
| #include "nlohmann/json.hpp" | // #include "nlohmann/json.hpp" | ||||||
|  |  | ||||||
| namespace OpenWifi { | namespace OpenWifi { | ||||||
|  |  | ||||||
| @@ -28,11 +30,11 @@ namespace OpenWifi { | |||||||
| 				if (F.exists()) { | 				if (F.exists()) { | ||||||
| 					std::ostringstream OS; | 					std::ostringstream OS; | ||||||
| 					std::ifstream IF(FileName); | 					std::ifstream IF(FileName); | ||||||
| 					Poco::StreamCopier::copyStream(IF, OS); |                     Poco::JSON::Parser  P; | ||||||
| 					Registry_ = nlohmann::json::parse(OS.str()); | 					Registry_ = P.parse(IF).extract<Poco::JSON::Object::Ptr>(); | ||||||
| 				} | 				} | ||||||
| 			} catch (...) { | 			} catch (...) { | ||||||
| 				Registry_ = nlohmann::json::parse("{}"); | 				Registry_ = Poco::makeShared<Poco::JSON::Object>(); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -44,46 +46,39 @@ namespace OpenWifi { | |||||||
| 		inline ~AppServiceRegistry() { Save(); } | 		inline ~AppServiceRegistry() { Save(); } | ||||||
|  |  | ||||||
| 		inline void Save() { | 		inline void Save() { | ||||||
| 			std::istringstream IS(to_string(Registry_)); |  | ||||||
| 			std::ofstream OF; | 			std::ofstream OF; | ||||||
| 			OF.open(FileName, std::ios::binary | std::ios::trunc); | 			OF.open(FileName, std::ios::binary | std::ios::trunc); | ||||||
| 			Poco::StreamCopier::copyStream(IS, OF); |             Registry_->stringify(OF); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		inline void Set(const char *Key, uint64_t Value) { |         void Set(const char *key, const std::vector<std::string> &V) { | ||||||
| 			Registry_[Key] = Value; |             Poco::JSON::Array   Arr; | ||||||
|  |             for(const auto &s:V) { | ||||||
|  |                 Arr.add(s); | ||||||
|  |             } | ||||||
|  |             Registry_->set(key,Arr); | ||||||
|             Save(); |             Save(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
| 		inline void Set(const char *Key, const std::string &Value) { |         template<class T> void Set(const char *key, const T &Value) { | ||||||
| 			Registry_[Key] = Value; |             Registry_->set(key,Value); | ||||||
| 			Save(); | 			Save(); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		inline void Set(const char *Key, bool Value) { |         bool Get(const char *key, std::vector<std::string> &Value) { | ||||||
| 			Registry_[Key] = Value; |             if(Registry_->has(key) && !Registry_->isNull(key) && Registry_->isArray(key)) { | ||||||
| 			Save(); |                 auto Arr = Registry_->get(key); | ||||||
|  |                 for(const auto &v:Arr) { | ||||||
|  |                     Value.emplace_back(v); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
| 		inline bool Get(const char *Key, bool &Value) { |  | ||||||
| 			if (Registry_[Key].is_boolean()) { |  | ||||||
| 				Value = Registry_[Key].get<bool>(); |  | ||||||
|                 return true; |                 return true; | ||||||
|             } |             } | ||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
|  |  | ||||||
| 		inline bool Get(const char *Key, uint64_t &Value) { |         template<class T> bool Get(const char *key, T &Value) { | ||||||
| 			if (Registry_[Key].is_number_unsigned()) { |             if(Registry_->has(key) && !Registry_->isNull(key)) { | ||||||
| 				Value = Registry_[Key].get<uint64_t>(); |                 Value = Registry_->getValue<T>(key); | ||||||
| 				return true; |  | ||||||
| 			} |  | ||||||
| 			return false; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		inline bool Get(const char *Key, std::string &Value) { |  | ||||||
| 			if (Registry_[Key].is_string()) { |  | ||||||
| 				Value = Registry_[Key].get<std::string>(); |  | ||||||
|                 return true; |                 return true; | ||||||
|             } |             } | ||||||
|             return false; |             return false; | ||||||
| @@ -91,7 +86,7 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 	  private: | 	  private: | ||||||
| 		std::string FileName; | 		std::string FileName; | ||||||
| 		nlohmann::json Registry_; | 		Poco::JSON::Object::Ptr Registry_; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	inline auto AppServiceRegistry() { return AppServiceRegistry::instance(); } | 	inline auto AppServiceRegistry() { return AppServiceRegistry::instance(); } | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -9,29 +9,27 @@ | |||||||
|  |  | ||||||
| namespace OpenWifi { | namespace OpenWifi { | ||||||
|  |  | ||||||
| 	EventBusManager::EventBusManager(Poco::Logger &L) : Logger_(L) {} |  | ||||||
|  |  | ||||||
| 	void EventBusManager::run() { | 	void EventBusManager::run() { | ||||||
| 		Running_ = true; | 		Running_ = true; | ||||||
| 		Utils::SetThreadName("fmwk:EventMgr"); | 		Utils::SetThreadName("fmwk:EventMgr"); | ||||||
| 		auto Msg = MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_JOIN); | 		auto Msg = (MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_JOIN)); | ||||||
| 		KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), Msg, | 		KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), Msg, | ||||||
| 									false); | 									false); | ||||||
| 		while (Running_) { | 		while (Running_) { | ||||||
| 			Poco::Thread::trySleep((unsigned long)MicroServiceDaemonBusTimer()); | 			if(!Poco::Thread::trySleep((unsigned long)MicroServiceDaemonBusTimer())) { | ||||||
| 			if (!Running_) |  | ||||||
|                 break; |                 break; | ||||||
| 			Msg = MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE); |             } | ||||||
|  | 			Msg = (MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE)); | ||||||
| 			KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), | 			KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), | ||||||
| 										Msg, false); | 										Msg, false); | ||||||
| 		} | 		} | ||||||
| 		Msg = MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_LEAVE); | 		Msg = (MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_LEAVE)); | ||||||
| 		KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), Msg, | 		KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), Msg, | ||||||
| 									false); | 									false); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	void EventBusManager::Start() { | 	void EventBusManager::Start() { | ||||||
| 		poco_information(Logger(), "Starting..."); | 		poco_information(Logger_, "Starting..."); | ||||||
| 		if (KafkaManager()->Enabled()) { | 		if (KafkaManager()->Enabled()) { | ||||||
| 			Thread_.start(*this); | 			Thread_.start(*this); | ||||||
| 		} | 		} | ||||||
| @@ -39,11 +37,11 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 	void EventBusManager::Stop() { | 	void EventBusManager::Stop() { | ||||||
| 		if (KafkaManager()->Enabled()) { | 		if (KafkaManager()->Enabled()) { | ||||||
| 			poco_information(Logger(), "Stopping..."); | 			poco_information(Logger_, "Stopping..."); | ||||||
| 			Running_ = false; | 			Running_ = false; | ||||||
| 			Thread_.wakeUp(); | 			Thread_.wakeUp(); | ||||||
| 			Thread_.join(); | 			Thread_.join(); | ||||||
| 			poco_information(Logger(), "Stopped..."); | 			poco_information(Logger_, "Stopped..."); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -12,7 +12,16 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 	class EventBusManager : public Poco::Runnable { | 	class EventBusManager : public Poco::Runnable { | ||||||
| 	  public: | 	  public: | ||||||
| 		explicit EventBusManager(Poco::Logger &L); | 		EventBusManager() : | ||||||
|  | 			Logger_(Poco::Logger::create( | ||||||
|  | 				"EventBusManager", Poco::Logger::root().getChannel(), Poco::Logger::root().getLevel())) { | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		static auto instance() { | ||||||
|  | 			static auto instance_ = new EventBusManager; | ||||||
|  | 			return instance_; | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		void run() final; | 		void run() final; | ||||||
| 		void Start(); | 		void Start(); | ||||||
| 		void Stop(); | 		void Stop(); | ||||||
| @@ -24,4 +33,6 @@ namespace OpenWifi { | |||||||
| 		Poco::Logger &Logger_; | 		Poco::Logger &Logger_; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
|  | 	inline auto EventBusManager() { return EventBusManager::instance(); } | ||||||
|  |  | ||||||
| } // namespace OpenWifi | } // namespace OpenWifi | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ | |||||||
|  |  | ||||||
| #include "fmt/format.h" | #include "fmt/format.h" | ||||||
| #include "framework/MicroServiceFuncs.h" | #include "framework/MicroServiceFuncs.h" | ||||||
|  | #include "cppkafka/utils/consumer_dispatcher.h" | ||||||
|  |  | ||||||
| namespace OpenWifi { | namespace OpenWifi { | ||||||
|  |  | ||||||
| @@ -78,8 +79,10 @@ namespace OpenWifi { | |||||||
| 		Utils::SetThreadName("Kafka:Prod"); | 		Utils::SetThreadName("Kafka:Prod"); | ||||||
| 		cppkafka::Configuration Config( | 		cppkafka::Configuration Config( | ||||||
| 			{{"client.id", MicroServiceConfigGetString("openwifi.kafka.client.id", "")}, | 			{{"client.id", MicroServiceConfigGetString("openwifi.kafka.client.id", "")}, | ||||||
| 			 {"metadata.broker.list", | 			 {"metadata.broker.list",MicroServiceConfigGetString("openwifi.kafka.brokerlist", "")} // , | ||||||
| 			  MicroServiceConfigGetString("openwifi.kafka.brokerlist", "")}}); | 			 // {"send.buffer.bytes", KafkaManager()->KafkaManagerMaximumPayloadSize() } | ||||||
|  | 			} | ||||||
|  |  		); | ||||||
|  |  | ||||||
| 		AddKafkaSecurity(Config); | 		AddKafkaSecurity(Config); | ||||||
|  |  | ||||||
| @@ -99,9 +102,12 @@ namespace OpenWifi { | |||||||
| 			try { | 			try { | ||||||
| 				auto Msg = dynamic_cast<KafkaMessage *>(Note.get()); | 				auto Msg = dynamic_cast<KafkaMessage *>(Note.get()); | ||||||
| 				if (Msg != nullptr) { | 				if (Msg != nullptr) { | ||||||
| 					Producer.produce(cppkafka::MessageBuilder(Msg->Topic()) | 					auto NewMessage = cppkafka::MessageBuilder(Msg->Topic()); | ||||||
| 										 .key(Msg->Key()) | 					NewMessage.key(Msg->Key()); | ||||||
| 										 .payload(Msg->Payload())); | 					NewMessage.partition(0); | ||||||
|  | 					NewMessage.payload(Msg->Payload()); | ||||||
|  | 					Producer.produce(NewMessage); | ||||||
|  | 					Producer.flush(); | ||||||
| 				} | 				} | ||||||
| 			} catch (const cppkafka::HandleException &E) { | 			} catch (const cppkafka::HandleException &E) { | ||||||
| 				poco_warning(Logger_, | 				poco_warning(Logger_, | ||||||
| @@ -156,43 +162,49 @@ namespace OpenWifi { | |||||||
| 			} | 			} | ||||||
| 		}); | 		}); | ||||||
|  |  | ||||||
| 		bool AutoCommit = MicroServiceConfigGetBool("openwifi.kafka.auto.commit", false); | 		// bool AutoCommit = MicroServiceConfigGetBool("openwifi.kafka.auto.commit", false); | ||||||
| 		auto BatchSize = MicroServiceConfigGetInt("openwifi.kafka.consumer.batchsize", 20); | 		// auto BatchSize = MicroServiceConfigGetInt("openwifi.kafka.consumer.batchsize", 100); | ||||||
|  |  | ||||||
| 		Types::StringVec Topics; | 		Types::StringVec Topics; | ||||||
| 		KafkaManager()->Topics(Topics); | 		std::for_each(Topics_.begin(),Topics_.end(), | ||||||
|  | 					  [&](const std::string & T) { Topics.emplace_back(T); }); | ||||||
| 		Consumer.subscribe(Topics); | 		Consumer.subscribe(Topics); | ||||||
|  |  | ||||||
| 		Running_ = true; | 		Running_ = true; | ||||||
| 		while (Running_) { | 		std::vector<cppkafka::Message> MsgVec; | ||||||
|  |  | ||||||
|  | 		Dispatcher_ = std::make_unique<cppkafka::ConsumerDispatcher>(Consumer); | ||||||
|  |  | ||||||
|  | 		Dispatcher_->run( | ||||||
|  | 			// Callback executed whenever a new message is consumed | ||||||
|  | 			[&](cppkafka::Message msg) { | ||||||
|  | 				// Print the key (if any) | ||||||
|  | 				std::lock_guard G(ConsumerMutex_); | ||||||
|  | 				auto It = Notifiers_.find(msg.get_topic()); | ||||||
|  | 				if (It != Notifiers_.end()) { | ||||||
|  | 					const auto &FL = It->second; | ||||||
|  | 					for (const auto &[CallbackFunc, _] : FL) { | ||||||
| 						try { | 						try { | ||||||
| 				std::vector<cppkafka::Message> MsgVec = | 							CallbackFunc(msg.get_key(), msg.get_payload()); | ||||||
| 					Consumer.poll_batch(BatchSize, std::chrono::milliseconds(100)); | 						} catch(const Poco::Exception &E) { | ||||||
| 				for (auto const &Msg : MsgVec) { |  | ||||||
| 					if (!Msg) | 						} catch(...) { | ||||||
| 						continue; |  | ||||||
| 					if (Msg.get_error()) { |  | ||||||
| 						if (!Msg.is_eof()) { |  | ||||||
| 							poco_error(Logger_, |  | ||||||
| 									   fmt::format("Error: {}", Msg.get_error().to_string())); |  | ||||||
| 						} |  | ||||||
| 						if (!AutoCommit) |  | ||||||
| 							Consumer.async_commit(Msg); |  | ||||||
| 						continue; |  | ||||||
| 					} |  | ||||||
| 					KafkaManager()->Dispatch(Msg.get_topic(), Msg.get_key(), Msg.get_payload()); |  | ||||||
| 					if (!AutoCommit) |  | ||||||
| 						Consumer.async_commit(Msg); |  | ||||||
| 				} |  | ||||||
| 			} catch (const cppkafka::HandleException &E) { |  | ||||||
| 				poco_warning(Logger_, |  | ||||||
| 							 fmt::format("Caught a Kafka exception (consumer): {}", E.what())); |  | ||||||
| 			} catch (const Poco::Exception &E) { |  | ||||||
| 				Logger_.log(E); |  | ||||||
| 			} catch (...) { |  | ||||||
| 				poco_error(Logger_, "std::exception"); |  | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
|  | 				} | ||||||
|  | 				Consumer.commit(msg); | ||||||
|  | 			}, | ||||||
|  | 			// Whenever there's an error (other than the EOF soft error) | ||||||
|  | 			[&Logger_](cppkafka::Error error) { | ||||||
|  | 				poco_warning(Logger_,fmt::format("Error: {}", error.to_string())); | ||||||
|  | 			}, | ||||||
|  | 			// Whenever EOF is reached on a partition, print this | ||||||
|  | 			[&Logger_](cppkafka::ConsumerDispatcher::EndOfFile, const cppkafka::TopicPartition& topic_partition) { | ||||||
|  | 				poco_debug(Logger_,fmt::format("Partition {} EOF", topic_partition.get_partition())); | ||||||
|  | 			} | ||||||
|  | 		); | ||||||
|  |  | ||||||
| 		Consumer.unsubscribe(); | 		Consumer.unsubscribe(); | ||||||
| 		poco_information(Logger_, "Stopped..."); | 		poco_information(Logger_, "Stopped..."); | ||||||
| 	} | 	} | ||||||
| @@ -212,7 +224,7 @@ namespace OpenWifi { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void KafkaProducer::Produce(const std::string &Topic, const std::string &Key, | 	void KafkaProducer::Produce(const char *Topic, const std::string &Key, | ||||||
| 								const std::string &Payload) { | 								const std::string &Payload) { | ||||||
| 		std::lock_guard G(Mutex_); | 		std::lock_guard G(Mutex_); | ||||||
| 		Queue_.enqueueNotification(new KafkaMessage(Topic, Key, Payload)); | 		Queue_.enqueueNotification(new KafkaMessage(Topic, Key, Payload)); | ||||||
| @@ -220,7 +232,6 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 	void KafkaConsumer::Start() { | 	void KafkaConsumer::Start() { | ||||||
| 		if (!Running_) { | 		if (!Running_) { | ||||||
| 			Running_ = true; |  | ||||||
| 			Worker_.start(*this); | 			Worker_.start(*this); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -228,29 +239,16 @@ namespace OpenWifi { | |||||||
| 	void KafkaConsumer::Stop() { | 	void KafkaConsumer::Stop() { | ||||||
| 		if (Running_) { | 		if (Running_) { | ||||||
| 			Running_ = false; | 			Running_ = false; | ||||||
| 			Worker_.wakeUp(); | 			if(Dispatcher_) { | ||||||
|  | 				Dispatcher_->stop(); | ||||||
|  | 			} | ||||||
| 			Worker_.join(); | 			Worker_.join(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void KafkaDispatcher::Start() { | 	std::uint64_t KafkaConsumer::RegisterTopicWatcher(const std::string &Topic, | ||||||
| 		if (!Running_) { |  | ||||||
| 			Running_ = true; |  | ||||||
| 			Worker_.start(*this); |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	void KafkaDispatcher::Stop() { |  | ||||||
| 		if (Running_) { |  | ||||||
| 			Running_ = false; |  | ||||||
| 			Queue_.wakeUpAll(); |  | ||||||
| 			Worker_.join(); |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	auto KafkaDispatcher::RegisterTopicWatcher(const std::string &Topic, |  | ||||||
| 											   Types::TopicNotifyFunction &F) { | 											   Types::TopicNotifyFunction &F) { | ||||||
| 		std::lock_guard G(Mutex_); | 		std::lock_guard G(ConsumerMutex_); | ||||||
| 		auto It = Notifiers_.find(Topic); | 		auto It = Notifiers_.find(Topic); | ||||||
| 		if (It == Notifiers_.end()) { | 		if (It == Notifiers_.end()) { | ||||||
| 			Types::TopicNotifyFunctionList L; | 			Types::TopicNotifyFunctionList L; | ||||||
| @@ -259,11 +257,12 @@ namespace OpenWifi { | |||||||
| 		} else { | 		} else { | ||||||
| 			It->second.emplace(It->second.end(), std::make_pair(F, FunctionId_)); | 			It->second.emplace(It->second.end(), std::make_pair(F, FunctionId_)); | ||||||
| 		} | 		} | ||||||
|  | 		Topics_.insert(Topic); | ||||||
| 		return FunctionId_++; | 		return FunctionId_++; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void KafkaDispatcher::UnregisterTopicWatcher(const std::string &Topic, int Id) { | 	void KafkaConsumer::UnregisterTopicWatcher(const std::string &Topic, int Id) { | ||||||
| 		std::lock_guard G(Mutex_); | 		std::lock_guard G(ConsumerMutex_); | ||||||
| 		auto It = Notifiers_.find(Topic); | 		auto It = Notifiers_.find(Topic); | ||||||
| 		if (It != Notifiers_.end()) { | 		if (It != Notifiers_.end()) { | ||||||
| 			Types::TopicNotifyFunctionList &L = It->second; | 			Types::TopicNotifyFunctionList &L = It->second; | ||||||
| @@ -275,56 +274,18 @@ namespace OpenWifi { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void KafkaDispatcher::Dispatch(const std::string &Topic, const std::string &Key, |  | ||||||
| 								   const std::string &Payload) { |  | ||||||
| 		std::lock_guard G(Mutex_); |  | ||||||
| 		auto It = Notifiers_.find(Topic); |  | ||||||
| 		if (It != Notifiers_.end()) { |  | ||||||
| 			Queue_.enqueueNotification(new KafkaMessage(Topic, Key, Payload)); |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	void KafkaDispatcher::run() { |  | ||||||
| 		Poco::Logger &Logger_ = |  | ||||||
| 			Poco::Logger::create("KAFKA-DISPATCHER", KafkaManager()->Logger().getChannel()); |  | ||||||
| 		poco_information(Logger_, "Starting..."); |  | ||||||
| 		Poco::AutoPtr<Poco::Notification> Note(Queue_.waitDequeueNotification()); |  | ||||||
| 		Utils::SetThreadName("kafka:dispatch"); |  | ||||||
| 		while (Note && Running_) { |  | ||||||
| 			auto Msg = dynamic_cast<KafkaMessage *>(Note.get()); |  | ||||||
| 			if (Msg != nullptr) { |  | ||||||
| 				auto It = Notifiers_.find(Msg->Topic()); |  | ||||||
| 				if (It != Notifiers_.end()) { |  | ||||||
| 					const auto &FL = It->second; |  | ||||||
| 					for (const auto &[CallbackFunc, _] : FL) { |  | ||||||
| 						CallbackFunc(Msg->Key(), Msg->Payload()); |  | ||||||
| 					} |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 			Note = Queue_.waitDequeueNotification(); |  | ||||||
| 		} |  | ||||||
| 		poco_information(Logger_, "Stopped..."); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	void KafkaDispatcher::Topics(std::vector<std::string> &T) { |  | ||||||
| 		T.clear(); |  | ||||||
| 		for (const auto &[TopicName, _] : Notifiers_) |  | ||||||
| 			T.push_back(TopicName); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	int KafkaManager::Start() { | 	int KafkaManager::Start() { | ||||||
| 		if (!KafkaEnabled_) | 		if (!KafkaEnabled_) | ||||||
| 			return 0; | 			return 0; | ||||||
|  | 		MaxPayloadSize_ = MicroServiceConfigGetInt("openwifi.kafka.max.payload", 250000); | ||||||
| 		ConsumerThr_.Start(); | 		ConsumerThr_.Start(); | ||||||
| 		ProducerThr_.Start(); | 		ProducerThr_.Start(); | ||||||
| 		Dispatcher_.Start(); |  | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void KafkaManager::Stop() { | 	void KafkaManager::Stop() { | ||||||
| 		if (KafkaEnabled_) { | 		if (KafkaEnabled_) { | ||||||
| 			poco_information(Logger(), "Stopping..."); | 			poco_information(Logger(), "Stopping..."); | ||||||
| 			Dispatcher_.Stop(); |  | ||||||
| 			ProducerThr_.Stop(); | 			ProducerThr_.Stop(); | ||||||
| 			ConsumerThr_.Stop(); | 			ConsumerThr_.Stop(); | ||||||
| 			poco_information(Logger(), "Stopped..."); | 			poco_information(Logger(), "Stopped..."); | ||||||
| @@ -332,38 +293,26 @@ namespace OpenWifi { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void KafkaManager::PostMessage(const std::string &topic, const std::string &key, | 	void KafkaManager::PostMessage(const char *topic, const std::string &key, | ||||||
| 								   const std::string &PayLoad, bool WrapMessage) { | 								   const std::string & PayLoad, bool WrapMessage) { | ||||||
| 		if (KafkaEnabled_) { | 		if (KafkaEnabled_) { | ||||||
| 			ProducerThr_.Produce(topic, key, WrapMessage ? WrapSystemId(PayLoad) : PayLoad); | 			ProducerThr_.Produce(topic, key, WrapMessage ? WrapSystemId(PayLoad) : PayLoad); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void KafkaManager::Dispatch(const std::string &Topic, const std::string &Key, | 	void KafkaManager::PostMessage(const char *topic, const std::string &key, | ||||||
| 								const std::string &Payload) { | 					 const Poco::JSON::Object &Object, bool WrapMessage) { | ||||||
| 		Dispatcher_.Dispatch(Topic, Key, Payload); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	[[nodiscard]] std::string KafkaManager::WrapSystemId(const std::string &PayLoad) { |  | ||||||
| 		return SystemInfoWrapper_ + PayLoad + "}"; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	uint64_t KafkaManager::RegisterTopicWatcher(const std::string &Topic, |  | ||||||
| 												Types::TopicNotifyFunction &F) { |  | ||||||
| 		if (KafkaEnabled_) { | 		if (KafkaEnabled_) { | ||||||
| 			return Dispatcher_.RegisterTopicWatcher(Topic, F); | 			std::ostringstream ObjectStr; | ||||||
| 		} else { | 			Object.stringify(ObjectStr); | ||||||
| 			return 0; | 			ProducerThr_.Produce(topic, key, WrapMessage ? WrapSystemId(ObjectStr.str()) : ObjectStr.str()); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void KafkaManager::UnregisterTopicWatcher(const std::string &Topic, uint64_t Id) { | 	[[nodiscard]] std::string KafkaManager::WrapSystemId(const std::string & PayLoad) { | ||||||
| 		if (KafkaEnabled_) { | 		return fmt::format(	R"lit({{ "system" : {{ "id" : {}, "host" : "{}" }}, "payload" : {} }})lit", | ||||||
| 			Dispatcher_.UnregisterTopicWatcher(Topic, Id); | 						   MicroServiceID(), MicroServicePrivateEndPoint(), PayLoad ) ; | ||||||
| 	} | 	} | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	void KafkaManager::Topics(std::vector<std::string> &T) { Dispatcher_.Topics(T); } |  | ||||||
|  |  | ||||||
| 	void KafkaManager::PartitionAssignment(const cppkafka::TopicPartitionList &partitions) { | 	void KafkaManager::PartitionAssignment(const cppkafka::TopicPartitionList &partitions) { | ||||||
| 		poco_information( | 		poco_information( | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ | |||||||
|  |  | ||||||
| #include "Poco/Notification.h" | #include "Poco/Notification.h" | ||||||
| #include "Poco/NotificationQueue.h" | #include "Poco/NotificationQueue.h" | ||||||
|  | #include "Poco/JSON/Object.h" | ||||||
| #include "framework/KafkaTopics.h" | #include "framework/KafkaTopics.h" | ||||||
| #include "framework/OpenWifiTypes.h" | #include "framework/OpenWifiTypes.h" | ||||||
| #include "framework/SubSystemServer.h" | #include "framework/SubSystemServer.h" | ||||||
| @@ -18,15 +18,15 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 	class KafkaMessage : public Poco::Notification { | 	class KafkaMessage : public Poco::Notification { | ||||||
| 	  public: | 	  public: | ||||||
| 		KafkaMessage(const std::string &Topic, const std::string &Key, const std::string &Payload) | 		KafkaMessage(const char * Topic, const std::string &Key, const std::string &Payload) | ||||||
| 			: Topic_(Topic), Key_(Key), Payload_(Payload) {} | 			: Topic_(Topic), Key_(Key), Payload_(Payload) {} | ||||||
|  |  | ||||||
| 		inline const std::string &Topic() { return Topic_; } | 		inline const char * Topic() { return Topic_; } | ||||||
| 		inline const std::string &Key() { return Key_; } | 		inline const std::string &Key() { return Key_; } | ||||||
| 		inline const std::string &Payload() { return Payload_; } | 		inline const std::string &Payload() { return Payload_; } | ||||||
|  |  | ||||||
| 	  private: | 	  private: | ||||||
| 		std::string Topic_; | 		const char *Topic_; | ||||||
| 		std::string Key_; | 		std::string Key_; | ||||||
| 		std::string Payload_; | 		std::string Payload_; | ||||||
| 	}; | 	}; | ||||||
| @@ -36,10 +36,10 @@ namespace OpenWifi { | |||||||
| 		void run() override; | 		void run() override; | ||||||
| 		void Start(); | 		void Start(); | ||||||
| 		void Stop(); | 		void Stop(); | ||||||
| 		void Produce(const std::string &Topic, const std::string &Key, const std::string &Payload); | 		void Produce(const char *Topic, const std::string &Key, const std::string & Payload); | ||||||
|  |  | ||||||
| 	  private: | 	  private: | ||||||
| 		std::recursive_mutex Mutex_; | 		std::mutex Mutex_; | ||||||
| 		Poco::Thread Worker_; | 		Poco::Thread Worker_; | ||||||
| 		mutable std::atomic_bool Running_ = false; | 		mutable std::atomic_bool Running_ = false; | ||||||
| 		Poco::NotificationQueue Queue_; | 		Poco::NotificationQueue Queue_; | ||||||
| @@ -47,33 +47,22 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 	class KafkaConsumer : public Poco::Runnable { | 	class KafkaConsumer : public Poco::Runnable { | ||||||
| 	  public: | 	  public: | ||||||
| 		void run() override; |  | ||||||
| 		void Start(); | 		void Start(); | ||||||
| 		void Stop(); | 		void Stop(); | ||||||
|  |  | ||||||
| 	  private: | 	  private: | ||||||
| 		std::recursive_mutex Mutex_; | 		std::mutex 				ConsumerMutex_; | ||||||
| 		Poco::Thread Worker_; |  | ||||||
| 		mutable std::atomic_bool Running_ = false; |  | ||||||
| 	}; |  | ||||||
|  |  | ||||||
| 	class KafkaDispatcher : public Poco::Runnable { |  | ||||||
| 	  public: |  | ||||||
| 		void Start(); |  | ||||||
| 		void Stop(); |  | ||||||
| 		auto RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction &F); |  | ||||||
| 		void UnregisterTopicWatcher(const std::string &Topic, int Id); |  | ||||||
| 		void Dispatch(const std::string &Topic, const std::string &Key, const std::string &Payload); |  | ||||||
| 		void run() override; |  | ||||||
| 		void Topics(std::vector<std::string> &T); |  | ||||||
|  |  | ||||||
| 	  private: |  | ||||||
| 		std::recursive_mutex Mutex_; |  | ||||||
| 		Types::NotifyTable 		Notifiers_; | 		Types::NotifyTable 		Notifiers_; | ||||||
| 		Poco::Thread 			Worker_; | 		Poco::Thread 			Worker_; | ||||||
| 		mutable std::atomic_bool Running_ = false; | 		mutable std::atomic_bool Running_ = false; | ||||||
| 		uint64_t 				FunctionId_ = 1; | 		uint64_t 				FunctionId_ = 1; | ||||||
| 		Poco::NotificationQueue Queue_; | 		std::unique_ptr<cppkafka::ConsumerDispatcher> 	Dispatcher_; | ||||||
|  | 		std::set<std::string>	Topics_; | ||||||
|  |  | ||||||
|  | 		void run() override; | ||||||
|  | 		friend class KafkaManager; | ||||||
|  | 		std::uint64_t RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction &F); | ||||||
|  | 		void UnregisterTopicWatcher(const std::string &Topic, int Id); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	class KafkaManager : public SubSystemServer { | 	class KafkaManager : public SubSystemServer { | ||||||
| @@ -91,21 +80,28 @@ namespace OpenWifi { | |||||||
| 		int Start() override; | 		int Start() override; | ||||||
| 		void Stop() override; | 		void Stop() override; | ||||||
|  |  | ||||||
| 		void PostMessage(const std::string &topic, const std::string &key, | 		void PostMessage(const char *topic, const std::string &key, | ||||||
| 						 const std::string &PayLoad, bool WrapMessage = true); | 						 const std::string &PayLoad, bool WrapMessage = true); | ||||||
| 		void Dispatch(const std::string &Topic, const std::string &Key, const std::string &Payload); | 		void PostMessage(const char *topic, const std::string &key, | ||||||
| 		[[nodiscard]] std::string WrapSystemId(const std::string &PayLoad); | 						 const Poco::JSON::Object &Object, bool WrapMessage = true); | ||||||
|  |  | ||||||
|  | 		[[nodiscard]] std::string WrapSystemId(const std::string & PayLoad); | ||||||
| 		[[nodiscard]] inline bool Enabled() const { return KafkaEnabled_; } | 		[[nodiscard]] inline bool Enabled() const { return KafkaEnabled_; } | ||||||
| 		uint64_t RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction &F); | 		inline std::uint64_t RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction &F) { | ||||||
| 		void UnregisterTopicWatcher(const std::string &Topic, uint64_t Id); | 			return ConsumerThr_.RegisterTopicWatcher(Topic,F); | ||||||
| 		void Topics(std::vector<std::string> &T); | 		} | ||||||
|  | 		inline void UnregisterTopicWatcher(const std::string &Topic, uint64_t Id) { | ||||||
|  | 			return ConsumerThr_.UnregisterTopicWatcher(Topic,Id); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		std::uint64_t KafkaManagerMaximumPayloadSize() const { return MaxPayloadSize_; } | ||||||
|  |  | ||||||
| 	  private: | 	  private: | ||||||
| 		bool KafkaEnabled_ = false; | 		bool KafkaEnabled_ = false; | ||||||
| 		std::string SystemInfoWrapper_; | 		std::string SystemInfoWrapper_; | ||||||
| 		KafkaProducer ProducerThr_; | 		KafkaProducer ProducerThr_; | ||||||
| 		KafkaConsumer ConsumerThr_; | 		KafkaConsumer ConsumerThr_; | ||||||
| 		KafkaDispatcher Dispatcher_; | 		std::uint64_t MaxPayloadSize_ = 250000; | ||||||
|  |  | ||||||
| 		void PartitionAssignment(const cppkafka::TopicPartitionList &partitions); | 		void PartitionAssignment(const cppkafka::TopicPartitionList &partitions); | ||||||
| 		void PartitionRevocation(const cppkafka::TopicPartitionList &partitions); | 		void PartitionRevocation(const cppkafka::TopicPartitionList &partitions); | ||||||
|   | |||||||
| @@ -10,32 +10,33 @@ | |||||||
|  |  | ||||||
| #include <string> | #include <string> | ||||||
| namespace OpenWifi::KafkaTopics { | namespace OpenWifi::KafkaTopics { | ||||||
| 	static const std::string HEALTHCHECK{"healthcheck"}; | 	inline const char * HEALTHCHECK = "healthcheck"; | ||||||
| 	static const std::string STATE{"state"}; | 	inline const char * STATE = "state"; | ||||||
| 	static const std::string CONNECTION{"connection"}; | 	inline const char * CONNECTION = "connection"; | ||||||
| 	static const std::string WIFISCAN{"wifiscan"}; | 	inline const char * WIFISCAN = "wifiscan"; | ||||||
| 	static const std::string ALERTS{"alerts"}; | 	inline const char * ALERTS = "alerts"; | ||||||
| 	static const std::string COMMAND{"command"}; | 	inline const char * COMMAND = "command"; | ||||||
| 	static const std::string SERVICE_EVENTS{"service_events"}; | 	inline const char * SERVICE_EVENTS = "service_events"; | ||||||
| 	static const std::string DEVICE_EVENT_QUEUE{"device_event_queue"}; | 	inline const char * DEVICE_EVENT_QUEUE = "device_event_queue"; | ||||||
| 	static const std::string DEVICE_TELEMETRY{"device_telemetry"}; | 	inline const char * DEVICE_TELEMETRY = "device_telemetry"; | ||||||
| 	static const std::string PROVISIONING_CHANGE{"provisioning_change"}; | 	inline const char * PROVISIONING_CHANGE = "provisioning_change"; | ||||||
|  | 	inline const char * RRM = "rrm"; | ||||||
|  |  | ||||||
| 	namespace ServiceEvents { | 	namespace ServiceEvents { | ||||||
| 		static const std::string EVENT_JOIN{"join"}; | 		inline const char * EVENT_JOIN = "join"; | ||||||
| 		static const std::string EVENT_LEAVE{"leave"}; | 		inline const char * EVENT_LEAVE = "leave"; | ||||||
| 		static const std::string EVENT_KEEP_ALIVE{"keep-alive"}; | 		inline const char * EVENT_KEEP_ALIVE = "keep-alive"; | ||||||
| 		static const std::string EVENT_REMOVE_TOKEN{"remove-token"}; | 		inline const char * EVENT_REMOVE_TOKEN = "remove-token"; | ||||||
|  |  | ||||||
| 		namespace Fields { | 		namespace Fields { | ||||||
| 			static const std::string EVENT{"event"}; | 			inline const char * EVENT = "event"; | ||||||
| 			static const std::string ID{"id"}; | 			inline const char * ID = "id"; | ||||||
| 			static const std::string TYPE{"type"}; | 			inline const char * TYPE = "type"; | ||||||
| 			static const std::string PUBLIC{"publicEndPoint"}; | 			inline const char * PUBLIC = "publicEndPoint"; | ||||||
| 			static const std::string PRIVATE{"privateEndPoint"}; | 			inline const char * PRIVATE = "privateEndPoint"; | ||||||
| 			static const std::string KEY{"key"}; | 			inline const char * KEY = "key"; | ||||||
| 			static const std::string VRSN{"version"}; | 			inline const char * VRSN = "version"; | ||||||
| 			static const std::string TOKEN{"token"}; | 			inline const char * TOKEN = "token"; | ||||||
| 		} // namespace Fields | 		} // namespace Fields | ||||||
| 	}	  // namespace ServiceEvents | 	}	  // namespace ServiceEvents | ||||||
| } // namespace OpenWifi::KafkaTopics | } // namespace OpenWifi::KafkaTopics | ||||||
|   | |||||||
| @@ -29,13 +29,29 @@ | |||||||
| #include "framework/WebSocketLogger.h" | #include "framework/WebSocketLogger.h" | ||||||
| #include "framework/utils.h" | #include "framework/utils.h" | ||||||
|  |  | ||||||
|  | #ifdef  USE_MEDUSA_CLIENT | ||||||
|  | #include <medusa/MedusaClient.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| namespace OpenWifi { | namespace OpenWifi { | ||||||
|  |  | ||||||
| 	void MicroService::Exit(int Reason) { std::exit(Reason); } | 	static std::string MakeServiceListString(const Types::MicroServiceMetaMap &Services) { | ||||||
|  |         std::string SvcList; | ||||||
|  |         for (const auto &Svc : Services) { | ||||||
|  |             if (SvcList.empty()) | ||||||
|  |                 SvcList = Svc.second.Type; | ||||||
|  |             else | ||||||
|  |                 SvcList += ", " + Svc.second.Type; | ||||||
|  |         } | ||||||
|  |         return SvcList; | ||||||
|  |     } | ||||||
|  |  | ||||||
| 	void MicroService::BusMessageReceived([[maybe_unused]] const std::string &Key, | 	void MicroService::BusMessageReceived([[maybe_unused]] const std::string &Key, | ||||||
| 										  const std::string &Payload) { | 										  const std::string &Payload) { | ||||||
| 		std::lock_guard G(InfraMutex_); | 		std::lock_guard G(InfraMutex_); | ||||||
|  |  | ||||||
|  | 		Poco::Logger &BusLogger = EventBusManager()->Logger(); | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			Poco::JSON::Parser P; | 			Poco::JSON::Parser P; | ||||||
| 			auto Object = P.parse(Payload).extract<Poco::JSON::Object::Ptr>(); | 			auto Object = P.parse(Payload).extract<Poco::JSON::Object::Ptr>(); | ||||||
| @@ -55,13 +71,10 @@ namespace OpenWifi { | |||||||
| 							Object->has(KafkaTopics::ServiceEvents::Fields::KEY)) { | 							Object->has(KafkaTopics::ServiceEvents::Fields::KEY)) { | ||||||
| 							auto PrivateEndPoint = | 							auto PrivateEndPoint = | ||||||
| 								Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE).toString(); | 								Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE).toString(); | ||||||
| 							if (Event == KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE && | 							if (Event == KafkaTopics::ServiceEvents::EVENT_LEAVE) { | ||||||
| 								Services_.find(PrivateEndPoint) != Services_.end()) { |  | ||||||
| 								Services_[PrivateEndPoint].LastUpdate = Utils::Now(); |  | ||||||
| 							} else if (Event == KafkaTopics::ServiceEvents::EVENT_LEAVE) { |  | ||||||
| 								Services_.erase(PrivateEndPoint); | 								Services_.erase(PrivateEndPoint); | ||||||
| 								poco_debug( | 								poco_information( | ||||||
| 									logger(), | 									BusLogger, | ||||||
| 									fmt::format( | 									fmt::format( | ||||||
| 										"Service {} ID={} leaving system.", | 										"Service {} ID={} leaving system.", | ||||||
| 										Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE) | 										Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE) | ||||||
| @@ -69,14 +82,7 @@ namespace OpenWifi { | |||||||
| 										ID)); | 										ID)); | ||||||
| 							} else if (Event == KafkaTopics::ServiceEvents::EVENT_JOIN || | 							} else if (Event == KafkaTopics::ServiceEvents::EVENT_JOIN || | ||||||
| 									   Event == KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE) { | 									   Event == KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE) { | ||||||
| 								poco_debug( | 								auto ServiceInfo = Types::MicroServiceMeta{ | ||||||
| 									logger(), |  | ||||||
| 									fmt::format( |  | ||||||
| 										"Service {} ID={} joining system.", |  | ||||||
| 										Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE) |  | ||||||
| 											.toString(), |  | ||||||
| 										ID)); |  | ||||||
| 								Services_[PrivateEndPoint] = Types::MicroServiceMeta{ |  | ||||||
| 									.Id = ID, | 									.Id = ID, | ||||||
| 									.Type = Poco::toLower( | 									.Type = Poco::toLower( | ||||||
| 										Object->get(KafkaTopics::ServiceEvents::Fields::TYPE) | 										Object->get(KafkaTopics::ServiceEvents::Fields::TYPE) | ||||||
| @@ -94,6 +100,22 @@ namespace OpenWifi { | |||||||
| 												   .toString(), | 												   .toString(), | ||||||
| 									.LastUpdate = Utils::Now()}; | 									.LastUpdate = Utils::Now()}; | ||||||
|  |  | ||||||
|  |                                 auto s1 = MakeServiceListString(Services_); | ||||||
|  | 								auto PreviousSize = Services_.size(); | ||||||
|  | 								Services_[PrivateEndPoint] = ServiceInfo; | ||||||
|  | 								auto CurrentSize = Services_.size(); | ||||||
|  | 								if(Event == KafkaTopics::ServiceEvents::EVENT_JOIN) { | ||||||
|  | 									if(!s1.empty()) { | ||||||
|  | 										poco_information( | ||||||
|  | 											BusLogger, | ||||||
|  | 											fmt::format( | ||||||
|  | 												"Service {} ID={} is joining the system.", | ||||||
|  | 												Object | ||||||
|  | 													->get( | ||||||
|  | 														KafkaTopics::ServiceEvents::Fields::PRIVATE) | ||||||
|  | 													.toString(), | ||||||
|  | 												ID)); | ||||||
|  | 									} | ||||||
| 									std::string SvcList; | 									std::string SvcList; | ||||||
| 									for (const auto &Svc : Services_) { | 									for (const auto &Svc : Services_) { | ||||||
| 										if (SvcList.empty()) | 										if (SvcList.empty()) | ||||||
| @@ -102,12 +124,22 @@ namespace OpenWifi { | |||||||
| 											SvcList += ", " + Svc.second.Type; | 											SvcList += ", " + Svc.second.Type; | ||||||
| 									} | 									} | ||||||
| 									poco_information( | 									poco_information( | ||||||
| 									logger(), | 										BusLogger, | ||||||
| 										fmt::format("Current list of microservices: {}", SvcList)); | 										fmt::format("Current list of microservices: {}", SvcList)); | ||||||
|  | 								} else if(CurrentSize!=PreviousSize) { | ||||||
|  | 									poco_information( | ||||||
|  | 										BusLogger, | ||||||
|  | 										fmt::format( | ||||||
|  | 											"Service {} ID={} is being added back in.", | ||||||
|  | 											Object | ||||||
|  | 												->get(KafkaTopics::ServiceEvents::Fields::PRIVATE) | ||||||
|  | 												.toString(), | ||||||
|  | 											ID)); | ||||||
|  | 								} | ||||||
| 							} | 							} | ||||||
| 						} else { | 						} else { | ||||||
| 							poco_error( | 							poco_information( | ||||||
| 								logger(), | 								BusLogger, | ||||||
| 								fmt::format("KAFKA-MSG: invalid event '{}', missing a field.", | 								fmt::format("KAFKA-MSG: invalid event '{}', missing a field.", | ||||||
| 											Event)); | 											Event)); | ||||||
| 						} | 						} | ||||||
| @@ -118,30 +150,39 @@ namespace OpenWifi { | |||||||
| 								Object->get(KafkaTopics::ServiceEvents::Fields::TOKEN).toString()); | 								Object->get(KafkaTopics::ServiceEvents::Fields::TOKEN).toString()); | ||||||
| #endif | #endif | ||||||
| 						} else { | 						} else { | ||||||
| 							poco_error( | 							poco_information( | ||||||
| 								logger(), | 								BusLogger, | ||||||
| 								fmt::format("KAFKA-MSG: invalid event '{}', missing token", Event)); | 								fmt::format("KAFKA-MSG: invalid event '{}', missing token", Event)); | ||||||
| 						} | 						} | ||||||
| 					} else { | 					} else { | ||||||
| 						poco_error(logger(), | 						poco_information(BusLogger, | ||||||
| 								   fmt::format("Unknown Event: {} Source: {}", Event, ID)); | 								   fmt::format("Unknown Event: {} Source: {}", Event, ID)); | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
| 				poco_error(logger(), "Bad bus message."); | 				std::ostringstream os; | ||||||
|  | 				Object->stringify(std::cout); | ||||||
|  | 				poco_error(BusLogger, fmt::format("Bad bus message: {}", os.str())); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			auto i = Services_.begin(); | 			auto ServiceHint = Services_.begin(); | ||||||
| 			auto now = Utils::Now(); | 			auto now = Utils::Now(); | ||||||
| 			for (; i != Services_.end();) { |             auto si1 = Services_.size(); | ||||||
| 				if ((now - i->second.LastUpdate) > 60) { |             auto ss1 = MakeServiceListString(Services_); | ||||||
| 					i = Services_.erase(i); | 			while(ServiceHint!=Services_.end()) { | ||||||
|  | 				if ((now - ServiceHint->second.LastUpdate) > 120) { | ||||||
|  | 					poco_information(BusLogger, fmt::format("ZombieService: Removing service {}, ", ServiceHint->second.PublicEndPoint)); | ||||||
|  | 					ServiceHint = Services_.erase(ServiceHint); | ||||||
| 				} else | 				} else | ||||||
| 					++i; | 					++ServiceHint; | ||||||
|  | 			} | ||||||
|  |             if(Services_.size() != si1) { | ||||||
|  |                 auto ss2 = MakeServiceListString(Services_); | ||||||
|  |                 poco_information(BusLogger, fmt::format("Current list of microservices: {} -> {}", ss1, ss2)); | ||||||
|             } |             } | ||||||
|  |  | ||||||
| 		} catch (const Poco::Exception &E) { | 		} catch (const Poco::Exception &E) { | ||||||
| 			logger().log(E); | 			BusLogger.log(E); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -165,9 +206,11 @@ namespace OpenWifi { | |||||||
| 			Res.push_back(ServiceRec); | 			Res.push_back(ServiceRec); | ||||||
| 		} | 		} | ||||||
| 		return Res; | 		return Res; | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void MicroService::LoadConfigurationFile() { | 	void MicroService::LoadConfigurationFile() { | ||||||
|  |         if(ConfigContent_.empty()) { | ||||||
|             std::string Location = Poco::Environment::get(DAEMON_CONFIG_ENV_VAR, "."); |             std::string Location = Poco::Environment::get(DAEMON_CONFIG_ENV_VAR, "."); | ||||||
|             ConfigFileName_ = |             ConfigFileName_ = | ||||||
|                 ConfigFileName_.empty() ? Location + "/" + DAEMON_PROPERTIES_FILENAME : ConfigFileName_; |                 ConfigFileName_.empty() ? Location + "/" + DAEMON_PROPERTIES_FILENAME : ConfigFileName_; | ||||||
| @@ -181,9 +224,11 @@ namespace OpenWifi { | |||||||
|                           << std::endl; |                           << std::endl; | ||||||
|                 std::exit(Poco::Util::Application::EXIT_CONFIG); |                 std::exit(Poco::Util::Application::EXIT_CONFIG); | ||||||
|             } |             } | ||||||
|  |  | ||||||
| 		// 	    loadConfiguration(ConfigFile.toString()); |  | ||||||
|             PropConfigurationFile_ = new Poco::Util::PropertyFileConfiguration(ConfigFile.toString()); |             PropConfigurationFile_ = new Poco::Util::PropertyFileConfiguration(ConfigFile.toString()); | ||||||
|  |         } else { | ||||||
|  |             std::istringstream is(ConfigContent_); | ||||||
|  |             PropConfigurationFile_ = new Poco::Util::PropertyFileConfiguration(is); | ||||||
|  |         } | ||||||
| 		configPtr()->addWriteable(PropConfigurationFile_, PRIO_DEFAULT); | 		configPtr()->addWriteable(PropConfigurationFile_, PRIO_DEFAULT); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -386,11 +431,13 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 	void DaemonPostInitialization(Poco::Util::Application &self); | 	void DaemonPostInitialization(Poco::Util::Application &self); | ||||||
|  |  | ||||||
| 	void MicroService::initialize(Poco::Util::Application &self) { |     void MicroService::StartEverything(Poco::Util::Application &self) { | ||||||
| 		// add the default services |  | ||||||
|         LoadConfigurationFile(); |         LoadConfigurationFile(); | ||||||
|         InitializeLoggingSystem(); |         InitializeLoggingSystem(); | ||||||
|  |  | ||||||
|  |         static bool InitializedBaseService=false; | ||||||
|  |         if(!InitializedBaseService) { | ||||||
|  |             InitializedBaseService = true; | ||||||
|             SubSystems_.push_back(KafkaManager()); |             SubSystems_.push_back(KafkaManager()); | ||||||
|             SubSystems_.push_back(ALBHealthCheckServer()); |             SubSystems_.push_back(ALBHealthCheckServer()); | ||||||
|             SubSystems_.push_back(RESTAPI_ExtServer()); |             SubSystems_.push_back(RESTAPI_ExtServer()); | ||||||
| @@ -398,11 +445,13 @@ namespace OpenWifi { | |||||||
| #ifndef TIP_SECURITY_SERVICE | #ifndef TIP_SECURITY_SERVICE | ||||||
|             SubSystems_.push_back(AuthClient()); |             SubSystems_.push_back(AuthClient()); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|             Poco::Net::initializeSSL(); |             Poco::Net::initializeSSL(); | ||||||
|             Poco::Net::HTTPStreamFactory::registerFactory(); |             Poco::Net::HTTPStreamFactory::registerFactory(); | ||||||
|             Poco::Net::HTTPSStreamFactory::registerFactory(); |             Poco::Net::HTTPSStreamFactory::registerFactory(); | ||||||
|             Poco::Net::FTPStreamFactory::registerFactory(); |             Poco::Net::FTPStreamFactory::registerFactory(); | ||||||
|             Poco::Net::FTPSStreamFactory::registerFactory(); |             Poco::Net::FTPSStreamFactory::registerFactory(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         Poco::File DataDir(ConfigPath("openwifi.system.data")); |         Poco::File DataDir(ConfigPath("openwifi.system.data")); | ||||||
|         DataDir_ = DataDir.path(); |         DataDir_ = DataDir.path(); | ||||||
| @@ -410,7 +459,7 @@ namespace OpenWifi { | |||||||
|             try { |             try { | ||||||
|                 DataDir.createDirectory(); |                 DataDir.createDirectory(); | ||||||
|             } catch (const Poco::Exception &E) { |             } catch (const Poco::Exception &E) { | ||||||
| 				logger().log(E); |                 Logger_.log(E); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         WWWAssetsDir_ = ConfigPath("openwifi.restapi.wwwassets", ""); |         WWWAssetsDir_ = ConfigPath("openwifi.restapi.wwwassets", ""); | ||||||
| @@ -431,6 +480,12 @@ namespace OpenWifi { | |||||||
|         KafkaManager()->RegisterTopicWatcher(KafkaTopics::SERVICE_EVENTS, F); |         KafkaManager()->RegisterTopicWatcher(KafkaTopics::SERVICE_EVENTS, F); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | 	void MicroService::initialize([[maybe_unused]] Poco::Util::Application &self) { | ||||||
|  | #ifndef USE_MEDUSA_CLIENT | ||||||
|  |         StartEverything(self); | ||||||
|  | #endif | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	void MicroService::uninitialize() { | 	void MicroService::uninitialize() { | ||||||
| 		// add your own uninitialization code here | 		// add your own uninitialization code here | ||||||
| 		ServerApplication::uninitialize(); | 		ServerApplication::uninitialize(); | ||||||
| @@ -528,14 +583,12 @@ namespace OpenWifi { | |||||||
| 		for (auto i : SubSystems_) { | 		for (auto i : SubSystems_) { | ||||||
| 			i->Start(); | 			i->Start(); | ||||||
| 		} | 		} | ||||||
| 		EventBusManager_ = std::make_unique<EventBusManager>(Poco::Logger::create( | 		EventBusManager()->Start(); | ||||||
| 			"EventBusManager", Poco::Logger::root().getChannel(), Poco::Logger::root().getLevel())); |  | ||||||
| 		EventBusManager_->Start(); |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void MicroService::StopSubSystemServers() { | 	void MicroService::StopSubSystemServers() { | ||||||
| 		AddActivity("Stopping"); | 		AddActivity("Stopping"); | ||||||
| 		EventBusManager_->Stop(); | 		EventBusManager()->Stop(); | ||||||
| 		for (auto i = SubSystems_.rbegin(); i != SubSystems_.rend(); ++i) { | 		for (auto i = SubSystems_.rbegin(); i != SubSystems_.rend(); ++i) { | ||||||
| 			(*i)->Stop(); | 			(*i)->Stop(); | ||||||
| 		} | 		} | ||||||
| @@ -695,7 +748,7 @@ namespace OpenWifi { | |||||||
| 			auto APIKEY = Request.get("X-API-KEY"); | 			auto APIKEY = Request.get("X-API-KEY"); | ||||||
| 			return APIKEY == MyHash_; | 			return APIKEY == MyHash_; | ||||||
| 		} catch (const Poco::Exception &E) { | 		} catch (const Poco::Exception &E) { | ||||||
| 			logger().log(E); | 			Logger_.log(E); | ||||||
| 		} | 		} | ||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
| @@ -716,6 +769,8 @@ namespace OpenWifi { | |||||||
| 		MicroServiceErrorHandler ErrorHandler(*this); | 		MicroServiceErrorHandler ErrorHandler(*this); | ||||||
| 		Poco::ErrorHandler::set(&ErrorHandler); | 		Poco::ErrorHandler::set(&ErrorHandler); | ||||||
|  |  | ||||||
|  |         Args_ = args; | ||||||
|  |  | ||||||
| 		if (!HelpRequested_) { | 		if (!HelpRequested_) { | ||||||
| 			SavePID(); | 			SavePID(); | ||||||
|  |  | ||||||
| @@ -731,11 +786,18 @@ namespace OpenWifi { | |||||||
| 				poco_information(logger, "Starting as a daemon."); | 				poco_information(logger, "Starting as a daemon."); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | #ifdef USE_MEDUSA_CLIENT | ||||||
|  |             MedusaClient::instance()->SetSubSystems(SubSystems_); | ||||||
|  |             MedusaClient::instance()->Start(); | ||||||
|  | 			waitForTerminationRequest(); | ||||||
|  |             MedusaClient::instance()->Stop(); | ||||||
|  | #else | ||||||
| 			poco_information(logger, fmt::format("System ID set to {}", ID_)); | 			poco_information(logger, fmt::format("System ID set to {}", ID_)); | ||||||
| 			StartSubSystemServers(); | 			StartSubSystemServers(); | ||||||
| 			waitForTerminationRequest(); | 			waitForTerminationRequest(); | ||||||
| 			StopSubSystemServers(); | 			StopSubSystemServers(); | ||||||
| 			logger.notice(fmt::format("Stopped {}...", DAEMON_APP_NAME)); | 			logger.notice(fmt::format("Stopped {}...", DAEMON_APP_NAME)); | ||||||
|  | #endif | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		return Application::EXIT_OK; | 		return Application::EXIT_OK; | ||||||
|   | |||||||
| @@ -55,9 +55,6 @@ namespace OpenWifi { | |||||||
| #include "nlohmann/json.hpp" | #include "nlohmann/json.hpp" | ||||||
| #include "ow_version.h" | #include "ow_version.h" | ||||||
|  |  | ||||||
| #define _OWDEBUG_ std::cout << __FILE__ << ":" << __LINE__ << std::endl; |  | ||||||
| // #define _OWDEBUG_ Logger().debug(Poco::format("%s: %lu",__FILE__,__LINE__)); |  | ||||||
|  |  | ||||||
| namespace OpenWifi { | namespace OpenWifi { | ||||||
|  |  | ||||||
| 	class MicroService : public Poco::Util::ServerApplication { | 	class MicroService : public Poco::Util::ServerApplication { | ||||||
| @@ -70,7 +67,6 @@ namespace OpenWifi { | |||||||
| 			  SubSystems_(std::move(Subsystems)), Logger_(Poco::Logger::get("FRAMEWORK")) { | 			  SubSystems_(std::move(Subsystems)), Logger_(Poco::Logger::get("FRAMEWORK")) { | ||||||
| 			instance_ = this; | 			instance_ = this; | ||||||
| 			RandomEngine_.seed(std::chrono::steady_clock::now().time_since_epoch().count()); | 			RandomEngine_.seed(std::chrono::steady_clock::now().time_since_epoch().count()); | ||||||
| 			// Logger_ = Poco::Logger::root().get("BASE-SVC"); |  | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		inline static const char *ExtraConfigurationFilename = "/configuration_override.json"; | 		inline static const char *ExtraConfigurationFilename = "/configuration_override.json"; | ||||||
| @@ -92,7 +88,7 @@ namespace OpenWifi { | |||||||
| 		inline uint64_t DaemonBusTimer() const { return DAEMON_BUS_TIMER; }; | 		inline uint64_t DaemonBusTimer() const { return DAEMON_BUS_TIMER; }; | ||||||
| 		[[nodiscard]] const std::string &AppName() { return DAEMON_APP_NAME; } | 		[[nodiscard]] const std::string &AppName() { return DAEMON_APP_NAME; } | ||||||
| 		static inline uint64_t GetPID() { return Poco::Process::id(); }; | 		static inline uint64_t GetPID() { return Poco::Process::id(); }; | ||||||
| 		[[nodiscard]] inline const std::string GetPublicAPIEndPoint() { | 		[[nodiscard]] inline std::string GetPublicAPIEndPoint() const { | ||||||
| 			return MyPublicEndPoint_ + "/api/v1"; | 			return MyPublicEndPoint_ + "/api/v1"; | ||||||
| 		}; | 		}; | ||||||
| 		[[nodiscard]] inline const std::string &GetUIURI() const { return UIURI_; }; | 		[[nodiscard]] inline const std::string &GetUIURI() const { return UIURI_; }; | ||||||
| @@ -107,7 +103,8 @@ namespace OpenWifi { | |||||||
| 		} | 		} | ||||||
| 		static MicroService &instance() { return *instance_; } | 		static MicroService &instance() { return *instance_; } | ||||||
|  |  | ||||||
| 		inline void Exit(int Reason); | 		inline void Exit(int Reason) { std::exit(Reason); } | ||||||
|  |  | ||||||
| 		void BusMessageReceived(const std::string &Key, const std::string &Payload); | 		void BusMessageReceived(const std::string &Key, const std::string &Payload); | ||||||
| 		Types::MicroServiceMetaVec GetServices(const std::string &Type); | 		Types::MicroServiceMetaVec GetServices(const std::string &Type); | ||||||
| 		Types::MicroServiceMetaVec GetServices(); | 		Types::MicroServiceMetaVec GetServices(); | ||||||
| @@ -115,6 +112,7 @@ namespace OpenWifi { | |||||||
| 		void Reload(); | 		void Reload(); | ||||||
| 		void LoadMyConfig(); | 		void LoadMyConfig(); | ||||||
| 		void initialize(Poco::Util::Application &self) override; | 		void initialize(Poco::Util::Application &self) override; | ||||||
|  |         void StartEverything(Poco::Util::Application &self); | ||||||
| 		void uninitialize() override; | 		void uninitialize() override; | ||||||
| 		void reinitialize(Poco::Util::Application &self) override; | 		void reinitialize(Poco::Util::Application &self) override; | ||||||
| 		void defineOptions(Poco::Util::OptionSet &options) override; | 		void defineOptions(Poco::Util::OptionSet &options) override; | ||||||
| @@ -132,7 +130,7 @@ namespace OpenWifi { | |||||||
| 		void Reload(const std::string &Sub); | 		void Reload(const std::string &Sub); | ||||||
| 		Types::StringVec GetSubSystems() const; | 		Types::StringVec GetSubSystems() const; | ||||||
| 		Types::StringPairVec GetLogLevels(); | 		Types::StringPairVec GetLogLevels(); | ||||||
| 		const Types::StringVec &GetLogLevelNames(); | 		static const Types::StringVec &GetLogLevelNames(); | ||||||
| 		uint64_t ConfigGetInt(const std::string &Key, uint64_t Default); | 		uint64_t ConfigGetInt(const std::string &Key, uint64_t Default); | ||||||
| 		uint64_t ConfigGetInt(const std::string &Key); | 		uint64_t ConfigGetInt(const std::string &Key); | ||||||
| 		uint64_t ConfigGetBool(const std::string &Key, bool Default); | 		uint64_t ConfigGetBool(const std::string &Key, bool Default); | ||||||
| @@ -166,12 +164,16 @@ namespace OpenWifi { | |||||||
| 								const std::string &FormatterPattern, | 								const std::string &FormatterPattern, | ||||||
| 								const std::string &root_env_var); | 								const std::string &root_env_var); | ||||||
| 		inline bool AllowExternalMicroServices() const { return AllowExternalMicroServices_; } | 		inline bool AllowExternalMicroServices() const { return AllowExternalMicroServices_; } | ||||||
|  |         const ArgVec &Args() const { return Args_; } | ||||||
|  |  | ||||||
|  |         inline void SetConfigContent(const std::string &Content) { ConfigContent_ = Content; } | ||||||
|  |  | ||||||
| 	  private: | 	  private: | ||||||
| 		static MicroService *instance_; | 		static MicroService *instance_; | ||||||
| 		bool HelpRequested_ = false; | 		bool HelpRequested_ = false; | ||||||
| 		std::string LogDir_; | 		std::string LogDir_; | ||||||
| 		std::string ConfigFileName_; | 		std::string ConfigFileName_; | ||||||
|  |         std::string ConfigContent_; | ||||||
| 		uint64_t ID_ = 1; | 		uint64_t ID_ = 1; | ||||||
| 		Poco::SharedPtr<Poco::Crypto::RSAKey> AppKey_; | 		Poco::SharedPtr<Poco::Crypto::RSAKey> AppKey_; | ||||||
| 		bool DebugMode_ = false; | 		bool DebugMode_ = false; | ||||||
| @@ -201,7 +203,7 @@ namespace OpenWifi { | |||||||
| 		Poco::JWT::Signer Signer_; | 		Poco::JWT::Signer Signer_; | ||||||
| 		Poco::Logger &Logger_; | 		Poco::Logger &Logger_; | ||||||
| 		Poco::ThreadPool TimerPool_{"timer:pool", 2, 32}; | 		Poco::ThreadPool TimerPool_{"timer:pool", 2, 32}; | ||||||
| 		std::unique_ptr<EventBusManager> EventBusManager_; |         ArgVec Args_; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	inline MicroService *MicroService::instance_ = nullptr; | 	inline MicroService *MicroService::instance_ = nullptr; | ||||||
|   | |||||||
| @@ -5,6 +5,8 @@ | |||||||
| #include "framework/MicroServiceFuncs.h" | #include "framework/MicroServiceFuncs.h" | ||||||
| #include "framework/MicroService.h" | #include "framework/MicroService.h" | ||||||
|  |  | ||||||
|  | #include "framework/ALBserver.h" | ||||||
|  |  | ||||||
| namespace OpenWifi { | namespace OpenWifi { | ||||||
| 	const std::string &MicroServiceDataDirectory() { return MicroService::instance().DataDir(); } | 	const std::string &MicroServiceDataDirectory() { return MicroService::instance().DataDir(); } | ||||||
|  |  | ||||||
| @@ -47,11 +49,11 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 	void MicroServiceReload(const std::string &Type) { MicroService::instance().Reload(Type); } | 	void MicroServiceReload(const std::string &Type) { MicroService::instance().Reload(Type); } | ||||||
|  |  | ||||||
| 	const Types::StringVec MicroServiceGetLogLevelNames() { | 	Types::StringVec MicroServiceGetLogLevelNames() { | ||||||
| 		return MicroService::instance().GetLogLevelNames(); | 		return MicroService::instance().GetLogLevelNames(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	const Types::StringVec MicroServiceGetSubSystems() { | 	Types::StringVec MicroServiceGetSubSystems() { | ||||||
| 		return MicroService::instance().GetSubSystems(); | 		return MicroService::instance().GetSubSystems(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -79,7 +81,7 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 	std::string MicroServiceGetUIURI() { return MicroService::instance().GetUIURI(); } | 	std::string MicroServiceGetUIURI() { return MicroService::instance().GetUIURI(); } | ||||||
|  |  | ||||||
| 	const SubSystemVec MicroServiceGetFullSubSystems() { | 	SubSystemVec MicroServiceGetFullSubSystems() { | ||||||
| 		return MicroService::instance().GetFullSubSystems(); | 		return MicroService::instance().GetFullSubSystems(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -87,7 +89,7 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 	std::uint64_t MicroServiceDaemonBusTimer() { return MicroService::instance().DaemonBusTimer(); } | 	std::uint64_t MicroServiceDaemonBusTimer() { return MicroService::instance().DaemonBusTimer(); } | ||||||
|  |  | ||||||
| 	std::string MicroServiceMakeSystemEventMessage(const std::string &Type) { | 	std::string MicroServiceMakeSystemEventMessage(const char *Type) { | ||||||
| 		return MicroService::instance().MakeSystemEventMessage(Type); | 		return MicroService::instance().MakeSystemEventMessage(Type); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -123,4 +125,12 @@ namespace OpenWifi { | |||||||
| 		return MicroService::instance().AllowExternalMicroServices(); | 		return MicroService::instance().AllowExternalMicroServices(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	void MicroServiceALBCallback( std::string Callback()) { | ||||||
|  | 		return ALBHealthCheckServer()->RegisterExtendedHealthMessage(Callback); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	std::string MicroServiceAccessKey() { | ||||||
|  | 		return MicroService::instance().Hash(); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| } // namespace OpenWifi | } // namespace OpenWifi | ||||||
|   | |||||||
| @@ -22,6 +22,7 @@ namespace OpenWifi { | |||||||
| 	std::string MicroServicePublicEndPoint(); | 	std::string MicroServicePublicEndPoint(); | ||||||
| 	std::string MicroServiceConfigGetString(const std::string &Key, | 	std::string MicroServiceConfigGetString(const std::string &Key, | ||||||
| 											const std::string &DefaultValue); | 											const std::string &DefaultValue); | ||||||
|  | 	std::string MicroServiceAccessKey(); | ||||||
| 	bool MicroServiceConfigGetBool(const std::string &Key, bool DefaultValue); | 	bool MicroServiceConfigGetBool(const std::string &Key, bool DefaultValue); | ||||||
| 	std::uint64_t MicroServiceConfigGetInt(const std::string &Key, std::uint64_t DefaultValue); | 	std::uint64_t MicroServiceConfigGetInt(const std::string &Key, std::uint64_t DefaultValue); | ||||||
| 	std::string MicroServicePrivateEndPoint(); | 	std::string MicroServicePrivateEndPoint(); | ||||||
| @@ -31,8 +32,8 @@ namespace OpenWifi { | |||||||
| 	void MicroServiceLoadConfigurationFile(); | 	void MicroServiceLoadConfigurationFile(); | ||||||
| 	void MicroServiceReload(); | 	void MicroServiceReload(); | ||||||
| 	void MicroServiceReload(const std::string &Type); | 	void MicroServiceReload(const std::string &Type); | ||||||
| 	const Types::StringVec MicroServiceGetLogLevelNames(); | 	Types::StringVec MicroServiceGetLogLevelNames(); | ||||||
| 	const Types::StringVec MicroServiceGetSubSystems(); | 	Types::StringVec MicroServiceGetSubSystems(); | ||||||
| 	Types::StringPairVec MicroServiceGetLogLevels(); | 	Types::StringPairVec MicroServiceGetLogLevels(); | ||||||
| 	bool MicroServiceSetSubsystemLogLevel(const std::string &SubSystem, const std::string &Level); | 	bool MicroServiceSetSubsystemLogLevel(const std::string &SubSystem, const std::string &Level); | ||||||
| 	void MicroServiceGetExtraConfiguration(Poco::JSON::Object &Answer); | 	void MicroServiceGetExtraConfiguration(Poco::JSON::Object &Answer); | ||||||
| @@ -40,10 +41,10 @@ namespace OpenWifi { | |||||||
| 	std::uint64_t MicroServiceUptimeTotalSeconds(); | 	std::uint64_t MicroServiceUptimeTotalSeconds(); | ||||||
| 	std::uint64_t MicroServiceStartTimeEpochTime(); | 	std::uint64_t MicroServiceStartTimeEpochTime(); | ||||||
| 	std::string MicroServiceGetUIURI(); | 	std::string MicroServiceGetUIURI(); | ||||||
| 	const SubSystemVec MicroServiceGetFullSubSystems(); | 	SubSystemVec MicroServiceGetFullSubSystems(); | ||||||
| 	std::string MicroServiceCreateUUID(); | 	std::string MicroServiceCreateUUID(); | ||||||
| 	std::uint64_t MicroServiceDaemonBusTimer(); | 	std::uint64_t MicroServiceDaemonBusTimer(); | ||||||
| 	std::string MicroServiceMakeSystemEventMessage(const std::string &Type); | 	std::string MicroServiceMakeSystemEventMessage(const char *Type); | ||||||
| 	Poco::ThreadPool &MicroServiceTimerPool(); | 	Poco::ThreadPool &MicroServiceTimerPool(); | ||||||
| 	std::string MicroServiceConfigPath(const std::string &Key, const std::string &DefaultValue); | 	std::string MicroServiceConfigPath(const std::string &Key, const std::string &DefaultValue); | ||||||
| 	std::string MicroServiceWWWAssetsDir(); | 	std::string MicroServiceWWWAssetsDir(); | ||||||
| @@ -53,4 +54,5 @@ namespace OpenWifi { | |||||||
| 	std::string MicroServiceGetPublicAPIEndPoint(); | 	std::string MicroServiceGetPublicAPIEndPoint(); | ||||||
| 	void MicroServiceDeleteOverrideConfiguration(); | 	void MicroServiceDeleteOverrideConfiguration(); | ||||||
| 	bool AllowExternalMicroServices(); | 	bool AllowExternalMicroServices(); | ||||||
|  | 	void MicroServiceALBCallback( std::string Callback()); | ||||||
| } // namespace OpenWifi | } // namespace OpenWifi | ||||||
|   | |||||||
| @@ -28,6 +28,9 @@ namespace OpenWifi::Types { | |||||||
| 	typedef std::string UUID_t; | 	typedef std::string UUID_t; | ||||||
| 	typedef std::vector<UUID_t> UUIDvec_t; | 	typedef std::vector<UUID_t> UUIDvec_t; | ||||||
| 	typedef std::map<std::string, std::map<uint32_t, uint64_t>> Counted3DMapSII; | 	typedef std::map<std::string, std::map<uint32_t, uint64_t>> Counted3DMapSII; | ||||||
|  | 	typedef std::vector<int64_t> IntList; | ||||||
|  | 	typedef std::vector<uint64_t> UIntList; | ||||||
|  | 	typedef std::vector<double> DoubleList; | ||||||
|  |  | ||||||
| 	struct MicroServiceMeta { | 	struct MicroServiceMeta { | ||||||
| 		uint64_t Id = 0; | 		uint64_t Id = 0; | ||||||
|   | |||||||
| @@ -483,6 +483,7 @@ namespace OpenWifi { | |||||||
| 				Response->set("Content-Transfer-Encoding", "binary"); | 				Response->set("Content-Transfer-Encoding", "binary"); | ||||||
| 				Response->set("Accept-Ranges", "bytes"); | 				Response->set("Accept-Ranges", "bytes"); | ||||||
| 			} | 			} | ||||||
|  | 			Response->set("Access-Control-Expose-Headers", "Content-Disposition"); | ||||||
| 			Response->set("Content-Disposition", "attachment; filename=" + Name); | 			Response->set("Content-Disposition", "attachment; filename=" + Name); | ||||||
| 			Response->set("Accept-Ranges", "bytes"); | 			Response->set("Accept-Ranges", "bytes"); | ||||||
| 			Response->set("Cache-Control", "no-store"); | 			Response->set("Cache-Control", "no-store"); | ||||||
| @@ -491,7 +492,7 @@ namespace OpenWifi { | |||||||
| 			Response->sendFile(TempAvatar.path(), MT.ContentType); | 			Response->sendFile(TempAvatar.path(), MT.ContentType); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		inline void SendFileContent(const std::string &Content, const std::string &Type, | 		inline void SendFileContent(const std::string &Content, [[maybe_unused]] const std::string &Type, | ||||||
| 									const std::string &Name) { | 									const std::string &Name) { | ||||||
| 			Response->setStatus(Poco::Net::HTTPResponse::HTTPStatus::HTTP_OK); | 			Response->setStatus(Poco::Net::HTTPResponse::HTTPStatus::HTTP_OK); | ||||||
| 			SetCommonHeaders(); | 			SetCommonHeaders(); | ||||||
| @@ -500,12 +501,13 @@ namespace OpenWifi { | |||||||
| 				Response->set("Content-Transfer-Encoding", "binary"); | 				Response->set("Content-Transfer-Encoding", "binary"); | ||||||
| 				Response->set("Accept-Ranges", "bytes"); | 				Response->set("Accept-Ranges", "bytes"); | ||||||
| 			} | 			} | ||||||
|  | 			Response->set("Access-Control-Expose-Headers", "Content-Disposition"); | ||||||
| 			Response->set("Content-Disposition", "attachment; filename=" + Name); | 			Response->set("Content-Disposition", "attachment; filename=" + Name); | ||||||
| 			Response->set("Accept-Ranges", "bytes"); | 			Response->set("Accept-Ranges", "bytes"); | ||||||
| 			Response->set("Cache-Control", "no-store"); | 			Response->set("Cache-Control", "no-store"); | ||||||
| 			Response->set("Expires", "Mon, 26 Jul 2027 05:00:00 GMT"); | 			Response->set("Expires", "Mon, 26 Jul 2027 05:00:00 GMT"); | ||||||
| 			Response->setContentLength(Content.size()); | 			Response->setContentLength(Content.size()); | ||||||
| 			Response->setContentType(Type); | 			Response->setContentType(MT.ContentType); | ||||||
| 			auto &OutputStream = Response->send(); | 			auto &OutputStream = Response->send(); | ||||||
| 			OutputStream << Content; | 			OutputStream << Content; | ||||||
| 		} | 		} | ||||||
| @@ -572,6 +574,36 @@ namespace OpenWifi { | |||||||
| 			Poco::JSON::Stringifier::stringify(Object, Answer); | 			Poco::JSON::Stringifier::stringify(Object, Answer); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  |         inline void ReturnObject(const std::vector<std::string> &Strings) { | ||||||
|  |             Poco::JSON::Array   Arr; | ||||||
|  |             for(const auto &String:Strings) { | ||||||
|  |                 Arr.add(String); | ||||||
|  |             } | ||||||
|  |             std::ostringstream os; | ||||||
|  |             Arr.stringify(os); | ||||||
|  |             return ReturnRawJSON(os.str()); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         template<class T> void ReturnObject(const std::vector<T> &Objects) { | ||||||
|  |             Poco::JSON::Array   Arr; | ||||||
|  |             for(const auto &Object:Objects) { | ||||||
|  |                 Poco::JSON::Object O; | ||||||
|  |                 Object.to_json(O); | ||||||
|  |                 Arr.add(O); | ||||||
|  |             } | ||||||
|  |             std::ostringstream os; | ||||||
|  |             Arr.stringify(os); | ||||||
|  |             return ReturnRawJSON(os.str()); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         template<class T> void ReturnObject(const T &Object) { | ||||||
|  |             Poco::JSON::Object  O; | ||||||
|  |             Object.to_json(O); | ||||||
|  |             std::ostringstream os; | ||||||
|  |             O.stringify(os); | ||||||
|  |             return ReturnRawJSON(os.str()); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         inline void ReturnRawJSON(const std::string &json_doc) { |         inline void ReturnRawJSON(const std::string &json_doc) { | ||||||
| 			PrepareResponse(); | 			PrepareResponse(); | ||||||
| 			if (Request != nullptr) { | 			if (Request != nullptr) { | ||||||
|   | |||||||
| @@ -24,9 +24,10 @@ namespace OpenWifi { | |||||||
| 							 Server, TransactionId, Internal) {} | 							 Server, TransactionId, Internal) {} | ||||||
| 		static auto PathName() { return std::list<std::string>{"/api/v1/system"}; } | 		static auto PathName() { return std::list<std::string>{"/api/v1/system"}; } | ||||||
|  |  | ||||||
| 		inline void DoGet() { | 		inline void DoGet() final { | ||||||
| 			std::string Arg; | 			std::string Arg; | ||||||
| 			if (HasParameter("command", Arg) && Arg == "info") { | 			if (HasParameter("command", Arg)) { | ||||||
|  | 				if (Arg == "info") { | ||||||
| 					Poco::JSON::Object Answer; | 					Poco::JSON::Object Answer; | ||||||
| 					Answer.set(RESTAPI::Protocol::VERSION, MicroServiceVersion()); | 					Answer.set(RESTAPI::Protocol::VERSION, MicroServiceVersion()); | ||||||
| 					Answer.set(RESTAPI::Protocol::UPTIME, MicroServiceUptimeTotalSeconds()); | 					Answer.set(RESTAPI::Protocol::UPTIME, MicroServiceUptimeTotalSeconds()); | ||||||
| @@ -64,11 +65,23 @@ namespace OpenWifi { | |||||||
| 					Answer.set("certificates", Certificates); | 					Answer.set("certificates", Certificates); | ||||||
| 					return ReturnObject(Answer); | 					return ReturnObject(Answer); | ||||||
| 				} | 				} | ||||||
| 			if (GetBoolParameter("extraConfiguration")) { | 				if (Arg == "extraConfiguration") { | ||||||
| 					Poco::JSON::Object Answer; | 					Poco::JSON::Object Answer; | ||||||
| 					MicroServiceGetExtraConfiguration(Answer); | 					MicroServiceGetExtraConfiguration(Answer); | ||||||
| 					return ReturnObject(Answer); | 					return ReturnObject(Answer); | ||||||
| 				} | 				} | ||||||
|  | 				if (Arg == "resources") { | ||||||
|  | 					Poco::JSON::Object Answer; | ||||||
|  | 					Answer.set("numberOfFileDescriptors", Utils::get_open_fds()); | ||||||
|  | 					std::uint64_t currRealMem, peakRealMem, currVirtMem, peakVirtMem; | ||||||
|  | 					Utils::getMemory(currRealMem, peakRealMem, currVirtMem, peakVirtMem); | ||||||
|  | 					Answer.set("currRealMem", currRealMem); | ||||||
|  | 					Answer.set("peakRealMem", peakRealMem); | ||||||
|  | 					Answer.set("currVirtMem", currVirtMem); | ||||||
|  | 					Answer.set("peakVirtMem", peakVirtMem); | ||||||
|  | 					return ReturnObject(Answer); | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
| 			BadRequest(RESTAPI::Errors::InvalidCommand); | 			BadRequest(RESTAPI::Errors::InvalidCommand); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -14,8 +14,15 @@ | |||||||
| #include "framework/OpenWifiTypes.h" | #include "framework/OpenWifiTypes.h" | ||||||
| #include "framework/utils.h" | #include "framework/utils.h" | ||||||
|  |  | ||||||
|  | #include <RESTObjects/RESTAPI_SecurityObjects.h> | ||||||
|  |  | ||||||
| namespace OpenWifi::RESTAPI_utils { | namespace OpenWifi::RESTAPI_utils { | ||||||
|  |  | ||||||
|  | 	inline bool IsRootOrAdmin(const SecurityObjects::UserInfo &UI) { | ||||||
|  | 		return 	UI.userRole==SecurityObjects::ROOT || | ||||||
|  | 				UI.userRole==SecurityObjects::ADMIN; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	inline void EmbedDocument(const std::string &ObjName, Poco::JSON::Object &Obj, | 	inline void EmbedDocument(const std::string &ObjName, Poco::JSON::Object &Obj, | ||||||
| 							  const std::string &ObjStr) { | 							  const std::string &ObjStr) { | ||||||
| 		std::string D = ObjStr.empty() ? "{}" : ObjStr; | 		std::string D = ObjStr.empty() ? "{}" : ObjStr; | ||||||
| @@ -95,6 +102,20 @@ namespace OpenWifi::RESTAPI_utils { | |||||||
| 		Obj.set(Field, A); | 		Obj.set(Field, A); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	inline void field_to_json(Poco::JSON::Object &Obj, const char *Field, const Types::DoubleList &V) { | ||||||
|  | 		Poco::JSON::Array A; | ||||||
|  | 		for (const auto &i : V) | ||||||
|  | 			A.add(i); | ||||||
|  | 		Obj.set(Field, A); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	inline void field_to_json(Poco::JSON::Object &Obj, const char *Field, const Types::IntList &V) { | ||||||
|  | 		Poco::JSON::Array A; | ||||||
|  | 		for (const auto &i : V) | ||||||
|  | 			A.add(i); | ||||||
|  | 		Obj.set(Field, A); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	inline void field_to_json(Poco::JSON::Object &Obj, const char *Field, const Types::TagList &V) { | 	inline void field_to_json(Poco::JSON::Object &Obj, const char *Field, const Types::TagList &V) { | ||||||
| 		Poco::JSON::Array A; | 		Poco::JSON::Array A; | ||||||
| 		for (const auto &i : V) | 		for (const auto &i : V) | ||||||
| @@ -277,6 +298,28 @@ namespace OpenWifi::RESTAPI_utils { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	inline void field_from_json(const Poco::JSON::Object::Ptr &Obj, const char *Field, | ||||||
|  | 								Types::DoubleList &Value) { | ||||||
|  | 		if (Obj->isArray(Field) && !Obj->isNull(Field)) { | ||||||
|  | 			Value.clear(); | ||||||
|  | 			Poco::JSON::Array::Ptr A = Obj->getArray(Field); | ||||||
|  | 			for (const auto &i : *A) { | ||||||
|  | 				Value.push_back(i); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	inline void field_from_json(const Poco::JSON::Object::Ptr &Obj, const char *Field, | ||||||
|  | 								Types::IntList &Value) { | ||||||
|  | 		if (Obj->isArray(Field) && !Obj->isNull(Field)) { | ||||||
|  | 			Value.clear(); | ||||||
|  | 			Poco::JSON::Array::Ptr A = Obj->getArray(Field); | ||||||
|  | 			for (const auto &i : *A) { | ||||||
|  | 				Value.push_back(i); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	template <class T> | 	template <class T> | ||||||
| 	void field_from_json(const Poco::JSON::Object::Ptr &Obj, const char *Field, | 	void field_from_json(const Poco::JSON::Object::Ptr &Obj, const char *Field, | ||||||
| 						 std::vector<T> &Value) { | 						 std::vector<T> &Value) { | ||||||
|   | |||||||
| @@ -22,9 +22,8 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 	class StorageClass : public SubSystemServer { | 	class StorageClass : public SubSystemServer { | ||||||
| 	  public: | 	  public: | ||||||
| 		StorageClass() noexcept : SubSystemServer("StorageClass", "STORAGE-SVR", "storage") {} |  | ||||||
|  |  | ||||||
| 		int Start() override { |         inline int Start() override { | ||||||
| 			std::lock_guard Guard(Mutex_); | 			std::lock_guard Guard(Mutex_); | ||||||
|  |  | ||||||
| 			Logger().notice("Starting."); | 			Logger().notice("Starting."); | ||||||
| @@ -40,17 +39,24 @@ namespace OpenWifi { | |||||||
| 			return 0; | 			return 0; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		void Stop() override { Pool_->shutdown(); } | 		inline void Stop() override { Pool_->shutdown(); } | ||||||
|  |  | ||||||
| 		DBType Type() const { return dbType_; }; | 		DBType Type() const { return dbType_; }; | ||||||
|  |  | ||||||
|  |         StorageClass() noexcept : SubSystemServer("StorageClass", "STORAGE-SVR", "storage") { | ||||||
|  |  | ||||||
|  |         } | ||||||
|  |  | ||||||
|  | 		Poco::Data::SessionPool &Pool() { return *Pool_; } | ||||||
|  |  | ||||||
| 	  private: | 	  private: | ||||||
| 		inline int Setup_SQLite(); | 		inline int Setup_SQLite(); | ||||||
| 		inline int Setup_MySQL(); | 		inline int Setup_MySQL(); | ||||||
| 		inline int Setup_PostgreSQL(); | 		inline int Setup_PostgreSQL(); | ||||||
|  |  | ||||||
|  |  | ||||||
|     protected: |     protected: | ||||||
| 		std::unique_ptr<Poco::Data::SessionPool> Pool_; | 		std::shared_ptr<Poco::Data::SessionPool> Pool_; | ||||||
| 		Poco::Data::SQLite::Connector SQLiteConn_; | 		Poco::Data::SQLite::Connector SQLiteConn_; | ||||||
| 		Poco::Data::PostgreSQL::Connector PostgresConn_; | 		Poco::Data::PostgreSQL::Connector PostgresConn_; | ||||||
| 		Poco::Data::MySQL::Connector MySQLConn_; | 		Poco::Data::MySQL::Connector MySQLConn_; | ||||||
| @@ -81,7 +87,7 @@ namespace OpenWifi { | |||||||
| 		//        Poco::Data::SessionPool(SQLiteConn_.name(), DBName, 8, | 		//        Poco::Data::SessionPool(SQLiteConn_.name(), DBName, 8, | ||||||
| 		//                                                                                     (int)NumSessions, | 		//                                                                                     (int)NumSessions, | ||||||
| 		//                                                                                     (int)IdleTime)); | 		//                                                                                     (int)IdleTime)); | ||||||
| 		Pool_ = std::make_unique<Poco::Data::SessionPool>(SQLiteConn_.name(), DBName, 8, | 		Pool_ = std::make_shared<Poco::Data::SessionPool>(SQLiteConn_.name(), DBName, 8, | ||||||
| 														  (int)NumSessions, (int)IdleTime); | 														  (int)NumSessions, (int)IdleTime); | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| @@ -102,7 +108,7 @@ namespace OpenWifi { | |||||||
| 									";compress=true;auto-reconnect=true"; | 									";compress=true;auto-reconnect=true"; | ||||||
|  |  | ||||||
| 		Poco::Data::MySQL::Connector::registerConnector(); | 		Poco::Data::MySQL::Connector::registerConnector(); | ||||||
| 		Pool_ = std::make_unique<Poco::Data::SessionPool>(MySQLConn_.name(), ConnectionStr, 8, | 		Pool_ = std::make_shared<Poco::Data::SessionPool>(MySQLConn_.name(), ConnectionStr, 8, | ||||||
| 														  NumSessions, IdleTime); | 														  NumSessions, IdleTime); | ||||||
|  |  | ||||||
| 		return 0; | 		return 0; | ||||||
| @@ -126,7 +132,7 @@ namespace OpenWifi { | |||||||
| 									" connect_timeout=" + ConnectionTimeout; | 									" connect_timeout=" + ConnectionTimeout; | ||||||
|  |  | ||||||
| 		Poco::Data::PostgreSQL::Connector::registerConnector(); | 		Poco::Data::PostgreSQL::Connector::registerConnector(); | ||||||
| 		Pool_ = std::make_unique<Poco::Data::SessionPool>(PostgresConn_.name(), ConnectionStr, 8, | 		Pool_ = std::make_shared<Poco::Data::SessionPool>(PostgresConn_.name(), ConnectionStr, 8, | ||||||
| 														  NumSessions, IdleTime); | 														  NumSessions, IdleTime); | ||||||
|  |  | ||||||
| 		return 0; | 		return 0; | ||||||
|   | |||||||
| @@ -37,6 +37,7 @@ namespace OpenWifi { | |||||||
| 		P.cipherList = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"; | 		P.cipherList = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"; | ||||||
| 		P.dhUse2048Bits = true; | 		P.dhUse2048Bits = true; | ||||||
| 		P.caLocation = cas_; | 		P.caLocation = cas_; | ||||||
|  |         // P.securityLevel = | ||||||
|  |  | ||||||
| 		auto Context = Poco::AutoPtr<Poco::Net::Context>( | 		auto Context = Poco::AutoPtr<Poco::Net::Context>( | ||||||
| 			new Poco::Net::Context(Poco::Net::Context::TLS_SERVER_USE, P)); | 			new Poco::Net::Context(Poco::Net::Context::TLS_SERVER_USE, P)); | ||||||
| @@ -53,7 +54,6 @@ namespace OpenWifi { | |||||||
|  |  | ||||||
| 			Context->useCertificate(Cert); | 			Context->useCertificate(Cert); | ||||||
| 			Context->addChainCertificate(Root); | 			Context->addChainCertificate(Root); | ||||||
|  |  | ||||||
| 			Context->addCertificateAuthority(Root); | 			Context->addCertificateAuthority(Root); | ||||||
|  |  | ||||||
| 			if (level_ == Poco::Net::Context::VERIFY_STRICT) { | 			if (level_ == Poco::Net::Context::VERIFY_STRICT) { | ||||||
| @@ -76,18 +76,18 @@ namespace OpenWifi { | |||||||
| 				L.fatal(fmt::format("Wrong Certificate({}) for Key({})", cert_file_, key_file_)); | 				L.fatal(fmt::format("Wrong Certificate({}) for Key({})", cert_file_, key_file_)); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			SSL_CTX_set_verify(SSLCtx, SSL_VERIFY_PEER, nullptr); |             SSL_CTX_set_verify(SSLCtx, level_==Poco::Net::Context::VERIFY_NONE ? SSL_VERIFY_NONE : SSL_VERIFY_PEER, nullptr); | ||||||
|  |  | ||||||
| 			if (level_ == Poco::Net::Context::VERIFY_STRICT) { | 			if (level_ == Poco::Net::Context::VERIFY_STRICT) { | ||||||
| 				SSL_CTX_set_client_CA_list(SSLCtx, SSL_load_client_CA_file(client_cas_.c_str())); | 				SSL_CTX_set_client_CA_list(SSLCtx, SSL_load_client_CA_file(client_cas_.c_str())); | ||||||
| 			} |  | ||||||
|                 SSL_CTX_enable_ct(SSLCtx, SSL_CT_VALIDATION_STRICT); |                 SSL_CTX_enable_ct(SSLCtx, SSL_CT_VALIDATION_STRICT); | ||||||
|  | 			} | ||||||
| 			SSL_CTX_dane_enable(SSLCtx); | 			SSL_CTX_dane_enable(SSLCtx); | ||||||
|  |  | ||||||
| 			Context->enableSessionCache(); | 			Context->enableSessionCache(); | ||||||
| 			Context->setSessionCacheSize(0); | 			Context->setSessionCacheSize(0); | ||||||
| 			Context->setSessionTimeout(60); | 			Context->setSessionTimeout(60); | ||||||
| 			Context->enableExtendedCertificateVerification(true); | 			Context->enableExtendedCertificateVerification( level_!= Poco::Net::Context::VERIFY_NONE ); | ||||||
| 			Context->disableStatelessSessionResumption(); | 			Context->disableStatelessSessionResumption(); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -58,11 +58,9 @@ namespace OpenWifi { | |||||||
| 	void UI_WebSocketClientServer::run() { | 	void UI_WebSocketClientServer::run() { | ||||||
| 		Running_ = true; | 		Running_ = true; | ||||||
| 		while (Running_) { | 		while (Running_) { | ||||||
| 			Poco::Thread::trySleep(2000); | 			if(!Poco::Thread::trySleep(2000)) { | ||||||
|  |  | ||||||
| 			if (!Running_) |  | ||||||
|                 break; |                 break; | ||||||
|  |             } | ||||||
| 			std::lock_guard G(LocalMutex_); | 			std::lock_guard G(LocalMutex_); | ||||||
| 			for (const auto i : ToBeRemoved_) { | 			for (const auto i : ToBeRemoved_) { | ||||||
| 				// std::cout << "Erasing old WS UI connection..." << std::endl; | 				// std::cout << "Erasing old WS UI connection..." << std::endl; | ||||||
|   | |||||||
							
								
								
									
										63
									
								
								src/framework/default_device_types.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								src/framework/default_device_types.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | |||||||
|  | // | ||||||
|  | // Created by stephane bourque on 2023-04-19. | ||||||
|  | // | ||||||
|  |  | ||||||
|  | #pragma once | ||||||
|  |  | ||||||
|  | #include <vector> | ||||||
|  | #include <string> | ||||||
|  |  | ||||||
|  | namespace OpenWifi { | ||||||
|  | 	inline  const std::vector<std::pair<std::string, std::string>> DefaultDeviceTypeList{ | ||||||
|  | 		{"actiontec_web7200", "AP"}, | ||||||
|  | 		{"cig_wf186w", "AP"}, | ||||||
|  | 		{"cig_wf188n", "AP"}, | ||||||
|  | 		{"cig_wf194c4", "AP"}, | ||||||
|  | 		{"cig_wf196", "AP"}, | ||||||
|  | 		{"cig_wf196-ca", "AP"}, | ||||||
|  | 		{"cig_wf196-ca-ath12", "AP"}, | ||||||
|  | 		{"cig_wf196-us", "AP"}, | ||||||
|  | 		{"cig_wf610d", "AP"}, | ||||||
|  | 		{"cig_wf660a", "AP"}, | ||||||
|  | 		{"cig_wf808", "AP"}, | ||||||
|  | 		{"cybertan_eww622-a1", "AP"}, | ||||||
|  | 		{"edgecore_eap101", "AP"}, | ||||||
|  | 		{"edgecore_eap101-ath12", "AP"}, | ||||||
|  | 		{"edgecore_eap102", "AP"}, | ||||||
|  | 		{"edgecore_eap104", "AP"}, | ||||||
|  | 		{"edgecore_eap104-ath12", "AP"}, | ||||||
|  | 		{"edgecore_ecs4100-12ph", "AP"}, | ||||||
|  | 		{"edgecore_ecw5211", "AP"}, | ||||||
|  | 		{"edgecore_ecw5410", "AP"}, | ||||||
|  | 		{"edgecore_oap100", "AP"}, | ||||||
|  | 		{"edgecore_spw2ac1200", "SWITCH"}, | ||||||
|  | 		{"edgecore_spw2ac1200-lan-poe", "SWITCH"}, | ||||||
|  | 		{"edgecore_ssw2ac2600", "SWITCH"}, | ||||||
|  | 		{"hfcl_ion4", "AP"}, | ||||||
|  | 		{"hfcl_ion4x", "AP"}, | ||||||
|  | 		{"hfcl_ion4x_2", "AP"}, | ||||||
|  | 		{"hfcl_ion4xe", "AP"}, | ||||||
|  | 		{"hfcl_ion4xi", "AP"}, | ||||||
|  | 		{"indio_um-305ac", "AP"}, | ||||||
|  | 		{"indio_um-305ax", "AP"}, | ||||||
|  | 		{"indio_um-310ax-v1", "AP"}, | ||||||
|  | 		{"indio_um-325ac", "AP"}, | ||||||
|  | 		{"indio_um-510ac-v3", "AP"}, | ||||||
|  | 		{"indio_um-510axm-v1", "AP"}, | ||||||
|  | 		{"indio_um-510axp-v1", "AP"}, | ||||||
|  | 		{"indio_um-550ac", "AP"}, | ||||||
|  | 		{"linksys_e8450-ubi", "AP"}, | ||||||
|  | 		{"linksys_ea6350-v4", "AP"}, | ||||||
|  | 		{"linksys_ea8300", "AP"}, | ||||||
|  | 		{"liteon_wpx8324", "AP"}, | ||||||
|  | 		{"meshpp_s618_cp01", "AP"}, | ||||||
|  | 		{"meshpp_s618_cp03", "AP"}, | ||||||
|  | 		{"udaya_a5-id2", "AP"}, | ||||||
|  | 		{"wallys_dr40x9", "AP"}, | ||||||
|  | 		{"wallys_dr6018", "AP"}, | ||||||
|  | 		{"wallys_dr6018_v4", "AP"}, | ||||||
|  | 		{"x64_vm", "AP"}, | ||||||
|  | 		{"yuncore_ax840", "AP"}, | ||||||
|  | 		{"yuncore_fap640", "AP"}, | ||||||
|  | 		{"yuncore_fap650", "AP"}}; | ||||||
|  | } | ||||||
| @@ -576,8 +576,8 @@ namespace ORM { | |||||||
| 		bool UpdateRecord(field_name_t FieldName, const T &Value, const RecordType &R) { | 		bool UpdateRecord(field_name_t FieldName, const T &Value, const RecordType &R) { | ||||||
| 			try { | 			try { | ||||||
| 				assert(ValidFieldName(FieldName)); | 				assert(ValidFieldName(FieldName)); | ||||||
|  |  | ||||||
| 				Poco::Data::Session Session = Pool_.get(); | 				Poco::Data::Session Session = Pool_.get(); | ||||||
|  |                 Session.begin(); | ||||||
| 				Poco::Data::Statement Update(Session); | 				Poco::Data::Statement Update(Session); | ||||||
|  |  | ||||||
| 				RecordTuple RT; | 				RecordTuple RT; | ||||||
| @@ -593,6 +593,7 @@ namespace ORM { | |||||||
| 				Update.execute(); | 				Update.execute(); | ||||||
| 				if (Cache_) | 				if (Cache_) | ||||||
| 					Cache_->UpdateCache(R); | 					Cache_->UpdateCache(R); | ||||||
|  |                 Session.commit(); | ||||||
| 				return true; | 				return true; | ||||||
| 			} catch (const Poco::Exception &E) { | 			} catch (const Poco::Exception &E) { | ||||||
| 				Logger_.log(E); | 				Logger_.log(E); | ||||||
| @@ -662,6 +663,7 @@ namespace ORM { | |||||||
| 				assert(ValidFieldName(FieldName)); | 				assert(ValidFieldName(FieldName)); | ||||||
|  |  | ||||||
| 				Poco::Data::Session Session = Pool_.get(); | 				Poco::Data::Session Session = Pool_.get(); | ||||||
|  |                 Session.begin(); | ||||||
| 				Poco::Data::Statement Delete(Session); | 				Poco::Data::Statement Delete(Session); | ||||||
|  |  | ||||||
| 				std::string St = "delete from " + TableName_ + " where " + FieldName + "=?"; | 				std::string St = "delete from " + TableName_ + " where " + FieldName + "=?"; | ||||||
| @@ -671,6 +673,7 @@ namespace ORM { | |||||||
| 				Delete.execute(); | 				Delete.execute(); | ||||||
| 				if (Cache_) | 				if (Cache_) | ||||||
| 					Cache_->Delete(FieldName, Value); | 					Cache_->Delete(FieldName, Value); | ||||||
|  |                 Session.commit(); | ||||||
| 				return true; | 				return true; | ||||||
| 			} catch (const Poco::Exception &E) { | 			} catch (const Poco::Exception &E) { | ||||||
| 				Logger_.log(E); | 				Logger_.log(E); | ||||||
| @@ -682,11 +685,13 @@ namespace ORM { | |||||||
| 			try { | 			try { | ||||||
| 				assert(!WhereClause.empty()); | 				assert(!WhereClause.empty()); | ||||||
| 				Poco::Data::Session Session = Pool_.get(); | 				Poco::Data::Session Session = Pool_.get(); | ||||||
|  |                 Session.begin(); | ||||||
| 				Poco::Data::Statement Delete(Session); | 				Poco::Data::Statement Delete(Session); | ||||||
|  |  | ||||||
| 				std::string St = "delete from " + TableName_ + " where " + WhereClause; | 				std::string St = "delete from " + TableName_ + " where " + WhereClause; | ||||||
| 				Delete << St; | 				Delete << St; | ||||||
| 				Delete.execute(); | 				Delete.execute(); | ||||||
|  |                 Session.commit(); | ||||||
| 				return true; | 				return true; | ||||||
| 			} catch (const Poco::Exception &E) { | 			} catch (const Poco::Exception &E) { | ||||||
| 				Logger_.log(E); | 				Logger_.log(E); | ||||||
|   | |||||||
| @@ -40,6 +40,7 @@ namespace OpenWifi { | |||||||
| 	}; | 	}; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | #define DBGLINE     std::cout << __LINE__ << ":" << __FILE__ << ", " << __func__ << std::endl; | ||||||
| namespace OpenWifi::RESTAPI::Errors { | namespace OpenWifi::RESTAPI::Errors { | ||||||
| 	struct msg { | 	struct msg { | ||||||
| 		uint64_t err_num; | 		uint64_t err_num; | ||||||
| @@ -397,6 +398,49 @@ namespace OpenWifi::RESTAPI::Errors { | |||||||
| 	static const struct msg FirmwareBDInProgress { | 	static const struct msg FirmwareBDInProgress { | ||||||
| 		1170, "Firmware DB update already in progress." | 		1170, "Firmware DB update already in progress." | ||||||
| 	}; | 	}; | ||||||
|  | 	static const struct msg SimulatedDeviceNotSupported { | ||||||
|  | 		1171, "Command not supported on simulated device." | ||||||
|  | 	}; | ||||||
|  |  | ||||||
|  |     static const struct msg VenuesNameAlreadyExists { | ||||||
|  |             1172, "The venue name already exists." | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     static const struct msg InvalidGlobalReachAccount { | ||||||
|  |             1173, "Invalid Global Reach account information." | ||||||
|  |     }; | ||||||
|  |     static const struct msg CannotCreateCSR { | ||||||
|  |             1174, "Cannot create a CSR certificate." | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     static const struct msg DefFirmwareNameExists { 1175, "Firmware name already exists." }; | ||||||
|  |     static const struct msg NotAValidECKey { 1176, "Not a valid Signing Key." }; | ||||||
|  | 	static const struct msg NotAValidRadiusPoolType { 1177, "Not a valid RADIUS pool type." }; | ||||||
|  |     static const struct msg InvalidRadiusTypeEndpoint { 1178, "Invalid RADIUS Server Endpoint type." }; | ||||||
|  |     static const struct msg InvalidRadiusEndpointPoolStrategy { 1179, "Invalid RADIUS Server Endpoint Pool strategy." }; | ||||||
|  |     static const struct msg EndpointMustHaveOneTypeOfServers { 1180, "All servers must be either RADIUS or RADSEC." }; | ||||||
|  |     static const struct msg RadiusEndpointIndexInvalid { 1181, "Index must be an address between 0.0.1.1 and 0.0.2.254" }; | ||||||
|  |     static const struct msg RadiusEndpointIndexMustBeUnique { 1182, "Index must be unique." }; | ||||||
|  |     static const struct msg OrionAccountMustExist { 1183, "Orion account must exist." }; | ||||||
|  |     static const struct msg GlobalReachCertMustExist { 1184, "Global Reach certificate must exist." }; | ||||||
|  |     static const struct msg InvalidRadsecMainCertificate { 1185, "Invalid Radsec main certificate." }; | ||||||
|  |     static const struct msg InvalidRadsecCaCertificate { 1186, "Invalid Radsec CA certificates." }; | ||||||
|  |     static const struct msg InvalidRadsecPrivteKey { 1187, "Invalid Radsec Private key." }; | ||||||
|  |     static const struct msg InvalidRadsecIPAddress { 1188, "Invalid Radsec IP Address." }; | ||||||
|  |     static const struct msg InvalidRadsecPort { 1189, "Invalid Radsec Port." }; | ||||||
|  |     static const struct msg InvalidRadsecSecret { 1190, "Invalid Radsec Secret." }; | ||||||
|  |     static const struct msg InvalidRadiusServer { 1191, "Invalid Radius Server." }; | ||||||
|  |  | ||||||
|  | 	static const struct msg InvalidRRMAction { 1192, "Invalid RRM Action." }; | ||||||
|  |  | ||||||
|  |     static const struct msg SimulationDoesNotExist { | ||||||
|  |         7000, "Simulation Instance ID does not exist." | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     static const struct msg SimulationIsAlreadyRunning { | ||||||
|  |         7001, "There is an instance of this simulation already running.." | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |  | ||||||
| } // namespace OpenWifi::RESTAPI::Errors | } // namespace OpenWifi::RESTAPI::Errors | ||||||
|  |  | ||||||
| @@ -519,6 +563,11 @@ namespace OpenWifi::RESTAPI::Protocol { | |||||||
| 	static const char *CONTENTDISPOSITION = "Content-Disposition"; | 	static const char *CONTENTDISPOSITION = "Content-Disposition"; | ||||||
| 	static const char *CONTENTTYPE = "Content-Type"; | 	static const char *CONTENTTYPE = "Content-Type"; | ||||||
|  |  | ||||||
|  | 	static const char *TRANSFER = "transfer"; | ||||||
|  | 	static const char *CERTUPDATE = "certupdate"; | ||||||
|  | 	static const char *POWERCYCLE = "powercycle"; | ||||||
|  | 	static const char *RRM = "rrm"; | ||||||
|  |  | ||||||
| 	static const char *REQUIREMENTS = "requirements"; | 	static const char *REQUIREMENTS = "requirements"; | ||||||
| 	static const char *PASSWORDPATTERN = "passwordPattern"; | 	static const char *PASSWORDPATTERN = "passwordPattern"; | ||||||
| 	static const char *ACCESSPOLICY = "accessPolicy"; | 	static const char *ACCESSPOLICY = "accessPolicy"; | ||||||
| @@ -554,6 +603,7 @@ namespace OpenWifi::uCentralProtocol { | |||||||
| 	static const char *HEALTHCHECK = "healthcheck"; | 	static const char *HEALTHCHECK = "healthcheck"; | ||||||
| 	static const char *LOG = "log"; | 	static const char *LOG = "log"; | ||||||
| 	static const char *CRASHLOG = "crashlog"; | 	static const char *CRASHLOG = "crashlog"; | ||||||
|  | 	static const char *REBOOTLOG = "rebootLog"; | ||||||
| 	static const char *PING = "ping"; | 	static const char *PING = "ping"; | ||||||
| 	static const char *CFGPENDING = "cfgpending"; | 	static const char *CFGPENDING = "cfgpending"; | ||||||
| 	static const char *RECOVERY = "recovery"; | 	static const char *RECOVERY = "recovery"; | ||||||
| @@ -612,6 +662,8 @@ namespace OpenWifi::uCentralProtocol { | |||||||
| 	static const char *DEVICEUPDATE = "deviceupdate"; | 	static const char *DEVICEUPDATE = "deviceupdate"; | ||||||
| 	static const char *FWSIGNATURE = "FWsignature"; | 	static const char *FWSIGNATURE = "FWsignature"; | ||||||
| 	static const char *SIGNATURE = "signature"; | 	static const char *SIGNATURE = "signature"; | ||||||
|  | 	static const char *INFO = "info"; | ||||||
|  | 	static const char *DATE = "date"; | ||||||
|  |  | ||||||
| 	static const char *SERIALNUMBER = "serialNumber"; | 	static const char *SERIALNUMBER = "serialNumber"; | ||||||
| 	static const char *COMPATIBLE = "compatible"; | 	static const char *COMPATIBLE = "compatible"; | ||||||
| @@ -633,6 +685,13 @@ namespace OpenWifi::uCentralProtocol { | |||||||
| 	static const char *RADIUSCOA = "coa"; | 	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"; | ||||||
|  |  | ||||||
|  | 	static const char *TRANSFER = "transfer"; | ||||||
|  | 	static const char *CERTUPDATE = "certupdate"; | ||||||
|  | 	static const char *POWERCYCLE = "powercycle"; | ||||||
|  | 	static const char *RRM = "rrm"; | ||||||
|  | 	static const char *ACTIONS = "actions"; | ||||||
|  |  | ||||||
| } // namespace OpenWifi::uCentralProtocol | } // namespace OpenWifi::uCentralProtocol | ||||||
|  |  | ||||||
| namespace OpenWifi::uCentralProtocol::Events { | namespace OpenWifi::uCentralProtocol::Events { | ||||||
| @@ -642,6 +701,7 @@ namespace OpenWifi::uCentralProtocol::Events { | |||||||
| 	static const char *HEALTHCHECK = "healthcheck"; | 	static const char *HEALTHCHECK = "healthcheck"; | ||||||
| 	static const char *LOG = "log"; | 	static const char *LOG = "log"; | ||||||
| 	static const char *CRASHLOG = "crashlog"; | 	static const char *CRASHLOG = "crashlog"; | ||||||
|  | 	static const char *REBOOTLOG = "rebootLog"; | ||||||
| 	static const char *PING = "ping"; | 	static const char *PING = "ping"; | ||||||
| 	static const char *CFGPENDING = "cfgpending"; | 	static const char *CFGPENDING = "cfgpending"; | ||||||
| 	static const char *RECOVERY = "recovery"; | 	static const char *RECOVERY = "recovery"; | ||||||
| @@ -665,7 +725,8 @@ namespace OpenWifi::uCentralProtocol::Events { | |||||||
| 		ET_VENUEBROADCAST, | 		ET_VENUEBROADCAST, | ||||||
| 		ET_EVENT, | 		ET_EVENT, | ||||||
| 		ET_WIFISCAN, | 		ET_WIFISCAN, | ||||||
| 		ET_ALARM | 		ET_ALARM, | ||||||
|  | 		ET_REBOOTLOG | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	inline EVENT_MSG EventFromString(const std::string &Method) { | 	inline EVENT_MSG EventFromString(const std::string &Method) { | ||||||
| @@ -696,8 +757,10 @@ namespace OpenWifi::uCentralProtocol::Events { | |||||||
| 		else if (strcmp(WIFISCAN, Method.c_str()) == 0) | 		else if (strcmp(WIFISCAN, Method.c_str()) == 0) | ||||||
| 			return ET_WIFISCAN; | 			return ET_WIFISCAN; | ||||||
| 		else if (strcmp(ALARM, Method.c_str()) == 0) | 		else if (strcmp(ALARM, Method.c_str()) == 0) | ||||||
| 			return ET_WIFISCAN; |  | ||||||
| 			return ET_ALARM; | 			return ET_ALARM; | ||||||
|  | 		else if (strcmp(REBOOTLOG, Method.c_str()) == 0) | ||||||
|  | 			return ET_REBOOTLOG; | ||||||
|  | 		return ET_UNKNOWN; | ||||||
| 	}; | 	}; | ||||||
| } // namespace OpenWifi::uCentralProtocol::Events | } // namespace OpenWifi::uCentralProtocol::Events | ||||||
|  |  | ||||||
| @@ -721,6 +784,10 @@ namespace OpenWifi::APCommands { | |||||||
| 		telemetry, | 		telemetry, | ||||||
| 		ping, | 		ping, | ||||||
| 		script, | 		script, | ||||||
|  | 		rrm, | ||||||
|  | 		certupdate, | ||||||
|  | 		transfer, | ||||||
|  | 		powercycle, | ||||||
| 		unknown | 		unknown | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| @@ -733,7 +800,10 @@ namespace OpenWifi::APCommands { | |||||||
| 		RESTAPI::Protocol::LEDS,		 RESTAPI::Protocol::TRACE, | 		RESTAPI::Protocol::LEDS,		 RESTAPI::Protocol::TRACE, | ||||||
| 		RESTAPI::Protocol::REQUEST,		 RESTAPI::Protocol::WIFISCAN, | 		RESTAPI::Protocol::REQUEST,		 RESTAPI::Protocol::WIFISCAN, | ||||||
| 		RESTAPI::Protocol::EVENTQUEUE,	 RESTAPI::Protocol::TELEMETRY, | 		RESTAPI::Protocol::EVENTQUEUE,	 RESTAPI::Protocol::TELEMETRY, | ||||||
| 		RESTAPI::Protocol::PING,		 RESTAPI::Protocol::SCRIPT}; | 		RESTAPI::Protocol::PING,		 RESTAPI::Protocol::SCRIPT, | ||||||
|  | 		RESTAPI::Protocol::RRM,		 	 RESTAPI::Protocol::CERTUPDATE, | ||||||
|  | 		RESTAPI::Protocol::TRANSFER,	 RESTAPI::Protocol::POWERCYCLE | ||||||
|  | 	}; | ||||||
|  |  | ||||||
| 	inline const char *to_string(Commands Cmd) { return uCentralAPCommands[(uint8_t)Cmd]; } | 	inline const char *to_string(Commands Cmd) { return uCentralAPCommands[(uint8_t)Cmd]; } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,10 +3,19 @@ | |||||||
| // | // | ||||||
|  |  | ||||||
| #include "Poco/Path.h" | #include "Poco/Path.h" | ||||||
|  | #include "Poco/TemporaryFile.h" | ||||||
|  | #include "Poco/Crypto/ECKey.h" | ||||||
| #include "framework/AppServiceRegistry.h" | #include "framework/AppServiceRegistry.h" | ||||||
| #include "framework/utils.h" | #include "framework/utils.h" | ||||||
|  |  | ||||||
|  | #include <iostream> | ||||||
|  | #include <cstdlib> | ||||||
|  | #include <ctime> | ||||||
|  | #include <string> | ||||||
|  | #include <algorithm> | ||||||
|  |  | ||||||
|  | #include <resolv.h> | ||||||
|  |  | ||||||
| namespace OpenWifi::Utils { | namespace OpenWifi::Utils { | ||||||
|  |  | ||||||
| 	bool NormalizeMac(std::string &Mac) { | 	bool NormalizeMac(std::string &Mac) { | ||||||
| @@ -27,6 +36,10 @@ namespace OpenWifi::Utils { | |||||||
| 				std::all_of(Serial.begin(), Serial.end(), [](auto i) { return std::isxdigit(i); })); | 				std::all_of(Serial.begin(), Serial.end(), [](auto i) { return std::isxdigit(i); })); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	[[nodiscard]] bool ValidSerialNumbers(const std::vector<std::string> &numbers) { | ||||||
|  | 		return std::all_of(numbers.begin(),numbers.end(),[](auto &number) {return ValidSerialNumber(number);}); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	[[nodiscard]] bool ValidUUID(const std::string &UUID) { | 	[[nodiscard]] bool ValidUUID(const std::string &UUID) { | ||||||
| 		if (UUID.size() > 36) | 		if (UUID.size() > 36) | ||||||
| 			return false; | 			return false; | ||||||
| @@ -128,6 +141,15 @@ namespace OpenWifi::Utils { | |||||||
| 		return std::regex_match(Hostname, HostNameRegex); | 		return std::regex_match(Hostname, HostNameRegex); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	[[nodiscard]] bool ValidNumber(const std::string &number, bool isSigned) | ||||||
|  | 	{ | ||||||
|  | 		static std::regex IntRegex("^-?[0-9]\\d*(\\.\\d+)?$"); | ||||||
|  | 		if(!isSigned) { | ||||||
|  | 			IntRegex = "^[0-9]\\d*(\\.\\d+)?$"; | ||||||
|  | 		} | ||||||
|  | 		return std::regex_match(number, IntRegex); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	[[nodiscard]] std::string ToHex(const std::vector<unsigned char> &B) { | 	[[nodiscard]] std::string ToHex(const std::vector<unsigned char> &B) { | ||||||
| 		std::string R; | 		std::string R; | ||||||
| 		R.reserve(B.size() * 2); | 		R.reserve(B.size() * 2); | ||||||
| @@ -437,6 +459,15 @@ namespace OpenWifi::Utils { | |||||||
| 			return MediaTypeEncoding{.Encoding = PLAIN, .ContentType = "text/css"}; | 			return MediaTypeEncoding{.Encoding = PLAIN, .ContentType = "text/css"}; | ||||||
| 		if (E == "js") | 		if (E == "js") | ||||||
| 			return MediaTypeEncoding{.Encoding = PLAIN, .ContentType = "application/javascript"}; | 			return MediaTypeEncoding{.Encoding = PLAIN, .ContentType = "application/javascript"}; | ||||||
|  | 		if (E == "pcap") | ||||||
|  | 			return MediaTypeEncoding{.Encoding = BINARY, .ContentType = "application/vnd.tcpdump.pcap"}; | ||||||
|  | 		if (E == "txt") | ||||||
|  | 			return MediaTypeEncoding{.Encoding = PLAIN, .ContentType = "text/plain"}; | ||||||
|  | 		if (E == "tgz") | ||||||
|  | 			return MediaTypeEncoding{.Encoding = BINARY, .ContentType = "application/tar+gzip"}; | ||||||
|  | 		if (E == "gz" || E=="gzip") | ||||||
|  | 			return MediaTypeEncoding{.Encoding = BINARY, .ContentType = "application/gzip"}; | ||||||
|  |  | ||||||
| 		return MediaTypeEncoding{.Encoding = BINARY, .ContentType = "application/octet-stream"}; | 		return MediaTypeEncoding{.Encoding = BINARY, .ContentType = "application/octet-stream"}; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -586,4 +617,329 @@ namespace OpenWifi::Utils { | |||||||
| 		return DT.timestamp().epochTime(); | 		return DT.timestamp().epochTime(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |     static std::string FileToString(const std::string &Filename) { | ||||||
|  |         std::ifstream   ifs(Filename.c_str(),std::ios_base::in|std::ios_base::binary); | ||||||
|  |         std::ostringstream os; | ||||||
|  |         Poco::StreamCopier::copyStream(ifs,os); | ||||||
|  |         return os.str(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool CreateX509CSR(const CSRCreationParameters & Parameters, CSRCreationResults & Results) { | ||||||
|  |         int             ret = 0; | ||||||
|  |         RSA             *r = nullptr; | ||||||
|  |         BIGNUM          *bne = nullptr; | ||||||
|  |  | ||||||
|  |         int             nVersion = 0; | ||||||
|  |         unsigned long   e = RSA_F4; | ||||||
|  |  | ||||||
|  |         X509_REQ        *x509_req = nullptr; | ||||||
|  |         X509_NAME       *x509_name = nullptr; | ||||||
|  |         EVP_PKEY        *pKey = nullptr; | ||||||
|  | //        RSA             *tem = nullptr; | ||||||
|  | //        BIO             *bio_err = nullptr; | ||||||
|  |  | ||||||
|  |         const char      *szCountry = Parameters.Country.c_str(); | ||||||
|  |         const char      *szProvince = Parameters.Province.c_str(); | ||||||
|  |         const char      *szCity = Parameters.City.c_str(); | ||||||
|  |         const char      *szOrganization = Parameters.Organization.c_str(); | ||||||
|  |         const char      *szCommon = Parameters.CommonName.c_str(); | ||||||
|  |  | ||||||
|  |         Poco::TemporaryFile     CsrPath, PubKey, PrivateKey; | ||||||
|  |         std::string             Result; | ||||||
|  |         std::ifstream           ifs; | ||||||
|  |         std::ostringstream      ss; | ||||||
|  |         BIO                     *bp_public = nullptr, | ||||||
|  |                 *bp_private = nullptr, | ||||||
|  |                 *bp_csr = nullptr; | ||||||
|  |  | ||||||
|  |         // 1. generate rsa key | ||||||
|  |         bne = BN_new(); | ||||||
|  |         ret = BN_set_word(bne,e); | ||||||
|  |         if(ret != 1){ | ||||||
|  |             goto free_all; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         r = RSA_new(); | ||||||
|  |         ret = RSA_generate_key_ex(r, Parameters.bits, bne, nullptr); | ||||||
|  |         if(ret != 1){ | ||||||
|  |             goto free_all; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         bp_public = BIO_new_file(PubKey.path().c_str(), "w+"); | ||||||
|  |         ret = PEM_write_bio_RSAPublicKey(bp_public, r); | ||||||
|  |         if(ret != 1) { | ||||||
|  |             goto free_all; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         bp_private = BIO_new_file(PrivateKey.path().c_str(), "w+"); | ||||||
|  |         ret = PEM_write_bio_RSAPrivateKey(bp_private, r, NULL, NULL, 0, NULL, NULL); | ||||||
|  |         if(ret != 1) { | ||||||
|  |             goto free_all; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  | // 2. set version of x509 req | ||||||
|  |         x509_req = X509_REQ_new(); | ||||||
|  |         ret = X509_REQ_set_version(x509_req, nVersion); | ||||||
|  |         if (ret != 1){ | ||||||
|  |             goto free_all; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  | // 3. set subject of x509 req | ||||||
|  |         x509_name = X509_REQ_get_subject_name(x509_req); | ||||||
|  |  | ||||||
|  |         ret = X509_NAME_add_entry_by_txt(x509_name,"C", MBSTRING_ASC, (const unsigned char*)szCountry, -1, -1, 0); | ||||||
|  |         if (ret != 1){ | ||||||
|  |             goto free_all; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         ret = X509_NAME_add_entry_by_txt(x509_name,"ST", MBSTRING_ASC, (const unsigned char*)szProvince, -1, -1, 0); | ||||||
|  |         if (ret != 1){ | ||||||
|  |             goto free_all; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         ret = X509_NAME_add_entry_by_txt(x509_name,"L", MBSTRING_ASC, (const unsigned char*)szCity, -1, -1, 0); | ||||||
|  |         if (ret != 1){ | ||||||
|  |             goto free_all; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         ret = X509_NAME_add_entry_by_txt(x509_name,"O", MBSTRING_ASC, (const unsigned char*)szOrganization, -1, -1, 0); | ||||||
|  |         if (ret != 1){ | ||||||
|  |             goto free_all; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         ret = X509_NAME_add_entry_by_txt(x509_name,"CN", MBSTRING_ASC, (const unsigned char*)szCommon, -1, -1, 0); | ||||||
|  |         if (ret != 1){ | ||||||
|  |             goto free_all; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  | // 4. set public key of x509 req | ||||||
|  |         pKey = EVP_PKEY_new(); | ||||||
|  |         EVP_PKEY_assign_RSA(pKey, r); | ||||||
|  |         r = nullptr;   // will be free rsa when EVP_PKEY_free(pKey) | ||||||
|  |  | ||||||
|  |         ret = X509_REQ_set_pubkey(x509_req, pKey); | ||||||
|  |         if (ret != 1){ | ||||||
|  |             goto free_all; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  | // 5. set sign key of x509 req | ||||||
|  |         ret = X509_REQ_sign(x509_req, pKey, EVP_sha1());    // return x509_req->signature->length | ||||||
|  |         if (ret <= 0){ | ||||||
|  |             goto free_all; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         bp_csr = BIO_new_file(CsrPath.path().c_str(),"w"); | ||||||
|  |         ret = PEM_write_bio_X509_REQ(bp_csr, x509_req); | ||||||
|  |  | ||||||
|  | // 6. free | ||||||
|  |         free_all: | ||||||
|  |         X509_REQ_free(x509_req); | ||||||
|  |         BIO_free_all(bp_csr); | ||||||
|  |         BIO_free_all(bp_public); | ||||||
|  |         BIO_free_all(bp_private); | ||||||
|  |  | ||||||
|  |         EVP_PKEY_free(pKey); | ||||||
|  |         BN_free(bne); | ||||||
|  |         if(ret==1) { | ||||||
|  |             Results.CSR = FileToString(CsrPath.path()); | ||||||
|  |             Results.PrivateKey = FileToString(PrivateKey.path()); | ||||||
|  |             Results.PublicKey = FileToString(PubKey.path()); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return ret; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool VerifyECKey(const std::string &key) { | ||||||
|  |         try { | ||||||
|  |             Poco::TemporaryFile F; | ||||||
|  |  | ||||||
|  |             std::ofstream of(F.path().c_str(), std::ios_base::trunc | std::ios_base::out | std::ios_base::binary); | ||||||
|  |             of << key; | ||||||
|  |             of.close(); | ||||||
|  |  | ||||||
|  |             auto Key = Poco::SharedPtr<Poco::Crypto::ECKey>( | ||||||
|  |                     new Poco::Crypto::ECKey("", F.path(),"")); | ||||||
|  |  | ||||||
|  |             return true; | ||||||
|  |         } catch (const Poco::Exception &E) { | ||||||
|  |  | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool VerifyRSAKey([[ | ||||||
|  |     maybe_unused]] const std::string &key) { | ||||||
|  |         try { | ||||||
|  |             Poco::TemporaryFile F; | ||||||
|  |  | ||||||
|  |             std::ofstream of(F.path().c_str(), std::ios_base::trunc | std::ios_base::out | std::ios_base::binary); | ||||||
|  |             of << key; | ||||||
|  |             of.close(); | ||||||
|  |  | ||||||
|  |             auto Key = Poco::SharedPtr<Poco::Crypto::RSAKey>( | ||||||
|  |                     new Poco::Crypto::RSAKey("", F.path(),"")); | ||||||
|  |             return true; | ||||||
|  |         } catch (const Poco::Exception &E) { | ||||||
|  |  | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool VerifyPrivateKey(const std::string &key) { | ||||||
|  |         return VerifyECKey(key) || VerifyRSAKey(key); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool ValidX509Certificate([[ | ||||||
|  |                               maybe_unused]] const std::string &Cert) { | ||||||
|  |         try { | ||||||
|  |             Poco::TemporaryFile F; | ||||||
|  |             std::ofstream of(F.path().c_str(), std::ios_base::trunc | std::ios_base::out | std::ios_base::binary); | ||||||
|  |             of << Cert; | ||||||
|  |             of.close(); | ||||||
|  |  | ||||||
|  |             auto Key = Poco::SharedPtr<Poco::Crypto::X509Certificate>( | ||||||
|  |                     new Poco::Crypto::X509Certificate(F.path())); | ||||||
|  |             return true; | ||||||
|  |         } catch (const Poco::Exception &E) { | ||||||
|  |  | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     bool ValidX509Certificate([[ | ||||||
|  |                               maybe_unused]] const std::vector<std::string> &Certs) { | ||||||
|  |         auto F = [](const std::string &C) -> bool { return ValidX509Certificate(C); }; | ||||||
|  |         return std::all_of(Certs.begin(),Certs.end(), F); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     std::string generateStrongPassword(int minLength, int maxLength, int numDigits, int minLowercase, int minSpecial, int minUppercase) { | ||||||
|  |         // Define character sets for each category | ||||||
|  |         const std::string lowercaseChars = "abcdefghijklmnopqrstuvwxyz"; | ||||||
|  |         const std::string uppercaseChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | ||||||
|  |         const std::string digitChars = "0123456789"; | ||||||
|  |         const std::string specialChars = "!@#$%^&*()_+[]{}|;:,.<>?"; | ||||||
|  |  | ||||||
|  |         // Check if parameters are valid | ||||||
|  |         if (minLength < 1 || minLength > maxLength || minLowercase + minUppercase + numDigits + minSpecial > maxLength) { | ||||||
|  |             return "Invalid parameters"; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         // Initialize random seed | ||||||
|  |         std::random_device rd; | ||||||
|  |         std::mt19937 g(rd()); | ||||||
|  |  | ||||||
|  |         // Initialize the password string | ||||||
|  |         std::string password; | ||||||
|  |  | ||||||
|  |         // Generate the required number of each character type | ||||||
|  |         for (int i = 0; i < minLowercase; ++i) { | ||||||
|  |             password += lowercaseChars[g() % lowercaseChars.length()]; | ||||||
|  |         } | ||||||
|  |         for (int i = 0; i < minUppercase; ++i) { | ||||||
|  |             password += uppercaseChars[g() % uppercaseChars.length()]; | ||||||
|  |         } | ||||||
|  |         for (int i = 0; i < numDigits; ++i) { | ||||||
|  |             password += digitChars[g() % digitChars.length()]; | ||||||
|  |         } | ||||||
|  |         for (int i = 0; i < minSpecial; ++i) { | ||||||
|  |             password += specialChars[g() % specialChars.length()]; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         // Calculate how many more characters are needed | ||||||
|  |         int remainingLength = maxLength - (int)password.length(); | ||||||
|  |  | ||||||
|  |         // Generate random characters to fill the remaining length | ||||||
|  |         for (int i = 0; i < remainingLength; ++i) { | ||||||
|  |             int category = g() % 4; // Randomly select a category | ||||||
|  |             if (category == 0) { | ||||||
|  |                 password += lowercaseChars[g() % lowercaseChars.length()]; | ||||||
|  |             } else if (category == 1) { | ||||||
|  |                 password += uppercaseChars[g() % uppercaseChars.length()]; | ||||||
|  |             } else if (category == 2) { | ||||||
|  |                 password += digitChars[g() % digitChars.length()]; | ||||||
|  |             } else { | ||||||
|  |                 password += specialChars[g() % specialChars.length()]; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         // Shuffle the password to randomize the character order | ||||||
|  |         std::shuffle(password.begin(), password.end(),g); | ||||||
|  |  | ||||||
|  |         return password; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | // Function to query NAPTR records for a domain and return them in a vector | ||||||
|  |     std::vector<NAPTRRecord> getNAPTRRecords(const std::string& domain) { | ||||||
|  |         std::vector<NAPTRRecord> naptrRecords; | ||||||
|  |  | ||||||
|  |         unsigned char buf[4096]; | ||||||
|  |         ns_msg handle; | ||||||
|  |         ns_initparse(buf, NS_PACKETSZ, &handle); | ||||||
|  |  | ||||||
|  |         // Query NAPTR records for the given domain | ||||||
|  |         int response = res_query(domain.c_str(), ns_c_in, ns_t_naptr, buf, sizeof(buf)); | ||||||
|  |         if (response < 0) { | ||||||
|  |             return naptrRecords; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if(ns_initparse(buf, response, &handle) < 0) { | ||||||
|  |             return naptrRecords; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         // Iterate through the DNS response and extract NAPTR records | ||||||
|  |         int count = ns_msg_count(handle, ns_s_an); | ||||||
|  |         for (int i = 0; i < count; ++i) { | ||||||
|  |             ns_rr rr; | ||||||
|  |             if (ns_parserr(&handle, ns_s_an, i, &rr) == 0) { | ||||||
|  |                 char rdata[256]; | ||||||
|  |                 ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata)); | ||||||
|  |                 NAPTRRecord record; | ||||||
|  |                 std::istringstream os(rdata); | ||||||
|  |                 os  >> record.name >> record.ttl >> record.rclass >> record.rtype >> record.order >> record.preference >> record.flags | ||||||
|  |                     >> record.service >> record.regexp >>  record.replacement; | ||||||
|  |                 naptrRecords.push_back(record); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return naptrRecords; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     std::vector<SrvRecord> getSRVRecords(const std::string& domain) { | ||||||
|  |         std::vector<SrvRecord> srvRecords; | ||||||
|  |  | ||||||
|  |         // Buffer to hold the DNS response | ||||||
|  |         unsigned char buf[4096]; | ||||||
|  |         ns_msg handle; | ||||||
|  |         ns_initparse(buf, NS_PACKETSZ, &handle); | ||||||
|  |  | ||||||
|  |         // Query NAPTR records for the given domain | ||||||
|  |         int response = res_query(domain.c_str(), ns_c_in, ns_t_srv, buf, sizeof(buf)); | ||||||
|  |         if (response < 0) { | ||||||
|  |             std::cerr << "DNS query failed for " << domain << ": " << hstrerror(h_errno) << std::endl; | ||||||
|  |             return srvRecords; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if(ns_initparse(buf, response, &handle) < 0) { | ||||||
|  |             return srvRecords; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         // Iterate through the DNS response and extract NAPTR records | ||||||
|  |         int count = ns_msg_count(handle, ns_s_an); | ||||||
|  |         for (int i = 0; i < count; ++i) { | ||||||
|  |             ns_rr rr; | ||||||
|  |             if (ns_parserr(&handle, ns_s_an, i, &rr) == 0) { | ||||||
|  |                 char rdata[256]; | ||||||
|  |                 ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata)); | ||||||
|  |                 SrvRecord record; | ||||||
|  |                 std::istringstream os(rdata); | ||||||
|  |                 os  >>  record.name >> record.ttl >> record.rclass >> record.rtype >> record.pref >> record.weight >> | ||||||
|  |                     record.port >> record.srvname ; | ||||||
|  |                 srvRecords.push_back(record); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return srvRecords; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
| } // namespace OpenWifi::Utils | } // namespace OpenWifi::Utils | ||||||
|   | |||||||
| @@ -13,6 +13,8 @@ | |||||||
| #include <string> | #include <string> | ||||||
| #include <thread> | #include <thread> | ||||||
|  |  | ||||||
|  | #include <dirent.h> | ||||||
|  |  | ||||||
| #include "Poco/Base64Decoder.h" | #include "Poco/Base64Decoder.h" | ||||||
| #include "Poco/Base64Encoder.h" | #include "Poco/Base64Encoder.h" | ||||||
| #include "Poco/File.h" | #include "Poco/File.h" | ||||||
| @@ -68,8 +70,10 @@ namespace OpenWifi::Utils { | |||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	[[nodiscard]] bool ValidSerialNumber(const std::string &Serial); | 	[[nodiscard]] bool ValidSerialNumber(const std::string &Serial); | ||||||
|  | 	[[nodiscard]] bool ValidSerialNumbers(const std::vector<std::string> &Serial); | ||||||
| 	[[nodiscard]] bool ValidUUID(const std::string &UUID); | 	[[nodiscard]] bool ValidUUID(const std::string &UUID); | ||||||
| 	[[nodiscard]] bool ValidHostname(const std::string &hostname); | 	[[nodiscard]] bool ValidHostname(const std::string &hostname); | ||||||
|  | 	[[nodiscard]] bool ValidNumber(const std::string &number, bool isSigned); | ||||||
|  |  | ||||||
| 	template <typename... Args> std::string ComputeHash(Args &&...args) { | 	template <typename... Args> std::string ComputeHash(Args &&...args) { | ||||||
| 		Poco::SHA2Engine E; | 		Poco::SHA2Engine E; | ||||||
| @@ -146,4 +150,256 @@ namespace OpenWifi::Utils { | |||||||
|  |  | ||||||
| 	bool ExtractBase64CompressedData(const std::string &CompressedData, | 	bool ExtractBase64CompressedData(const std::string &CompressedData, | ||||||
| 									 std::string &UnCompressedData, uint64_t compress_sz); | 									 std::string &UnCompressedData, uint64_t compress_sz); | ||||||
|  |  | ||||||
|  | 	inline bool match(const char* first, const char* second) | ||||||
|  | 	{ | ||||||
|  | 		// If we reach at the end of both strings, we are done | ||||||
|  | 		if (*first == '\0' && *second == '\0') | ||||||
|  | 			return true; | ||||||
|  |  | ||||||
|  | 		// Make sure to eliminate consecutive '*' | ||||||
|  | 		if (*first == '*') { | ||||||
|  | 			while (*(first + 1) == '*') | ||||||
|  | 				first++; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		// Make sure that the characters after '*' are present | ||||||
|  | 		// in second string. This function assumes that the | ||||||
|  | 		// first string will not contain two consecutive '*' | ||||||
|  | 		if (*first == '*' && *(first + 1) != '\0' | ||||||
|  | 			&& *second == '\0') | ||||||
|  | 			return false; | ||||||
|  |  | ||||||
|  | 		// If the first string contains '?', or current | ||||||
|  | 		// characters of both strings match | ||||||
|  | 		if (*first == '?' || *first == *second) | ||||||
|  | 			return match(first + 1, second + 1); | ||||||
|  |  | ||||||
|  | 		// If there is *, then there are two possibilities | ||||||
|  | 		// a) We consider current character of second string | ||||||
|  | 		// b) We ignore current character of second string. | ||||||
|  | 		if (*first == '*') | ||||||
|  | 			return match(first + 1, second) | ||||||
|  | 				   || match(first, second + 1); | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	static inline std::uint64_t GetValue(FILE *file) { | ||||||
|  | 		unsigned long v=0; | ||||||
|  | 		char factor[32]; | ||||||
|  | 		if(fscanf(file, " %lu %31s", &v, factor)==2) { | ||||||
|  | 			switch (factor[0]) { | ||||||
|  | 			case 'k': | ||||||
|  | 				return v * 1000; | ||||||
|  | 			case 'M': | ||||||
|  | 				return v * 1000000; | ||||||
|  | 			case 'G': | ||||||
|  | 				return v * 1000000000; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		return v; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	inline bool getMemory( | ||||||
|  | 		std::uint64_t &currRealMem, std::uint64_t &peakRealMem, | ||||||
|  | 		std::uint64_t &currVirtMem, std::uint64_t &peakVirtMem) { | ||||||
|  |  | ||||||
|  | 		// stores each word in status file | ||||||
|  | 		char buffer[1024] = ""; | ||||||
|  |  | ||||||
|  | 		currRealMem = peakRealMem = currVirtMem = peakVirtMem = 0; | ||||||
|  |  | ||||||
|  | 		// linux file contains this-process info | ||||||
|  | 		FILE * file = std::fopen("/proc/self/status", "r"); | ||||||
|  | 		if (file == nullptr) { | ||||||
|  | 			return false; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		// read the entire file, recording mems in kB | ||||||
|  | 		while (fscanf(file, " %1023s", buffer) == 1) { | ||||||
|  |  | ||||||
|  | 			if (strcmp(buffer, "VmRSS:") == 0) { | ||||||
|  | 				currRealMem= GetValue(file); | ||||||
|  | 			} else if (strcmp(buffer, "VmHWM:") == 0) { | ||||||
|  | 				peakRealMem= GetValue(file); | ||||||
|  | 			} else if (strcmp(buffer, "VmSize:") == 0) { | ||||||
|  | 				currVirtMem= GetValue(file); | ||||||
|  | 			} else if (strcmp(buffer, "VmPeak:") == 0) { | ||||||
|  | 				peakVirtMem= GetValue(file); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		fclose(file); | ||||||
|  |  | ||||||
|  | 		return true; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	inline int get_open_fds() { | ||||||
|  | 		DIR *dp = opendir("/proc/self/fd"); | ||||||
|  | 		struct dirent *de; | ||||||
|  | 		int count = -3; // '.', '..', dp | ||||||
|  |  | ||||||
|  | 		if (dp == nullptr) | ||||||
|  | 			return -1; | ||||||
|  | 		while ((de = readdir(dp)) != nullptr) | ||||||
|  | 			count++; | ||||||
|  | 		(void)closedir(dp); | ||||||
|  |  | ||||||
|  | 		return count; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  |     inline std::uint32_t IPtoInt(const std::string &A) { | ||||||
|  |         Poco::Net::IPAddress    IP; | ||||||
|  |         std::uint32_t Result=0; | ||||||
|  |  | ||||||
|  |         if(Poco::Net::IPAddress::tryParse(A,IP)) { | ||||||
|  |             for(const auto i:IP.toBytes()) { | ||||||
|  |                 Result <<= 8; | ||||||
|  |                 Result += i; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return Result; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     inline bool ValidIP(const std::string &IPstr) { | ||||||
|  |         Poco::Net::IPAddress    IP; | ||||||
|  |         return Poco::Net::IPAddress::tryParse(IPstr,IP); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     struct CSRCreationParameters { | ||||||
|  |         std::string Country, Province, City, | ||||||
|  |                     Organization, CommonName; | ||||||
|  |         int         bits=2048; | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     struct CSRCreationResults { | ||||||
|  |         std::string     CSR, PublicKey, PrivateKey; | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     bool CreateX509CSR(const CSRCreationParameters & Parameters, CSRCreationResults & Results); | ||||||
|  |     std::string generateStrongPassword(int minLength, int maxLength, int numDigits, int minLowercase, int minSpecial, int minUppercase); | ||||||
|  |     bool VerifyECKey(const std::string &key); | ||||||
|  |     bool VerifyRSAKey(const std::string &key); | ||||||
|  |     bool VerifyPrivateKey(const std::string &key); | ||||||
|  |     bool ValidX509Certificate(const std::string &Cert); | ||||||
|  |     bool ValidX509Certificate(const std::vector<std::string> &Certs); | ||||||
|  |  | ||||||
|  |     struct NAPTRRecord { | ||||||
|  |         std::string     name; | ||||||
|  |         std::string     ttl; | ||||||
|  |         std::string     rclass; | ||||||
|  |         std::string     rtype; | ||||||
|  |         uint32_t        order=0; | ||||||
|  |         uint32_t        preference=0; | ||||||
|  |         std::string     flags; | ||||||
|  |         std::string     service; | ||||||
|  |         std::string     regexp; | ||||||
|  |         std::string     replacement; | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  | // Function to query NAPTR records for a domain and return them in a vector | ||||||
|  |     std::vector<NAPTRRecord> getNAPTRRecords(const std::string& domain); | ||||||
|  |     struct SrvRecord { | ||||||
|  |         std::string     name; | ||||||
|  |         std::string     ttl; | ||||||
|  |         std::string     rclass; | ||||||
|  |         std::string     rtype; | ||||||
|  |         uint32_t        pref = 0; | ||||||
|  |         uint32_t        weight = 0; | ||||||
|  |         uint32_t        port = 0; | ||||||
|  |         std::string     srvname; | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     std::vector<SrvRecord> getSRVRecords(const std::string& domain); | ||||||
|  |  | ||||||
|  |     struct HostNameServerResult{ | ||||||
|  |         std::string     Hostname; | ||||||
|  |         uint32_t        Port; | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  | 	class CompressedString { | ||||||
|  | 	  public: | ||||||
|  | 		CompressedString() { | ||||||
|  | 			DecompressedSize_ = 0; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		explicit CompressedString(const std::string &Data) : DecompressedSize_(Data.size()) { | ||||||
|  | 			CompressIt(Data); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		CompressedString(const CompressedString &Data) { | ||||||
|  | 			this->DecompressedSize_ = Data.DecompressedSize_; | ||||||
|  | 			this->CompressedData_ = Data.CompressedData_; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		CompressedString& operator=(const CompressedString& rhs) { | ||||||
|  | 			if (this != &rhs) { | ||||||
|  | 				this->DecompressedSize_ = rhs.DecompressedSize_; | ||||||
|  | 				this->CompressedData_ = rhs.CompressedData_; | ||||||
|  | 			} | ||||||
|  | 			return *this; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		CompressedString& operator=(CompressedString&& rhs) { | ||||||
|  | 			if (this != &rhs) { | ||||||
|  | 				this->DecompressedSize_ = rhs.DecompressedSize_; | ||||||
|  | 				this->CompressedData_ = rhs.CompressedData_; | ||||||
|  | 			} | ||||||
|  | 			return *this; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		~CompressedString() = default; | ||||||
|  |  | ||||||
|  | 		operator std::string() const { | ||||||
|  | 			return DecompressIt(); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		CompressedString &operator=(const std::string &Data) { | ||||||
|  | 			DecompressedSize_ = Data.size(); | ||||||
|  | 			CompressIt(Data); | ||||||
|  | 			return *this; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		auto CompressedSize() const { return CompressedData_.size(); } | ||||||
|  | 		auto DecompressedSize() const { return DecompressedSize_; } | ||||||
|  |  | ||||||
|  | 	  private: | ||||||
|  | 		std::string     CompressedData_; | ||||||
|  | 		std::size_t     DecompressedSize_; | ||||||
|  |  | ||||||
|  | 		inline void CompressIt(const std::string &Data) { | ||||||
|  | 			z_stream strm; // = {0}; | ||||||
|  | 			CompressedData_.resize(Data.size()); | ||||||
|  | 			strm.next_in = (Bytef *)Data.data(); | ||||||
|  | 			strm.avail_in = Data.size(); | ||||||
|  | 			strm.next_out = (Bytef *)CompressedData_.data(); | ||||||
|  | 			strm.avail_out = Data.size(); | ||||||
|  | 			strm.zalloc = Z_NULL; | ||||||
|  | 			strm.zfree = Z_NULL; | ||||||
|  | 			strm.opaque = Z_NULL; | ||||||
|  | 			deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15 + 16, 8, Z_DEFAULT_STRATEGY); | ||||||
|  | 			deflate(&strm, Z_FINISH); | ||||||
|  | 			deflateEnd(&strm); | ||||||
|  | 			CompressedData_.resize(strm.total_out); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		[[nodiscard]] std::string DecompressIt() const { | ||||||
|  | 			std::string Result; | ||||||
|  | 			if(DecompressedSize_!=0) { | ||||||
|  | 				Result.resize(DecompressedSize_); | ||||||
|  | 				z_stream strm ; //= {0}; | ||||||
|  | 				strm.next_in = (Bytef *)CompressedData_.data(); | ||||||
|  | 				strm.avail_in = CompressedData_.size(); | ||||||
|  | 				strm.next_out = (Bytef *)Result.data(); | ||||||
|  | 				strm.avail_out = Result.size(); | ||||||
|  | 				strm.zalloc = Z_NULL; | ||||||
|  | 				strm.zfree = Z_NULL; | ||||||
|  | 				strm.opaque = Z_NULL; | ||||||
|  | 				inflateInit2(&strm, 15 + 32); | ||||||
|  | 				inflate(&strm, Z_FINISH); | ||||||
|  | 				inflateEnd(&strm); | ||||||
|  | 			} | ||||||
|  | 			return Result; | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  |  | ||||||
| } // namespace OpenWifi::Utils | } // namespace OpenWifi::Utils | ||||||
|   | |||||||
| @@ -435,18 +435,18 @@ | |||||||
|                                                     regarding this application, |                                                     regarding this application, | ||||||
|                                                     please contact us at |                                                     please contact us at | ||||||
|                                                     <a |                                                     <a | ||||||
|                                                         href="mailto:tip-keys@arilia.com" |                                                         href="mailto:${USER_HELPER_EMAIL}" | ||||||
|                                                         target="_blank" |                                                         target="_blank" | ||||||
|                                                     > |                                                     > | ||||||
|                                                         tip-keys@arilia.com |                                                         ${USER_HELPER_EMAIL} | ||||||
|                                                     </a> |                                                     </a> | ||||||
|                                                     . For question regarding the |                                                     . For question regarding the | ||||||
|                                                     Telecom Infra Project, |                                                     Telecom Infra Project, | ||||||
|                                                     please contact us at |                                                     please contact us at | ||||||
|                                                     <a |                                                     <a | ||||||
|                                                         href="mailto:info@telecominfraproject.com" |                                                         href="mailto:${GLOBAL_USER_HELPER_EMAIL}" | ||||||
|                                                     > |                                                     > | ||||||
|                                                         info@telecominfraproject.com |                                                         ${GLOBAL_USER_HELPER_EMAIL} | ||||||
|                                                     </a> |                                                     </a> | ||||||
|                                                     . |                                                     . | ||||||
|                                                 </p> |                                                 </p> | ||||||
| @@ -456,7 +456,7 @@ | |||||||
|                                         <tr> |                                         <tr> | ||||||
|                                             <td> |                                             <td> | ||||||
|                                                 <p>Thank You!</p> |                                                 <p>Thank You!</p> | ||||||
|                                                 <p>Arilia Wireless Inc.</p> |                                                 <p>${USER_SIGNATURE}</p> | ||||||
|                                             </td> |                                             </td> | ||||||
|                                         </tr> |                                         </tr> | ||||||
|                                         <tr> |                                         <tr> | ||||||
| @@ -502,13 +502,13 @@ | |||||||
|                                                     <tr> |                                                     <tr> | ||||||
|                                                         <p class="align-center"> |                                                         <p class="align-center"> | ||||||
|                                                             Copyright 2023 |                                                             Copyright 2023 | ||||||
|                                                             Arilia Wireless Inc, |                                                             ${USER_SIGNATURE}, | ||||||
|                                                             All rights reserved. |                                                             All rights reserved. | ||||||
|                                                         </p> |                                                         </p> | ||||||
|                                                         <a |                                                         <a | ||||||
|                                                             href="https://arilia.com" |                                                             href="https://${USER_HELPER_SITE}" | ||||||
|                                                             target="_blank" |                                                             target="_blank" | ||||||
|                                                             >www.arilia.com</a |                                                             >${USER_HELPER_SITE}</a | ||||||
|                                                         > |                                                         > | ||||||
|                                                     </tr> |                                                     </tr> | ||||||
|                                                 </tbody> |                                                 </tbody> | ||||||
|   | |||||||
| @@ -431,18 +431,18 @@ | |||||||
|                                                     regarding this application, |                                                     regarding this application, | ||||||
|                                                     please contact us at |                                                     please contact us at | ||||||
|                                                     <a |                                                     <a | ||||||
|                                                         href="mailto:tip-keys@arilia.com" |                                                             href="mailto:${USER_HELPER_EMAIL}" | ||||||
|                                                             target="_blank" |                                                             target="_blank" | ||||||
|                                                     > |                                                     > | ||||||
|                                                         tip-keys@arilia.com |                                                         ${USER_HELPER_EMAIL} | ||||||
|                                                     </a> |                                                     </a> | ||||||
|                                                     . For question regarding the |                                                     . For question regarding the | ||||||
|                                                     Telecom Infra Project, |                                                     Telecom Infra Project, | ||||||
|                                                     please contact us at |                                                     please contact us at | ||||||
|                                                     <a |                                                     <a | ||||||
|                                                         href="mailto:info@telecominfraproject.com" |                                                             href="mailto:${GLOBAL_USER_HELPER_EMAIL}" | ||||||
|                                                     > |                                                     > | ||||||
|                                                         info@telecominfraproject.com |                                                         ${GLOBAL_USER_HELPER_EMAIL} | ||||||
|                                                     </a> |                                                     </a> | ||||||
|                                                     . |                                                     . | ||||||
|                                                 </p> |                                                 </p> | ||||||
| @@ -452,7 +452,7 @@ | |||||||
|                                         <tr> |                                         <tr> | ||||||
|                                             <td> |                                             <td> | ||||||
|                                                 <p>Thank You!</p> |                                                 <p>Thank You!</p> | ||||||
|                                                 <p>Arilia Wireless Inc.</p> |                                                 <p>${USER_SIGNATURE}</p> | ||||||
|                                             </td> |                                             </td> | ||||||
|                                         </tr> |                                         </tr> | ||||||
|                                         <tr> |                                         <tr> | ||||||
| @@ -498,13 +498,13 @@ | |||||||
|                                                 <tr> |                                                 <tr> | ||||||
|                                                     <p class="align-center"> |                                                     <p class="align-center"> | ||||||
|                                                         Copyright 2023 |                                                         Copyright 2023 | ||||||
|                                                             Arilia Wireless Inc, |                                                         ${USER_SIGNATURE}, | ||||||
|                                                         All rights reserved. |                                                         All rights reserved. | ||||||
|                                                     </p> |                                                     </p> | ||||||
|                                                     <a |                                                     <a | ||||||
|                                                             href="https://arilia.com" |                                                             href="https://${USER_HELPER_SITE}" | ||||||
|                                                             target="_blank" |                                                             target="_blank" | ||||||
|                                                             >www.arilia.com</a |                                                     >${USER_HELPER_SITE}</a | ||||||
|                                                     > |                                                     > | ||||||
|                                                 </tr> |                                                 </tr> | ||||||
|                                                 </tbody> |                                                 </tbody> | ||||||
|   | |||||||
| @@ -435,18 +435,18 @@ | |||||||
|                                                     regarding this application, |                                                     regarding this application, | ||||||
|                                                     please contact us at |                                                     please contact us at | ||||||
|                                                     <a |                                                     <a | ||||||
|                                                         href="mailto:tip-keys@arilia.com" |                                                             href="mailto:${USER_HELPER_EMAIL}" | ||||||
|                                                             target="_blank" |                                                             target="_blank" | ||||||
|                                                     > |                                                     > | ||||||
|                                                         tip-keys@arilia.com |                                                         ${USER_HELPER_EMAIL} | ||||||
|                                                     </a> |                                                     </a> | ||||||
|                                                     . For question regarding the |                                                     . For question regarding the | ||||||
|                                                     Telecom Infra Project, |                                                     Telecom Infra Project, | ||||||
|                                                     please contact us at |                                                     please contact us at | ||||||
|                                                     <a |                                                     <a | ||||||
|                                                         href="mailto:info@telecominfraproject.com" |                                                             href="mailto:${GLOBAL_USER_HELPER_EMAIL}" | ||||||
|                                                     > |                                                     > | ||||||
|                                                         info@telecominfraproject.com |                                                         ${GLOBAL_USER_HELPER_EMAIL} | ||||||
|                                                     </a> |                                                     </a> | ||||||
|                                                     . |                                                     . | ||||||
|                                                 </p> |                                                 </p> | ||||||
| @@ -456,7 +456,7 @@ | |||||||
|                                         <tr> |                                         <tr> | ||||||
|                                             <td> |                                             <td> | ||||||
|                                                 <p>Thank You!</p> |                                                 <p>Thank You!</p> | ||||||
|                                                 <p>Arilia Wireless Inc.</p> |                                                 <p>${USER_SIGNATURE}</p> | ||||||
|                                             </td> |                                             </td> | ||||||
|                                         </tr> |                                         </tr> | ||||||
|                                         <tr> |                                         <tr> | ||||||
| @@ -502,13 +502,13 @@ | |||||||
|                                                 <tr> |                                                 <tr> | ||||||
|                                                     <p class="align-center"> |                                                     <p class="align-center"> | ||||||
|                                                         Copyright 2023 |                                                         Copyright 2023 | ||||||
|                                                             Arilia Wireless Inc, |                                                         ${USER_SIGNATURE}, | ||||||
|                                                         All rights reserved. |                                                         All rights reserved. | ||||||
|                                                     </p> |                                                     </p> | ||||||
|                                                     <a |                                                     <a | ||||||
|                                                             href="https://arilia.com" |                                                             href="https://${USER_HELPER_SITE}" | ||||||
|                                                             target="_blank" |                                                             target="_blank" | ||||||
|                                                             >www.arilia.com</a |                                                     >${USER_HELPER_SITE}</a | ||||||
|                                                     > |                                                     > | ||||||
|                                                 </tr> |                                                 </tr> | ||||||
|                                                 </tbody> |                                                 </tbody> | ||||||
|   | |||||||
| @@ -0,0 +1,527 @@ | |||||||
|  | <html> | ||||||
|  | <head> | ||||||
|  |     <title>Email Confirmation</title> | ||||||
|  |     <style> | ||||||
|  |         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; | ||||||
|  |             width: 100%; | ||||||
|  |             text-align: center; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         table td { | ||||||
|  |             font-family: sans-serif; | ||||||
|  |             font-size: 14px; | ||||||
|  |             color: #414141; | ||||||
|  |             vertical-align: top; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .body { | ||||||
|  |             background-color: white; | ||||||
|  |             width: 100%; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .container { | ||||||
|  |             display: block; | ||||||
|  |             margin: 0 auto !important; | ||||||
|  |             max-width: 580px; | ||||||
|  |             padding: 10px; | ||||||
|  |             width: 580px; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .content { | ||||||
|  |             box-sizing: border-box; | ||||||
|  |             display: block; | ||||||
|  |             margin: 0 auto; | ||||||
|  |             max-width: 580px; | ||||||
|  |             padding: 10px; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .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 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 | ||||||
|  |         ------------------------------------- */ | ||||||
|  |  | ||||||
|  |         .align-center { | ||||||
|  |             text-align: center; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .preheader { | ||||||
|  |             color: transparent; | ||||||
|  |             display: none; | ||||||
|  |             height: 0; | ||||||
|  |             max-height: 0; | ||||||
|  |             max-width: 0; | ||||||
|  |             opacity: 0; | ||||||
|  |             overflow: hidden; | ||||||
|  |             visibility: hidden; | ||||||
|  |             width: 0; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         hr { | ||||||
|  |             border: 0; | ||||||
|  |             border-bottom: 1px solid #d4d4d4; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .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 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 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="center" | ||||||
|  |                                     style="text-align: center" | ||||||
|  |                                     width="100%" | ||||||
|  |                                     border="0" | ||||||
|  |                                     cellpadding="0" | ||||||
|  |                                     cellspacing="0" | ||||||
|  |                                     style="min-width: 100%" | ||||||
|  |                             > | ||||||
|  |                                 <tbody> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td | ||||||
|  |                                             valign="top" | ||||||
|  |                                             class="align-center" | ||||||
|  |                                             style=" | ||||||
|  |                                                             padding-right: 0px; | ||||||
|  |                                                             padding-left: 48px; | ||||||
|  |                                                             padding-top: 0; | ||||||
|  |                                                             padding-bottom: 0; | ||||||
|  |                                                         " | ||||||
|  |                                     > | ||||||
|  |                                         <img | ||||||
|  |                                                 align="center" | ||||||
|  |                                                 alt="OpenWifi" | ||||||
|  |                                                 src="${LOGO}" | ||||||
|  |                                                 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> | ||||||
|  |                                             Confirm Your Email Address | ||||||
|  |                                             to Get Started | ||||||
|  |                                         </h2> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td> | ||||||
|  |                                         <p>Dear ${RECIPIENT_EMAIL} ,</p> | ||||||
|  |                                         <p> | ||||||
|  |                                             Before you can access the | ||||||
|  |                                             system, you must validate | ||||||
|  |                                             your e-mail address. Please | ||||||
|  |                                             click on the button below to | ||||||
|  |                                             complete this task. | ||||||
|  |                                         </p> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td | ||||||
|  |                                             style=" | ||||||
|  |                                                     padding-top: 15px; | ||||||
|  |                                                     padding-bottom: 40px; | ||||||
|  |                                                 " | ||||||
|  |                                             class="btn btn-primary" | ||||||
|  |                                     > | ||||||
|  |                                         <a | ||||||
|  |                                                 href="${ACTION_LINK}" | ||||||
|  |                                                 target="_blank" | ||||||
|  |                                         >Confirm Email Address</a | ||||||
|  |                                         > | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td> | ||||||
|  |                                         <hr | ||||||
|  |                                                 style=" | ||||||
|  |                                                         margin-top: 0px; | ||||||
|  |                                                         margin-bottom: 30px; | ||||||
|  |                                                     " | ||||||
|  |                                         /> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td> | ||||||
|  |                                         <p> | ||||||
|  |                                             For questions & support | ||||||
|  |                                             regarding this application, | ||||||
|  |                                             please contact us at | ||||||
|  |                                             <a | ||||||
|  |                                                     href="mailto:${SUB_HELPER_EMAIL}" | ||||||
|  |                                                     target="_blank" | ||||||
|  |                                             > | ||||||
|  |                                                 ${SUB_HELPER_EMAIL} | ||||||
|  |                                             </a> | ||||||
|  |                                             . For question regarding the | ||||||
|  |                                             Telecom Infra Project, | ||||||
|  |                                             please contact us at | ||||||
|  |                                             <a | ||||||
|  |                                                     href="mailto:${GLOBAL_SUB_HELPER_EMAIL}" | ||||||
|  |                                             > | ||||||
|  |                                                 ${GLOBAL_SUB_HELPER_EMAIL} | ||||||
|  |                                             </a> | ||||||
|  |                                             . | ||||||
|  |                                         </p> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |  | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td> | ||||||
|  |                                         <p>Thank You!</p> | ||||||
|  |                                         <p>${SUB_SIGNATURE}</p> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <table | ||||||
|  |                                             role="presentation" | ||||||
|  |                                             border="0" | ||||||
|  |                                             cellpadding="0" | ||||||
|  |                                             cellspacing="0" | ||||||
|  |                                             class="btn btn-primary" | ||||||
|  |                                     > | ||||||
|  |                                         <tbody></tbody> | ||||||
|  |                                     </table> | ||||||
|  |                                 </tr> | ||||||
|  |                             </table> | ||||||
|  |                         </td> | ||||||
|  |                     </tr> | ||||||
|  |                     <!-- END MAIN CONTENT AREA --> | ||||||
|  |                 </table> | ||||||
|  |  | ||||||
|  |                 <!-- 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> | ||||||
|  |                                     <tr> | ||||||
|  |                                         <p class="align-center"> | ||||||
|  |                                             Copyright 2023 | ||||||
|  |                                             ${SUB_SIGNATURE}, | ||||||
|  |                                             All rights reserved. | ||||||
|  |                                         </p> | ||||||
|  |                                         <a | ||||||
|  |                                                 href="https://${SUB_HELPER_SITE}" | ||||||
|  |                                                 target="_blank" | ||||||
|  |                                         >${SUB_HELPER_SITE}</a | ||||||
|  |                                         > | ||||||
|  |                                     </tr> | ||||||
|  |                                     </tbody> | ||||||
|  |                                 </table> | ||||||
|  |                             </td> | ||||||
|  |                         </tr> | ||||||
|  |                         </tbody> | ||||||
|  |                     </table> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |         </td> | ||||||
|  |         <td> </td> | ||||||
|  |     </tr> | ||||||
|  | </table> | ||||||
|  | </body> | ||||||
|  | </html> | ||||||
|   | |||||||
| @@ -0,0 +1,9 @@ | |||||||
|  | Dear ${RECIPIENT_EMAIL}, | ||||||
|  |  | ||||||
|  |     Before you can access the system, you must validate your e-mail address. Please click on the link below to complete this task. | ||||||
|  |  | ||||||
|  |         ${ACTION_LINK} | ||||||
|  |  | ||||||
|  |     And follow the instructions. | ||||||
|  |  | ||||||
|  | Thank you! | ||||||
| @@ -0,0 +1,523 @@ | |||||||
|  | <html> | ||||||
|  | <head> | ||||||
|  |     <title>Password Reset</title> | ||||||
|  |     <style> | ||||||
|  |         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; | ||||||
|  |             width: 100%; | ||||||
|  |             text-align: center; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         table td { | ||||||
|  |             font-family: sans-serif; | ||||||
|  |             font-size: 14px; | ||||||
|  |             color: #414141; | ||||||
|  |             vertical-align: top; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .body { | ||||||
|  |             background-color: white; | ||||||
|  |             width: 100%; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .container { | ||||||
|  |             display: block; | ||||||
|  |             margin: 0 auto !important; | ||||||
|  |             max-width: 580px; | ||||||
|  |             padding: 10px; | ||||||
|  |             width: 580px; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .content { | ||||||
|  |             box-sizing: border-box; | ||||||
|  |             display: block; | ||||||
|  |             margin: 0 auto; | ||||||
|  |             max-width: 580px; | ||||||
|  |             padding: 10px; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .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 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 | ||||||
|  |         ------------------------------------- */ | ||||||
|  |  | ||||||
|  |         .align-center { | ||||||
|  |             text-align: center; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .preheader { | ||||||
|  |             color: transparent; | ||||||
|  |             display: none; | ||||||
|  |             height: 0; | ||||||
|  |             max-height: 0; | ||||||
|  |             max-width: 0; | ||||||
|  |             opacity: 0; | ||||||
|  |             overflow: hidden; | ||||||
|  |             visibility: hidden; | ||||||
|  |             width: 0; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         hr { | ||||||
|  |             border: 0; | ||||||
|  |             border-bottom: 1px solid #d4d4d4; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .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 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 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="center" | ||||||
|  |                                     style="text-align: center" | ||||||
|  |                                     width="100%" | ||||||
|  |                                     border="0" | ||||||
|  |                                     cellpadding="0" | ||||||
|  |                                     cellspacing="0" | ||||||
|  |                                     style="min-width: 100%" | ||||||
|  |                             > | ||||||
|  |                                 <tbody> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td | ||||||
|  |                                             valign="top" | ||||||
|  |                                             class="align-center" | ||||||
|  |                                             style=" | ||||||
|  |                                                             padding-right: 0px; | ||||||
|  |                                                             padding-left: 48px; | ||||||
|  |                                                             padding-top: 0; | ||||||
|  |                                                             padding-bottom: 0; | ||||||
|  |                                                         " | ||||||
|  |                                     > | ||||||
|  |                                         <img | ||||||
|  |                                                 align="center" | ||||||
|  |                                                 alt="OpenWifi" | ||||||
|  |                                                 src="${LOGO}" | ||||||
|  |                                                 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>Password Reset</h2> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td> | ||||||
|  |                                         <p>Dear ${RECIPIENT_EMAIL} ,</p> | ||||||
|  |                                         <p> | ||||||
|  |                                             You have requested us to | ||||||
|  |                                             reset your password. Please | ||||||
|  |                                             click on the link below and | ||||||
|  |                                             follow the instructions. | ||||||
|  |                                         </p> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td | ||||||
|  |                                             style=" | ||||||
|  |                                                     padding-top: 15px; | ||||||
|  |                                                     padding-bottom: 40px; | ||||||
|  |                                                 " | ||||||
|  |                                             class="btn btn-primary" | ||||||
|  |                                     > | ||||||
|  |                                         <a | ||||||
|  |                                                 href="${ACTION_LINK}" | ||||||
|  |                                                 target="_blank" | ||||||
|  |                                         >Reset Password</a | ||||||
|  |                                         > | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td> | ||||||
|  |                                         <hr | ||||||
|  |                                                 style=" | ||||||
|  |                                                         margin-top: 0px; | ||||||
|  |                                                         margin-bottom: 30px; | ||||||
|  |                                                     " | ||||||
|  |                                         /> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td> | ||||||
|  |                                         <p> | ||||||
|  |                                             For questions & support | ||||||
|  |                                             regarding this application, | ||||||
|  |                                             please contact us at | ||||||
|  |                                             <a | ||||||
|  |                                                     href="mailto:${SUB_HELPER_EMAIL}" | ||||||
|  |                                                     target="_blank" | ||||||
|  |                                             > | ||||||
|  |                                                 ${SUB_HELPER_EMAIL} | ||||||
|  |                                             </a> | ||||||
|  |                                             . For question regarding the | ||||||
|  |                                             Telecom Infra Project, | ||||||
|  |                                             please contact us at | ||||||
|  |                                             <a | ||||||
|  |                                                     href="mailto:${GLOBAL_SUB_HELPER_EMAIL}" | ||||||
|  |                                             > | ||||||
|  |                                                 ${GLOBAL_SUB_HELPER_EMAIL} | ||||||
|  |                                             </a> | ||||||
|  |                                             . | ||||||
|  |                                         </p> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |  | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td> | ||||||
|  |                                         <p>Thank You!</p> | ||||||
|  |                                         <p>${SUB_SIGNATURE}</p> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <table | ||||||
|  |                                             role="presentation" | ||||||
|  |                                             border="0" | ||||||
|  |                                             cellpadding="0" | ||||||
|  |                                             cellspacing="0" | ||||||
|  |                                             class="btn btn-primary" | ||||||
|  |                                     > | ||||||
|  |                                         <tbody></tbody> | ||||||
|  |                                     </table> | ||||||
|  |                                 </tr> | ||||||
|  |                             </table> | ||||||
|  |                         </td> | ||||||
|  |                     </tr> | ||||||
|  |                     <!-- END MAIN CONTENT AREA --> | ||||||
|  |                 </table> | ||||||
|  |  | ||||||
|  |                 <!-- 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> | ||||||
|  |                                     <tr> | ||||||
|  |                                         <p class="align-center"> | ||||||
|  |                                             Copyright 2023 | ||||||
|  |                                             ${SUB_SIGNATURE}, | ||||||
|  |                                             All rights reserved. | ||||||
|  |                                         </p> | ||||||
|  |                                         <a | ||||||
|  |                                                 href="https://${SUB_HELPER_SITE}" | ||||||
|  |                                                 target="_blank" | ||||||
|  |                                         >${SUB_HELPER_SITE}</a | ||||||
|  |                                         > | ||||||
|  |                                     </tr> | ||||||
|  |                                     </tbody> | ||||||
|  |                                 </table> | ||||||
|  |                             </td> | ||||||
|  |                         </tr> | ||||||
|  |                         </tbody> | ||||||
|  |                     </table> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |         </td> | ||||||
|  |         <td> </td> | ||||||
|  |     </tr> | ||||||
|  | </table> | ||||||
|  | </body> | ||||||
|  | </html> | ||||||
|   | |||||||
| @@ -0,0 +1,9 @@ | |||||||
|  | Dear ${RECIPIENT_EMAIL}, | ||||||
|  |  | ||||||
|  |     You have requested us to reset your password. Please click on the link below | ||||||
|  |  | ||||||
|  |         ${ACTION_LINK} | ||||||
|  |  | ||||||
|  |     And follow the instructions. | ||||||
|  |  | ||||||
|  | Thank you! | ||||||
| @@ -0,0 +1,515 @@ | |||||||
|  | <html> | ||||||
|  | <head> | ||||||
|  |     <title>Verification Code</title> | ||||||
|  |     <style> | ||||||
|  |         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; | ||||||
|  |             width: 100%; | ||||||
|  |             text-align: center; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         table td { | ||||||
|  |             font-family: sans-serif; | ||||||
|  |             font-size: 14px; | ||||||
|  |             color: #414141; | ||||||
|  |             vertical-align: top; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .body { | ||||||
|  |             background-color: white; | ||||||
|  |             width: 100%; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .container { | ||||||
|  |             display: block; | ||||||
|  |             margin: 0 auto !important; | ||||||
|  |             max-width: 580px; | ||||||
|  |             padding: 10px; | ||||||
|  |             width: 580px; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .content { | ||||||
|  |             box-sizing: border-box; | ||||||
|  |             display: block; | ||||||
|  |             margin: 0 auto; | ||||||
|  |             max-width: 580px; | ||||||
|  |             padding: 10px; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .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 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 | ||||||
|  |         ------------------------------------- */ | ||||||
|  |  | ||||||
|  |         .align-center { | ||||||
|  |             text-align: center; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .preheader { | ||||||
|  |             color: transparent; | ||||||
|  |             display: none; | ||||||
|  |             height: 0; | ||||||
|  |             max-height: 0; | ||||||
|  |             max-width: 0; | ||||||
|  |             opacity: 0; | ||||||
|  |             overflow: hidden; | ||||||
|  |             visibility: hidden; | ||||||
|  |             width: 0; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         hr { | ||||||
|  |             border: 0; | ||||||
|  |             border-bottom: 1px solid #d4d4d4; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .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 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 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="center" | ||||||
|  |                                     style="text-align: center" | ||||||
|  |                                     width="100%" | ||||||
|  |                                     border="0" | ||||||
|  |                                     cellpadding="0" | ||||||
|  |                                     cellspacing="0" | ||||||
|  |                                     style="min-width: 100%" | ||||||
|  |                             > | ||||||
|  |                                 <tbody> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td | ||||||
|  |                                             valign="top" | ||||||
|  |                                             class="align-center" | ||||||
|  |                                             style=" | ||||||
|  |                                                             padding-right: 0px; | ||||||
|  |                                                             padding-left: 48px; | ||||||
|  |                                                             padding-top: 0; | ||||||
|  |                                                             padding-bottom: 0; | ||||||
|  |                                                         " | ||||||
|  |                                     > | ||||||
|  |                                         <img | ||||||
|  |                                                 align="center" | ||||||
|  |                                                 alt="OpenWifi" | ||||||
|  |                                                 src="${LOGO}" | ||||||
|  |                                                 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>Your Login Validation Code</h2> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td> | ||||||
|  |                                         <p>Dear ${RECIPIENT_EMAIL} ,</p> | ||||||
|  |                                         <p> | ||||||
|  |                                             You have requested your login validation. Please enter the following code on the login screen: | ||||||
|  |                                         </p> | ||||||
|  |                                         <p> | ||||||
|  |                                         <div style="text-align: center;"> | ||||||
|  |                                             <h3 style="margin-bottom: 0px; font-weight: bold;">${CHALLENGE_CODE}</h3> | ||||||
|  |                                         </div> | ||||||
|  |                                         </p> | ||||||
|  |                                         <p> | ||||||
|  |                                             If you are not trying to login, please login and change your password. Someone may be trying to | ||||||
|  |                                             access your account illegally. | ||||||
|  |                                         </p> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |  | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td> | ||||||
|  |                                         <hr | ||||||
|  |                                                 style=" | ||||||
|  |                                                         margin-top: 0px; | ||||||
|  |                                                         margin-bottom: 30px; | ||||||
|  |                                                     " | ||||||
|  |                                         /> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td> | ||||||
|  |                                         <p> | ||||||
|  |                                             For questions & support | ||||||
|  |                                             regarding this application, | ||||||
|  |                                             please contact us at | ||||||
|  |                                             <a | ||||||
|  |                                                     href="mailto:${SUB_HELPER_EMAIL}" | ||||||
|  |                                                     target="_blank" | ||||||
|  |                                             > | ||||||
|  |                                                 ${SUB_HELPER_EMAIL} | ||||||
|  |                                             </a> | ||||||
|  |                                             . For question regarding the | ||||||
|  |                                             Telecom Infra Project, | ||||||
|  |                                             please contact us at | ||||||
|  |                                             <a | ||||||
|  |                                                     href="mailto:${GLOBAL_SUB_HELPER_EMAIL}" | ||||||
|  |                                             > | ||||||
|  |                                                 ${GLOBAL_SUB_HELPER_EMAIL} | ||||||
|  |                                             </a> | ||||||
|  |                                             . | ||||||
|  |                                         </p> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |  | ||||||
|  |                                 <tr> | ||||||
|  |                                     <td> | ||||||
|  |                                         <p>Thank You!</p> | ||||||
|  |                                         <p>${SUB_SIGNATURE}</p> | ||||||
|  |                                     </td> | ||||||
|  |                                 </tr> | ||||||
|  |                                 <tr> | ||||||
|  |                                     <table | ||||||
|  |                                             role="presentation" | ||||||
|  |                                             border="0" | ||||||
|  |                                             cellpadding="0" | ||||||
|  |                                             cellspacing="0" | ||||||
|  |                                             class="btn btn-primary" | ||||||
|  |                                     > | ||||||
|  |                                         <tbody></tbody> | ||||||
|  |                                     </table> | ||||||
|  |                                 </tr> | ||||||
|  |                             </table> | ||||||
|  |                         </td> | ||||||
|  |                     </tr> | ||||||
|  |                     <!-- END MAIN CONTENT AREA --> | ||||||
|  |                 </table> | ||||||
|  |  | ||||||
|  |                 <!-- 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> | ||||||
|  |                                     <tr> | ||||||
|  |                                         <p class="align-center"> | ||||||
|  |                                             Copyright 2023 | ||||||
|  |                                             ${SUB_SIGNATURE}, | ||||||
|  |                                             All rights reserved. | ||||||
|  |                                         </p> | ||||||
|  |                                         <a | ||||||
|  |                                                 href="https://${SUB_HELPER_SITE}" | ||||||
|  |                                                 target="_blank" | ||||||
|  |                                         >${SUB_HELPER_SITE}</a | ||||||
|  |                                         > | ||||||
|  |                                     </tr> | ||||||
|  |                                     </tbody> | ||||||
|  |                                 </table> | ||||||
|  |                             </td> | ||||||
|  |                         </tr> | ||||||
|  |                         </tbody> | ||||||
|  |                     </table> | ||||||
|  |                 </div> | ||||||
|  |             </div> | ||||||
|  |         </td> | ||||||
|  |         <td> </td> | ||||||
|  |     </tr> | ||||||
|  | </table> | ||||||
|  | </body> | ||||||
|  | </html> | ||||||
|   | |||||||
| @@ -0,0 +1,10 @@ | |||||||
|  | Dear ${RECIPIENT_EMAIL}, | ||||||
|  |  | ||||||
|  |     You have requested your login validation. Please enter the following code on the login screen: | ||||||
|  |  | ||||||
|  |         ${CHALLENGE_CODE} | ||||||
|  |  | ||||||
|  |     If you are not trying to login, please login and change your password. Someone may be trying to | ||||||
|  |     access your account illegally. | ||||||
|  |  | ||||||
|  | Thank you! | ||||||
| @@ -423,18 +423,18 @@ | |||||||
|                                                     regarding this application, |                                                     regarding this application, | ||||||
|                                                     please contact us at |                                                     please contact us at | ||||||
|                                                     <a |                                                     <a | ||||||
|                                                         href="mailto:tip-keys@arilia.com" |                                                             href="mailto:${USER_HELPER_EMAIL}" | ||||||
|                                                             target="_blank" |                                                             target="_blank" | ||||||
|                                                     > |                                                     > | ||||||
|                                                         tip-keys@arilia.com |                                                         ${USER_HELPER_EMAIL} | ||||||
|                                                     </a> |                                                     </a> | ||||||
|                                                     . For question regarding the |                                                     . For question regarding the | ||||||
|                                                     Telecom Infra Project, |                                                     Telecom Infra Project, | ||||||
|                                                     please contact us at |                                                     please contact us at | ||||||
|                                                     <a |                                                     <a | ||||||
|                                                         href="mailto:info@telecominfraproject.com" |                                                             href="mailto:${GLOBAL_USER_HELPER_EMAIL}" | ||||||
|                                                     > |                                                     > | ||||||
|                                                         info@telecominfraproject.com |                                                         ${GLOBAL_USER_HELPER_EMAIL} | ||||||
|                                                     </a> |                                                     </a> | ||||||
|                                                     . |                                                     . | ||||||
|                                                 </p> |                                                 </p> | ||||||
| @@ -444,7 +444,7 @@ | |||||||
|                                         <tr> |                                         <tr> | ||||||
|                                             <td> |                                             <td> | ||||||
|                                                 <p>Thank You!</p> |                                                 <p>Thank You!</p> | ||||||
|                                                 <p>Arilia Wireless Inc.</p> |                                                 <p>${USER_SIGNATURE}</p> | ||||||
|                                             </td> |                                             </td> | ||||||
|                                         </tr> |                                         </tr> | ||||||
|                                         <tr> |                                         <tr> | ||||||
| @@ -490,13 +490,13 @@ | |||||||
|                                                     <tr> |                                                     <tr> | ||||||
|                                                         <p class="align-center"> |                                                         <p class="align-center"> | ||||||
|                                                             Copyright 2023 |                                                             Copyright 2023 | ||||||
|                                                             Arilia Wireless Inc, |                                                             ${USER_SIGNATURE}, | ||||||
|                                                             All rights reserved. |                                                             All rights reserved. | ||||||
|                                                         </p> |                                                         </p> | ||||||
|                                                         <a |                                                         <a | ||||||
|                                                             href="https://arilia.com" |                                                                 href="https://${USER_HELPER_SITE}" | ||||||
|                                                                 target="_blank" |                                                                 target="_blank" | ||||||
|                                                             >www.arilia.com</a |                                                         >${USER_HELPER_SITE}</a | ||||||
|                                                         > |                                                         > | ||||||
|                                                     </tr> |                                                     </tr> | ||||||
|                                                 </tbody> |                                                 </tbody> | ||||||
|   | |||||||
| @@ -2,10 +2,10 @@ | |||||||
| <div class="footer"> | <div class="footer"> | ||||||
|   <p> |   <p> | ||||||
|     For questions & support regarding this application, please contact us at |     For questions & support regarding this application, please contact us at | ||||||
|     <a href="mailto:tip-keys@arilia.com" target="_blank">tip-keys@arilia.com</a>. |     <a href="mailto:${USER_HELPER_EMAIL}" target="_blank">${USER_HELPER_EMAIL}</a>. | ||||||
|     For question regarding the Telecom Infra Project, please contact us at |     For question regarding the Telecom Infra Project, please contact us at | ||||||
|     <a href="mailto:info@telecominfraproject.com"> |     <a href="mailto:${GLOBAL_USER_HELPER_EMAIL}"> | ||||||
|         info@telecominfraproject.com |       ${GLOBAL_USER_HELPER_EMAIL} | ||||||
|     </a>. |     </a>. | ||||||
|   </p> |   </p> | ||||||
| </div> | </div> | ||||||
| @@ -16,6 +16,7 @@ | |||||||
| <div class="info-card"> | <div class="info-card"> | ||||||
|     <h2 class="info-title">Reset Password</h2> |     <h2 class="info-title">Reset Password</h2> | ||||||
|     <form action="/api/v1/actionLink?action=password_reset" method="post" onsubmit="return validatePassword()" class="form-container"> |     <form action="/api/v1/actionLink?action=password_reset" method="post" onsubmit="return validatePassword()" class="form-container"> | ||||||
|  |         <input type="hidden" id="custId" name="id" value="${UUID}"> | ||||||
|         <div class="form-control"> |         <div class="form-control"> | ||||||
|             <label class="form-label" for="password1" ><b>New Password</b></label> |             <label class="form-label" for="password1" ><b>New Password</b></label> | ||||||
|             <input class="form-input" id="password1" type="password" placeholder="New password" name="password1" pattern="${PASSWORD_VALIDATION}" required> |             <input class="form-input" id="password1" type="password" placeholder="New password" name="password1" pattern="${PASSWORD_VALIDATION}" required> | ||||||
|   | |||||||
							
								
								
									
										171
									
								
								wwwassets/sub_common.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										171
									
								
								wwwassets/sub_common.css
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,171 @@ | |||||||
|  | body {font-family: Arial, Helvetica, sans-serif;} | ||||||
|  |  | ||||||
|  | input[type=text], input[type=password] { | ||||||
|  |   width: 100%; | ||||||
|  |   padding: 12px 20px; | ||||||
|  |   margin: 8px 0; | ||||||
|  |   display: inline-block; | ||||||
|  |   border: 1px solid #ccc; | ||||||
|  |   box-sizing: border-box; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | button { | ||||||
|  |   background-color: #04AA6D; | ||||||
|  |   color: white; | ||||||
|  |   padding: 14px 20px; | ||||||
|  |   margin: 8px 0; | ||||||
|  |   border: none; | ||||||
|  |   cursor: pointer; | ||||||
|  |   width: 100%; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | button:hover { | ||||||
|  |   opacity: 0.8; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .logo-grid { | ||||||
|  |   display: grid; | ||||||
|  |   grid-template-columns: 20% 60% 20%; | ||||||
|  |   margin-top: calc(10vh) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .logo-grid > div > img { | ||||||
|  |   width: 100%; | ||||||
|  |   height: 100%; | ||||||
|  |   max-height: 200px; | ||||||
|  |   object-fit: contain; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | .info-card { | ||||||
|  |   padding: 30px; | ||||||
|  |   box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); | ||||||
|  |   display: block; | ||||||
|  |   width: 50%; | ||||||
|  |   min-width: 400px; | ||||||
|  |   border: 1em; | ||||||
|  |   background-color: white; | ||||||
|  |   width: 40%; | ||||||
|  |   height: auto; | ||||||
|  |   margin-left: auto; | ||||||
|  |   margin-right: auto; | ||||||
|  |   margin-bottom: auto; | ||||||
|  |   margin-top: 50px; | ||||||
|  |   position: relative; | ||||||
|  |   border-radius: 15px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .info-list { | ||||||
|  |   margin-left: 5%; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .info-title { | ||||||
|  |   margin-left: 5%; | ||||||
|  |   color: #63B3ED; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .flex-box { | ||||||
|  |   display: flex; | ||||||
|  |   flex-direction: row; | ||||||
|  |   justify-content: left; | ||||||
|  |   align-items: center; | ||||||
|  |   margin-left: 5%; | ||||||
|  |   margin-top: 6px; | ||||||
|  |   margin-bottom: 6px; | ||||||
|  |   min-height: 30px | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .flex-box > h3 { | ||||||
|  |   margin-right: 4px; | ||||||
|  |   margin-top: 5px; | ||||||
|  |   margin-bottom: 5px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .container { | ||||||
|  |   padding: 16px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | span.password1 { | ||||||
|  |   float: right; | ||||||
|  |   padding-top: 16px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | body { | ||||||
|  |   background-color: #ebedef; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* Change styles for span and cancel button on extra small screens */ | ||||||
|  | @media screen and (max-width: 300px) { | ||||||
|  |   span.password1 { | ||||||
|  |     display: block; | ||||||
|  |     float: none; | ||||||
|  |   } | ||||||
|  |   .cancelbtn { | ||||||
|  |     width: 100%; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .form-container { | ||||||
|  |   border: 0px; | ||||||
|  |   margin-left: 5%; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .form-label { | ||||||
|  |     float: left; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .form-input { | ||||||
|  |   border-radius: 15px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .form-control { | ||||||
|  |   margin-bottom: 6px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .form-submit-btn { | ||||||
|  |     display: inline-flex; | ||||||
|  |     appearance: none; | ||||||
|  |     -webkit-box-align: center; | ||||||
|  |     align-items: center; | ||||||
|  |     -webkit-box-pack: center; | ||||||
|  |     justify-content: center; | ||||||
|  |     -webkit-user-select: none; | ||||||
|  |     position: relative; | ||||||
|  |     white-space: nowrap; | ||||||
|  |     vertical-align: middle; | ||||||
|  |     outline-color: transparent; | ||||||
|  |     outline-style: solid; | ||||||
|  |     outline-width: 2px; | ||||||
|  |     outline-offset: 2px; | ||||||
|  |     line-height: 1.2; | ||||||
|  |     border-top-left-radius: 15px; | ||||||
|  |     border-top-right-radius: 15px; | ||||||
|  |     border-bottom-right-radius: 15px; | ||||||
|  |     border-bottom-left-radius: 15px; | ||||||
|  |     height: 45px; | ||||||
|  |     background-color:#4299E1; | ||||||
|  |     font-size: 15px; | ||||||
|  |     padding-inline-start: 16px; | ||||||
|  |     padding-inline-end: 16px; | ||||||
|  |     width: 100%; | ||||||
|  |     margin-bottom: 20px; | ||||||
|  |     color: white; | ||||||
|  |     margin-top: 20px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .footer{ | ||||||
|  |   display: flex; | ||||||
|  |   flex-direction: row; | ||||||
|  |   justify-content: left; | ||||||
|  |   align-items: center; | ||||||
|  |   margin-left: 5%; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | hr.rounded { | ||||||
|  |   margin-top: 40px; | ||||||
|  |   margin-bottom: 0px; | ||||||
|  |   margin-left: 5%; | ||||||
|  |   margin-right: 5%; | ||||||
|  |   border-top: 1px solid #bbb; | ||||||
|  |   border-radius: 5px; | ||||||
|  | } | ||||||
| @@ -2,10 +2,10 @@ | |||||||
| <div class="footer"> | <div class="footer"> | ||||||
|   <p> |   <p> | ||||||
|     For questions & support regarding this application, please contact us at |     For questions & support regarding this application, please contact us at | ||||||
|     <a href="mailto:tip-keys@arilia.com" target="_blank">tip-keys@arilia.com</a>. |     <a href="mailto:${SUB_HELPER_EMAIL}" target="_blank">${SUB_HELPER_EMAIL}</a>. | ||||||
|     For question regarding the Telecom Infra Project, please contact us at |     For question regarding the Telecom Infra Project, please contact us at | ||||||
|     <a href="mailto:info@telecominfraproject.com"> |     <a href="mailto:${GLOBAL_SUB_HELPER_EMAIL}"> | ||||||
|         info@telecominfraproject.com |       ${GLOBAL_SUB_HELPER_EMAIL} | ||||||
|     </a>. |     </a>. | ||||||
|   </p> |   </p> | ||||||
| </div> | </div> | ||||||
| @@ -16,6 +16,7 @@ | |||||||
| <div class="info-card"> | <div class="info-card"> | ||||||
|     <h2 class="info-title">Reset Password</h2> |     <h2 class="info-title">Reset Password</h2> | ||||||
|     <form action="/api/v1/actionLink?action=password_reset" method="post" onsubmit="return validatePassword()" class="form-container"> |     <form action="/api/v1/actionLink?action=password_reset" method="post" onsubmit="return validatePassword()" class="form-container"> | ||||||
|  |         <input type="hidden" id="custId" name="id" value="${UUID}"> | ||||||
|         <div class="form-control"> |         <div class="form-control"> | ||||||
|             <label class="form-label" for="password1" ><b>New Password</b></label> |             <label class="form-label" for="password1" ><b>New Password</b></label> | ||||||
|             <input class="form-input" id="password1" type="password" placeholder="New password" name="password1" pattern="${PASSWORD_VALIDATION}" required> |             <input class="form-input" id="password1" type="password" placeholder="New password" name="password1" pattern="${PASSWORD_VALIDATION}" required> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user