acme.sh icon indicating copy to clipboard operation
acme.sh copied to clipboard

sudo warning

Open justinnoor opened this issue 5 years ago • 5 comments

Hello,

This issue report says not to run sudo, but to use sudo su, and then issue the certs as root. However, when doing so, it throws this error:

It seems that you are using sudo, please read this link first: https://github.com/Neilpang/acme.sh/wiki/sudo

This a FreeBSD-12.0-RELEASE-p10 machine with an OpenBSD httpd webserver, which chroots the /var/www/htdocs directory. Web content is only accessible by the www user, which has limited access to the system. Hence the cert must be issued as root.

Do we still need to pass the --force flag, even as root?

Thank you

justinnoor avatar Nov 14 '19 15:11 justinnoor

please show me the env:

sudo su

env

Neilpang avatar Nov 15 '19 14:11 Neilpang

Yes the warning makes no sense. I have a wrapper script that I run using sudo, which handles some stuff like putting certificate files into the right directories and su's to the unprivileged acme user to run acme.sh. However acme.sh still complains about the use of sudo. I work around it by unsetting the variables SUDO_UID, SUDO_GID and SUDO_USER in the wrapper script before calling acme.sh.

AgentOak avatar Nov 15 '19 14:11 AgentOak

Below is my my env. On FreeBSD, the root user defaults to /bin/csh, and the others default to /bin/sh. However, as root, I specifically entered /bin/sh before executing acme.sh.

VENDOR=amd SUDO_COMMAND=/usr/bin/su LOGNAME=root PAGER=less OSTYPE=FreeBSD MACHTYPE=x86_64 MAIL=/var/mail/root PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin EDITOR=vi HOST=myserver REMOTEHOST=XXX.XX.XXX.XX.lightspeed.sntcca.sbcglobal.net OLDPWD=/root SUDO_GID=1002 PWD=/root GROUP=wheel TERM=st-256color HOME=/root USER=root HOSTTYPE=FreeBSD SHELL=/bin/csh SUDO_USER=mysuer SUDO_UID=1002 BLOCKSIZE=K SHLVL=1

justinnoor avatar Nov 19 '19 14:11 justinnoor

@Marco01809 @Neilpang Should be fixed by PR https://github.com/Neilpang/acme.sh/pull/2574.

honzahommer avatar Jan 28 '20 18:01 honzahommer

FYI sudo su does the user assumption operation twice (check the auth logs or watch strace output)

It would be better to document/advise sudo -i or sudo -l @Neilpang

jorhett avatar Nov 23 '23 20:11 jorhett