Compare commits
2 commits
42056f3df6
...
0be4944a74
| Author | SHA1 | Date | |
|---|---|---|---|
| 0be4944a74 | |||
| 3a674d9e3b |
1 changed files with 6 additions and 6 deletions
12
app.py
12
app.py
|
|
@ -1209,15 +1209,15 @@ SYSCTL_AUDIT_KEYS = (
|
||||||
|
|
||||||
|
|
||||||
def _sysctl_audit_command() -> str:
|
def _sysctl_audit_command() -> str:
|
||||||
script = f'''import glob, json, subprocess
|
script = f'''import glob, json
|
||||||
|
from pathlib import Path
|
||||||
keys = {SYSCTL_AUDIT_KEYS!r}
|
keys = {SYSCTL_AUDIT_KEYS!r}
|
||||||
live, errors = {{}}, {{}}
|
live, errors = {{}}, {{}}
|
||||||
for key in keys:
|
for key in keys:
|
||||||
result = subprocess.run(["sysctl", "-n", key], capture_output=True, text=True)
|
try:
|
||||||
if result.returncode == 0:
|
live[key] = Path("/proc/sys/" + key.replace(".", "/")).read_text().strip()
|
||||||
live[key] = result.stdout.strip()
|
except OSError as exc:
|
||||||
else:
|
errors[key] = str(exc)[:160]
|
||||||
errors[key] = result.stderr.strip()[:160]
|
|
||||||
persistent = {{}}
|
persistent = {{}}
|
||||||
for path in ["/etc/sysctl.conf", *sorted(glob.glob("/etc/sysctl.d/*.conf"))]:
|
for path in ["/etc/sysctl.conf", *sorted(glob.glob("/etc/sysctl.d/*.conf"))]:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue