Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Self-hosting NetBird script):support custom service port and DNS… #1464

Closed
wants to merge 1 commit into from
Closed

feat(Self-hosting NetBird script):support custom service port and DNS… #1464

wants to merge 1 commit into from

Conversation

xcstatus
Copy link

@xcstatus xcstatus commented Jan 13, 2024

… challenge

Adding port variable support custom service port;
Adding the CUSTOM_INITIAL_FILES variable allows you to change the configuration files to allow DNS challenge configuration or manual certificate management

Most of the people who encountered this problem were from China, so I added the description in Chinese
I didn't test the conditions for port 80 and 443 deployments, so I didn't test this case

The following variables are added(增加了以下变量)

Custom ports(自定义端口)

export NETBIRD_HTTP_PORT=80;
export NETBIRD_HTTPS_PORT=443;
export TURN_MIN_PORT=49152;
export TURN_MAX_PORT=65535;
export TURN_LISTENING_PORT=3478;

Customize the initial configuration file(定制初始配置文件)
export CUSTOM_INITIAL_FILES=true;

Certificate Settings when customizing ports(自定义端口时证书的设置)

两种设置方式:DNS challenge、Manage certificates manually(手动管理证书)

DNS challenge

Automatically sign and renew certificates with caddy DNS challenge(通过 caddy DNS challenge自动签发、续签证书)

  1. Enable the custom initial profile option(启用定制初始配置文件选项): export CUSTOM_INITIAL_FILES=true;
  2. Modify the caddy image in docker-compose.yml. Mirroring requires the addition of plugs to support the DNS challenge(修改docker-compose.yml中caddy镜像。镜像需要增加plug,以支持DNS challenge)
  3. Modify Caddyfile to add DNS challenge configuration(修改Caddyfile,增加DNS challenge配置)

Take DNSPod as an example(以DNSPod为例)

Obtain or manually build caddy-dnspod. Modify the caddy image in docker-compose.yml.
(获取或手动构建caddy-dnspod。 修改docker-compose.yml中caddy镜像。)

Pasted image 20240113181331

Modify Caddyfile to add DNS challenge configuration
(修改Caddyfile,增加DNS challenge配置)

tls [email protected] {
  dns dnspod apiTokenId,apiToken
}

Pasted image 20240113181652

Manage certificates manually(手动管理证书)

Manage the certificates manually, and replace them manually when they expire
手动管理证书,到期需要手动替换证书

  1. Enable the custom initial profile option(启用定制初始配置文件选项): export CUSTOM_INITIAL_FILES=true;
  2. Get the certificate and upload it to the certs folder in your installation directory.(获取证书,将证书上传到安装目录下certs文件夹中。)
  3. Modify the caddy configuration in docker-compose.yml to mount the certificate file(docker-compose.yml中caddy配置,挂载证书文件)
  4. Modify Caddyfile to add the certificate configuration(修改Caddyfile,增加证书配置)

Get the certificate and upload it to the certs folder in your installation directory.(获取证书,将证书上传到安装目录下certs文件夹中。)

~/docker-netbird# tree certs
certs
├── netbird.my-domain.com.key
└── netbird.my-domain.com.pem

Modify the caddy configuration in docker-compose.yml to mount the certificate file(docker-compose.yml中caddy配置,挂载证书文件)

Pasted image 20240113182511

Modify Caddyfile to add the certificate configuration(修改Caddyfile,增加证书配置)

Pasted image 20240113182955

Issue ticket number and link

discussions
https://github.com/netbirdio/netbird/discussions/1406
issues
#1408
#1267

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

… challenge

Adding port variable support custom service port;
Adding the CUSTOM_INITIAL_FILES variable allows you to change the configuration files to allow DNS challenge configuration or manual certificate management
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant