Files

166 lines
4.5 KiB
Markdown
Raw Permalink Normal View History

2026-02-05 23:16:18 +03:00
# GrapheneOS AttestationServer Docker
Dockerized deployment of [GrapheneOS AttestationServer](https://github.com/GrapheneOS/AttestationServer) for local attestation.
## Overview
This project provides a containerized setup for running your own GrapheneOS AttestationServer. It includes:
- **AttestationServer** - The main Java application handling attestations
- **Caddy** - Reverse proxy with HTTPS support
- **SQLite** - Local database storage for attestation data
## Prerequisites
Before running the server, ensure you have:
1. **Docker** and **Docker Compose** installed
2026-02-06 11:19:50 +03:00
2. **TLS certificates** for your domain in the `certs/` directory
3. **DNS or hosts file configuration** to resolve your domain to your server
2026-02-05 23:16:18 +03:00
2026-02-06 11:19:50 +03:00
## Configuration
2026-02-05 23:16:18 +03:00
2026-02-06 11:19:50 +03:00
### 1. Create .env file
2026-02-05 23:16:18 +03:00
2026-02-06 11:19:50 +03:00
Copy the example environment file and edit it with your domain:
```bash
cp .env.example .env
```
Edit `.env` and set your domain:
```bash
DOMAIN=your-domain.com
```
### 2. Prepare TLS Certificates
Place your TLS certificates for your domain in the `certs/` directory:
- `certs/your-domain.com.crt` - Certificate file
- `certs/your-domain.com.key` - Private key file
2026-02-05 23:16:18 +03:00
> **Note:** Certificate generation is up to you. You can use self-signed certificates for local testing or certificates from a trusted CA.
2026-02-06 11:19:50 +03:00
> **Important:** The certificate filenames must match your domain name from the `.env` file.
### 3. Configure DNS or Hosts File
2026-02-05 23:16:18 +03:00
2026-02-06 11:19:50 +03:00
The GrapheneOS Auditor app expects to connect to the domain you configured. You must redirect this domain to your local server's IP address.
2026-02-05 23:16:18 +03:00
#### Option A: Local Machine (hosts file)
Edit your hosts file:
**Linux/macOS:**
```bash
sudo nano /etc/hosts
```
**Windows:**
```
C:\Windows\System32\drivers\etc\hosts
```
2026-02-06 11:19:50 +03:00
Add the following line (replace `192.168.1.100` with your server's IP and `your-domain.com` with your domain):
2026-02-05 23:16:18 +03:00
```
2026-02-06 11:19:50 +03:00
192.168.1.100 your-domain.com
2026-02-05 23:16:18 +03:00
```
#### Option B: Network-wide (DNS)
2026-02-06 11:19:50 +03:00
Configure your router or local DNS server (like Pi-hole or AdGuard) to resolve your domain to your server's IP address.
2026-02-05 23:16:18 +03:00
#### Option C: Android Device (root required)
If your Android device is rooted, edit `/system/etc/hosts`:
```bash
su
mount -o remount,rw /system
2026-02-06 11:19:50 +03:00
echo "192.168.1.100 your-domain.com" >> /system/etc/hosts
2026-02-05 23:16:18 +03:00
mount -o remount,ro /system
```
**Important:** You must configure this on the Android device running the Auditor app, not just the server.
2026-02-06 11:19:50 +03:00
### 4. Create Data Directory
2026-02-05 23:16:18 +03:00
Ensure the data directory exists for persistent SQLite storage:
```bash
mkdir -p data
```
## Running the Server
### Build and Start
```bash
2026-02-06 09:58:22 +03:00
docker compose up -d --build
2026-02-05 23:16:18 +03:00
```
This will:
2026-02-06 11:19:50 +03:00
1. Build the AttestationServer from source with your configured domain
2026-02-05 23:16:18 +03:00
2. Start the attestation service on port 8080 (internal)
3. Start Caddy reverse proxy on ports 80 and 443
### Check Status
```bash
2026-02-06 11:23:12 +03:00
docker compose ps
docker compose logs -f
2026-02-05 23:16:18 +03:00
```
### Stop the Server
```bash
2026-02-06 09:58:22 +03:00
docker compose down
2026-02-05 23:16:18 +03:00
```
### Stop and Remove All Data
```bash
2026-02-06 09:58:22 +03:00
docker compose down -v
2026-02-05 23:16:18 +03:00
rm -rf data/*.db data/*.db-*
```
## Usage
2026-02-06 11:19:50 +03:00
1. Ensure your Android device has your domain pointing to your server IP
2026-02-05 23:16:18 +03:00
2. Install [GrapheneOS Auditor](https://github.com/GrapheneOS/Auditor) app on your Android device
3. Open the Auditor app
4. The app will connect to your local attestation server instead of the official one
## Directory Structure
```
.
├── certs/ # TLS certificates
2026-02-06 11:19:50 +03:00
│ ├── your-domain.com.crt
│ └── your-domain.com.key
2026-02-05 23:16:18 +03:00
├── data/ # SQLite databases (persistent)
│ ├── attestation.db
│ └── samples.db
2026-02-06 11:19:50 +03:00
├── .env # Environment configuration (domain settings)
├── .env.example # Example environment file
2026-02-05 23:16:18 +03:00
├── Caddyfile # Caddy reverse proxy config
├── Dockerfile # AttestationServer build
├── docker-compose.yml # Service orchestration
├── entrypoint.sh # Container entrypoint
└── process-static-docker.sh # Static file processor
```
2026-02-06 11:19:50 +03:00
## Default Domain
If you don't create a `.env` file, the default domain `attestation.app` will be used for backward compatibility.
2026-02-05 23:16:18 +03:00
## Security Considerations
2026-02-06 11:19:50 +03:00
- Keep your private key (`certs/*.key`) secure and never commit it to version control
2026-02-05 23:16:18 +03:00
- The `.gitignore` file excludes sensitive files like certificates and databases
- This setup is intended for **local/private use only**
- For production deployment, use properly signed certificates from a trusted CA
## License
This Docker setup follows the same license as the upstream [GrapheneOS AttestationServer](https://github.com/GrapheneOS/AttestationServer).