Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] The http.conf file is not written after modifying the service configuration in the Web UI. #639

Closed
2 tasks done
weizhuangzhi opened this issue Sep 14, 2023 · 11 comments
Labels
bug Something isn't working need more info

Comments

@weizhuangzhi
Copy link

What happened?

Add a service mysite.net in the Web UI and set up a reverse proxy and save it. Mysite.net can be accessed.

Modify the configuration, set Activate DNSBL to false and save, mysite.net cannot be accessed.
Re-modify the configuration, set Activate DNSBL to true and save, so mysite.net can be accessed.

I'm not sure if this is unique to the Activate DNSBL setting, but modifying the Activate DNSBL option reproduced the issue for me.

How to reproduce?

I compared the files in the /etc/nginx directory before and after the settings, and found that when the /etc/nginx/http.conf file was inaccessible, the content of the /etc/nginx/http.conf file was missing at the end include /etc/nginx/mysite.net/server.conf;

Configuration file(s) (yaml or .env)

DNS_RESOLVERS=8.8.8.8 8.8.4.4
HTTP_PORT=80
HTTPS_PORT=443
API_LISTEN_IP=127.0.0.1
API_HTTP_PORT=7001
SERVER_NAME=bunker6.tt
MULTISITE=yes

bunker6.tt_USE_UI=yes
bunker6.tt_USE_REVERSE_PROXY=yes
bunker6.tt_REVERSE_PROXY_URL=/manage
bunker6.tt_REVERSE_PROXY_HOST=http://127.0.0.1:7000
bunker6.tt_INTERCEPTED_ERROR_CODES=400 404 405 413 429 500 501 502 503 504

Relevant log output

nothing

BunkerWeb version

1.5.2

What integration are you using?

Linux

Linux distribution (if applicable)

Fedora 38 (updated to the latest)

Removed private data

  • I have removed all private data from the configuration file and the logs

Code of Conduct

  • I agree to follow this project's Code of Conduct
@weizhuangzhi weizhuangzhi added the bug Something isn't working label Sep 14, 2023
@TheophileDiot
Copy link
Member

Hi @weizhuangzhi, I couldn't manage to reproduce your error. Is it possible that you give us more information about the steps to reproduce your error ?

@weizhuangzhi
Copy link
Author

Could it be related to url accessibility in Global_config's DNSBL list?

Sometimes these URLs cannot be accessed in an intranet environment, and Plugins sometimes displays: PLUGINS ERRORS 1

Can it be reproduced if the URL in the DNSBL list is set to a non-existent URL?
If this affects whether the configuration can be saved, ignore this accessibility issue. I have tested it many times and it seems that it cannot be reproduced every time. If a problem occurs and it seems that the program has interrupted execution, delete the configuration directory of the site and execute this process. But the re-creation process is not executed.

@weizhuangzhi
Copy link
Author

Reinstalled and tested again.

sudo dnf update -y
sudo dnf install -y nginx-1.24.0
curl -s https://packagecloud.io/install/repositories/bunkerity/bunkerweb/script.rpm.sh | \
sed 's/yum install -y pygpgme --disablerepo='\''bunkerity_bunkerweb'\''/yum install -y python-gnupg/g' | \
sed 's/pypgpme_check=`rpm -qa | grep -qw pygpgme`/python-gnupg_check=`rpm -qa | grep -qw python-gnupg`/g' | sudo bash && \
sudo dnf makecache && \
sudo dnf install -y bunkerweb-1.5.2

sudo tee /etc/bunkerweb/ui.env >/dev/null <<EOF
ADMIN_USERNAME=administrator
ADMIN_PASSWORD=*************
EOF

sudo tee /etc/bunkerweb/variables.env >/dev/null <<EOF
DNS_RESOLVERS=8.8.8.8 8.8.4.4
HTTP_PORT=80
HTTPS_PORT=443
API_LISTEN_IP=127.0.0.1
API_HTTP_PORT=7001
SERVER_NAME=bunker6.tt
MULTISITE=yes

bunker6.tt_USE_UI=yes
bunker6.tt_USE_REVERSE_PROXY=yes
bunker6.tt_REVERSE_PROXY_URL=/manage
bunker6.tt_REVERSE_PROXY_HOST=http://127.0.0.1:7000
bunker6.tt_INTERCEPTED_ERROR_CODES=400 404 405 413 429 500 501 502 503 504
EOF

# restart service
sudo systemctl restart bunkerweb
sudo systemctl status bunkerweb --no-pager
sudo systemctl restart bunkerweb-ui
sudo systemctl status bunkerweb-ui --no-pager

# open firewall web ports
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

Visit http://bunker6.tt/manage/ to enter the Web UI. In order to simulate the situation where the DNSBL URL is inaccessible, set the Global configs DNSBL list to: dnsbl.unknown.net, and then save it.

To avoid the impact of caching, etc., run the following command:
sudo systemctl restart bunkerweb
sudo systemctl restart bunkerweb-ui

Enter the Web UI, create a service, set the Server name to: mysite.net, save other settings without setting them, and view the files in the /etc/nginx directory:
image

Enter the Web UI, edit the mysite.net service, save it directly without modifying any settings, and view the files in the /etc/nginx directory:
image

It is not a problem of slow execution of the background program, because after waiting for a long time, there is still no mysite.net directory generated.

@TheophileDiot
Copy link
Member

Hi @weizhuangzhi, we'll shortly push a new testing release for Linux packages, could you test if the issue still occurs with it ?

@weizhuangzhi
Copy link
Author

Okay, I'll test it as soon as it's released.

@TheophileDiot
Copy link
Member

Hi @weizhuangzhi the dev finally passed (after a lot of tinkering), you can test it on this release if you want

@weizhuangzhi
Copy link
Author

I updated the file using the dev branch.

This problem could always be reproduced before, but now it occurs occasionally.

The other test environments have not changed. Edit the service (modify or not modify the configuration items) and save it. About 5-10 times, the mysite.net folder will not be generated, and there seems to be no pattern. (Deleted, recreated, modified many times)

I use watch -n 0.1 -d "ls -l /etc/nginx" on the command line to monitor whether the folder is generated.

In addition, after modifying the service, I encountered "err_connection_refused" errors 2 to 3 times, and the web ui site was also inaccessible. No abnormalities were found using "systemctl status bunkerweb" and "systemctl status bunkerweb-ui". I think the generated nginx configuration may be problems, use "nginx -t":

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

No configuration error was found, so nginx -s reload was executed.

nginx: [error] invalid PID number "" in "/var/run/bunkerweb/nginx.pid"

It was found that the nginx.pid file was empty and had no pid number. However, this problem is more difficult to reproduce. It may not be a problem with bunkerweb but a problem with my environment. This is for reference only.

@weizhuangzhi
Copy link
Author

Comparison of nginx configuration directories when generating files successfully and unsuccessfully:
image

http.conf : There is one line of difference.
image

variables.env : All variable definitions starting with "mysite.net_" are missing.
image

@TheophileDiot
Copy link
Member

Interesting, i'll try this again when I have the time

@TheophileDiot
Copy link
Member

Hi @weizhuangzhi a few fixes and optimisation have been done since yesterday. If you have the time, you can test the latests changes with the dev tag.
This commit might have fixed your issue : 48096d7

@weizhuangzhi
Copy link
Author

@TheophileDiot Thank you, this problem no longer exists in the dev branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need more info
Projects
None yet
Development

No branches or pull requests

2 participants