From 1a7152507550db3e72e4c6744677dea1a55a77f7 Mon Sep 17 00:00:00 2001 From: XeRo Date: Wed, 28 Jan 2026 17:46:10 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=84=D0=B0=D0=B9?= =?UTF-8?q?=D0=BB=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D0=B0=20rep?= =?UTF-8?q?ko?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- confs/repko.yaml | 55 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/confs/repko.yaml b/confs/repko.yaml index 1cdf4f6..5ac9b63 100644 --- a/confs/repko.yaml +++ b/confs/repko.yaml @@ -215,6 +215,18 @@ sections: variable-name: "server_address" field-type: "input" description: "Адрес сервера" + validate: + - rule: "regex_match(server_address,`^[a-zA-Z.-]+:[0-9]+$`)" + message: "Неверный формат, host:port, host только латиница,цифры, тире, '.', port только цифры" + - rule: "port_free( regex(server_address, `^.*:([0-9]+)$`, `$1`) )" + message: "Порт занят" + - name: "trusted_proxy" + variable-name: "trusted_proxy" + description: "Доверенные прокси" + field-type: "compute" + parent: + - "server_address" + compute: split(server_address,":")[0] - name: "ssl" description: "Настройка ssl" condition: "is_secure == true" @@ -262,7 +274,7 @@ sections: condition: "ssl_type == 'self-signed'" run-as: "root" error: "Ошибка при создании директории для сертификатов" - - name: "generate_self_signed" + - name: "generate_self_signed" #тут type: "command" command: | openssl req -x509 -nodes -days 365 \ @@ -272,7 +284,17 @@ sections: -subj "/CN={{api_domain}}" condition: "ssl_type == 'self-signed'" run-as: "root" - error: "Ошибка при генерации самоподписанного сертификата" + error: "Не удалось сгенерировать сертификат через openssl" + - name: "Set owner for key" + type: "command" + command: "chown root:root {{.ssl_key_path}}" + condition: "ssl_type == 'self-signed'" + error: "Ошибка установки владельца ключа" + - name: "Set rights 600 for key" + type: "command" + command: "chmod 600 {{.ssl_key_path}}" + condition: "ssl_type == 'self-signed'" + error: "Ошибка установки прав ключа" - name: "run_certbot" type: "command" command: "certbot --nginx -d {{api_domain}} -d {{panel_domain}} --non-interactive --agree-tos -m admin@{{api_domain}}" @@ -282,14 +304,12 @@ sections: - "certbot" run-as: "root" error: "Ошибка при генерации сертификата через lets encrypt" - # - name: "update_ca_certificates" - # type: "command" - # command: "update_ca_certificates" - # run-as: "root" - # error: "Не удалось обновить сертификаты" - # condition: "ssl_type != 'path later'" - # require-packages: - # - "dont know what" + - name: "update_ca_certificates" + type: "command" + command: "update_ca_certificates" + run-as: "root" + error: "Не удалось обновить сертификаты" + condition: "ssl_type != 'path later'" - name: "database" description: "Настройка используемой базы данных" fields: @@ -307,6 +327,9 @@ sections: condition: "database_type=='postgres'" parent: - "database_type" + validate: + - rule: "regex_match(database_host,`^[a-zA-Z0-9.-]+$`" + message: "Только латинские буквы, цифры, -, '.'" - name: "database_port" variable-name: "database_port" field-type: "input" @@ -314,6 +337,9 @@ sections: condition: "database_type=='postgres'" parent: - "database_type" + validate: + - rule: "regex_match(database_host,`^[0-9]+$`" + message: "Только цифры" - name: "database_name" variable-name: "database_name" field-type: "input" @@ -321,6 +347,9 @@ sections: condition: "database_type=='postgres'" parent: - "database_type" + validate: + - rule: "regex_match(database_name,`^[a-zA-Z0-9_-]+$`" + message: "Только латинские буквы, цифры, -, _" - name: "database_user" variable-name: "database_user" field-type: "input" @@ -328,6 +357,9 @@ sections: condition: "database_type=='postgres'" parent: - "database_type" + validate: + - rule: "regex_match(database_user,`^[a-zA-Z0-9_-]+$`" + message: "Только латинские буквы, цифры, -, _" - name: "database_password" variable-name: "database_password" field-type: "input" @@ -335,6 +367,9 @@ sections: condition: "database_type=='postgres'" parent: - "database_type" + validate: + - rule: "database_password!=''" + message: "Поле не может быть пустым" - name: "paths" description: "Настройка директорий" fields: