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

ifupdown2 will run all scripts regardless of the execute bit being set #89

Closed
gedia opened this issue Jan 9, 2019 · 6 comments
Closed
Assignees
Milestone

Comments

@gedia
Copy link

gedia commented Jan 9, 2019

Hello,

I believe I've found a point where ifupdown2 behaviour significantly diverges from ifupdown on debian stretch. I'm using ifupdown2-1.2.1 and I needed to replace the stock /etc/network/if-up.d/openssh-server script with a custom version of it, so I used dpkg-divert to rename the original file and then removed the execute bit from the diverted version.

Original ifupdown uses run-parts which supposedly doesn't run non-executable files in the directory. However, ifupdown2 doesn't seem to make this distinction. Is it possible to make ifupdown2 behave similarly to ifupdown in this respect?

@roopa-prabhu
Copy link
Contributor

roopa-prabhu commented Jan 9, 2019 via email

@julienfortin julienfortin self-assigned this Jan 16, 2019
@julienfortin julienfortin added this to the 1.2.5 milestone Jan 16, 2019
@julienfortin
Copy link
Contributor

Hello @gedia,

Can you please provide ifup -a -d output? I'm not able to reproduce, see logs below:

[6:50:41] root:if-up.d # cat no_permission_ls.sh
ls -l
[6:50:42] root:if-up.d # ll no_permission_ls.sh
-rw-r--r-- 1 root root 6 Jan 16 06:50 no_permission_ls.sh
[6:50:48] root:if-up.d # ifup -a
error: lo : lo: up cmd '/etc/network/if-up.d/no_permission_ls.sh' failed ([Errno 13] Permission denied)
error: enp0s3 : enp0s3: up cmd '/etc/network/if-up.d/no_permission_ls.sh' failed ([Errno 13] Permission denied)

@roopa-prabhu
Copy link
Contributor

@julienfortin instead of error'ing out, the ask is to not try to execute the script

@julienfortin
Copy link
Contributor

@roopa-prabhu I'm afraid that this might confuse users who won't pay attention to the permission on the file, and might wonder why their script is not executed..?
Maybe we can have a log info "Permission denied" ?

@roopa-prabhu
Copy link
Contributor

roopa-prabhu commented Jan 17, 2019 via email

@gedia
Copy link
Author

gedia commented Jan 17, 2019

Actually, what prompted me to open this issue is that when systemd restarts networking, for example, the failure of the script's execution will also cause the systemd unit to fail.

Printing a "Permission denied" error is, of course, desirable, but my main concern here is that the networking systemd service unit will exit cleanly (sorry, I should have elaborated more in my initial report).

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

No branches or pull requests

3 participants