# IPv6 NAT46 Publisher - Bootstrap Script

A thin bootstrap that wraps the standard `bakery_shared/provision_shared.sh` with two environment variables to enable IPv6 NAT46 support.

## How It Works

The bootstrap sets these env vars before calling the standard provisioning script:

```bash
export PUBLISHER_REPO=johnneerdael/publisher-ipv6   # Docker Hub image with CoreDNS nat46 plugin
export INSTALL_JOOL=true                             # Triggers Jool SIIT install + ULA prefix + Corefile generation
```

Everything else — Docker install, firewall, hardening, wizard, Jool install, Corefile generation, container launch — is handled by the same `provision_shared.sh` from `bakery_shared/`.

## Webserver Setup

Upload these files to your webserver:

```
https://<your-server>/ipv6/bootstrap.sh              # This bootstrap
https://<your-server>/ipv6/provision_shared.sh        # Copy of bakery_shared/provision_shared.sh
https://<your-server>/ipv6/cleanup.sh                 # Copy of provision-scripts/cleanup.sh
https://<your-server>/ipv6/npa-publisher.ubuntu.service  # Copy of provision-scripts/npa-publisher.ubuntu.service
```

Then edit `bootstrap.sh` line 36 to point `S3_PUBLISHER_GENERIC_PATH` to your URL:

```bash
S3_PUBLISHER_GENERIC_PATH=https://<your-server>/ipv6
```

## Installation

On a fresh Ubuntu 22.04 host, from the non-root user's home directory:

```bash
curl https://<your-server>/ipv6/bootstrap.sh | sudo bash
```

After provisioning completes, SSH back in and run the wizard:

```bash
sudo ./npa_publisher_wizard
```

## Configuration Overrides

Set these environment variables before running bootstrap.sh to override defaults:

| Variable | Default | Description |
|----------|---------|-------------|
| `PUBLISHER_REPO` | `johnneerdael/publisher-ipv6` | Docker image repository |
| `PUBLISHER_IMAGE_TAG` | `latest` | Docker image tag |
| `JOOL_VERSION` | `4.1.12` | Jool version to install |
| `NPA_NAT46_IPV4_RANGE` | `240.0.0.0/4` | IPv4 range for NAT46 mappings |
| `NPA_NAT46_JOOL_INSTANCE` | `default` | Jool SIIT instance name |
| `NPA_NAT46_TTL` | `300` | TTL for synthesized A records |
| `NPA_NAT46_GRACE_PERIOD` | `1h` | Grace period for EAMT cleanup |
