Remove the requirement to run as root
This commit is contained in:
@@ -32,11 +32,16 @@ class Issue implements Command {
|
||||
|
||||
private function doExecute(Manager $args): Generator {
|
||||
if (posix_geteuid() !== 0) {
|
||||
throw new AcmeException("Please run this script as root!");
|
||||
$processUser = posix_getpwuid(posix_geteuid());
|
||||
$currentUsername = $processUser['name'];
|
||||
$user = $args->get("user") ?? $currentUsername;
|
||||
if ($currentUsername !== $user) {
|
||||
throw new AcmeException("Running this script with --user only works as root");
|
||||
}
|
||||
} else {
|
||||
$user = $args->get("user") ?? "www-data";
|
||||
}
|
||||
|
||||
$user = $args->get("user") ?? "www-data";
|
||||
|
||||
$server = $args->get("server");
|
||||
$protocol = substr($server, 0, strpos("://", $server));
|
||||
|
||||
|
||||
@@ -29,10 +29,6 @@ class Register implements Command {
|
||||
}
|
||||
|
||||
public function doExecute(Manager $args): Generator {
|
||||
if (posix_geteuid() !== 0) {
|
||||
throw new AcmeException("Please run this script as root!");
|
||||
}
|
||||
|
||||
$email = $args->get("email");
|
||||
yield resolve($this->checkEmail($email));
|
||||
|
||||
|
||||
@@ -27,10 +27,6 @@ class Revoke implements Command {
|
||||
}
|
||||
|
||||
private function doExecute(Manager $args): Generator {
|
||||
if (posix_geteuid() !== 0) {
|
||||
throw new AcmeException("Please run this script as root!");
|
||||
}
|
||||
|
||||
$server = $args->get("server");
|
||||
$protocol = substr($server, 0, strpos("://", $server));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user