hmgle / graftcp

A flexible tool for redirecting a given program's TCP traffic to SOCKS5 or HTTP proxy.
GNU General Public License v3.0
2.07k stars 174 forks source link

modify systemdScript template #24

Closed TonyAble closed 4 years ago

TonyAble commented 4 years ago

Without /bin/bash -c ,systemd may not know how to start the graftcp-local and "systemctl start graftcp-local.service" will fail.

hmgle commented 4 years ago

I cannot reproduce the problem on my host, so I'm not sure if it's a problem. Could you report the environment(may be '/etc/issue', etc.) on your host? As the service_systemd_linux.go file is part of the github.com/kardianos/service project, I think the newer versions of kardianos/service may have solved this problem. If you find the version that works, you could update the service_systemd_linux.go file to keep up that version of the upstream, and update this pull reqeust. Thank you.

TonyAble commented 4 years ago

I cannot reproduce the problem on my host, so I'm not sure if it's a problem. Could you report the environment(may be '/etc/issue', etc.) on your host? As the service_systemd_linux.go file is part of the github.com/kardianos/service project, I think the newer versions of kardianos/service may have solved this problem. If you find the version that works, you could update the service_systemd_linux.go file to keep up that version of the upstream, and update this pull reqeust. Thank you.

This is not a go program problem,it may happen because different distros have ther own features.I am using Fedora 31,it doesn't work.And I have tested in Debian 10 and Ubuntu 18.04,it works.It is quite confusing. 这不像是那个包的问题,看起来是不同发行版systemd实现的差异,我用的是Fedora 31,systemd不能够识别如何执行braftcp-local,但是测试了一下,Debian 10 和Ubuntu 18.04都可以。。。没有在其他平台再做测试了,反正在模板里加上/bin/bash -c 也不会对能正常运行的发行版造成影响,在上述三个平台测试都没有问题。

hmgle commented 4 years ago

I reproduced this problem on a Fedora virtual machine. It's caused by the SElinux, SELinux prevents you from running a system service where the binary is in a user's home directory.

https://serverfault.com/questions/957084/failed-at-step-exec-spawning-permission-denied/957087#957087