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

Adding warning message when running APISIX in root path #1201

Closed
wants to merge 4 commits into from
Closed

Adding warning message when running APISIX in root path #1201

wants to merge 4 commits into from

Conversation

sshniro
Copy link
Member

@sshniro sshniro commented Mar 4, 2020

Fix #1196

@membphis
Copy link
Member

membphis commented Mar 4, 2020

You are so cool, submit a PR so soon

bin/apisix Outdated Show resolved Hide resolved
@membphis
Copy link
Member

membphis commented Mar 4, 2020

BTW, if the current user is a root user, we need to add user root; in conf/nginx.conf, otherwise, the APISIX instance will not start properly.

we can add it here:

https://github.com/apache/incubator-apisix/blob/c84d79898cbc2b4029e86a1633f1bda1444e6c3a/bin/apisix#L91

@sshniro
Copy link
Member Author

sshniro commented Mar 4, 2020

BTW, if the current user is a root user, we need to add user root; in conf/nginx.conf, otherwise, the APISIX instance will not start properly.

we can add it here:

https://github.com/apache/incubator-apisix/blob/c84d79898cbc2b4029e86a1633f1bda1444e6c3a/bin/apisix#L91

Will do. Thanks.

@moonming
Copy link
Member

moonming commented Mar 5, 2020

BTW, if the current user is a root user, we need to add user root; in conf/nginx.conf, otherwise, the APISIX instance will not start properly.

we can add it here:

https://github.com/apache/incubator-apisix/blob/c84d79898cbc2b4029e86a1633f1bda1444e6c3a/bin/apisix#L91

we can not run APISIX with user root, which is not safe.
By the way, user should not directly use the root user to start APISIX.

@sshniro
Copy link
Member Author

sshniro commented Mar 5, 2020

BTW, if the current user is a root user, we need to add user root; in conf/nginx.conf, otherwise, the APISIX instance will not start properly.
we can add it here:
https://github.com/apache/incubator-apisix/blob/c84d79898cbc2b4029e86a1633f1bda1444e6c3a/bin/apisix#L91

we can not run APISIX with user root, which is not safe.
By the way, user should not directly use the root user to start APISIX.

Then shall I exit the program if it is a root user? by checking with the whoami ?

@moonming
Copy link
Member

moonming commented Mar 6, 2020

BTW, if the current user is a root user, we need to add user root; in conf/nginx.conf, otherwise, the APISIX instance will not start properly.
we can add it here:
https://github.com/apache/incubator-apisix/blob/c84d79898cbc2b4029e86a1633f1bda1444e6c3a/bin/apisix#L91

we can not run APISIX with user root, which is not safe.
By the way, user should not directly use the root user to start APISIX.

Then shall I exit the program if it is a root user? by checking with the whoami ?

I don't think so, user should check the permission issue by themself. There may be other users and user groups, which is difficult for us to deal with.

@membphis
Copy link
Member

membphis commented Mar 6, 2020

we can not run APISIX with user root, which is not safe.

When the user tries to run APISIX at /root, he can be sure that he is a developer, and we have printed a warning message for this case.

I should allow users to use the / root directory as a temporary development directory.

@soulsoul
Copy link
Member

soulsoul commented Mar 7, 2020

we can not run APISIX with user root, which is not safe.

When the user tries to run APISIX at /root, he can be sure that he is a developer, and we have printed a warning message for this case.

I should allow users to use the / root directory as a temporary development directory.

i agree with you. some developer maybe like run apisix with root user. we need to keep it open and remind them at the right time

@moonming
Copy link
Member

moonming commented Mar 7, 2020 via email

@sshniro
Copy link
Member Author

sshniro commented Mar 7, 2020

@membphis I have fixed the violation for Lua 5.3 and updated the nginx conf with root configurations.

@@ -82,7 +87,9 @@ local ngx_tpl = [=[
# This is a read-only file, do not try to modify it.

master_process on;

{% if is_root_path then %}
user root;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using root as the user is dangerous and is likely to be exploited by hackers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okays, but it won't start when in root dir rite?, I guess from the previous message I understood to allow the user to start but only print warnings?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, you are right:)
IMO, We can print warnings, but we don't need to deal with the permission problem, and we don't need to be compatible with the situation of using root to start Apache APISIX.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, then ill remove the root user configs, and only settle to printing warnings.

@sshniro
Copy link
Member Author

sshniro commented Mar 12, 2020

Hi all, I have accidentally deleted my fork :( , I will raise another PR with the requested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

improvement: print a warning message when running APISIX in /root directory
4 participants