# Technical Documentation: teddysun/across

> ℹ️ **Provenance:** Multi-Tier Ingestion · [CodeWiki Reference](https://codewiki.google/github.com/teddysun/across)

### Overview (`README.md`)

## Across the Great Wall we can reach every corner in the world

## wireguard.sh

- Description: This is a shell script for configure and start WireGuard VPN server.
- Intro: https://teddysun.com/554.html

## bbr.sh

- Description: Auto install latest kernel for TCP BBR
- Intro: https://teddysun.com/489.html

## kms.sh

- Description: Auto install KMS Server
- Intro: https://teddysun.com/530.html
- **KMS Server Docker Image**: https://hub.docker.com/r/teddysun/kms

## bench.sh

- Description: Auto test I/O & upload & download speed script
- Intro: https://teddysun.com/444.html

## backup.sh

- You must modify the config before run it
- Backup MySQL or MariaDB datebases, files and directories
- Backup file is encrypted with AES-256-CBC with sha256 message-digest (Depends on `openssl` command) (option)
- Auto transfer backup file to Google Drive (Depends on [`rclone`](https://teddysun.com/469.html) command) (option)
- Auto transfer backup file to FTP server (Depends on `ftp` command) (option)
- Auto delete remote file from Google Drive or FTP server (option)
- Intro: https://teddysun.com/469.html

## ftp_upload.sh

- You must modify the config before run it
- Upload file(s) to FTP server
- Intro: https://teddysun.com/484.html

## unixbench.sh

- Description: Auto install unixbench and test script
- Intro: https://teddysun.com/245.html

## l2tp.sh(Deprecated, DO NOT USE)

## pptp.sh(Deprecated, DO NOT USE)

Copyright (C) 2013-2021 Teddysun <i@teddysun.com>

---

### Overview (`docker/brook/README.md`)

## Brook Docker Image by Teddysun

[Brook][1] is a cross-platform proxy/VPN software which can help you get through firewalls.

Docker images are built for quick deployment in various computing cloud providers.

For more information on docker and containerization technologies, refer to [official document][2].

## Prepare the host

If you need to install docker by yourself, follow the [official installation guide][3].

## Pull the image

```bash
$ docker pull teddysun/brook
```

This pulls the latest release of Brook.

It can be found at [Docker Hub][4].

## Start a container

You **must set environment variable** `ARGS` at first.

There is an example to start a container that listen on port `9000`, password is `password0` (both TCP and UDP) run as a brook server like below:

```bash
$ docker run -d -p 9000:9000 -p 9000:9000/udp --name brook --restart=always -e "ARGS=server -l :9000 -p password0" teddysun/brook
```

**Warning**: The port number must be same as environment variable and opened in firewall.

[1]: https://github.com/txthinking/brook
[2]: https://docs.docker.com/
[3]: https://docs.docker.com/install/
[4]: https://hub.docker.com/r/teddysun/brook/

---

### Overview (`docker/caddy/README.md`)

## Caddy Docker Image by Teddysun

[Caddy][1] is a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go.

Docker images are built for quick deployment in various computing cloud providers.

For more information on docker and containerization technologies, refer to [official document][2].

## Prepare the host

If you need to install docker by yourself, follow the [official installation guide][3].

## Pull the image

```bash
$ docker pull teddysun/caddy
```

This pulls the version **v1.0.5** of Caddy.

It can be found at [Docker Hub][4].

## Start a container

You **must create a configuration file**  `/etc/caddy/Caddyfile` in host at first:

```
$ mkdir -p /etc/caddy
```

Mount your site root using the `www` volume, a sample `Caddyfile` like below:

```
:80 {
  root /www
  index index.html
}
```

There is an example to override the default `Caddyfile`, you can mount a new one at `/etc/caddy/Caddyfile` like below:

```bash
$ docker run -d -p 80:80 --name caddy --restart=always -v /etc/caddy:/etc/caddy -v $(pwd)/site:/www teddysun/caddy
```

[1]: https://caddyserver.com/
[2]: https://docs.docker.com/
[3]: https://docs.docker.com/install/
[4]: https://hub.docker.com/r/teddysun/caddy/

---

### Overview (`docker/hysteria/README.md`)

## Hysteria Docker Image by Teddysun

[Hysteria][1] is a feature-packed proxy & relay utility optimized for lossy, unstable connections, powered by a customized QUIC protocol.

Docker images are built for quick deployment in various computing cloud providers.

For more information on docker and containerization technologies, refer to [official document][2].

## Prepare the host

If you need to install docker by yourself, follow the [official installation guide][3].

## Pull the image

```bash
$ docker pull teddysun/hysteria
```

This pulls the latest release of Hysteria.

It can be found at [Docker Hub][4].

## Start a container

You **must create a configuration file**  `/etc/hysteria/server.yaml` in host at first:

```
$ mkdir -p /etc/hysteria
```

A sample in yaml like below:

```
listen: :8998

tls:
  cert: /etc/hysteria/cert.crt
  key: /etc/hysteria/private.key

auth:
  type: password
  password: your_password

resolver:
  type: https
  https:
    addr: 8.8.8.8:443
    timeout: 10s
```

And put the `cert.crt`, `private.key` to the `/etc/hysteria/`.

There is an example to start a container that listen on port `8998`, run as a Hysteria server like below:

```bash
$ docker run -d -p 8998:8998 --name hysteria --restart=always -v /etc/hysteria:/etc/hysteria teddysun/hysteria
```

**Warning**: The port number must be same as configuration and opened in firewall.

[1]: https://github.com/apernet/hysteria
[2]: https://docs.docker.com/
[3]: https://docs.docker.com/install/
[4]: https://hub.docker.com/r/teddysun/hysteria/

---

### Overview (`docker/kms/README.md`)

## KMS Server Docker Image by Teddysun

This is A fully Microsoft compatible KMS server with Docker Image.

vlmcsd is a fully Microsoft compatible KMS server that provides product activation services to clients. It is meant as a drop-in replacement for a Microsoft KMS server (Windows computer with KMS key entered). It currently supports KMS protocol versions 4, 5 and 6.

vlmcsd is designed to run on POSIX compatible operating systens. It only requires a basic C library with a BSD-style sockets API and either `fork` or `pthreads`. That allows it to run on most embedded systems like routers, NASes, mobile phones, tablets, TVs, settop boxes, etc. Some efforts have been made that it also runs on Windows.

## Prepare the host

Docker images are built for quick deployment in various computing cloud providers.
For more information on docker and containerization technologies, refer to [official document][1].

If you need to install docker by yourself, follow the [official installation guide][2].

## Pull the image

```bash
$ docker pull teddysun/kms
```

This pulls the latest release of KMS Server.
It can be found at [Docker Hub][3].

## Start a container

```bash
$ docker run -d -p 1688:1688 --name kms --restart=always teddysun/kms
```

**Note**: The TCP port number `1688` must be opened in firewall.

[1]: https://docs.docker.com/
[2]: https://docs.docker.com/install/
[3]: https://hub.docker.com/r/teddysun/kms/

---

### Overview (`docker/l2tp/README.md`)

## L2TP/IPsec VPN Server Docker Image by Teddysun

Docker image to run a L2TP/IPsec VPN Server, with both `L2TP/IPsec PSK` and `IPSec Xauth PSK`.

Based on Alpine with [libreswan-3.29 (IPsec VPN software)](https://pkgs.alpinelinux.org/package/edge/community/x86_64/libreswan) and [xl2tpd-1.3.15 (L2TP daemon)](https://pkgs.alpinelinux.org/package/edge/main/x86_64/xl2tpd).

Docker images are built for quick deployment in various computing cloud providers.

For more information on docker and containerization technologies, refer to [official document][1].

## Prepare the host

If you need to install docker by yourself, follow the [official installation guide][2].

## Pull the image

```bash
$ docker pull teddysun/l2tp
```

This pulls the latest release of L2TP/IPsec VPN Server.
It can be found at [Docker Hub][3].

## Start a container

You **must create a environment file**  `/etc/l2tp.env` in host at first, and sample value is below:

```
VPN_IPSEC_PSK=teddysun.com
VPN_USER=vpnuser
VPN_PASSWORD=vpnpassword
VPN_PUBLIC_IP=
VPN_L2TP_NET=
VPN_L2TP_LOCAL=
VPN_L2TP_REMOTE=
VPN_XAUTH_NET=
VPN_XAUTH_REMOTE=
VPN_DNS1=
VPN_DNS2=
VPN_SHA2_TRUNCBUG=
```

This will create a default user account for L2TP/IPsec VPN login, which can be used by your **multiple devices**.

The IPSec PSK (pre-shared key) is specified by the `VPN_IPSEC_PSK`. 

The **default username** is specified in `VPN_USER`.

The **default password** is specified in `VPN_PASSWORD`.

If your VPS has multiple public IP addresses, maybe public IP need to specified in `VPN_PUBLIC_IP`.

If you want to specify a other private network, maybe need to specified in `VPN_L2TP_NET` (default `192.168.18.0/24`).

If you want to specify a other private network, maybe need to specified in `VPN_XAUTH_NET` (default `192.168.20.0/24`).

If you want to specify a `local ip` for `xl2tpd.conf`, maybe need to specified in `VPN_L2TP_LOCAL` (default `192.168.18.1`).

If you want to specify a `ip range` for `xl2tpd.conf`, maybe need to specified in `VPN_L2TP_REMOTE` (default `192.168.18.10-192.168.18.250`).

If you want to specify a `rightaddresspool` for `ipsec.conf`, maybe need to specified in `VPN_XAUTH_REMOTE` (default `192.168.20.10-192.168.20.250`).

If you want to specify a other DNS servers, maybe need to specified in `VPN_DNS1` and `VPN_DNS2` (default `8.8.8.8`, `8.8.4.4`).

**Android 6 and 7 users**: If you encounter connection issues, you may set `sha2-truncbug=yes` (default is no) in `/etc/ipsec.conf` by adding `VPN_SHA2_TRUNCBUG=yes` to `/etc/l2tp.env` file, then re-create the Docker container.

There is an example to start a container:

```bash
$ docker run -d --privileged -p 500:500/udp -p 4500:4500/udp --name l2tp --restart=always --env-file /etc/l2tp.env -v /lib/modules:/lib/modules teddysun/l2tp
```

**Warning**: The UDP port number `500` and `4500` must be opened in firewall.

## Check container details

If you want to view the container logs:

```bash
$ docker logs l2tp
```

Output log like below:

```
L2TP/IPsec VPN Server with the Username and Password is below:

Server IP: Your Server public IP
IPSec PSK: IPSec PSK (pre-shared key)
Username : VPN username
Password : VPN password

Redirecting to: /etc/init.d/ipsec start
Starting pluto IKE daemon for IPsec: Initializing NSS database

xl2tpd[1]: Not looking for kernel SAref support.
xl2tpd[1]: Using l2tp kernel support.
xl2tpd[1]: xl2tpd version xl2tpd-1.3.15 started on 1d20eaecd9f2 PID:1
xl2tpd[1]: Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.
xl2tpd[1]: Forked by Scott Balmos and David Stipp, (C) 2001
xl2tpd[1]: Inherited by Jeff McAdams, (C) 2002
xl2tpd[1]: Forked again by Xelerance (www.xelerance.com) (C) 2006-2016
xl2tpd[1]: Listening on IP address 0.0.0.0, port 1701
```

To check the status of your L2TP/IPSec VPN server, you can confirm `ipsec status` to your container like below:

```bash
$ docker exec -it l2tp ipsec status
```

## Manage VPN Users

If you want to add, modify or remove user accounts, please do it simple like below:

### List all users

```bash
$ docker exec -it l2tp l2tpctl -l
```

### Add a user

```bash
$ docker exec -it l2tp l2tpctl -a
```

### Delete a user

```bash
$ docker exec -it l2tp l2tpctl -d
```

### Modify a user password

```bash
$ docker exec -it l2tp l2tpctl -m
```

### Print Libreswan & xl2tpd version

```bash
$ docker exec -it l2tp l2tpctl -v
```

### Print help information

```bash
$ docker exec -it l2tp l2tpctl -h
```


[1]: https://docs.docker.com/
[2]: https://docs.docker.com/install/
[3]: https://hub.docker.com/r/teddysun/l2tp/

---

### Overview (`docker/rpmbuild/README.md`)

## RHEL RPM package building environment by Teddysun

This docker image can be used to build RPM packages.

For more information on docker and containerization technologies, refer to [official document][1].

## Supported tags and respective `Dockerfile` links

- `latest`, `10` [*(Dockerfile)*][8]
- `9` [*(Dockerfile)*][7]
- `8` [*(Dockerfile)*][2]
- `7` [*(Dockerfile)*][3]

### Reference

- Supported architectures ([*more info*][4]): `amd64`, `arm64`

## Integration

RPMs will be built in `/home/builder/rpmbuild` folder, which should contain source archives, patches and built RPM/SRPM files.

## Prepare the host

If you need to install docker by yourself, follow the [official installation guide][5].

## User Account and Root Access

The `builder` user (UID 1000) is a member of users and wheel, and has password-less sudo as any user, any group.

## Pull the image

For CentOS 7

```bash
$ docker pull teddysun/rpmbuild:7
```

For CentOS 8 Stream / Rockylinux 8 / Almalinux 8

```bash
$ docker pull teddysun/rpmbuild:8
```

For CentOS 9 Stream / Rockylinux 9 / Almalinux 9

```bash
$ docker pull teddysun/rpmbuild:9
```

For CentOS 10 Stream / Rockylinux 10 / Almalinux 10

```bash
$ docker pull teddysun/rpmbuild:10
```

It can be found at [Docker Hub][6].

## Start a container

There is an example to start a container for CentOS 7 like below:

```bash
$ mkdir -m 777 -p /opt/builder7
$ docker run -it --rm -h buildbot --name rpmbuild7 -v /opt/builder7:/home/builder/rpmbuild teddysun/rpmbuild:7
```

There is an example to start a container for CentOS 8 Stream / Rockylinux 8 / Almalinux 8 like below:

```bash
$ mkdir -m 777 -p /opt/builder8
$ docker run -it --rm -h buildbot --name rpmbuild8 -v /opt/builder8:/home/builder/rpmbuild teddysun/rpmbuild:8
```

There is an example to start a container for CentOS 9 Stream / Rockylinux 9 / Almalinux 9 like below:

```bash
$ mkdir -m 777 -p /opt/builder9
$ docker run -it --rm -h buildbot --name rpmbuild9 -v /opt/builder9:/home/builder/rpmbuild teddysun/rpmbuild:9
```

There is an example to start a container for CentOS 10 Stream / Rockylinux 10 / Almalinux 10 like below:

```bash
$ mkdir -m 777 -p /opt/builder10
$ docker run -it --rm -h buildbot --name rpmbuild10 -v /opt/builder10:/home/builder/rpmbuild teddysun/rpmbuild:10
```

[1]: https://docs.docker.com/
[2]: https://github.com/teddysun/across/blob/master/docker/rpmbuild/Dockerfile.rpmbuild8
[3]: https://github.com/teddysun/across/blob/master/docker/rpmbuild/Dockerfile.rpmbuild7
[4]: https://github.com/docker-library/official-images#architectures-other-than-amd64
[5]: https://docs.docker.com/install/
[6]: https://hub.docker.com/r/teddysun/rpmbuild/
[7]: https://github.com/teddysun/across/blob/master/docker/rpmbuild/Dockerfile.rpmbuild9
[8]: https://github.com/teddysun/across/blob/master/docker/rpmbuild/Dockerfile.rpmbuild10

---

### Overview (`docker/trojan-go/README.md`)

## Trojan-Go Docker Image by Teddysun

[Trojan-Go][1] is An unidentifiable mechanism that helps you bypass [GFW](https://en.wikipedia.org/wiki/Great_Firewall).

Trojan-Go features multiple protocols over `TLS` to avoid both active/passive detections and ISP `QoS` limitations.

Docker images are built for quick deployment in various computing cloud providers.

For more information on docker and containerization technologies, refer to [official document][2].

## Prepare the host

If you need to install docker by yourself, follow the [official installation guide][3].

## Pull the image

```bash
$ docker pull teddysun/trojan-go
```

This pulls the latest release of trojan-go.

It can be found at [Docker Hub][4].

## Start a container

You **must create a configuration file**  `/etc/trojan-go/config.json` in host at first:

```
$ mkdir -p /etc/trojan-go
```

A sample in JSON like below:

```
{
    "run_type": "server",
    "local_addr": "0.0.0.0",
    "local_port": 443,
    "remote_addr": "127.0.0.1",
    "remote_port": 80,
    "password": [
        "your_password"
    ],
    "ssl": {
        "cert": "your_cert.crt",
        "key": "your_key.key",
        "sni": "your-domain-name.com"
    },
    "router": {
        "enabled": true,
        "block": [
            "geoip:private"
        ],
        "geoip": "/usr/share/trojan-go/geoip.dat",
        "geosite": "/usr/share/trojan-go/geosite.dat"
    }
}
```

An online documentation can be found [here](https://p4gefau1t.github.io/trojan-go/)

There is an example to start a container that use host network, run as a trojan-go server like below:

```bash
$ docker run -d --network host --name trojan-go --restart=always -v /etc/trojan-go:/etc/trojan-go teddysun/trojan-go
```

[1]: https://github.com/p4gefau1t/trojan-go
[2]: https://docs.docker.com/
[3]: https://docs.docker.com/install/
[4]: https://hub.docker.com/r/teddysun/trojan-go/

---

### Overview (`docker/trojan/README.md`)

## Trojan Docker Image by Teddysun

[Trojan][1] is An unidentifiable mechanism that helps you bypass [GFW](https://en.wikipedia.org/wiki/Great_Firewall).

Trojan features multiple protocols over `TLS` to avoid both active/passive detections and ISP `QoS` limitations.

Docker images are built for quick deployment in various computing cloud providers.

For more information on docker and containerization technologies, refer to [official document][2].

## Prepare the host

If you need to install docker by yourself, follow the [official installation guide][3].

## Pull the image

```bash
$ docker pull teddysun/trojan
```

This pulls the latest release of Trojan.

It can be found at [Docker Hub][4].

## Start a container

You **must create a configuration file**  `/etc/trojan/config.json` in host at first:

```
$ mkdir -p /etc/trojan
```

A sample in JSON like below:

```
{
    "run_type": "server",
    "local_addr": "0.0.0.0",
    "local_port": 443,
    "remote_addr": "127.0.0.1",
    "remote_port": 80,
    "password": [
        "password1",
        "password2"
    ],
    "log_level": 1,
    "ssl": {
        "cert": "/path/to/certificate.crt",
        "key": "/path/to/private.key",
        "key_password": "",
        "cipher": "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384",
        "cipher_tls13": "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384",
        "prefer_server_cipher": true,
        "alpn": [
            "http/1.1"
        ],
        "reuse_session": true,
        "session_ticket": false,
        "session_timeout": 600,
        "plain_http_response": "",
        "curves": "",
        "dhparam": ""
    },
    "tcp": {
        "prefer_ipv4": false,
        "no_delay": true,
        "keep_alive": true,
        "reuse_port": false,
        "fast_open": false,
        "fast_open_qlen": 20
    },
    "mysql": {
        "enabled": false,
        "server_addr": "127.0.0.1",
        "server_port": 3306,
        "database": "trojan",
        "username": "trojan",
        "password": ""
    }
}
```

An online documentation can be found [here](https://trojan-gfw.github.io/trojan/)

There is an example to start a container that listen on port `443`, run as a Trojan server like below:

```bash
$ docker run -d -p 443:443 --name trojan --restart=always -v /etc/trojan:/etc/trojan teddysun/trojan
```

**Warning**: The port number `443` must be same as configuration and opened in firewall.

[1]: https://github.com/trojan-gfw/trojan
[2]: https://docs.docker.com/
[3]: https://docs.docker.com/install/
[4]: https://hub.docker.com/r/teddysun/trojan/

---

### Overview (`docker/v2ray/README.md`)

## V2Ray Docker Image by Teddysun

[V2Ray][1] is a platform for building proxies to bypass network restrictions.

It secures your network connections and thus protects your privacy.

Docker images are built for quick deployment in various computing cloud providers.

For more information on docker and containerization technologies, refer to [official document][2].

## Prepare the host

If you need to install docker by yourself, follow the [official installation guide][3].

## Pull the image

```bash
$ docker pull teddysun/v2ray
```

This pulls the latest release of V2Ray.

It can be found at [Docker Hub][4].

## Start a container

You **must create a configuration file**  `/etc/v2ray/config.json` in host at first:

```
$ mkdir -p /etc/v2ray
```

A sample in JSON like below:

```
{
  "inbounds": [{
    "port": 9000,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "11c2a696-0366-4524-b8f0-9a9c21512b02",
          "level": 1,
          "alterId": 64
        }
      ]
    }
  }],
  "outbounds": [{
    "protocol": "freedom",
    "settings": {}
  }]
}
```

Or generate a configuration file online by [https://tools.sprov.xyz/v2ray/](https://tools.sprov.xyz/v2ray/)

There is an example to start a container that listen on port `9000`, run as a V2Ray server like below:

```bash
$ docker run -d -p 9000:9000 --name v2ray --restart=always -v /etc/v2ray:/etc/v2ray teddysun/v2ray
```

**Warning**: The port number must be same as configuration and opened in firewall.

[1]: https://github.com/v2fly/v2ray-core
[2]: https://docs.docker.com/
[3]: https://docs.docker.com/install/
[4]: https://hub.docker.com/r/teddysun/v2ray/

---

### Overview (`docker/xray/README.md`)

## Xray Docker Image by Teddysun

[Xray][1] is a platform for building proxies to bypass network restrictions.

It secures your network connections and thus protects your privacy.

Docker images are built for quick deployment in various computing cloud providers.

For more information on docker and containerization technologies, refer to [official document][2].

## Prepare the host

If you need to install docker by yourself, follow the [official installation guide][3].

## Pull the image

```bash
$ docker pull teddysun/xray
```

This pulls the latest release of Xray.

It can be found at [Docker Hub][4].

## Start a container

You **must create a configuration file**  `/etc/xray/config.json` in host at first:

```
$ mkdir -p /etc/xray
```

A sample in JSON like below:

```
{
  "inbounds": [{
    "port": 9000,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "1eb6e917-774b-4a84-aff6-b058577c60a5"
        }
      ]
    }
  }],
  "outbounds": [{
    "protocol": "freedom",
    "settings": {}
  }]
}
```

Or some examples of uses for Xray-core [https://github.com/XTLS/Xray-examples](https://github.com/XTLS/Xray-examples)

There is an example to start a container that listen on port `9000`, run as a Xray server like below:

```bash
$ docker run -d -p 9000:9000 --name xray --restart=always -v /etc/xray:/etc/xray teddysun/xray
```

**Warning**: The port number must be same as configuration and opened in firewall.

[1]: https://github.com/XTLS/Xray-core
[2]: https://docs.docker.com/
[3]: https://docs.docker.com/install/
[4]: https://hub.docker.com/r/teddysun/xray/

---

--- METRICS ---
- Files Extracted: 11
- Estimated Token Budget: ~5709 tokens
- Canonical Reference: https://codewiki.google/github.com/teddysun/across
