diff --git a/0001-add-paging-parameter-schema.patch b/0001-add-paging-parameter-schema.patch new file mode 100644 index 0000000000000000000000000000000000000000..6c0ea2999af03df9b839dd9c426a3c36a6c64a4b --- /dev/null +++ b/0001-add-paging-parameter-schema.patch @@ -0,0 +1,41 @@ +From db18901aae967d1bf6b26a751d25a8f63eba7c2d Mon Sep 17 00:00:00 2001 +From: rabbitali +Date: Wed, 7 Jun 2023 16:35:22 +0800 +Subject: [PATCH] add paging parameter schema + +--- + vulcanus/restful/serialize/validate.py | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/vulcanus/restful/serialize/validate.py b/vulcanus/restful/serialize/validate.py +index 1c00804..0e5c6ea 100644 +--- a/vulcanus/restful/serialize/validate.py ++++ b/vulcanus/restful/serialize/validate.py +@@ -16,7 +16,8 @@ Author: + Description: + """ + import re +-from marshmallow import ValidationError ++ ++from marshmallow import Schema, ValidationError, fields + + + def validate(verifier, data, load=False): +@@ -72,4 +73,12 @@ class ValidateRules: + validation rules for password, which only contains string or number + """ + if not re.findall("[a-zA-Z0-9]{6,20}", string): +- raise ValidationError("password should only contains string or number, between 6 and 20 characters!!") +\ No newline at end of file ++ raise ValidationError("password should only contains string or number, between 6 and 20 characters!!") ++ ++ ++class PaginationSchema(Schema): ++ """ ++ filter schema of paging parameter ++ """ ++ page = fields.Integer(required=False, validate=lambda s: 10**6 > s > 0) ++ per_page = fields.Integer(required=False, validate=lambda s: 10**3 > s > 0) +-- +Gitee + diff --git a/0001-fix-script-docker-install-error.patch b/0001-fix-script-docker-install-error.patch deleted file mode 100644 index 211a9ea2d7e46fc970bed2a4f1dd6a1254beae01..0000000000000000000000000000000000000000 --- a/0001-fix-script-docker-install-error.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 5ecf2c9769dc81b1a9da2c4ef1821184766a370b Mon Sep 17 00:00:00 2001 -From: gongzt -Date: Mon, 24 Apr 2023 09:36:25 +0800 -Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E9=94=AE=E9=83=A8?= - =?UTF-8?q?=E7=BD=B2=E4=B8=AD=E6=A3=80=E6=9F=A5docker=E3=80=81docker-compo?= - =?UTF-8?q?se=E5=AE=89=E8=A3=85=E7=9A=84=E9=94=99=E8=AF=AF=EF=BC=8C?= - =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=A4=E4=BA=92=E5=BC=8F=E5=91=BD=E4=BB=A4?= - =?UTF-8?q?=E4=B8=AD=E6=A0=87=E8=AF=86=E7=AC=A6=E9=94=99=E8=AF=AF?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- - .../deploy/container/aops-apollo/Dockerfile | 2 +- - .../deploy/container/aops-diana/Dockerfile | 2 +- - scripts/deploy/container/run.sh | 22 ++++++++++++------- - 3 files changed, 16 insertions(+), 10 deletions(-) - -diff --git a/scripts/deploy/container/aops-apollo/Dockerfile b/scripts/deploy/container/aops-apollo/Dockerfile -index 996b7ec..ea0a3fc 100644 ---- a/scripts/deploy/container/aops-apollo/Dockerfile -+++ b/scripts/deploy/container/aops-apollo/Dockerfile -@@ -1,5 +1,5 @@ - FROM openeuler/openeuler:22.03-lts-sp1 - WORKDIR /app --COPY *.repo /app/ -+COPY * /app/ - RUN dnf install aops-apollo -y --setopt=reposdir=/app - CMD ["/bin/bash","/app/start.sh"] -\ No newline at end of file -diff --git a/scripts/deploy/container/aops-diana/Dockerfile b/scripts/deploy/container/aops-diana/Dockerfile -index 03297ec..9e9eef9 100644 ---- a/scripts/deploy/container/aops-diana/Dockerfile -+++ b/scripts/deploy/container/aops-diana/Dockerfile -@@ -1,5 +1,5 @@ - FROM openeuler/openeuler:22.03-lts-sp1 - WORKDIR /app --COPY *.repo /app/ -+COPY * /app/ - RUN dnf install aops-diana -y --setopt=reposdir=/app - CMD ["/bin/bash","/app/start.sh"] -\ No newline at end of file -diff --git a/scripts/deploy/container/run.sh b/scripts/deploy/container/run.sh -index c32a57a..581c0bc 100755 ---- a/scripts/deploy/container/run.sh -+++ b/scripts/deploy/container/run.sh -@@ -44,10 +44,6 @@ prometheus(){ - docker_build(){ - copy_aops_conf - prepare_dockerfile_repo -- storage_mysql_data -- storage_es_data -- prometheus -- docker-compose -f docker-compose-base-service.yml build --no-cache - docker-compose build --no-cache - rm ./aops-apollo/*.repo - rm ./aops-diana/*.repo -@@ -56,14 +52,21 @@ docker_build(){ - } - - install_docker_compose(){ -- installed_docker_compose=`rpm -ql docker-compose` -- if [ "$(echo $installed_docker_compose | grep "is not installed")" != "" ]; then -+ docker_compose_installed=`rpm -q docker-compose` -+ if [ $? -ne 0 ] ; then - dnf install docker-compose -y -+ else -+ echo "docker-compose is already installed." -+ fi -+ docker_installed=`rpm -q docker` -+ if [ $? -ne 0 ] ; then -+ dnf install docker -y -+ else -+ echo "docker is already installed." - fi - } - - main(){ -- - install_docker_compose - while : - do -@@ -71,7 +74,7 @@ main(){ - echo "1. Build the docker container (build)." - echo "2. Start the container orchestration service (start-service/start-env)." - echo "3. Stop all container services (stop-service/stop-env)." -- read "Enter to exit the operation (Q/q)." -+ echo "Enter to exit the operation (Q/q)." - read -p "Select an operation procedure to continue: " operation - case $operation in - "build") -@@ -82,6 +85,9 @@ main(){ - docker-compose up -d - ;; - "start-env") -+ prometheus -+ storage_es_data -+ storage_mysql_data - docker-compose -f docker-compose-base-service.yml up -d - ;; - "stop-service") --- -Gitee - diff --git a/0002-add-custom-validation-rules.patch b/0002-add-custom-validation-rules.patch deleted file mode 100644 index e65dfa7df374a340038ec3cf7befe4a827c84555..0000000000000000000000000000000000000000 --- a/0002-add-custom-validation-rules.patch +++ /dev/null @@ -1,78 +0,0 @@ -From e1a72048bed334ff2e5014e2437598aa5580760f Mon Sep 17 00:00:00 2001 -From: rabbitali -Date: Wed, 26 Apr 2023 19:25:32 +0800 -Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89?= - =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99;=E6=B7=BB=E5=8A=A0?= - =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=80=80=E5=87=BA=E7=99=BB=E5=BD=95=E6=8E=A5?= - =?UTF-8?q?=E5=8F=A3=E7=9A=84=E8=B7=AF=E7=94=B1?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- - vulcanus/conf/constant.py | 1 + - vulcanus/restful/serialize/validate.py | 31 ++++++++++++++++++++++++++ - 2 files changed, 32 insertions(+) - -diff --git a/vulcanus/conf/constant.py b/vulcanus/conf/constant.py -index 9779602..7185685 100644 ---- a/vulcanus/conf/constant.py -+++ b/vulcanus/conf/constant.py -@@ -53,6 +53,7 @@ GET_GROUP = "/manage/host/group/get" - COLLECT_CONFIG = '/manage/config/collect' - - USER_LOGIN = "/manage/account/login" -+LOGOUT = "/manage/account/logout" - CHANGE_PASSWORD = '/manage/account/change' - ADD_USER = '/manage/account/add' - GITEE_AUTH_LOGIN = "/manage/account/gitee/login" -diff --git a/vulcanus/restful/serialize/validate.py b/vulcanus/restful/serialize/validate.py -index bfe25ad..1c00804 100644 ---- a/vulcanus/restful/serialize/validate.py -+++ b/vulcanus/restful/serialize/validate.py -@@ -15,6 +15,7 @@ Time: - Author: - Description: - """ -+import re - from marshmallow import ValidationError - - -@@ -42,3 +43,33 @@ def validate(verifier, data, load=False): - errors = verifier().validate(data) - - return result, errors -+ -+ -+class ValidateRules: -+ """ -+ Custom validation rules -+ """ -+ -+ @staticmethod -+ def space_character_check(string: str) -> None: -+ """ -+ one of validation rules for string, no spaces are allowed at the beginning or end. -+ """ -+ if len(string.strip()) != len(string): -+ raise ValidationError("there may be space character exists at the beginning or end!") -+ -+ @staticmethod -+ def account_name_check(string: str) -> None: -+ """ -+ validation rules for username, which only contains string or number -+ """ -+ if not re.findall("[a-zA-Z0-9]{5,20}", string): -+ raise ValidationError("username should only contains string or number, between 5 and 20 characters!") -+ -+ @staticmethod -+ def account_password_check(string: str) -> None: -+ """ -+ validation rules for password, which only contains string or number -+ """ -+ if not re.findall("[a-zA-Z0-9]{6,20}", string): -+ raise ValidationError("password should only contains string or number, between 6 and 20 characters!!") -\ No newline at end of file --- -Gitee - diff --git a/0002-updateuwsgi-conf-file-generation-function.patch b/0002-updateuwsgi-conf-file-generation-function.patch new file mode 100644 index 0000000000000000000000000000000000000000..6069f4af41e98a62dbec2b153e72a27b72fc156c --- /dev/null +++ b/0002-updateuwsgi-conf-file-generation-function.patch @@ -0,0 +1,24 @@ +From af4cb1a8f4b898e94d67020a7425d781e28013f5 Mon Sep 17 00:00:00 2001 +From: rabbitali +Date: Mon, 5 Jun 2023 23:48:03 +0800 +Subject: [PATCH] update uwsgi.ini generation function + +--- + aops-vulcanus | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/aops-vulcanus b/aops-vulcanus +index dea2b61..ce63dbd 100644 +--- a/aops-vulcanus ++++ b/aops-vulcanus +@@ -67,7 +67,6 @@ callable=app + http-timeout=${http_timeout} + harakiri=${harakiri} + processes=${processes} +-lazy-apps=true + daemonize=${daemonize}" >"${OUT_PATH}"/"${service_name}".ini + if [ ${gevent} ] + then +-- +Gitee + diff --git a/0003-old-token-is-invalid.patch b/0003-old-token-is-invalid.patch deleted file mode 100644 index 4243943bd9caab335c8a3f6b2cd1fbc235d3b655..0000000000000000000000000000000000000000 --- a/0003-old-token-is-invalid.patch +++ /dev/null @@ -1,29 +0,0 @@ -From: gongzt -Date: Sat, 6 May 2023 10:12:42 +0800 -Subject:[PATCH] fix old token can still be used normally -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- - vulcanus/restful/response.py | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/vulcanus/restful/response.py b/vulcanus/restful/response.py -index 0cb8c4b..f21e6ca 100644 ---- a/vulcanus/restful/response.py -+++ b/vulcanus/restful/response.py -@@ -139,9 +139,8 @@ class BaseResponse(Resource): - except ValueError: - return state.TOKEN_ERROR - -- cache_token = RedisProxy.redis_connect.get( -- "token_" + verify_info["key"]) -- if not cache_token: -+ cache_token = RedisProxy.redis_connect.get("token_" + verify_info["key"]) -+ if not cache_token or cache_token != token: - return state.TOKEN_ERROR - - args['username'] = verify_info["key"] --- -Gitee diff --git a/0004-add-gevent-config-item-for-uwsgi.patch b/0004-add-gevent-config-item-for-uwsgi.patch deleted file mode 100644 index 6717066935c170a31870e1970c3ba85525781cea..0000000000000000000000000000000000000000 --- a/0004-add-gevent-config-item-for-uwsgi.patch +++ /dev/null @@ -1,40 +0,0 @@ -From: rabbitali -Date: Mon, 8 May 2023 10:34:39 +0800 -Subject: [PATCH] add gevent conf item when create uwsgi conf file - ---- - aops-vulcanus | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/aops-vulcanus b/aops-vulcanus -index 368c57f..d7e4cb9 100644 ---- a/aops-vulcanus -+++ b/aops-vulcanus -@@ -42,6 +42,7 @@ function create_config_file() { - harakiri=$(get_config "${config_file}" "uwsgi" "harakiri") - processes=$(get_config "${config_file}" "uwsgi" "processes") - threads=$(get_config "${config_file}" "uwsgi" "threads") -+ gevent=$(get_config "${config_file}" "uwsgi" "gevent") - - check_file $daemonize - echo "[INFO] run ${service_name} under path: ${wsgi_file}" -@@ -65,10 +66,16 @@ pidfile=${OUT_PATH}/${service_name}.pid - callable=app - http-timeout=${http_timeout} - harakiri=${harakiri} --threads=${threads} - processes=${processes} - lazy-apps=true - daemonize=${daemonize}" >"${OUT_PATH}"/"${service_name}".ini -+ if [ ${gevent} ] -+ then -+ echo "gevent=${gevent} -+gevent-monkey-patch=true" >>"${OUT_PATH}"/"${service_name}".ini -+ else -+ echo "threads=${threads}" >>"${OUT_PATH}"/"${service_name}".ini -+ fi - chown root: ${OUT_PATH}/"${service_name}".ini - chmod 750 ${OUT_PATH}/"${service_name}".ini - echo "[INFO] create ${service_name} uwsgi file ok,path is ${OUT_PATH}/${service_name}.ini" --- - diff --git a/0005-update-length-limit-of-username-field.patch b/0005-update-length-limit-of-username-field.patch deleted file mode 100644 index 1e17daaa3ba1fedcc4e10a0b6a34ddc9415d846f..0000000000000000000000000000000000000000 --- a/0005-update-length-limit-of-username-field.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 4276d15604e0445558009a7c48dce323073cd2d3 Mon Sep 17 00:00:00 2001 -From: rabbitali -Date: Tue, 9 May 2023 11:03:45 +0800 -Subject: [PATCH] update length limit of username field - ---- - vulcanus/database/table.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/vulcanus/database/table.py b/vulcanus/database/table.py -index 0c8d2c1..23ad889 100644 ---- a/vulcanus/database/table.py -+++ b/vulcanus/database/table.py -@@ -56,7 +56,7 @@ class Host(Base, MyBase): # pylint: disable=R0903 - last_scan = Column(Integer) - scene = Column(String(255)) - os_version = Column(String(40)) -- ssh_user = Column(String(20), default="root") -+ ssh_user = Column(String(40), default="root") - ssh_port = Column(Integer(), default=22) - pkey = Column(String(2048)) - status = Column(Integer(), default=2) --- -Gitee - diff --git a/aops-vulcanus-v1.2.0.tar.gz b/aops-vulcanus-v1.2.0.tar.gz deleted file mode 100644 index cf87863606b366629207080489541ddd344868b5..0000000000000000000000000000000000000000 Binary files a/aops-vulcanus-v1.2.0.tar.gz and /dev/null differ diff --git a/aops-vulcanus-v1.2.1.tar.gz b/aops-vulcanus-v1.2.1.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..2db472a771767ebd3b5f63a722d41dc61beee6f5 Binary files /dev/null and b/aops-vulcanus-v1.2.1.tar.gz differ diff --git a/aops-vulcanus.spec b/aops-vulcanus.spec index 2794beb6b632d967a6c8a53108fc9143950664e4..c712efab52cb8325acf75f78e999d616693fd360 100644 --- a/aops-vulcanus.spec +++ b/aops-vulcanus.spec @@ -1,15 +1,12 @@ Name: aops-vulcanus -Version: v1.2.0 -Release: 4 +Version: v1.2.1 +Release: 2 Summary: A basic tool libraries of aops, including logging, configure and response, etc. License: MulanPSL2 URL: https://gitee.com/openeuler/%{name} Source0: %{name}-%{version}.tar.gz -Patch0001: 0001-fix-script-docker-install-error.patch -Patch0002: 0002-add-custom-validation-rules.patch -Patch0003: 0003-old-token-is-invalid.patch -Patch0004: 0004-add-gevent-config-item-for-uwsgi.patch -Patch0005: 0005-update-length-limit-of-username-field.patch +Patch0001: 0001-add-paging-parameter-schema.patch +Patch0002: 0002-updateuwsgi-conf-file-generation-function.patch BuildRequires: python3-setuptools @@ -65,6 +62,13 @@ cp -r scripts %{buildroot}/opt/aops/ %changelog +* Thu Jun 08 2023 wenxin - v1.2.1-2 +- fix issue: aops-zeus app failed to load when first start by uwsgi +- add paging parameter schema + +* Tue May 23 2023 wenxin - v1.2.1-1 +- add cve rollback url for aops-zeus + * Tue May 9 2023 wenxin - v1.2.0-4 - update length limit of username field