├── tokens_siswa.csv # Data token siswa (auto-generated)
├── state/ # State Tailscale (auto-generated)
└── elemes/ # Folder engine LMS (JANGAN DIUBAH)
├── elemes.sh # Script untuk menjalankan LMS
└── ...
```
## Setup and Execution
The primary entry point for managing the system is the `elemes.sh` script located in the `elemes` folder.
1.**Initialization:**
```bash
cd elemes
./elemes.sh init
```
Generates `.env`, `content/`, and `tokens_siswa.csv` from examples. Safe to run multiple times.
2.**Configuration:**
Edit `../.env` to set branding and Tailscale configuration:
```env
APP_BAR_TITLE=Pemrograman C - SMK Nusantara
COPYRIGHT_TEXT=SMK Nusantara @ 2025
PAGE_TITLE_SUFFIX=SMK Nusantara
CONTENT_DIR=content
TOKENS_FILE=tokens.csv
ELEMES_HOST=lms-smk-nusantara
TS_AUTHKEY=tskey-auth-xxxx
```
3.**Running the Application:**
```bash
./elemes.sh runbuild # Build images and start containers
./elemes.sh run # Start containers without rebuilding
./elemes.sh stop # Stop all containers
```
4.**Managing Users (Tokens):**
To update columns in the CSV based on available lessons:
```bash
./elemes.sh generatetoken
```
Then manually edit `tokens_siswa.csv` (using semicolon `;` delimiter) to add student rows. The first data row is always the teacher token.
## Security Overview
The system incorporates several security layers to ensure stability and safety:
1.**Isolated Execution:** User-submitted C and Python code runs inside a `compiler-worker` container protected by a **gVisor (`runsc`) sandbox**, preventing RCE attacks from reaching the host kernel.
2.**Rate Limiting & Tarpitting:**
- Anonymous users: Limited to **1 compile per 2 minutes** per IP, with a global queue of 20 slots.
- Login endpoints: Max **50 requests per minute per IP**.
- Failed logins: Suffer a **1.5-second tarpit delay** to neutralize brute-force attacks.
3.**Cookie Security:** The `student_token` session cookie uses `httponly: true`, `samesite: 'Lax'`, and dynamically sets `secure: true` based on the `COOKIE_SECURE` environment variable.