feat: add MAXKB_SANDBOX_PYTHON_BANNED_HOSTS env to ban host for sandbox in tools code.
parent
9971df1a02
commit
b7152867a3
|
|
@ -197,7 +197,7 @@ exec({dedent(code)!a})
|
||||||
file.write(_code)
|
file.write(_code)
|
||||||
os.system(f"chown {self.user}:root {exec_python_file}")
|
os.system(f"chown {self.user}:root {exec_python_file}")
|
||||||
kwargs = {'cwd': BASE_DIR}
|
kwargs = {'cwd': BASE_DIR}
|
||||||
kwargs['env'] = {'LD_PRELOAD': '/opt/maxkb-app/apps/sanbox_ban_host.so'}
|
kwargs['env'] = {'LD_PRELOAD': '/opt/maxkb-app/apps/sandbox.so'}
|
||||||
subprocess_result = subprocess.run(
|
subprocess_result = subprocess.run(
|
||||||
['su', '-s', python_directory, '-c', "exec(open('" + exec_python_file + "').read())", self.user],
|
['su', '-s', python_directory, '-c', "exec(open('" + exec_python_file + "').read())", self.user],
|
||||||
text=True,
|
text=True,
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ RUN apt-get update && \
|
||||||
apt-get clean all && \
|
apt-get clean all && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
WORKDIR /opt/maxkb-app
|
WORKDIR /opt/maxkb-app
|
||||||
RUN gcc -shared -fPIC -o /opt/maxkb-app/apps/sanbox_ban_host.so /opt/maxkb-app/installer/sanbox_ban_host.c -ldl && \
|
RUN gcc -shared -fPIC -o /opt/maxkb-app/apps/sandbox.so /opt/maxkb-app/installer/sandbox.c -ldl && \
|
||||||
rm -rf /opt/maxkb-app/ui && \
|
rm -rf /opt/maxkb-app/ui && \
|
||||||
pip install uv --break-system-packages && \
|
pip install uv --break-system-packages && \
|
||||||
python -m uv pip install -r pyproject.toml && \
|
python -m uv pip install -r pyproject.toml && \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue