mirror of
https://github.com/Monadical-SAS/cubbi.git
synced 2025-12-20 12:19:07 +00:00
feat: add sudo and sudoers (#20)
* feat: add sudo and sudoers * Update cubbi/images/cubbi_init.py Co-authored-by: pr-agent-monadical[bot] <198624643+pr-agent-monadical[bot]@users.noreply.github.com> --------- Co-authored-by: pr-agent-monadical[bot] <198624643+pr-agent-monadical[bot]@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,7 @@ LABEL description="Aider AI pair programming for Cubbi"
|
|||||||
# Install system dependencies including gosu for user switching
|
# Install system dependencies including gosu for user switching
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
gosu \
|
gosu \
|
||||||
|
sudo \
|
||||||
passwd \
|
passwd \
|
||||||
bash \
|
bash \
|
||||||
curl \
|
curl \
|
||||||
@@ -64,4 +65,4 @@ RUN /cubbi/cubbi_init.py --help
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENTRYPOINT ["/cubbi/cubbi_init.py"]
|
ENTRYPOINT ["/cubbi/cubbi_init.py"]
|
||||||
CMD ["tail", "-f", "/dev/null"]
|
CMD ["tail", "-f", "/dev/null"]
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ Tests Docker image build, API key configuration, and Cubbi CLI integration
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
def run_command(cmd, description="", check=True):
|
def run_command(cmd, description="", check=True):
|
||||||
@@ -156,7 +157,7 @@ def test_cubbi_cli_integration():
|
|||||||
|
|
||||||
assert (
|
assert (
|
||||||
result.returncode == 0
|
result.returncode == 0
|
||||||
and "aider 0.84.0" in result.stdout
|
and re.search(r"aider \d+\.\d+\.\d+", result.stdout)
|
||||||
and "Cubbi CLI test successful" in result.stdout
|
and "Cubbi CLI test successful" in result.stdout
|
||||||
), "Cubbi CLI session creation failed"
|
), "Cubbi CLI session creation failed"
|
||||||
print("✅ Cubbi CLI session creation works")
|
print("✅ Cubbi CLI session creation works")
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ LABEL description="Claude Code for Cubbi"
|
|||||||
# Install system dependencies including gosu for user switching
|
# Install system dependencies including gosu for user switching
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
gosu \
|
gosu \
|
||||||
|
sudo \
|
||||||
passwd \
|
passwd \
|
||||||
bash \
|
bash \
|
||||||
curl \
|
curl \
|
||||||
@@ -69,4 +70,4 @@ RUN /cubbi/cubbi_init.py --help
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENTRYPOINT ["/cubbi/cubbi_init.py"]
|
ENTRYPOINT ["/cubbi/cubbi_init.py"]
|
||||||
CMD ["tail", "-f", "/dev/null"]
|
CMD ["tail", "-f", "/dev/null"]
|
||||||
|
|||||||
@@ -222,6 +222,16 @@ class UserManager:
|
|||||||
):
|
):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Create the sudoers file entry for the 'cubbi' user
|
||||||
|
sudoers_command = [
|
||||||
|
"sh",
|
||||||
|
"-c",
|
||||||
|
"echo 'cubbi ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/cubbi && chmod 0440 /etc/sudoers.d/cubbi",
|
||||||
|
]
|
||||||
|
if not self._run_command(sudoers_command):
|
||||||
|
self.status.log("Failed to create sudoers entry for cubbi", "ERROR")
|
||||||
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ LABEL description="Goose for Cubbi"
|
|||||||
# Install system dependencies including gosu for user switching and shadow for useradd/groupadd
|
# Install system dependencies including gosu for user switching and shadow for useradd/groupadd
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
gosu \
|
gosu \
|
||||||
|
sudo \
|
||||||
passwd \
|
passwd \
|
||||||
bash \
|
bash \
|
||||||
curl \
|
curl \
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ LABEL description="Opencode for Cubbi"
|
|||||||
# Install system dependencies including gosu for user switching and shadow for useradd/groupadd
|
# Install system dependencies including gosu for user switching and shadow for useradd/groupadd
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
gosu \
|
gosu \
|
||||||
|
sudo \
|
||||||
passwd \
|
passwd \
|
||||||
bash \
|
bash \
|
||||||
curl \
|
curl \
|
||||||
|
|||||||
Reference in New Issue
Block a user