stage(oscap.remediation): link /proc/self/fd to /dev/fd
Remediation bash didn't work correctly without /dev/fd. Link /proc/self/fd to /dev/fd within the tree.
This commit is contained in:
parent
edbf409a40
commit
810a48d859
1 changed files with 7 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import osbuild.api
|
import osbuild.api
|
||||||
|
from osbuild.util.mnt import mount
|
||||||
|
|
||||||
SCHEMA = """
|
SCHEMA = """
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
|
@ -206,6 +207,12 @@ def main(tree, options):
|
||||||
f"{data_dir}/{REMEDIATION_SCRIPT}"
|
f"{data_dir}/{REMEDIATION_SCRIPT}"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
for source in ("/dev", "/proc"):
|
||||||
|
target = os.path.join(tree, source.lstrip("/"))
|
||||||
|
os.makedirs(target, exist_ok=True)
|
||||||
|
mount(source, target, ro=False)
|
||||||
|
os.symlink("/proc/self/fd", f"{tree}/dev/fd")
|
||||||
|
|
||||||
log = None
|
log = None
|
||||||
if verbose_log is not None:
|
if verbose_log is not None:
|
||||||
log = open(f"{tree}/{data_dir}/{verbose_log}.remediation", "w", encoding="utf8")
|
log = open(f"{tree}/{data_dir}/{verbose_log}.remediation", "w", encoding="utf8")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue