Bug 48777 - podsec-create-services создаёт дублирующую запись в /etc/nginx/sites-available.d/default.conf
Summary: podsec-create-services создаёт дублирующую запись в /etc/nginx/sites-availabl...
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: podsec (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: kaf@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-12 14:58 MSK by Alexander Makeenkov
Modified: 2024-02-29 18:15 MSK (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Makeenkov 2023-12-12 14:58:29 MSK
Версия пакета:
podsec-1.0.8-alt1

Шаги воспроизведения:
# apt-get install podsec
# podsec-create-policy 192.168.0.10
# podsec-create-services

Получаемый результат:
Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nginx
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/nginx.service.
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.
registry
Created symlink /etc/systemd/system/multi-user.target.wants/docker-registry.service → /lib/systemd/system/docker-registry.service.

# systemctl status nginx.service 
× nginx.service - The nginx HTTP and reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Tue 2023-12-12 14:53:02 MSK; 2min 44s ago
        CPU: 22ms

дек 12 14:53:02 podsec-master systemd[1]: Starting The nginx HTTP and reverse proxy server...
дек 12 14:53:02 podsec-master nginx[8538]: nginx: [emerg] a duplicate listen 0.0.0.0:81 in /etc/nginx/sites-enabled.d/default.conf:8
дек 12 14:53:02 podsec-master nginx[8538]: nginx: configuration file /etc/nginx/nginx.conf test failed
дек 12 14:53:02 podsec-master systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
дек 12 14:53:02 podsec-master systemd[1]: nginx.service: Failed with result 'exit-code'.
дек 12 14:53:02 podsec-master systemd[1]: Failed to start The nginx HTTP and reverse proxy server.

# grep listen /etc/nginx/sites-available.d/default.conf
        listen 0.0.0.0:81;
        listen 0.0.0.0:81;
Comment 1 ALexey Kostarev 2024-02-26 10:09:24 MSK
Добрый день
Если нетрудно приложите весь файл /etc/nginx/sites-available.d/default.conf
У меня (правда кое-каких корретировок) файл формируется корректно
Возмоэно у Вас был поавторный вызов скрипта
Comment 2 Artem Varaksa 2024-02-29 18:15:15 MSK
Ошибка исправлена по состоянию на версию podsec-1.0.10-alt4.

Проблема была в том, что:

        listen  127.0.0.1:80;
        listen  [::1]:80;

Заменялось на:

        listen 0.0.0.0:81;
        listen 0.0.0.0:81;

А теперь корректно заменяется на:

        listen 0.0.0.0:81;
        listen  [::1]:81;

Лишний пробел, конечно, но на функционал, насколько понимаю, это не влияет.

Коммит с исправлением: https://git.altlinux.org/gears/p/podsec.git?p=podsec.git;a=blobdiff;f=podsec/bin/podsec-create-services;h=d63c1049f56e7135b95cd0f343423072c0dc05af;hp=ea136dd387aa066446bbdf33e41da93aacd86aa8;hb=f8eb3620849244ec89896a864bfa6cfa096e5623;hpb=c0def7c6ca3ec8635e1a9cb31be058d92481705b