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
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gosu \
|
||||
sudo \
|
||||
passwd \
|
||||
bash \
|
||||
curl \
|
||||
@@ -64,4 +65,4 @@ RUN /cubbi/cubbi_init.py --help
|
||||
WORKDIR /app
|
||||
|
||||
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 sys
|
||||
import tempfile
|
||||
import re
|
||||
|
||||
|
||||
def run_command(cmd, description="", check=True):
|
||||
@@ -156,7 +157,7 @@ def test_cubbi_cli_integration():
|
||||
|
||||
assert (
|
||||
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
|
||||
), "Cubbi CLI session creation failed"
|
||||
print("✅ Cubbi CLI session creation works")
|
||||
|
||||
@@ -6,6 +6,7 @@ LABEL description="Claude Code for Cubbi"
|
||||
# Install system dependencies including gosu for user switching
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gosu \
|
||||
sudo \
|
||||
passwd \
|
||||
bash \
|
||||
curl \
|
||||
@@ -69,4 +70,4 @@ RUN /cubbi/cubbi_init.py --help
|
||||
WORKDIR /app
|
||||
|
||||
ENTRYPOINT ["/cubbi/cubbi_init.py"]
|
||||
CMD ["tail", "-f", "/dev/null"]
|
||||
CMD ["tail", "-f", "/dev/null"]
|
||||
|
||||
@@ -222,6 +222,16 @@ class UserManager:
|
||||
):
|
||||
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
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ LABEL description="Goose for Cubbi"
|
||||
# Install system dependencies including gosu for user switching and shadow for useradd/groupadd
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gosu \
|
||||
sudo \
|
||||
passwd \
|
||||
bash \
|
||||
curl \
|
||||
|
||||
@@ -6,6 +6,7 @@ LABEL description="Opencode for Cubbi"
|
||||
# Install system dependencies including gosu for user switching and shadow for useradd/groupadd
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gosu \
|
||||
sudo \
|
||||
passwd \
|
||||
bash \
|
||||
curl \
|
||||
|
||||
Reference in New Issue
Block a user