Enable E2EE message parsing

This commit is contained in:
Astra Logical 2026-07-22 16:44:42 -04:00
parent e5a9f85752
commit ccccebcd22
3 changed files with 15 additions and 6 deletions

View file

@ -1,20 +1,25 @@
FROM python:3.12-slim FROM python:3.12-slim
# Prevent Python from writing .pyc files and buffer stdout/stderr for clean logging
ENV PYTHONDONTWRITEBYTECODE=1 \ ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 PYTHONUNBUFFERED=1
WORKDIR /app WORKDIR /app
# Install dependencies first to leverage Docker layer caching # Install libolm C library and build dependencies for E2E crypto bindings
RUN apt-get update && apt-get install -y --no-install-recommends \
libolm-dev \
gcc \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt . COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# Copy application source code
COPY matrix_keycloak_bot.py . COPY matrix_keycloak_bot.py .
# Security best practice: run as a non-root user # Create the store directory for Olm/Megolm key databases
RUN useradd -m -u 10001 botuser && \ RUN useradd -m -u 10001 botuser && \
mkdir -p /app/store && \
chown -R botuser:botuser /app chown -R botuser:botuser /app
USER botuser USER botuser

View file

@ -241,7 +241,11 @@ async def on_reaction(client: AsyncClient, room: MatrixRoom, event: ReactionEven
# Main Event Loop # Main Event Loop
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
async def main(): async def main():
client = AsyncClient(MATRIX_HOMESERVER, MATRIX_BOT_USER) client = AsyncClient(
MATRIX_HOMESERVER,
MATRIX_BOT_USER,
store_path="/app/store"
)
# Register callbacks # Register callbacks
client.add_event_callback( client.add_event_callback(

View file

@ -1,2 +1,2 @@
matrix-nio>=0.24.0 matrix-nio[e2e]>=0.24.0
python-keycloak>=4.0.0 python-keycloak>=4.0.0