Skip to content

Commit

Permalink
sync (#2437)
Browse files Browse the repository at this point in the history
* fix #2409 (#2430)

* Add variable exports for Successful Post Hook and Renew Hook calls (#2431)

* fixed json parse regex for support api gcore_cdn (#2381)

* start 2.8.3 Forbidden sudo
  • Loading branch information
Neilpang committed Aug 11, 2019
1 parent ee38ccc commit a336180
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion acme.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

VER=2.8.2
VER=2.8.3

PROJECT_NAME="acme.sh"

Expand Down Expand Up @@ -135,6 +135,8 @@ _DNS_MANUAL_WIKI="https://github.com/Neilpang/acme.sh/wiki/dns-manual-mode"

_NOTIFY_WIKI="https://github.com/Neilpang/acme.sh/wiki/notify"

_SUDO_WIKI="https://github.com/Neilpang/acme.sh/wiki/sudo"

_DNS_MANUAL_ERR="The dns manual mode can not renew automatically, you must issue it again manually. You'd better use the other modes instead."

_DNS_MANUAL_WARN="It seems that you are using dns manual mode. please take care: $_DNS_MANUAL_ERR"
Expand Down Expand Up @@ -6233,6 +6235,23 @@ _processAccountConf() {

}

_checkSudo() {
if [ "$SUDO_GID" ] && [ "$SUDO_COMMAND" ] && [ "$SUDO_USER" ] && [ "$SUDO_UID" ]; then
if [ "$SUDO_USER" = "root" ] && [ "$SUDO_UID" = "0" ]; then
#it's root using sudo, no matter it's using sudo or not, just fine
return 0
fi
if [ "$SUDO_COMMAND" = "/bin/su" ]; then
#it's a normal user doing "sudo su"
#fine
return 0
fi
#otherwise
return 1
fi
return 0
}

_process() {
_CMD=""
_domain=""
Expand Down Expand Up @@ -6761,6 +6780,14 @@ _process() {
done

if [ "${_CMD}" != "install" ]; then
if [ "$__INTERACTIVE" ] && ! _checkSudo; then
if [ -z "$FORCE" ]; then
#Use "echo" here, instead of _info. it's too early
echo "It seems that you are using sudo, please read this link first:"
echo "$_SUDO_WIKI"
return 1
fi
fi
__initHome
if [ "$_log" ]; then
if [ -z "$_logfile" ]; then
Expand Down

0 comments on commit a336180

Please sign in to comment.