mirror of https://github.com/apache/nifi.git
NIFI-145: Make nifi.pid writable by owner
This commit is contained in:
parent
1a231d8b95
commit
c1681d95f6
|
@ -36,9 +36,11 @@ import java.nio.file.attribute.PosixFilePermission;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
@ -217,7 +219,10 @@ public class RunNiFi {
|
|||
}
|
||||
|
||||
try {
|
||||
Files.setPosixFilePermissions(statusFile.toPath(), Collections.singleton(PosixFilePermission.OWNER_READ));
|
||||
final Set<PosixFilePermission> perms = new HashSet<>();
|
||||
perms.add(PosixFilePermission.OWNER_READ);
|
||||
perms.add(PosixFilePermission.OWNER_WRITE);
|
||||
Files.setPosixFilePermissions(statusFile.toPath(), perms);
|
||||
} catch (final Exception e) {
|
||||
logger.warning("Failed to set permissions so that only the owner can read status file " + statusFile + "; this may allows others to have access to the key needed to communicate with NiFi. Permissions should be changed so that only the owner can read this file");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue