From f4c854573195133676dc8a017fca7237f43fcf6c Mon Sep 17 00:00:00 2001 From: igor Date: Tue, 18 Feb 2025 07:27:32 +0500 Subject: [PATCH] + --- Dahy_install.md | 84 +++++++++++++ Gotify_install.md | 138 +++++++++++++++++++++ HAProxy_install.md | 218 ++++++++++++++++++++++++++++++++++ HTTPTunnel.md | 73 ++++++++++++ Portainer_io_install.md | 71 +++++++++++ Ubuntu.md | 257 ---------------------------------------- Uptime_Kuma_install.md | 66 +++++++++++ 7 files changed, 650 insertions(+), 257 deletions(-) create mode 100644 Dahy_install.md create mode 100644 Gotify_install.md create mode 100644 HAProxy_install.md create mode 100644 HTTPTunnel.md create mode 100644 Portainer_io_install.md create mode 100644 Uptime_Kuma_install.md diff --git a/Dahy_install.md b/Dahy_install.md new file mode 100644 index 0000000..d09b133 --- /dev/null +++ b/Dahy_install.md @@ -0,0 +1,84 @@ +Подключаюсь к нужной машине + +## 2. Подключаемся +```sh +ssh igor@192.168.200.84 -p 22 +``` + +## 3. Создаём директории +```sh + sudo mkdir -p /opt/dashy && + sudo mkdir -p /opt/dashy/data && + sudo chmod -R 777 /opt/dashy && + sudo chown -R $USER:$USER /opt/dashy && +``` + +Создаём файл конфигурации +```sh +cd /opt/dashy/data && +cat > conf.yml < docker-compose.yml < /etc/haproxy/ssl/bigfoottrade_kz.pem +cat AAA_Certificate_Services.crt GoGetSSL_RSA_DV_CA.crt istransit_kz.crt istransit_kz.key > istransit_kz.pem + + SSLCertificateFile + SSLCertificateKeyFile + +Для включения WEB статистики на 9000 порту добавить в конец конфигурации: +listen stats +bind *:8989 +stats enable +stats uri /stats +stats realm Haproxy\ Statistics +stats auth igor:i123456 +Тестирую файл конфигурации: +```sh + haproxy -f /etc/haproxy/haproxy.cfg -c +```` +Также можно в журнале посмотреть что написал HAProxy: +```sh + sudo journalctl -u haproxy --no-pager | tail -n 50 +```` +Перезагружаем: +sudo systemctl restart haproxy +И теперь должно открываться но адресу: http://data.ccalm.org:8989/ +Обязательно проверить как установился SSL чекером: https://www.leaderssl.ru/tools/ssl_checker + + +# 📌 Бесплатный SSL сертификат Let’s Encrypt для HAPROXY +**************************************************************************************************** +Бесплатный SSL сертификат Let’s Encrypt для HAPROXY https://serversforhackers.com/c/letsencrypt-with-haproxy +```sh + sudo apt-get update + sudo apt-get install -y certbot +```` +Для удаления PPA нужно выполнить: +```sh + sudo apt-get remove certbot + sudo add-apt-repository --remove ppa:certbot/certbot + apt-get install -f + apt autoremove +``` +Если включён файрволл то разрешаем порт: +```sh + sudo ufw allow 9080/tcp +``` +Проверяем что автообновление в certbot работает для этого выполняем команду: +```sh + sudo systemctl status certbot.timer +``` +Затем пытаемся выполнить пробный прогон при помощи команды: +```sh + sudo certbot renew --dry-run +``` + +Согласно инструкции модифицируем конфигурационный файл haproxy добавив во frontend это: +``` + # ACL for detecting Let's Encrypt validtion requests + acl is_certbot path_beg /.well-known/acme-challenge/ + use_backend backend-certbot if is_certbot +``` +А также ещё один backend: +``` + # Certbot backend + # Contains certbot stand-alone webserver + backend backend-certbot + mode http + server certbot 127.0.0.1:9080 +``` +Перезагрузить и выполнить команду: + +```sh + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d locust.kz --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d gotify.locust.kz --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d git.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d ru.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d rug.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive + + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d kz.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d kzg.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive + + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d locust.kz --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d test.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d data.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d geoserver2.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d geoserver.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d stations.istt.kz --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d uspdmanager.istt.kz --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d tourist.istt.kz --email irigm@mail.ru --agree-tos --non-interactive + + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d monitoring.infracos.kz --email irigm@mail.ru --agree-tos --non-interactive + + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d aistransit.kz --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d istransit.kz --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d test.istransit.kz --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d main.istransit.kz --email irigm@mail.ru --agree-tos --non-interactive + + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d transit.istt.kz --email irigm@mail.ru --agree-tos --non-interactive + + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d geovizor.com --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d mqtt.kz --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d observer.kz --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d rigor.kz --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d pal.kz --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d elektronnaya-ochered.kz --email irigm@mail.ru --agree-tos --non-interactive + certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d mcp.kz --email irigm@mail.ru --agree-tos --non-interactive +``` + +После генерации файлы будут в: + /etc/letsencrypt/live/geoserver2.ccalm.org/fullchain.pem + /etc/letsencrypt/live/geoserver2.ccalm.org/privkey.pem + +Для обновления создаём файл /etc/letsencrypt/renew.sh (по моему этот скрипт не нужен так как рабтает сервис certbot.timer): + #!/bin/bash + certbot renew --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 --post-hook "/etc/haproxy/prepare.sh" --quiet + +Но для HAProxy нужно чтобы 2 файла были объединены поэтому добавляю спец скрипт /etc/haproxy/prepare.sh: + #!/bin/bash + + # Loop through all Let's Encrypt certificates + for CERTIFICATE in `find /etc/letsencrypt/live/* -type d`; do + + CERTIFICATE=`basename $CERTIFICATE` + + # Combine certificate and private key to single file + cat /etc/letsencrypt/live/$CERTIFICATE/fullchain.pem /etc/letsencrypt/live/$CERTIFICATE/privkey.pem > /etc/haproxy/ssl/$CERTIFICATE.pem + + done + systemctl reload haproxy.service + +Обновляем конфигурацию HAProxy добавив в frontend: + bind *:443 ssl crt /etc/haproxy/ssl/mqtt.kz.pem + +Устанавливаем права + chmod +x /etc/haproxy/renew.sh + chmod +x /etc/haproxy/prepare.sh +И добавляем задание в cron "crontab -e" ниже текст это раз в 24 часа в 00:00:00 ночи: + 0 0 * * * /bin/sh /etc/letsencrypt/renew.sh diff --git a/HTTPTunnel.md b/HTTPTunnel.md new file mode 100644 index 0000000..351a533 --- /dev/null +++ b/HTTPTunnel.md @@ -0,0 +1,73 @@ +# 📌 Туннелирование SSH через HTTP +**************************************************************************************************** +Исходники тут: https://github.com/larsbrinkhoff/httptunnel: +```sh + sudo apt-get install httptunnel +```` +Настроил HAProxy примерно так, чтобы проверялся параметр "mybiglogfile" для редиректа: +``` +frontend frontend-http +bind *:80 +mode http + + acl v_tunnel url_param(mybiglogfile) -m found + use_backend httptunnel_backend if v_tunnel + + http-request redirect scheme https code 301 unless { ssl_fc } || v_tunnel +``` + +Проверить нет ли редирект можно так: +curl -I http://192.168.200.81/index.html?mybiglogfile=all +curl -I http://locust.kz/index.html?mybiglogfile=all + +На сервере запустил прослушку на 9999 и перенаправление на 22: +```sh + sudo hts -F 127.0.0.1:22 9999 +```` +Для остановки +```sh + ps aux | grep hts + sudo kill 1854 +``` +Можно запустить как сервис так sudo mcedit /etc/systemd/system/httptunnel.service: +``` +[Unit] +Description=HTTP Tunnel Service +After=network.target + +[Service] +ExecStart=hts -F 127.0.0.1:22 9999 +Restart=always +User=root +RestartSec=10 + +[Install] +WantedBy=multi-user.target +``` +Потом: +```sh + sudo systemctl daemon-reload + sudo systemctl enable httptunnel + sudo systemctl stop httptunnel + sudo systemctl start httptunnel + sudo systemctl status httptunnel + tail -f /var/log/syslog | grep --line-buffered "htc" +``` + +На клиенте запускаем локальный порт также указал 9999 а ключь +```sh + htc -F 9999 --base-uri /index.html?mybiglogfile=all 192.168.200.81:80 + htc -F 9999 --base-uri /index.html?mybiglogfile=all locust.kz:80 +``` + +Для остановки +```sh + ps aux | grep htc + Потом + sudo kill 783 +``` + +Пробую подключиться после настройки тунеля: +```sh + ssh igor@127.0.0.1 -p 9999 +``` \ No newline at end of file diff --git a/Portainer_io_install.md b/Portainer_io_install.md new file mode 100644 index 0000000..ae58e40 --- /dev/null +++ b/Portainer_io_install.md @@ -0,0 +1,71 @@ +# Установка Portainer.io в Docker на Ubuntu 24.04 + +Пробую установить в ProxMox в контейнер созданный на основе Ubuntu, незабыть убрать галочку: Unprivileged container + +Подключаюсь к нужной машине +```sh +ssh igor@192.168.200.84 -p 22 +``` + +## Шаг 1: Обновление системы и установка Docker +Перед установкой Portainer убедитесь, что Docker установлен и запущен. + +```bash + sudo apt update && sudo apt upgrade -y + sudo apt-get install python3-venv python3-pip + sudo apt install docker.io -y + sudo systemctl enable --now docker + sudo systemctl start docker + sudo systemctl status docker + sudo apt install -y docker-compose + docker-compose --version +``` + +Добавляем текущего пользователя в группу докера +```sh + sudo usermod -aG docker $USER +```` + +## Шаг 2: Создание директории для Portainer +Создадим папку для хранения данных Portainer в `/opt`: + +```bash + sudo mkdir -p /opt/portainer/data + sudo chmod -R 777 /opt/portainer +``` + +## Шаг 3: Создание docker-compose.yml + +```sh + cd /opt/portainer + sudo mcedit docker-compose.yml +``` + +```yaml +services: + portainer: + image: portainer/portainer-ce:latest + container_name: portainer + restart: always + ports: + - "8000:8000" + - "9443:9443" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ./data:/data +``` + +## Шаг 4: Запуск контейнера Portainer + +```sh + sudo docker-compose up -d +``` + +```sh +start https://192.168.200.84:9443 +``` + +## Шаг 5: Начальная настройка +1. Создайте учетную запись администратора. +2. Подключите локальный Docker-движок. +3. Начните управлять контейнерами через Portainer! diff --git a/Ubuntu.md b/Ubuntu.md index 2f492dc..b43b46f 100644 --- a/Ubuntu.md +++ b/Ubuntu.md @@ -2350,190 +2350,6 @@ print ? 1. sudo update-rc.d autostart.script remove -**************************************************************************************************** -Установка HAProxy на Ubuntu 20.04 по https://itsecforu.ru/2019/07/15/⏳-настройка-балансировщика-нагрузки-h/ - sudo apt-get update && sudo apt-get install haproxy -y -Создаём резервную копию файла: - sudo cp /etc/haproxy/haproxy.cfg{,.bak} -Редактируем конфигурацию (Описание конфигурационного файла HAProxy https://habr.com/ru/sandbox/34354/) - mcedit /etc/haproxy/haproxy.cfg -В конец файла добавляем пока только для перенаправления (для балансироки больше IP адресов): - -frontend frontend-http - bind *:80 - mode http - - # ACL для определения запросов на проверку Let's Encrypt - acl is_certbot path_beg /.well-known/acme-challenge/ - - # Если это не запрос Let's Encrypt, перенаправляем на HTTPS - http-request redirect scheme https code 301 unless is_certbot - - # Отправляем запросы Let's Encrypt на backend-certbot - use_backend backend-certbot if is_certbot - - - frontend LOADBALANCER-01 - bind *:80 - bind *:443 ssl crt /etc/haproxy/ssl/mqtt.kz.pem crt /etc/ssl/certs/bigfoottrade_kz.pem - mode http #режим работы HAProxy, в http режиме происходит анализ Layer 7 трафика - option httpclose #Закрывает пассивные соединения - - acl v_geoserver2 hdr(host) -i geoserver2.ccalm.org - use_backend geoserver2_ccalm_org if v_geoserver2 - - #Перенаправление одной страницы по адресу http://geoserver2.ccalm.org/data/ на другой backend - acl v_geo_data hdr(host) -i geoserver2.ccalm.org/data - use_backend WEBSERVERS-01 if v_geo_data - - - default_backend WEBSERVERS-01 - - backend WEBSERVERS-01 - balance roundrobin - server web10 127.0.0.1:8081 check inter 5s ssl verify none - option httpchk - - backend geoserver2_ccalm_org - balance roundrobin - server web1 192.168.0.90:80 check - option httpchk - - listen stats - bind *:8989 - stats enable - stats uri / - stats realm Haproxy\ Statistics - stats auth igor:i123456 - -frontend f-RabbitMQ - mode tcp - bind 10.1.7.73:21000 - default_backend b-RabbitMQ - -backend b-RabbitMQ - mode tcp - server srv1 10.10.16.21:20000 - -Для перенаправления незащищённого HTTP трафика можно: xxxxxxxxxxxxxxx - -Для использования SSL и перенаправляние по обычному сокету для начала нужно настроить pem файл объеденив crt и key (и незабыть изменить порт Apache с 433) - cat /etc/ssl/certs/bigfoottrade_kz.crt /etc/ssl/certs/bigfoottrade_kz_ca.crt /etc/ssl/private/bigfoottrade_kz.key > /etc/haproxy/ssl/bigfoottrade_kz.pem - cat AAA_Certificate_Services.crt GoGetSSL_RSA_DV_CA.crt istransit_kz.crt istransit_kz.key > istransit_kz.pem - - SSLCertificateFile - SSLCertificateKeyFile - -Для включения WEB статистики на 9000 порту добавить в конец конфигурации: - listen stats - bind *:8989 - stats enable - stats uri /stats - stats realm Haproxy\ Statistics - stats auth igor:i123456 -Тестирую файл конфигурации: - haproxy -f /etc/haproxy/haproxy.cfg -c -Перезагружаем: - sudo systemctl restart haproxy -И теперь должно открываться но адресу: http://data.ccalm.org:8989/ -Обязательно проверить как установился SSL чекером: https://www.leaderssl.ru/tools/ssl_checker - -**************************************************************************************************** -Бесплатный SSL сертификат Let’s Encrypt для HAPROXY https://serversforhackers.com/c/letsencrypt-with-haproxy - На новой убунте по моему уже не обязательно выполнять так как новая версия уже есть в репозитории: sudo add-apt-repository -y ppa:certbot/certbot - sudo apt-get update - sudo apt-get install -y certbot - -Для удаления PPA нужно выполнить: - sudo apt-get remove certbot - sudo add-apt-repository --remove ppa:certbot/certbot - apt-get install -f - apt autoremove - -Если включён файрволл то разрешаем порт: - sudo ufw allow 9080/tcp -Проверяем что автообновление в certbot работает для этого выполняем команду: - sudo systemctl status certbot.timer -Затем пытаемся выполнить пробный прогон при помощи команды: - sudo certbot renew --dry-run - -Согласно инструкции модифицируем конфигурационный файл haproxy добавив во frontend это: - # ACL for detecting Let's Encrypt validtion requests - acl is_certbot path_beg /.well-known/acme-challenge/ - use_backend backend-certbot if is_certbot - -А также ещё один backend: - # Certbot backend - # Contains certbot stand-alone webserver - backend backend-certbot - mode http - server certbot 127.0.0.1:9080 - -Перезагрузить и выполнить команду: - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d git.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d ru.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d rug.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive - - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d kz.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d kzg.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive - - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d locust.kz --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d test.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d data.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d geoserver2.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d geoserver.ccalm.org --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d stations.istt.kz --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d uspdmanager.istt.kz --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d tourist.istt.kz --email irigm@mail.ru --agree-tos --non-interactive - - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d monitoring.infracos.kz --email irigm@mail.ru --agree-tos --non-interactive - - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d aistransit.kz --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d istransit.kz --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d test.istransit.kz --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d main.istransit.kz --email irigm@mail.ru --agree-tos --non-interactive - - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d transit.istt.kz --email irigm@mail.ru --agree-tos --non-interactive - - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d geovizor.com --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d mqtt.kz --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d observer.kz --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d rigor.kz --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d pal.kz --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d elektronnaya-ochered.kz --email irigm@mail.ru --agree-tos --non-interactive - certbot certonly --rsa-key-size 2048 --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 -d mcp.kz --email irigm@mail.ru --agree-tos --non-interactive - -После генерации файлы будут в: - /etc/letsencrypt/live/geoserver2.ccalm.org/fullchain.pem - /etc/letsencrypt/live/geoserver2.ccalm.org/privkey.pem - -Для обновления создаём файл /etc/letsencrypt/renew.sh (по моему этот скрипт не нужен так как рабтает сервис certbot.timer): - #!/bin/bash - certbot renew --standalone --preferred-challenges http --http-01-address 127.0.0.1 --http-01-port 9080 --post-hook "/etc/haproxy/prepare.sh" --quiet - -Но для HAProxy нужно чтобы 2 файла были объединены поэтому добавляю спец скрипт /etc/haproxy/prepare.sh: - #!/bin/bash - - # Loop through all Let's Encrypt certificates - for CERTIFICATE in `find /etc/letsencrypt/live/* -type d`; do - - CERTIFICATE=`basename $CERTIFICATE` - - # Combine certificate and private key to single file - cat /etc/letsencrypt/live/$CERTIFICATE/fullchain.pem /etc/letsencrypt/live/$CERTIFICATE/privkey.pem > /etc/haproxy/ssl/$CERTIFICATE.pem - - done - systemctl reload haproxy.service - -Обновляем конфигурацию HAProxy добавив в frontend: - bind *:443 ssl crt /etc/haproxy/ssl/mqtt.kz.pem - -Устанавливаем права - chmod +x /etc/haproxy/renew.sh - chmod +x /etc/haproxy/prepare.sh -И добавляем задание в cron "crontab -e" ниже текст это раз в 24 часа в 00:00:00 ночи: - 0 0 * * * /bin/sh /etc/letsencrypt/renew.sh - **************************************************************************************************** Подключение стронних SSL сертификатов, допустим с gogetssl.com После покупки сертификата в .pem файл нужно переписать такие ключи и сертификаты как: @@ -4412,76 +4228,3 @@ server: sudo systemctl restart smbd sudo systemctl enable smbd -**************************************************************************************************** -Туннелирование SSH через HTTP при помощи https://github.com/larsbrinkhoff/httptunnel: - sudo apt-get install httptunnel - -Настроил haproxy примерно так, чтобы проверялся параметр "mybiglogfile" для редиректа: - -frontend frontend-http - bind *:80 - mode http - - acl v_tunnel url_param(mybiglogfile) -m found - use_backend httptunnel_backend if v_tunnel - - http-request redirect scheme https code 301 unless { ssl_fc } || v_tunnel - -Если есть проксирование через Nginx то добавляем в конфигурацю это: -proxy_http_version 1.1; -proxy_set_header Host $host; -proxy_set_header X-Real-IP $remote_addr; -proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; -proxy_set_header Connection ""; -proxy_pass_request_body on; - -Проверить нет ли редиректо можно так: - curl -I http://192.168.200.81/index.html?mybiglogfile=all - curl -I http://locust.kz/index.html?mybiglogfile=all - -На сервере запустил прослушку на 9999 и перенаправление на 22: - sudo hts -F 127.0.0.1:22 9999 -Для остановки - ps aux | grep hts - sudo kill 1854 - -Можно запустить как сервис так sudo mcedit /etc/systemd/system/httptunnel.service: -[Unit] -Description=HTTP Tunnel Service -After=network.target - -[Service] -ExecStart=hts -F 127.0.0.1:22 9999 -Restart=always -User=root - -[Install] -WantedBy=multi-user.target - -Потом: - sudo systemctl daemon-reload - sudo systemctl enable httptunnel - sudo systemctl start httptunnel - sudo systemctl status httptunnel - tail -f /var/log/syslog | grep --line-buffered "htc" - -На клиенте запускаем локальный порт также указал 9999 а ключь - htc -F 9999 --base-uri /index.html?mybiglogfile=all 192.168.200.81:80 - htc -F 9999 --base-uri /index.html?mybiglogfile=all locust.kz:80 - -Для остановки - ps aux | grep htc -Потом - sudo kill 783 - -Пробую подключиться после настройки тунеля: - ssh igor@127.0.0.1 -p 9999 -**************************************************************************************************** -Установка Gotify через докер контейнер - sudo apt update && sudo apt install -y docker.io docker-compose -sudo mkdir -p /opt/gotify - cd /opt/gotify -Создадим конфигурацию: - sudo nano /opt/gotify/docker-compose.yml - - diff --git a/Uptime_Kuma_install.md b/Uptime_Kuma_install.md new file mode 100644 index 0000000..86145cd --- /dev/null +++ b/Uptime_Kuma_install.md @@ -0,0 +1,66 @@ +# Установка Uptime Kuma в Ubuntu 24.04 с помощью Docker Compose + +## 1. Установка необходимых пакетов +Обновите систему и установите Docker и Docker Compose: + +```sh +sudo apt update && sudo apt upgrade -y +sudo apt install -y docker.io docker-compose +``` + +## 2. Создание директории для Uptime Kuma +```sh + sudo mkdir -p /opt/uptime-kuma + cd /opt/uptime-kuma +``` + +## 3. Создание `docker-compose.yml` +Создайте файл `docker-compose.yml`: + +```sh + sudo mcedit /opt/uptime-kuma/docker-compose.yml +``` + +Вставьте следующий конфигурационный файл: + +```yaml +services: + uptime-kuma: + image: louislam/uptime-kuma:latest + container_name: uptime-kuma + restart: always + ports: + - "3001:3001" + volumes: + - ./data:/app/data +``` + +## 4. Запуск контейнера +```sh + sudo docker-compose up -d +``` + +## 5. Проверка работы Uptime Kuma +Откройте браузер и перейдите по адресу: + +```sh +start http://192.168.200.84:3001 +``` + +## 6. Управление контейнером +- **Остановить Uptime Kuma:** +```sh + sudo docker-compose down +``` +- **Перезапустить контейнер:** +```sh + sudo docker-compose restart +``` +- **Просмотреть логи:** + +```sh + sudo docker-compose logs -f +``` + +Готово! Uptime Kuma установлен и запущен в Docker на Ubuntu 24.04. 🚀 +