accplan commited on
Commit
cda61d9
1 Parent(s): 1d772be
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .dockerignore +3 -6
  2. .editorconfig +20 -0
  3. .gitattributes +17 -34
  4. .github/CONTRIBUTING.md +123 -0
  5. .github/FUNDING.yml +2 -0
  6. .github/ISSUE_TEMPLATE/00-bug-report.md +0 -48
  7. .github/ISSUE_TEMPLATE/10-bug-report-zh.md +0 -48
  8. .github/ISSUE_TEMPLATE/20-enhancement-request.md +0 -26
  9. .github/ISSUE_TEMPLATE/30-enhancement-request-zh.md +0 -26
  10. .github/ISSUE_TEMPLATE/config.yml +13 -0
  11. .github/ISSUE_TEMPLATE/issue.bug.yml +77 -0
  12. .github/ISSUE_TEMPLATE/issue.feature.yml +31 -0
  13. .github/PULL_REQUEST_TEMPLATE.md +43 -0
  14. .github/workflows/buildx.yml +0 -187
  15. .github/workflows/call_issue_pr_tracker.yml +14 -0
  16. .github/workflows/call_issues_cron.yml +13 -0
  17. .github/workflows/check_update.yml +0 -97
  18. .github/workflows/cron-alpine.yml +0 -43
  19. .github/workflows/cron-debian.yml +0 -43
  20. .github/workflows/external_trigger.yml +104 -0
  21. .github/workflows/external_trigger_scheduler.yml +43 -0
  22. .github/workflows/greetings.yml +13 -0
  23. .github/workflows/main-alpine.yml +0 -45
  24. .github/workflows/main-debian.yml +0 -45
  25. .github/workflows/package_trigger.yml +38 -0
  26. .github/workflows/package_trigger_scheduler.yml +50 -0
  27. .github/workflows/permissions.yml +10 -0
  28. .github/workflows/shellcheck.yml +0 -38
  29. .github/workflows/vpn_test.yml +0 -166
  30. .gitignore +44 -1
  31. Dockerfile +33 -54
  32. Dockerfile.aarch64 +39 -0
  33. Dockerfile.armhf +39 -0
  34. Dockerfile.debian +0 -68
  35. Jenkinsfile +986 -0
  36. LICENSE +674 -0
  37. LICENSE.md +0 -406
  38. README-zh.md +0 -360
  39. docker-compose.yml +0 -20
  40. docs/advanced-usage-zh.md +0 -319
  41. docs/advanced-usage.md +0 -319
  42. docs/images/badges/docker-pulls.svg +0 -1
  43. docs/images/badges/docker-stars.svg +0 -1
  44. docs/images/badges/github-stars.svg +0 -1
  45. jenkins-vars.yml +29 -0
  46. package_versions.txt +56 -0
  47. readme-vars.yml +111 -0
  48. root/etc/motd +2 -0
  49. root/etc/s6-overlay/s6-rc.d/init-adduser/run +56 -0
  50. root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-openssh-server-config +0 -0
.dockerignore CHANGED
@@ -1,9 +1,6 @@
1
  .git
2
- .github
3
  .gitignore
4
- docker-compose.yml
5
- LICENSE.md
 
6
  README.md
7
- README-zh.md
8
- vpn.env
9
- vpn.env.example
 
1
  .git
 
2
  .gitignore
3
+ .github
4
+ .gitattributes
5
+ READMETEMPLATE.md
6
  README.md
 
 
 
.editorconfig ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is globally distributed to all container image projects from
2
+ # https://github.com/linuxserver/docker-jenkins-builder/blob/master/.editorconfig
3
+
4
+ # top-most EditorConfig file
5
+ root = true
6
+
7
+ # Unix-style newlines with a newline ending every file
8
+ [*]
9
+ end_of_line = lf
10
+ insert_final_newline = true
11
+ # trim_trailing_whitespace may cause unintended issues and should not be globally set true
12
+ trim_trailing_whitespace = false
13
+
14
+ [{Dockerfile*,**.yml}]
15
+ indent_style = space
16
+ indent_size = 2
17
+
18
+ [{**.sh,root/etc/s6-overlay/s6-rc.d/**,root/etc/cont-init.d/**,root/etc/services.d/**}]
19
+ indent_style = space
20
+ indent_size = 4
.gitattributes CHANGED
@@ -1,34 +1,17 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tflite filter=lfs diff=lfs merge=lfs -text
29
- *.tgz filter=lfs diff=lfs merge=lfs -text
30
- *.wasm filter=lfs diff=lfs merge=lfs -text
31
- *.xz filter=lfs diff=lfs merge=lfs -text
32
- *.zip filter=lfs diff=lfs merge=lfs -text
33
- *.zst filter=lfs diff=lfs merge=lfs -text
34
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
3
+
4
+ # Custom for Visual Studio
5
+ *.cs diff=csharp
6
+
7
+ # Standard to msysgit
8
+ *.doc diff=astextplain
9
+ *.DOC diff=astextplain
10
+ *.docx diff=astextplain
11
+ *.DOCX diff=astextplain
12
+ *.dot diff=astextplain
13
+ *.DOT diff=astextplain
14
+ *.pdf diff=astextplain
15
+ *.PDF diff=astextplain
16
+ *.rtf diff=astextplain
17
+ *.RTF diff=astextplain
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/CONTRIBUTING.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to openssh-server
2
+
3
+ ## Gotchas
4
+
5
+ * While contributing make sure to make all your changes before creating a Pull Request, as our pipeline builds each commit after the PR is open.
6
+ * Read, and fill the Pull Request template
7
+ * If this is a fix for a typo (in code, documentation, or the README) please file an issue and let us sort it out. We do not need a PR
8
+ * If the PR is addressing an existing issue include, closes #\<issue number>, in the body of the PR commit message
9
+ * If you want to discuss changes, you can also bring it up in [#dev-talk](https://discordapp.com/channels/354974912613449730/757585807061155840) in our [Discord server](https://discord.gg/YWrKVTn)
10
+
11
+ ## Common files
12
+
13
+ | File | Use case |
14
+ | :----: | --- |
15
+ | `Dockerfile` | Dockerfile used to build amd64 images |
16
+ | `Dockerfile.aarch64` | Dockerfile used to build 64bit ARM architectures |
17
+ | `Dockerfile.armhf` | Dockerfile used to build 32bit ARM architectures |
18
+ | `Jenkinsfile` | This file is a product of our builder and should not be edited directly. This is used to build the image |
19
+ | `jenkins-vars.yml` | This file is used to generate the `Jenkinsfile` mentioned above, it only affects the build-process |
20
+ | `package_versions.txt` | This file is generated as a part of the build-process and should not be edited directly. It lists all the installed packages and their versions |
21
+ | `README.md` | This file is a product of our builder and should not be edited directly. This displays the readme for the repository and image registries |
22
+ | `readme-vars.yml` | This file is used to generate the `README.md` |
23
+
24
+ ## Readme
25
+
26
+ If you would like to change our readme, please __**do not**__ directly edit the readme, as it is auto-generated on each commit.
27
+ Instead edit the [readme-vars.yml](https://github.com/linuxserver/docker-openssh-server/edit/master/readme-vars.yml).
28
+
29
+ These variables are used in a template for our [Jenkins Builder](https://github.com/linuxserver/docker-jenkins-builder) as part of an ansible play.
30
+ Most of these variables are also carried over to [docs.linuxserver.io](https://docs.linuxserver.io/images/docker-openssh-server)
31
+
32
+ ### Fixing typos or clarify the text in the readme
33
+
34
+ There are variables for multiple parts of the readme, the most common ones are:
35
+
36
+ | Variable | Description |
37
+ | :----: | --- |
38
+ | `project_blurb` | This is the short excerpt shown above the project logo. |
39
+ | `app_setup_block` | This is the text that shows up under "Application Setup" if enabled |
40
+
41
+ ### Parameters
42
+
43
+ The compose and run examples are also generated from these variables.
44
+
45
+ We have a [reference file](https://github.com/linuxserver/docker-jenkins-builder/blob/master/vars/_container-vars-blank) in our Jenkins Builder.
46
+
47
+ These are prefixed with `param_` for required parameters, or `opt_param` for optional parameters, except for `cap_add`.
48
+ Remember to enable param, if currently disabled. This differs between parameters, and can be seen in the reference file.
49
+
50
+ Devices, environment variables, ports and volumes expects its variables in a certain way.
51
+
52
+ ### Devices
53
+
54
+ ```yml
55
+ param_devices:
56
+ - { device_path: "/dev/dri", device_host_path: "/dev/dri", desc: "For hardware transcoding" }
57
+ opt_param_devices:
58
+ - { device_path: "/dev/dri", device_host_path: "/dev/dri", desc: "For hardware transcoding" }
59
+ ```
60
+
61
+ ### Environment variables
62
+
63
+ ```yml
64
+ param_env_vars:
65
+ - { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London." }
66
+ opt_param_env_vars:
67
+ - { env_var: "VERSION", env_value: "latest", desc: "Supported values are LATEST, PLEXPASS or a specific version number." }
68
+ ```
69
+
70
+ ### Ports
71
+
72
+ ```yml
73
+ param_ports:
74
+ - { external_port: "80", internal_port: "80", port_desc: "Application WebUI" }
75
+ opt_param_ports:
76
+ - { external_port: "80", internal_port: "80", port_desc: "Application WebUI" }
77
+ ```
78
+
79
+ ### Volumes
80
+
81
+ ```yml
82
+ param_volumes:
83
+ - { vol_path: "/config", vol_host_path: "</path/to/appdata/config>", desc: "Configuration files." }
84
+ opt_param_volumes:
85
+ - { vol_path: "/config", vol_host_path: "</path/to/appdata/config>", desc: "Configuration files." }
86
+ ```
87
+
88
+ ### Testing template changes
89
+
90
+ After you make any changes to the templates, you can use our [Jenkins Builder](https://github.com/linuxserver/docker-jenkins-builder) to have the files updated from the modified templates. Please use the command found under `Running Locally` [on this page](https://github.com/linuxserver/docker-jenkins-builder/blob/master/README.md) to generate them prior to submitting a PR.
91
+
92
+ ## Dockerfiles
93
+
94
+ We use multiple Dockerfiles in our repos, this is because sometimes some CPU architectures needs different packages to work.
95
+ If you are proposing additional packages to be added, ensure that you added the packages to all the Dockerfiles in alphabetical order.
96
+
97
+ ### Testing your changes
98
+
99
+ ```bash
100
+ git clone https://github.com/linuxserver/docker-openssh-server.git
101
+ cd docker-openssh-server
102
+ docker build \
103
+ --no-cache \
104
+ --pull \
105
+ -t linuxserver/openssh-server:latest .
106
+ ```
107
+
108
+ The ARM variants can be built on x86_64 hardware using `multiarch/qemu-user-static`
109
+
110
+ ```bash
111
+ docker run --rm --privileged multiarch/qemu-user-static:register --reset
112
+ ```
113
+
114
+ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64`.
115
+
116
+ ## Update the changelog
117
+
118
+ If you are modifying the Dockerfiles or any of the startup scripts in [root](https://github.com/linuxserver/docker-openssh-server/tree/master/root), add an entry to the changelog
119
+
120
+ ```yml
121
+ changelogs:
122
+ - { date: "DD.MM.YY:", desc: "Added some love to templates" }
123
+ ```
.github/FUNDING.yml ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ github: linuxserver
2
+ open_collective: linuxserver
.github/ISSUE_TEMPLATE/00-bug-report.md DELETED
@@ -1,48 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Tell us about a problem you are experiencing
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Checklist**
11
-
12
- - [ ] I read the [README](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/README.md)
13
- - [ ] I read the [Important notes](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/README.md#important-notes)
14
- - [ ] I followed instructions to [configure VPN clients](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/README.md#next-steps)
15
- - [ ] I checked [IKEv1 troubleshooting](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients.md#ikev1-troubleshooting), [IKEv2 troubleshooting](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/ikev2-howto.md#ikev2-troubleshooting), [enabled logs](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/docs/advanced-usage.md#enable-libreswan-logs) and checked [VPN status](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients.md#check-logs-and-vpn-status)
16
- - [ ] I searched existing [Issues](https://github.com/hwdsl2/docker-ipsec-vpn-server/issues?q=is%3Aissue)
17
- - [ ] This bug is about the IPsec VPN server Docker image, and not IPsec VPN itself
18
-
19
- <!---
20
- If you found a reproducible bug for the IPsec VPN, open a bug report at https://github.com/libreswan/libreswan. Ask VPN-related questions on the [Libreswan](https://lists.libreswan.org/mailman/listinfo/swan) or [strongSwan](https://lists.strongswan.org/mailman/listinfo/users) users mailing list, or search e.g. [Stack Overflow](https://stackoverflow.com/questions/tagged/vpn).
21
- --->
22
-
23
- **Describe the issue**
24
- A clear and concise description of what the bug is.
25
-
26
- **To Reproduce**
27
- Steps to reproduce the behavior:
28
-
29
- 1. ...
30
- 2. ...
31
-
32
- **Expected behavior**
33
- A clear and concise description of what you expected to happen.
34
-
35
- **Logs**
36
- [Enable logs](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/docs/advanced-usage.md#enable-libreswan-logs), check [VPN status](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients.md#check-logs-and-vpn-status), and add error logs to help explain the problem, if applicable.
37
-
38
- **Server (please complete the following information)**
39
- - Docker host OS: [e.g. Ubuntu 20.04]
40
- - Hosting provider (if applicable): [e.g. GCP, AWS]
41
-
42
- **Client (please complete the following information)**
43
- - Device: [e.g. iPhone 12]
44
- - OS: [e.g. iOS 15]
45
- - VPN mode: [IPsec/L2TP, IPsec/XAuth ("Cisco IPsec") or IKEv2]
46
-
47
- **Additional context**
48
- Add any other context about the problem here.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/ISSUE_TEMPLATE/10-bug-report-zh.md DELETED
@@ -1,48 +0,0 @@
1
- ---
2
- name: 错误报告
3
- about: 请使用这个模板来提交 bug
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
- **任务列表**
11
-
12
- - [ ] 我已阅读 [自述文件](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/README-zh.md)
13
- - [ ] 我已阅读 [重要提示](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/README-zh.md#重要提示)
14
- - [ ] 我已按照说明 [配置 VPN 客户端](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/README-zh.md#下一步)
15
- - [ ] 我检查了 [IKEv1 故障排除](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients-zh.md#ikev1-故障排除),[IKEv2 故障排除](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/ikev2-howto-zh.md#ikev2-故障排除),[启用日志](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/docs/advanced-usage-zh.md#启用-libreswan-日志) 并查看了 [VPN 状态](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients-zh.md#检查日志及-vpn-状态)
16
- - [ ] 我搜索了已有的 [Issues](https://github.com/hwdsl2/docker-ipsec-vpn-server/issues?q=is%3Aissue)
17
- - [ ] 这个 bug 是关于 IPsec VPN 服务器 Docker 镜像,而不是 IPsec VPN 本身
18
-
19
- <!---
20
- 如果你发现了 IPsec VPN 的一个可重复的程序漏洞,请在 https://github.com/libreswan/libreswan 提交一个错误报告。VPN 的相关问题可在 [Libreswan](https://lists.libreswan.org/mailman/listinfo/swan) 或 [strongSwan](https://lists.strongswan.org/mailman/listinfo/users) 用户邮件列表提问,或者搜索比如 [Stack Overflow](https://stackoverflow.com/questions/tagged/vpn) 等网站。
21
- --->
22
-
23
- **问题描述**
24
- 使用清楚简明的语言描述这个 bug。
25
-
26
- **重现步骤**
27
- 重现该 bug 的步骤:
28
-
29
- 1. ...
30
- 2. ...
31
-
32
- **期待的正确结果**
33
- 简要地描述你期望的正确结果。
34
-
35
- **日志**
36
- [启用日志](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/docs/advanced-usage-zh.md#启用-libreswan-日志),检查 [VPN 状态](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients-zh.md#检查日志及-vpn-状态),并且添加错误日志以帮助解释该问题(如果适用)。
37
-
38
- **服务器信息(请填写以下信息)**
39
- - Docker 主机操作系统: [比如 Ubuntu 20.04]
40
- - 服务提供商(如果适用): [比如 GCP, AWS]
41
-
42
- **客户端信息(请填写以下信息)**
43
- - 设备: [比如 iPhone 12]
44
- - 操作系统: [比如 iOS 15]
45
- - VPN 模式: [IPsec/L2TP, IPsec/XAuth ("Cisco IPsec") 或 IKEv2]
46
-
47
- **其它信息**
48
- 添加关于该 bug 的其它信息。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/ISSUE_TEMPLATE/20-enhancement-request.md DELETED
@@ -1,26 +0,0 @@
1
- ---
2
- name: Enhancement request
3
- about: Suggest an improvement for this project
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Checklist**
11
-
12
- - [ ] I searched existing [Issues](https://github.com/hwdsl2/docker-ipsec-vpn-server/issues?q=is%3Aissue), and did not find a similar enhancement request
13
- - [ ] This enhancement request is about the IPsec VPN server Docker image, and not IPsec VPN itself
14
- - [ ] I read the [README](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/README.md)
15
- - [ ] I read the [Important notes](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/README.md#important-notes)
16
- - [ ] I followed instructions to [configure VPN clients](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/README.md#next-steps)
17
- - [ ] I checked [IKEv1 troubleshooting](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients.md#ikev1-troubleshooting), [IKEv2 troubleshooting](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/ikev2-howto.md#ikev2-troubleshooting), [enabled logs](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/docs/advanced-usage.md#enable-libreswan-logs) and checked [VPN status](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients.md#check-logs-and-vpn-status)
18
-
19
- **Describe the enhancement request**
20
- A clear and concise description of your enhancement request.
21
-
22
- **Is your enhancement request related to a problem? Please describe.**
23
- (If applicable) A clear and concise description of what the problem is.
24
-
25
- **Additional context**
26
- Add any other context about the enhancement request here.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/ISSUE_TEMPLATE/30-enhancement-request-zh.md DELETED
@@ -1,26 +0,0 @@
1
- ---
2
- name: 改进建议
3
- about: 请使用这个模板来提交改进建议
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
- **任务列表**
11
-
12
- - [ ] 我搜索了已有的 [Issues](https://github.com/hwdsl2/docker-ipsec-vpn-server/issues?q=is%3Aissue),没有找到类似的改进建议
13
- - [ ] 这个改进建议是关于 IPsec VPN 服务器 Docker 镜像,而不是 IPsec VPN 本身
14
- - [ ] 我已阅读 [自述文件](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/README-zh.md)
15
- - [ ] 我已阅读 [重要提示](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/README-zh.md#重要提示)
16
- - [ ] 我已按照说明 [配置 VPN 客户端](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/README-zh.md#下一步)
17
- - [ ] 我检查了 [IKEv1 故障排除](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients-zh.md#ikev1-故障排除),[IKEv2 故障排除](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/ikev2-howto-zh.md#ikev2-故障排除),[启用日志](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/docs/advanced-usage-zh.md#启用-libreswan-日志) 并查看了 [VPN 状态](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients-zh.md#检查日志及-vpn-状态)
18
-
19
- **描述改进建议**
20
- 使用清楚简明的语言描述你的改进建议。
21
-
22
- **你的改进建议与遇到的问题有关吗?请描述。**
23
- (如果适用)清楚,简洁地说明问题所在。
24
-
25
- **其它信息**
26
- 添加关于该改进建议的其它信息。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/ISSUE_TEMPLATE/config.yml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Discord chat support
4
+ url: https://discord.gg/YWrKVTn
5
+ about: Realtime support / chat with the community and the team.
6
+
7
+ - name: Discourse discussion forum
8
+ url: https://discourse.linuxserver.io
9
+ about: Post on our community forum.
10
+
11
+ - name: Documentation
12
+ url: https://docs.linuxserver.io/images/docker-openssh-server
13
+ about: Documentation - information about all of our containers.
.github/ISSUE_TEMPLATE/issue.bug.yml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Based on the issue template
2
+ name: Bug report
3
+ description: Create a report to help us improve
4
+ title: "[BUG] <title>"
5
+ labels: [Bug]
6
+ body:
7
+ - type: checkboxes
8
+ attributes:
9
+ label: Is there an existing issue for this?
10
+ description: Please search to see if an issue already exists for the bug you encountered.
11
+ options:
12
+ - label: I have searched the existing issues
13
+ required: true
14
+ - type: textarea
15
+ attributes:
16
+ label: Current Behavior
17
+ description: Tell us what happens instead of the expected behavior.
18
+ validations:
19
+ required: true
20
+ - type: textarea
21
+ attributes:
22
+ label: Expected Behavior
23
+ description: Tell us what should happen.
24
+ validations:
25
+ required: false
26
+ - type: textarea
27
+ attributes:
28
+ label: Steps To Reproduce
29
+ description: Steps to reproduce the behavior.
30
+ placeholder: |
31
+ 1. In this environment...
32
+ 2. With this config...
33
+ 3. Run '...'
34
+ 4. See error...
35
+ validations:
36
+ required: true
37
+ - type: textarea
38
+ attributes:
39
+ label: Environment
40
+ description: |
41
+ examples:
42
+ - **OS**: Ubuntu 20.04
43
+ - **How docker service was installed**: distro's packagemanager
44
+ value: |
45
+ - OS:
46
+ - How docker service was installed:
47
+ render: markdown
48
+ validations:
49
+ required: false
50
+ - type: dropdown
51
+ attributes:
52
+ label: CPU architecture
53
+ options:
54
+ - x86-64
55
+ - arm64
56
+ - armhf
57
+ validations:
58
+ required: true
59
+ - type: textarea
60
+ attributes:
61
+ label: Docker creation
62
+ description: |
63
+ Command used to create docker container
64
+ Provide your docker create/run command or compose yaml snippet, or a screenshot of settings if using a gui to create the container
65
+ render: bash
66
+ validations:
67
+ required: true
68
+ - type: textarea
69
+ attributes:
70
+ description: |
71
+ Provide a full docker log, output of "docker logs linuxserver.io"
72
+ label: Container logs
73
+ placeholder: |
74
+ Output of `docker logs linuxserver.io`
75
+ render: bash
76
+ validations:
77
+ required: true
.github/ISSUE_TEMPLATE/issue.feature.yml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Based on the issue template
2
+ name: Feature request
3
+ description: Suggest an idea for this project
4
+ title: "[FEAT] <title>"
5
+ labels: [enhancement]
6
+ body:
7
+ - type: checkboxes
8
+ attributes:
9
+ label: Is this a new feature request?
10
+ description: Please search to see if a feature request already exists.
11
+ options:
12
+ - label: I have searched the existing issues
13
+ required: true
14
+ - type: textarea
15
+ attributes:
16
+ label: Wanted change
17
+ description: Tell us what you want to happen.
18
+ validations:
19
+ required: true
20
+ - type: textarea
21
+ attributes:
22
+ label: Reason for change
23
+ description: Justify your request, why do you want it, what is the benefit.
24
+ validations:
25
+ required: true
26
+ - type: textarea
27
+ attributes:
28
+ label: Proposed code change
29
+ description: Do you have a potential code change in mind?
30
+ validations:
31
+ required: false
.github/PULL_REQUEST_TEMPLATE.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--- Provide a general summary of your changes in the Title above -->
2
+
3
+ [linuxserverurl]: https://linuxserver.io
4
+ [![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl]
5
+
6
+
7
+ <!--- Before submitting a pull request please check the following -->
8
+
9
+ <!--- If this is a fix for a typo (in code, documentation, or the README) please file an issue and let us sort it out. We do not need a PR -->
10
+ <!--- Ask yourself if this modification is something the whole userbase will benefit from, if this is a specific change for corner case functionality or plugins please look at making a Docker Mod or local script https://blog.linuxserver.io/2019/09/14/customizing-our-containers/ -->
11
+ <!--- That if the PR is addressing an existing issue include, closes #<issue number> , in the body of the PR commit message -->
12
+ <!--- You have included links to any files / patches etc your PR may be using in the body of the PR commit message -->
13
+ <!--- We maintain a changelog of major revisions to the container at the end of readme-vars.yml in the root of this repository, please add your changes there if appropriate -->
14
+
15
+
16
+ <!--- Coding guidelines: -->
17
+ <!--- 1. Installed packages in the Dockerfiles should be in alphabetical order -->
18
+ <!--- 2. Changes to Dockerfile should be replicated in Dockerfile.armhf and Dockerfile.aarch64 if applicable -->
19
+ <!--- 3. Indentation style (tabs vs 4 spaces vs 1 space) should match the rest of the document -->
20
+ <!--- 4. Readme is auto generated from readme-vars.yml, make your changes there -->
21
+
22
+ ------------------------------
23
+
24
+ - [ ] I have read the [contributing](https://github.com/linuxserver/docker-openssh-server/blob/master/.github/CONTRIBUTING.md) guideline and understand that I have made the correct modifications
25
+
26
+ ------------------------------
27
+
28
+ <!--- We welcome all PR’s though this doesn’t guarantee it will be accepted. -->
29
+
30
+ ## Description:
31
+ <!--- Describe your changes in detail -->
32
+
33
+ ## Benefits of this PR and context:
34
+ <!--- Please explain why we should accept this PR. If this fixes an outstanding bug, please reference the issue # -->
35
+
36
+ ## How Has This Been Tested?
37
+ <!--- Please describe in detail how you tested your changes. -->
38
+ <!--- Include details of your testing environment, and the tests you ran to -->
39
+ <!--- see how your change affects other areas of the code, etc. -->
40
+
41
+
42
+ ## Source / References:
43
+ <!--- Please include any forum posts/github links relevant to the PR -->
.github/workflows/buildx.yml DELETED
@@ -1,187 +0,0 @@
1
- #
2
- # Copyright (C) 2020-2023 Lin Song <linsongui@gmail.com>
3
- #
4
- # This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
5
- # Unported License: http://creativecommons.org/licenses/by-sa/3.0/
6
- #
7
- # Attribution required: please include my name in any derivative and let me
8
- # know how you have improved it!
9
-
10
- name: buildx
11
-
12
- on:
13
- workflow_call:
14
- inputs:
15
- os_type:
16
- required: true
17
- type: string
18
- secrets:
19
- CACHE_NAME:
20
- required: true
21
- DOCKER_TOKEN:
22
- required: true
23
- QUAY_USER:
24
- required: true
25
- QUAY_TOKEN:
26
- required: true
27
- BUILD_ONLY:
28
- required: true
29
-
30
- jobs:
31
- buildx:
32
- runs-on: ubuntu-20.04
33
- if: github.repository_owner == 'hwdsl2'
34
- steps:
35
- - uses: actions/checkout@v3
36
- with:
37
- persist-credentials: false
38
- - name: Cache
39
- uses: actions/cache@v3
40
- with:
41
- path: |
42
- ${{ runner.temp }}/.buildx-bin
43
- ${{ runner.temp }}/.buildx-cache
44
- ${{ runner.temp }}/.docker-images
45
- key: ${{ secrets.CACHE_NAME }}-${{ github.sha }}-${{ github.run_id }}
46
- restore-keys: |
47
- ${{ secrets.CACHE_NAME }}-
48
- - name: Set up Buildx
49
- env:
50
- RUNNER_TEMP: ${{ runner.temp }}
51
- run: |
52
- [ ! -x /usr/bin/docker ] && exit 1
53
- if [ ! -x /usr/bin/wget ] || [ ! -x /usr/bin/jq ]; then
54
- export DEBIAN_FRONTEND=noninteractive
55
- sudo apt-get -yq update
56
- sudo apt-get -yq install wget jq
57
- fi
58
-
59
- BUILDX_VER=$(wget -t 3 -T 30 -qO- "https://api.github.com/repos/docker/buildx/releases/latest" | jq -r ".tag_name")
60
- [ -z "${BUILDX_VER}" ] && exit 1
61
- echo "Buildx version: ${BUILDX_VER}"
62
-
63
- DOCKER_DIR="${HOME}/.docker/cli-plugins"
64
- CACHE_DIR="${RUNNER_TEMP}/.buildx-bin"
65
- mkdir -p "${DOCKER_DIR}"
66
- if [ -s "${CACHE_DIR}/docker-buildx-${BUILDX_VER}" ]; then
67
- echo "Using buildx binary from cache..."
68
- cp -f "${CACHE_DIR}/docker-buildx-${BUILDX_VER}" "${DOCKER_DIR}/docker-buildx"
69
- else
70
- echo "Downloading buildx..."
71
- BUILDX_URL="https://github.com/docker/buildx/releases/download/${BUILDX_VER}/buildx-${BUILDX_VER}.linux-amd64"
72
- wget -t 3 -T 30 -nv -O "${DOCKER_DIR}/docker-buildx" "${BUILDX_URL}"
73
- [ ! -s "${DOCKER_DIR}/docker-buildx" ] && exit 1
74
- /bin/rm -rf "${CACHE_DIR}"
75
- mkdir -p "${CACHE_DIR}"
76
- /bin/cp -f "${DOCKER_DIR}/docker-buildx" "${CACHE_DIR}/docker-buildx-${BUILDX_VER}"
77
- fi
78
- chmod a+x "${DOCKER_DIR}/docker-buildx"
79
-
80
- docker info
81
- docker buildx version
82
-
83
- image_cache_dir="${RUNNER_TEMP}/.docker-images"
84
- for image in "quay.io/hwdsl2/qemu-user-static:latest" "moby/buildkit:buildx-stable-1"; do
85
- image_file=$(printf '%s' "${image}.tar.gz" | tr '/' '-' | tr ':' '-')
86
- if [ -s "${image_cache_dir}/${image_file}" ]; then
87
- echo "Using ${image} from cache..."
88
- docker load -i "${image_cache_dir}/${image_file}"
89
- else
90
- echo "Downloading ${image}..."
91
- docker pull -q "${image}"
92
- mkdir -p "${image_cache_dir}"
93
- docker save "${image}" | gzip > "${image_cache_dir}/${image_file}"
94
- fi
95
- done
96
-
97
- docker run --rm --privileged quay.io/hwdsl2/qemu-user-static:latest --reset -p yes --credential yes
98
- docker buildx create --name "builder-${GITHUB_SHA::8}" --driver docker-container --use
99
- docker buildx inspect --bootstrap
100
- - name: Docker Hub Login
101
- env:
102
- DOCKER_USER: ${{ github.repository_owner }}
103
- DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
104
- run: echo "$DOCKER_TOKEN" | docker login --username "$DOCKER_USER" --password-stdin 2>&1
105
- - name: Quay.io Login
106
- env:
107
- QUAY_USER: ${{ secrets.QUAY_USER }}
108
- QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
109
- run: echo "$QUAY_TOKEN" | docker login quay.io --username "$QUAY_USER" --password-stdin 2>&1
110
- - name: Docker Buildx
111
- env:
112
- DOCKER_USER: ${{ github.repository_owner }}
113
- BUILD_ONLY: ${{ secrets.BUILD_ONLY }}
114
- RUNNER_TEMP: ${{ runner.temp }}
115
- OS_TYPE: ${{ inputs.os_type }}
116
- run: |
117
- cd "$GITHUB_WORKSPACE"
118
- pwd
119
- ls -ld vpn.env.example
120
-
121
- [ "$BUILD_ONLY" = "true" ] && BUILD_ONLY=""
122
- ts_now=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
123
-
124
- if [ "$OS_TYPE" = "alpine" ]; then
125
- docker buildx build \
126
- --progress plain \
127
- --platform=linux/amd64,linux/arm64,linux/arm/v7 \
128
- --build-arg BUILD_DATE=$ts_now \
129
- --build-arg VCS_REF=${GITHUB_SHA::8} \
130
- --build-arg VERSION=alpine-latest \
131
- --cache-from type=local,src="${RUNNER_TEMP}/.buildx-cache" \
132
- --cache-to type=local,dest="${RUNNER_TEMP}/.buildx-cache-new" \
133
- -t "$DOCKER_USER/ipsec-vpn-server:latest" \
134
- --pull \
135
- ${BUILD_ONLY:+--push} \
136
- .
137
-
138
- docker buildx build \
139
- --progress plain \
140
- --platform=linux/amd64,linux/arm64,linux/arm/v7 \
141
- --build-arg BUILD_DATE=$ts_now \
142
- --build-arg VCS_REF=${GITHUB_SHA::8} \
143
- --build-arg VERSION=alpine-latest \
144
- --cache-from type=local,src="${RUNNER_TEMP}/.buildx-cache-new" \
145
- -t "quay.io/$DOCKER_USER/ipsec-vpn-server:latest" \
146
- --pull \
147
- ${BUILD_ONLY:+--push} \
148
- .
149
- elif [ "$OS_TYPE" = "debian" ]; then
150
- docker buildx build \
151
- --progress plain \
152
- --platform=linux/amd64,linux/arm64,linux/arm/v7 \
153
- --build-arg BUILD_DATE=$ts_now \
154
- --build-arg VCS_REF=${GITHUB_SHA::8} \
155
- --build-arg VERSION=debian-latest \
156
- --cache-from type=local,src="${RUNNER_TEMP}/.buildx-cache" \
157
- --cache-to type=local,dest="${RUNNER_TEMP}/.buildx-cache-new" \
158
- -f Dockerfile.debian \
159
- -t "$DOCKER_USER/ipsec-vpn-server:debian" \
160
- --pull \
161
- ${BUILD_ONLY:+--push} \
162
- .
163
-
164
- docker buildx build \
165
- --progress plain \
166
- --platform=linux/amd64,linux/arm64,linux/arm/v7 \
167
- --build-arg BUILD_DATE=$ts_now \
168
- --build-arg VCS_REF=${GITHUB_SHA::8} \
169
- --build-arg VERSION=debian-latest \
170
- --cache-from type=local,src="${RUNNER_TEMP}/.buildx-cache-new" \
171
- -f Dockerfile.debian \
172
- -t "quay.io/$DOCKER_USER/ipsec-vpn-server:debian" \
173
- --pull \
174
- ${BUILD_ONLY:+--push} \
175
- .
176
- else
177
- exit 1
178
- fi
179
-
180
- /bin/rm -rf "${RUNNER_TEMP}/.buildx-cache"
181
- /bin/mv -f "${RUNNER_TEMP}/.buildx-cache-new" "${RUNNER_TEMP}/.buildx-cache"
182
- - name: Clear
183
- if: always()
184
- run: |
185
- shred -u "${HOME}/.docker/config.json"
186
- rm -f "${HOME}/.docker/config.json"
187
- docker buildx rm "builder-${GITHUB_SHA::8}" || true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/call_issue_pr_tracker.yml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Issue & PR Tracker
2
+
3
+ on:
4
+ issues:
5
+ types: [opened,reopened,labeled,unlabeled]
6
+ pull_request_target:
7
+ types: [opened,reopened,review_requested,review_request_removed,labeled,unlabeled]
8
+
9
+ jobs:
10
+ manage-project:
11
+ permissions:
12
+ issues: write
13
+ uses: linuxserver/github-workflows/.github/workflows/issue-pr-tracker.yml@v1
14
+ secrets: inherit
.github/workflows/call_issues_cron.yml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Mark stale issues and pull requests
2
+ on:
3
+ schedule:
4
+ - cron: '26 1 * * *'
5
+ workflow_dispatch:
6
+
7
+ jobs:
8
+ stale:
9
+ permissions:
10
+ issues: write
11
+ pull-requests: write
12
+ uses: linuxserver/github-workflows/.github/workflows/issues-cron.yml@v1
13
+ secrets: inherit
.github/workflows/check_update.yml DELETED
@@ -1,97 +0,0 @@
1
- #
2
- # Copyright (C) 2020-2023 Lin Song <linsongui@gmail.com>
3
- #
4
- # This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
5
- # Unported License: http://creativecommons.org/licenses/by-sa/3.0/
6
- #
7
- # Attribution required: please include my name in any derivative and let me
8
- # know how you have improved it!
9
-
10
- name: check_update
11
-
12
- on:
13
- workflow_call:
14
- inputs:
15
- os_type:
16
- required: true
17
- type: string
18
- secrets:
19
- CACHE_NAME:
20
- required: true
21
- outputs:
22
- should_test:
23
- value: ${{ jobs.check_update.outputs.should_test }}
24
- should_update:
25
- value: ${{ jobs.check_update.outputs.should_update }}
26
-
27
- jobs:
28
- check_update:
29
- runs-on: ubuntu-20.04
30
- if: github.repository_owner == 'hwdsl2'
31
- env:
32
- DOCKER_USER: ${{ github.repository_owner }}
33
- OS_TYPE: ${{ inputs.os_type }}
34
- outputs:
35
- should_test: ${{ steps.check.outputs.should_test }}
36
- should_update: ${{ steps.check.outputs.should_update }}
37
- steps:
38
- - name: Cache
39
- uses: actions/cache@v3
40
- with:
41
- path: |
42
- ${{ runner.temp }}/.buildx-bin
43
- ${{ runner.temp }}/.buildx-cache
44
- ${{ runner.temp }}/.docker-images
45
- key: ${{ secrets.CACHE_NAME }}-${{ github.sha }}-${{ github.run_id }}-check
46
- restore-keys: |
47
- ${{ secrets.CACHE_NAME }}-
48
- - name: Prepare
49
- run: |
50
- if [ "$OS_TYPE" = "alpine" ]; then
51
- docker pull alpine:3.17
52
- docker pull "$DOCKER_USER/ipsec-vpn-server"
53
- elif [ "$OS_TYPE" = "debian" ]; then
54
- docker pull debian:bullseye-slim
55
- docker pull "$DOCKER_USER/ipsec-vpn-server:debian"
56
- else
57
- exit 1
58
- fi
59
- - name: Check
60
- id: check
61
- run: |
62
- BASE_UPDATED=false
63
-
64
- if [ "$OS_TYPE" = "alpine" ]; then
65
- base_ts=$(docker inspect --format='{{.Created}}' alpine:3.17)
66
- image_ts=$(docker inspect --format='{{.Created}}' "$DOCKER_USER/ipsec-vpn-server")
67
- elif [ "$OS_TYPE" = "debian" ]; then
68
- base_ts=$(docker inspect --format='{{.Created}}' debian:bullseye-slim)
69
- image_ts=$(docker inspect --format='{{.Created}}' "$DOCKER_USER/ipsec-vpn-server:debian")
70
- else
71
- exit 1
72
- fi
73
-
74
- if [ -n "$base_ts" ] && [ -n "$image_ts" ]; then
75
- base_ts_s=$(date -d "$base_ts" +%s)
76
- image_ts_s=$(date -d "$image_ts" +%s)
77
- ts_now=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
78
- ts_now_s=$(date -d "$ts_now" +%s)
79
- diff_s=$((ts_now_s - base_ts_s))
80
- diff=$(printf '%dd %dh:%dm:%ds\n' $(($diff_s/86400)) $(($diff_s%86400/3600)) $(($diff_s%3600/60)) $(($diff_s%60)))
81
-
82
- echo "Base update time: $base_ts"
83
- echo "Image update time: $image_ts"
84
- echo "Current time: $ts_now"
85
- echo "Time diff (cur-base): $diff (${diff_s}s)"
86
-
87
- if [ -n "$base_ts_s" ] && [ -n "$image_ts_s" ] \
88
- && [ "$base_ts_s" -ge "$image_ts_s" ] \
89
- && [ "$diff_s" -ge 14400 ]; then
90
- echo "Starting build..."
91
- BASE_UPDATED=true
92
- else
93
- echo "Not starting build."
94
- fi
95
- fi
96
- echo "should_test=${BASE_UPDATED}" >> "$GITHUB_OUTPUT"
97
- echo "should_update=${BASE_UPDATED}" >> "$GITHUB_OUTPUT"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/cron-alpine.yml DELETED
@@ -1,43 +0,0 @@
1
- #
2
- # Copyright (C) 2020-2023 Lin Song <linsongui@gmail.com>
3
- #
4
- # This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
5
- # Unported License: http://creativecommons.org/licenses/by-sa/3.0/
6
- #
7
- # Attribution required: please include my name in any derivative and let me
8
- # know how you have improved it!
9
-
10
- name: build cron
11
-
12
- on:
13
- schedule:
14
- - cron: '40 2,14 * * *'
15
-
16
- jobs:
17
- check_update:
18
- if: github.repository_owner == 'hwdsl2'
19
- uses: ./.github/workflows/check_update.yml
20
- with:
21
- os_type: alpine
22
- secrets:
23
- CACHE_NAME: ${{ secrets.CACHE_NAME2 }}
24
-
25
- vpn_test:
26
- needs: check_update
27
- if: needs.check_update.outputs.should_test == 'true'
28
- uses: ./.github/workflows/vpn_test.yml
29
- with:
30
- os_type: alpine
31
-
32
- buildx:
33
- needs: [check_update, vpn_test]
34
- if: needs.check_update.outputs.should_update == 'true'
35
- uses: ./.github/workflows/buildx.yml
36
- with:
37
- os_type: alpine
38
- secrets:
39
- CACHE_NAME: ${{ secrets.CACHE_NAME2 }}
40
- DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
41
- QUAY_USER: ${{ secrets.QUAY_USER }}
42
- QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
43
- BUILD_ONLY: ${{ secrets.BUILD_ONLY }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/cron-debian.yml DELETED
@@ -1,43 +0,0 @@
1
- #
2
- # Copyright (C) 2020-2023 Lin Song <linsongui@gmail.com>
3
- #
4
- # This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
5
- # Unported License: http://creativecommons.org/licenses/by-sa/3.0/
6
- #
7
- # Attribution required: please include my name in any derivative and let me
8
- # know how you have improved it!
9
-
10
- name: build debian cron
11
-
12
- on:
13
- schedule:
14
- - cron: '25 2,14 * * *'
15
-
16
- jobs:
17
- check_update:
18
- if: github.repository_owner == 'hwdsl2'
19
- uses: ./.github/workflows/check_update.yml
20
- with:
21
- os_type: debian
22
- secrets:
23
- CACHE_NAME: ${{ secrets.CACHE_NAME }}
24
-
25
- vpn_test:
26
- needs: check_update
27
- if: needs.check_update.outputs.should_test == 'true'
28
- uses: ./.github/workflows/vpn_test.yml
29
- with:
30
- os_type: debian
31
-
32
- buildx:
33
- needs: [check_update, vpn_test]
34
- if: needs.check_update.outputs.should_update == 'true'
35
- uses: ./.github/workflows/buildx.yml
36
- with:
37
- os_type: debian
38
- secrets:
39
- CACHE_NAME: ${{ secrets.CACHE_NAME }}
40
- DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
41
- QUAY_USER: ${{ secrets.QUAY_USER }}
42
- QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
43
- BUILD_ONLY: ${{ secrets.BUILD_ONLY }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/external_trigger.yml ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: External Trigger Main
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ external-trigger-master:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v3.1.0
11
+
12
+ - name: External Trigger
13
+ if: github.ref == 'refs/heads/master'
14
+ run: |
15
+ if [ -n "${{ secrets.PAUSE_EXTERNAL_TRIGGER_OPENSSH_SERVER_MASTER }}" ]; then
16
+ echo "**** Github secret PAUSE_EXTERNAL_TRIGGER_OPENSSH_SERVER_MASTER is set; skipping trigger. ****"
17
+ exit 0
18
+ fi
19
+ echo "**** External trigger running off of master branch. To disable this trigger, set a Github secret named \"PAUSE_EXTERNAL_TRIGGER_OPENSSH_SERVER_MASTER\". ****"
20
+ echo "**** Retrieving external version ****"
21
+ EXT_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
22
+ && awk '/^P:'"openssh-server-pam"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://')
23
+ if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then
24
+ echo "**** Can't retrieve external version, exiting ****"
25
+ FAILURE_REASON="Can't retrieve external version for openssh-server branch master"
26
+ GHA_TRIGGER_URL="https://github.com/linuxserver/docker-openssh-server/actions/runs/${{ github.run_id }}"
27
+ curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 16711680,
28
+ "description": "**Trigger Failed** \n**Reason:** '"${FAILURE_REASON}"' \n**Trigger URL:** '"${GHA_TRIGGER_URL}"' \n"}],
29
+ "username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
30
+ exit 1
31
+ fi
32
+ EXT_RELEASE=$(echo ${EXT_RELEASE} | sed 's/[~,%@+;:/]//g')
33
+ echo "**** External version: ${EXT_RELEASE} ****"
34
+ echo "**** Retrieving last pushed version ****"
35
+ image="linuxserver/openssh-server"
36
+ tag="latest"
37
+ token=$(curl -sX GET \
38
+ "https://ghcr.io/token?scope=repository%3Alinuxserver%2Fopenssh-server%3Apull" \
39
+ | jq -r '.token')
40
+ multidigest=$(curl -s \
41
+ --header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
42
+ --header "Authorization: Bearer ${token}" \
43
+ "https://ghcr.io/v2/${image}/manifests/${tag}" \
44
+ | jq -r 'first(.manifests[].digest)')
45
+ digest=$(curl -s \
46
+ --header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
47
+ --header "Authorization: Bearer ${token}" \
48
+ "https://ghcr.io/v2/${image}/manifests/${multidigest}" \
49
+ | jq -r '.config.digest')
50
+ image_info=$(curl -sL \
51
+ --header "Authorization: Bearer ${token}" \
52
+ "https://ghcr.io/v2/${image}/blobs/${digest}")
53
+ if [[ $(echo $image_info | jq -r '.container_config') == "null" ]]; then
54
+ image_info=$(echo $image_info | jq -r '.config')
55
+ else
56
+ image_info=$(echo $image_info | jq -r '.container_config')
57
+ fi
58
+ IMAGE_RELEASE=$(echo ${image_info} | jq -r '.Labels.build_version' | awk '{print $3}')
59
+ IMAGE_VERSION=$(echo ${IMAGE_RELEASE} | awk -F'-ls' '{print $1}')
60
+ if [ -z "${IMAGE_VERSION}" ]; then
61
+ echo "**** Can't retrieve last pushed version, exiting ****"
62
+ FAILURE_REASON="Can't retrieve last pushed version for openssh-server tag latest"
63
+ curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 16711680,
64
+ "description": "**Trigger Failed** \n**Reason:** '"${FAILURE_REASON}"' \n"}],
65
+ "username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
66
+ exit 1
67
+ fi
68
+ echo "**** Last pushed version: ${IMAGE_VERSION} ****"
69
+ if [ "${EXT_RELEASE}" == "${IMAGE_VERSION}" ]; then
70
+ echo "**** Version ${EXT_RELEASE} already pushed, exiting ****"
71
+ exit 0
72
+ elif [[ $(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.17/main/aarch64/APKINDEX.tar.gz" | tar -xz -C /tmp && awk '/^P:'"openssh-server-pam"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') != "${EXT_RELEASE}" ]] || [[ $(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.17/main/armv7/APKINDEX.tar.gz" | tar -xz -C /tmp && awk '/^P:'"openssh-server-pam"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') != "${EXT_RELEASE}" ]]; then
73
+ echo "**** New version ${EXT_RELEASE} found; but not all arch repos updated yet; exiting ****"
74
+ FAILURE_REASON="New version ${EXT_RELEASE} for openssh-server tag latest is detected, however not all arch repos are updated yet. Will try again later."
75
+ curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
76
+ "description": "**Trigger Failed** \n**Reason:** '"${FAILURE_REASON}"' \n"}],
77
+ "username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
78
+ exit 0
79
+ elif [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-openssh-server/job/master/lastBuild/api/json | jq -r '.building') == "true" ]; then
80
+ echo "**** New version ${EXT_RELEASE} found; but there already seems to be an active build on Jenkins; exiting ****"
81
+ exit 0
82
+ else
83
+ echo "**** New version ${EXT_RELEASE} found; old version was ${IMAGE_VERSION}. Triggering new build ****"
84
+ response=$(curl -iX POST \
85
+ https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-openssh-server/job/master/buildWithParameters?PACKAGE_CHECK=false \
86
+ --user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} | grep -i location | sed "s|^[L|l]ocation: \(.*\)|\1|")
87
+ echo "**** Jenkins job queue url: ${response%$'\r'} ****"
88
+ echo "**** Sleeping 10 seconds until job starts ****"
89
+ sleep 10
90
+ buildurl=$(curl -s "${response%$'\r'}api/json" | jq -r '.executable.url')
91
+ buildurl="${buildurl%$'\r'}"
92
+ echo "**** Jenkins job build url: ${buildurl} ****"
93
+ echo "**** Attempting to change the Jenkins job description ****"
94
+ curl -iX POST \
95
+ "${buildurl}submitDescription" \
96
+ --user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} \
97
+ --data-urlencode "description=GHA external trigger https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
98
+ --data-urlencode "Submit=Submit"
99
+ echo "**** Notifying Discord ****"
100
+ TRIGGER_REASON="A version change was detected for openssh-server tag latest. Old version:${IMAGE_VERSION} New version:${EXT_RELEASE}"
101
+ curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
102
+ "description": "**Build Triggered** \n**Reason:** '"${TRIGGER_REASON}"' \n**Build URL:** '"${buildurl}display/redirect"' \n"}],
103
+ "username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
104
+ fi
.github/workflows/external_trigger_scheduler.yml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: External Trigger Scheduler
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '01 * * * *'
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ external-trigger-scheduler:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v3.1.0
13
+ with:
14
+ fetch-depth: '0'
15
+
16
+ - name: External Trigger Scheduler
17
+ run: |
18
+ echo "**** Branches found: ****"
19
+ git for-each-ref --format='%(refname:short)' refs/remotes
20
+ echo "**** Pulling the yq docker image ****"
21
+ docker pull ghcr.io/linuxserver/yq
22
+ for br in $(git for-each-ref --format='%(refname:short)' refs/remotes)
23
+ do
24
+ br=$(echo "$br" | sed 's|origin/||g')
25
+ echo "**** Evaluating branch ${br} ****"
26
+ ls_branch=$(curl -sX GET https://raw.githubusercontent.com/linuxserver/docker-openssh-server/${br}/jenkins-vars.yml \
27
+ | docker run --rm -i --entrypoint yq ghcr.io/linuxserver/yq -r .ls_branch)
28
+ if [ "$br" == "$ls_branch" ]; then
29
+ echo "**** Branch ${br} appears to be live; checking workflow. ****"
30
+ if curl -sfX GET https://raw.githubusercontent.com/linuxserver/docker-openssh-server/${br}/.github/workflows/external_trigger.yml > /dev/null 2>&1; then
31
+ echo "**** Workflow exists. Triggering external trigger workflow for branch ${br} ****."
32
+ curl -iX POST \
33
+ -H "Authorization: token ${{ secrets.CR_PAT }}" \
34
+ -H "Accept: application/vnd.github.v3+json" \
35
+ -d "{\"ref\":\"refs/heads/${br}\"}" \
36
+ https://api.github.com/repos/linuxserver/docker-openssh-server/actions/workflows/external_trigger.yml/dispatches
37
+ else
38
+ echo "**** Workflow doesn't exist; skipping trigger. ****"
39
+ fi
40
+ else
41
+ echo "**** ${br} appears to be a dev branch; skipping trigger. ****"
42
+ fi
43
+ done
.github/workflows/greetings.yml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Greetings
2
+
3
+ on: [pull_request_target, issues]
4
+
5
+ jobs:
6
+ greeting:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/first-interaction@v1
10
+ with:
11
+ issue-message: 'Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.'
12
+ pr-message: 'Thanks for opening this pull request! Be sure to follow the [pull request template](https://github.com/linuxserver/docker-openssh-server/blob/master/.github/PULL_REQUEST_TEMPLATE.md)!'
13
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
.github/workflows/main-alpine.yml DELETED
@@ -1,45 +0,0 @@
1
- #
2
- # Copyright (C) 2020-2023 Lin Song <linsongui@gmail.com>
3
- #
4
- # This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
5
- # Unported License: http://creativecommons.org/licenses/by-sa/3.0/
6
- #
7
- # Attribution required: please include my name in any derivative and let me
8
- # know how you have improved it!
9
-
10
- name: build
11
-
12
- on:
13
- push:
14
- branches: [master]
15
- paths:
16
- - '.github/workflows/main-alpine.yml'
17
- - '.github/workflows/buildx.yml'
18
- - '.github/workflows/shellcheck.yml'
19
- - '.github/workflows/vpn_test.yml'
20
- - '.dockerignore'
21
- - 'Dockerfile'
22
- - 'run.sh'
23
-
24
- jobs:
25
- shellcheck:
26
- if: github.repository_owner == 'hwdsl2'
27
- uses: ./.github/workflows/shellcheck.yml
28
-
29
- vpn_test:
30
- if: github.repository_owner == 'hwdsl2'
31
- uses: ./.github/workflows/vpn_test.yml
32
- with:
33
- os_type: alpine
34
-
35
- buildx:
36
- needs: [shellcheck, vpn_test]
37
- uses: ./.github/workflows/buildx.yml
38
- with:
39
- os_type: alpine
40
- secrets:
41
- CACHE_NAME: ${{ secrets.CACHE_NAME2 }}
42
- DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
43
- QUAY_USER: ${{ secrets.QUAY_USER }}
44
- QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
45
- BUILD_ONLY: ${{ secrets.BUILD_ONLY }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/main-debian.yml DELETED
@@ -1,45 +0,0 @@
1
- #
2
- # Copyright (C) 2020-2023 Lin Song <linsongui@gmail.com>
3
- #
4
- # This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
5
- # Unported License: http://creativecommons.org/licenses/by-sa/3.0/
6
- #
7
- # Attribution required: please include my name in any derivative and let me
8
- # know how you have improved it!
9
-
10
- name: build debian
11
-
12
- on:
13
- push:
14
- branches: [master]
15
- paths:
16
- - '.github/workflows/main-debian.yml'
17
- - '.github/workflows/buildx.yml'
18
- - '.github/workflows/shellcheck.yml'
19
- - '.github/workflows/vpn_test.yml'
20
- - '.dockerignore'
21
- - 'Dockerfile.debian'
22
- - 'run.sh'
23
-
24
- jobs:
25
- shellcheck:
26
- if: github.repository_owner == 'hwdsl2'
27
- uses: ./.github/workflows/shellcheck.yml
28
-
29
- vpn_test:
30
- if: github.repository_owner == 'hwdsl2'
31
- uses: ./.github/workflows/vpn_test.yml
32
- with:
33
- os_type: debian
34
-
35
- buildx:
36
- needs: [shellcheck, vpn_test]
37
- uses: ./.github/workflows/buildx.yml
38
- with:
39
- os_type: debian
40
- secrets:
41
- CACHE_NAME: ${{ secrets.CACHE_NAME }}
42
- DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
43
- QUAY_USER: ${{ secrets.QUAY_USER }}
44
- QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
45
- BUILD_ONLY: ${{ secrets.BUILD_ONLY }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/package_trigger.yml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Package Trigger Main
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ package-trigger-master:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v3.1.0
11
+
12
+ - name: Package Trigger
13
+ if: github.ref == 'refs/heads/master'
14
+ run: |
15
+ if [ -n "${{ secrets.PAUSE_PACKAGE_TRIGGER_OPENSSH_SERVER_MASTER }}" ]; then
16
+ echo "**** Github secret PAUSE_PACKAGE_TRIGGER_OPENSSH_SERVER_MASTER is set; skipping trigger. ****"
17
+ exit 0
18
+ fi
19
+ if [ $(curl -s https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-openssh-server/job/master/lastBuild/api/json | jq -r '.building') == "true" ]; then
20
+ echo "**** There already seems to be an active build on Jenkins; skipping package trigger ****"
21
+ exit 0
22
+ fi
23
+ echo "**** Package trigger running off of master branch. To disable, set a Github secret named \"PAUSE_PACKAGE_TRIGGER_OPENSSH_SERVER_MASTER\". ****"
24
+ response=$(curl -iX POST \
25
+ https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-openssh-server/job/master/buildWithParameters?PACKAGE_CHECK=true \
26
+ --user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} | grep -i location | sed "s|^[L|l]ocation: \(.*\)|\1|")
27
+ echo "**** Jenkins job queue url: ${response%$'\r'} ****"
28
+ echo "**** Sleeping 10 seconds until job starts ****"
29
+ sleep 10
30
+ buildurl=$(curl -s "${response%$'\r'}api/json" | jq -r '.executable.url')
31
+ buildurl="${buildurl%$'\r'}"
32
+ echo "**** Jenkins job build url: ${buildurl} ****"
33
+ echo "**** Attempting to change the Jenkins job description ****"
34
+ curl -iX POST \
35
+ "${buildurl}submitDescription" \
36
+ --user ${{ secrets.JENKINS_USER }}:${{ secrets.JENKINS_TOKEN }} \
37
+ --data-urlencode "description=GHA package trigger https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
38
+ --data-urlencode "Submit=Submit"
.github/workflows/package_trigger_scheduler.yml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Package Trigger Scheduler
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '39 18 * * 0'
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ package-trigger-scheduler:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v3.1.0
13
+ with:
14
+ fetch-depth: '0'
15
+
16
+ - name: Package Trigger Scheduler
17
+ run: |
18
+ echo "**** Branches found: ****"
19
+ git for-each-ref --format='%(refname:short)' refs/remotes
20
+ echo "**** Pulling the yq docker image ****"
21
+ docker pull ghcr.io/linuxserver/yq
22
+ for br in $(git for-each-ref --format='%(refname:short)' refs/remotes)
23
+ do
24
+ br=$(echo "$br" | sed 's|origin/||g')
25
+ echo "**** Evaluating branch ${br} ****"
26
+ ls_branch=$(curl -sX GET https://raw.githubusercontent.com/linuxserver/docker-openssh-server/${br}/jenkins-vars.yml \
27
+ | docker run --rm -i --entrypoint yq ghcr.io/linuxserver/yq -r .ls_branch)
28
+ if [ "${br}" == "${ls_branch}" ]; then
29
+ echo "**** Branch ${br} appears to be live; checking workflow. ****"
30
+ if curl -sfX GET https://raw.githubusercontent.com/linuxserver/docker-openssh-server/${br}/.github/workflows/package_trigger.yml > /dev/null 2>&1; then
31
+ echo "**** Workflow exists. Triggering package trigger workflow for branch ${br}. ****"
32
+ triggered_branches="${triggered_branches}${br} "
33
+ curl -iX POST \
34
+ -H "Authorization: token ${{ secrets.CR_PAT }}" \
35
+ -H "Accept: application/vnd.github.v3+json" \
36
+ -d "{\"ref\":\"refs/heads/${br}\"}" \
37
+ https://api.github.com/repos/linuxserver/docker-openssh-server/actions/workflows/package_trigger.yml/dispatches
38
+ sleep 30
39
+ else
40
+ echo "**** Workflow doesn't exist; skipping trigger. ****"
41
+ fi
42
+ else
43
+ echo "**** ${br} appears to be a dev branch; skipping trigger. ****"
44
+ fi
45
+ done
46
+ echo "**** Package check build(s) triggered for branch(es): ${triggered_branches} ****"
47
+ echo "**** Notifying Discord ****"
48
+ curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://cdn.discordapp.com/avatars/354986384542662657/df91181b3f1cf0ef1592fbe18e0962d7.png","embeds": [{"color": 9802903,
49
+ "description": "**Package Check Build(s) Triggered for openssh-server** \n**Branch(es):** '"${triggered_branches}"' \n**Build URL:** '"https://ci.linuxserver.io/blue/organizations/jenkins/Docker-Pipeline-Builders%2Fdocker-openssh-server/activity/"' \n"}],
50
+ "username": "Github Actions"}' ${{ secrets.DISCORD_WEBHOOK }}
.github/workflows/permissions.yml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Permission check
2
+ on:
3
+ pull_request_target:
4
+ paths:
5
+ - '**/run'
6
+ - '**/finish'
7
+ - '**/check'
8
+ jobs:
9
+ permission_check:
10
+ uses: linuxserver/github-workflows/.github/workflows/init-svc-executable-permissions.yml@v1
.github/workflows/shellcheck.yml DELETED
@@ -1,38 +0,0 @@
1
- #
2
- # Copyright (C) 2020-2023 Lin Song <linsongui@gmail.com>
3
- #
4
- # This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
5
- # Unported License: http://creativecommons.org/licenses/by-sa/3.0/
6
- #
7
- # Attribution required: please include my name in any derivative and let me
8
- # know how you have improved it!
9
-
10
- name: shellcheck
11
-
12
- on: workflow_call
13
-
14
- jobs:
15
- shellcheck:
16
- runs-on: ubuntu-20.04
17
- if: github.repository_owner == 'hwdsl2'
18
- steps:
19
- - uses: actions/checkout@v3
20
- with:
21
- persist-credentials: false
22
- - name: Check
23
- run: |
24
- if [ ! -x /usr/bin/shellcheck ]; then
25
- export DEBIAN_FRONTEND=noninteractive
26
- sudo apt-get -yqq update
27
- sudo apt-get -yqq install shellcheck
28
- fi
29
-
30
- cd "$GITHUB_WORKSPACE"
31
- pwd
32
- ls -ld vpn.env.example
33
-
34
- export SHELLCHECK_OPTS="-e SC1090,SC1091"
35
- shellcheck --version
36
- shopt -s globstar
37
- ls -ld -- **/*.sh
38
- shellcheck **/*.sh
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/vpn_test.yml DELETED
@@ -1,166 +0,0 @@
1
- #
2
- # Copyright (C) 2020-2023 Lin Song <linsongui@gmail.com>
3
- #
4
- # This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
5
- # Unported License: http://creativecommons.org/licenses/by-sa/3.0/
6
- #
7
- # Attribution required: please include my name in any derivative and let me
8
- # know how you have improved it!
9
-
10
- name: vpn_test
11
-
12
- on:
13
- workflow_call:
14
- inputs:
15
- os_type:
16
- required: true
17
- type: string
18
-
19
- jobs:
20
- vpn_test:
21
- runs-on: ubuntu-20.04
22
- if: github.repository_owner == 'hwdsl2'
23
- strategy:
24
- matrix:
25
- test_id: [no-env, with-env]
26
- fail-fast: false
27
- env:
28
- OS_TYPE: ${{ inputs.os_type }}
29
- TEST_ID: ${{ matrix.test_id }}
30
- steps:
31
- - uses: actions/checkout@v3
32
- with:
33
- persist-credentials: false
34
- - name: Test
35
- run: |
36
- [ ! -x /usr/bin/docker ] && exit 1
37
-
38
- cd "$GITHUB_WORKSPACE"
39
- pwd
40
- ls -ld vpn.env.example
41
- sed -i '/ swan_ver_latest=/s/^/#/' run.sh
42
- sed -i \
43
- -e '/VPN_IPSEC_PSK/s/# //' \
44
- -e '/VPN_USER/s/# //' \
45
- -e '/VPN_PASSWORD/s/# //' \
46
- -e '/VPN_DNS_NAME/s/# //' \
47
- -e '/VPN_CLIENT_NAME/s/# //' \
48
- -e '/VPN_DNS_SRV1/s/# //' \
49
- -e '/VPN_DNS_SRV2/s/# //' vpn.env.example
50
-
51
- set -x
52
-
53
- if [ "$OS_TYPE" = "alpine" ]; then
54
- docker build -t vpn-test .
55
- elif [ "$OS_TYPE" = "debian" ]; then
56
- docker build -f Dockerfile.debian -t vpn-test .
57
- else
58
- exit 1
59
- fi
60
-
61
- if [ "$TEST_ID" = "with-env" ]; then
62
- docker run \
63
- --name "$TEST_ID" \
64
- --env-file ./vpn.env.example \
65
- --restart=always \
66
- -v ikev2-vpn-data:/etc/ipsec.d \
67
- -p 500:500/udp \
68
- -p 4500:4500/udp \
69
- -d --cap-add=NET_ADMIN \
70
- --device=/dev/ppp \
71
- --sysctl net.ipv4.ip_forward=1 \
72
- --sysctl net.ipv4.conf.all.accept_redirects=0 \
73
- --sysctl net.ipv4.conf.all.send_redirects=0 \
74
- --sysctl net.ipv4.conf.all.rp_filter=0 \
75
- --sysctl net.ipv4.conf.default.accept_redirects=0 \
76
- --sysctl net.ipv4.conf.default.send_redirects=0 \
77
- --sysctl net.ipv4.conf.default.rp_filter=0 \
78
- --sysctl net.ipv4.conf.eth0.send_redirects=0 \
79
- --sysctl net.ipv4.conf.eth0.rp_filter=0 \
80
- vpn-test
81
- elif [ "$TEST_ID" = "no-env" ]; then
82
- docker run \
83
- --name "$TEST_ID" \
84
- --restart=always \
85
- -p 500:500/udp \
86
- -p 4500:4500/udp \
87
- -d --privileged \
88
- vpn-test
89
- fi
90
-
91
- sleep 30
92
- docker ps | grep "$TEST_ID"
93
- docker logs "$TEST_ID"
94
- docker exec "$TEST_ID" netstat -anpu | grep pluto
95
- docker exec "$TEST_ID" netstat -anpu | grep xl2tpd
96
- docker exec "$TEST_ID" iptables -nvL
97
- docker exec "$TEST_ID" iptables -nvL | grep -q 'ppp+'
98
- docker exec "$TEST_ID" iptables -nvL | grep -q '192\.168\.43\.0/24'
99
- docker exec "$TEST_ID" iptables -nvL -t nat
100
- docker exec "$TEST_ID" iptables -nvL -t nat | grep -q '192\.168\.42\.0/24'
101
- docker exec "$TEST_ID" iptables -nvL -t nat | grep -q '192\.168\.43\.0/24'
102
- docker exec "$TEST_ID" ipsec status
103
- docker exec "$TEST_ID" ipsec status | grep -q l2tp-psk
104
- docker exec "$TEST_ID" ipsec status | grep -q xauth-psk
105
- if [ "$TEST_ID" = "with-env" ]; then
106
- source ./vpn.env.example
107
- docker exec "$TEST_ID" grep "$VPN_IPSEC_PSK" /etc/ipsec.secrets
108
- docker exec "$TEST_ID" grep "$VPN_USER" /etc/ppp/chap-secrets
109
- docker exec "$TEST_ID" grep "$VPN_PASSWORD" /etc/ppp/chap-secrets
110
- docker exec "$TEST_ID" grep "$VPN_USER" /etc/ipsec.d/passwd
111
- docker exec "$TEST_ID" ipsec status | grep -q ikev2-cp
112
- docker exec "$TEST_ID" grep "leftid=vpn.example.com" /etc/ipsec.conf
113
- docker exec "$TEST_ID" grep 'modecfgdns="1.1.1.1 1.0.0.1"' /etc/ipsec.conf
114
- docker exec "$TEST_ID" grep 'ms-dns 1.1.1.1' /etc/ppp/options.xl2tpd
115
- docker exec "$TEST_ID" grep 'ms-dns 1.0.0.1' /etc/ppp/options.xl2tpd
116
- docker exec "$TEST_ID" grep 'leftid=@vpn.example.com' /etc/ipsec.d/ikev2.conf
117
- docker exec "$TEST_ID" grep 'modecfgdns="1.1.1.1 1.0.0.1"' /etc/ipsec.d/ikev2.conf
118
- docker exec "$TEST_ID" ls -ld /etc/ipsec.d/your_client_name.mobileconfig
119
- docker exec "$TEST_ID" ls -ld /etc/ipsec.d/your_client_name.sswan
120
- docker exec "$TEST_ID" ls -ld /etc/ipsec.d/your_client_name.p12
121
- docker exec "$TEST_ID" grep 'vpn.example.com' /etc/ipsec.d/your_client_name.mobileconfig
122
- docker exec "$TEST_ID" grep 'vpn.example.com' /etc/ipsec.d/your_client_name.sswan
123
- docker exec "$TEST_ID" ikev2.sh --addclient vpnclient2
124
- docker exec "$TEST_ID" ls -ld /etc/ipsec.d/vpnclient2.mobileconfig
125
- docker exec "$TEST_ID" ls -ld /etc/ipsec.d/vpnclient2.sswan
126
- docker exec "$TEST_ID" ls -ld /etc/ipsec.d/vpnclient2.p12
127
- docker exec "$TEST_ID" rm -f /etc/ipsec.d/vpnclient2*
128
- docker exec "$TEST_ID" ikev2.sh --exportclient vpnclient2
129
- docker exec "$TEST_ID" ls -ld /etc/ipsec.d/vpnclient2.mobileconfig
130
- docker exec "$TEST_ID" ls -ld /etc/ipsec.d/vpnclient2.sswan
131
- docker exec "$TEST_ID" ls -ld /etc/ipsec.d/vpnclient2.p12
132
- docker exec "$TEST_ID" ikev2.sh --listclients
133
- echo "y" | docker exec -i "$TEST_ID" ikev2.sh --revokeclient vpnclient2
134
- else
135
- docker exec "$TEST_ID" ipsec status | grep -q ikev2-cp && exit 1
136
- fi
137
-
138
- docker restart "$TEST_ID"
139
-
140
- sleep 10
141
- docker ps | grep "$TEST_ID"
142
- docker logs "$TEST_ID"
143
- docker exec "$TEST_ID" netstat -anpu | grep pluto
144
- docker exec "$TEST_ID" netstat -anpu | grep xl2tpd
145
- docker exec "$TEST_ID" iptables -nvL
146
- docker exec "$TEST_ID" iptables -nvL | grep -q 'ppp+'
147
- docker exec "$TEST_ID" iptables -nvL | grep -q '192\.168\.43\.0/24'
148
- docker exec "$TEST_ID" iptables -nvL -t nat
149
- docker exec "$TEST_ID" iptables -nvL -t nat | grep -q '192\.168\.42\.0/24'
150
- docker exec "$TEST_ID" iptables -nvL -t nat | grep -q '192\.168\.43\.0/24'
151
- docker exec "$TEST_ID" ipsec status
152
- docker exec "$TEST_ID" ipsec status | grep -q l2tp-psk
153
- docker exec "$TEST_ID" ipsec status | grep -q xauth-psk
154
- if [ "$TEST_ID" = "with-env" ]; then
155
- docker exec "$TEST_ID" ipsec status | grep -q ikev2-cp
156
- echo "y" | docker exec -i "$TEST_ID" ikev2.sh --removeikev2
157
- sleep 3
158
- fi
159
- docker exec "$TEST_ID" ipsec status | grep -q ikev2-cp && exit 1
160
-
161
- exit 0
162
- - name: Clear
163
- if: always()
164
- run: |
165
- docker rm -f "$TEST_ID" || true
166
- docker rmi vpn-test || true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.gitignore CHANGED
@@ -1 +1,44 @@
1
- vpn.env
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Windows image file caches
2
+ Thumbs.db
3
+ ehthumbs.db
4
+
5
+ # Folder config file
6
+ Desktop.ini
7
+
8
+ # Recycle Bin used on file shares
9
+ $RECYCLE.BIN/
10
+
11
+ # Windows Installer files
12
+ *.cab
13
+ *.msi
14
+ *.msm
15
+ *.msp
16
+
17
+ # Windows shortcuts
18
+ *.lnk
19
+
20
+ # =========================
21
+ # Operating System Files
22
+ # =========================
23
+
24
+ # OSX
25
+ # =========================
26
+
27
+ .DS_Store
28
+ .AppleDouble
29
+ .LSOverride
30
+
31
+ # Thumbnails
32
+ ._*
33
+
34
+ # Files that might appear on external disk
35
+ .Spotlight-V100
36
+ .Trashes
37
+
38
+ # Directories potentially created on remote AFP share
39
+ .AppleDB
40
+ .AppleDesktop
41
+ Network Trash Folder
42
+ Temporary Items
43
+ .apdisk
44
+ .jenkins-external
Dockerfile CHANGED
@@ -1,60 +1,39 @@
1
- #
2
- # Copyright (C) 2021-2023 Lin Song <linsongui@gmail.com>
3
- #
4
- # This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
5
- # Unported License: http://creativecommons.org/licenses/by-sa/3.0/
6
- #
7
- # Attribution required: please include my name in any derivative and let me
8
- # know how you have improved it!
9
 
10
- FROM alpine:3.17
11
 
12
- ENV SWAN_VER 4.10
13
- WORKDIR /opt/src
14
-
15
- RUN set -x \
16
- && apk add --no-cache \
17
- bash bind-tools coreutils openssl uuidgen wget xl2tpd iproute2 \
18
- libcap-ng libcurl libevent linux-pam musl nspr nss nss-tools openrc \
19
- bison flex gcc make libc-dev bsd-compat-headers linux-pam-dev \
20
- nss-dev libcap-ng-dev libevent-dev curl-dev nspr-dev \
21
- && wget -t 3 -T 30 -nv -O libreswan.tar.gz "https://github.com/libreswan/libreswan/archive/v${SWAN_VER}.tar.gz" \
22
- || wget -t 3 -T 30 -nv -O libreswan.tar.gz "https://download.libreswan.org/libreswan-${SWAN_VER}.tar.gz" \
23
- && tar xzf libreswan.tar.gz \
24
- && rm -f libreswan.tar.gz \
25
- && cd "libreswan-${SWAN_VER}" \
26
- && printf 'WERROR_CFLAGS=-w -s\nUSE_DNSSEC=false\nUSE_DH2=true\nFINALNSSDIR=/etc/ipsec.d\n' > Makefile.inc.local \
27
- && make -s base \
28
- && make -s install-base \
29
- && cd /opt/src \
30
- && mkdir -p /run/openrc \
31
- && touch /run/openrc/softlevel \
32
- && rm -rf "/opt/src/libreswan-${SWAN_VER}" \
33
- && apk del --no-cache \
34
- bison flex gcc make libc-dev bsd-compat-headers linux-pam-dev \
35
- nss-dev libcap-ng-dev libevent-dev curl-dev nspr-dev
36
 
37
- RUN wget -t 3 -T 30 -nv -O /opt/src/ikev2.sh https://github.com/hwdsl2/setup-ipsec-vpn/raw/2039f91151c4a339c57fff221d6b540d523dd262/extras/ikev2setup.sh \
38
- && chmod +x /opt/src/ikev2.sh \
39
- && ln -s /opt/src/ikev2.sh /usr/bin
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
- COPY ./run.sh /opt/src/run.sh
42
- RUN chmod 755 /opt/src/run.sh
43
- EXPOSE 500/udp 7860/udp
44
- CMD ["/opt/src/run.sh"]
45
 
46
- ARG BUILD_DATE
47
- ARG VERSION
48
- ARG VCS_REF
49
- ENV IMAGE_VER $BUILD_DATE
50
 
51
- LABEL maintainer="Lin Song <linsongui@gmail.com>" \
52
- org.opencontainers.image.created="$BUILD_DATE" \
53
- org.opencontainers.image.version="$VERSION" \
54
- org.opencontainers.image.revision="$VCS_REF" \
55
- org.opencontainers.image.authors="Lin Song <linsongui@gmail.com>" \
56
- org.opencontainers.image.title="IPsec VPN Server on Docker" \
57
- org.opencontainers.image.description="Docker image to run an IPsec VPN server, with IPsec/L2TP, Cisco IPsec and IKEv2." \
58
- org.opencontainers.image.url="https://github.com/hwdsl2/docker-ipsec-vpn-server" \
59
- org.opencontainers.image.source="https://github.com/hwdsl2/docker-ipsec-vpn-server" \
60
- org.opencontainers.image.documentation="https://github.com/hwdsl2/docker-ipsec-vpn-server"
 
1
+ # syntax=docker/dockerfile:1
 
 
 
 
 
 
 
2
 
3
+ FROM ghcr.io/linuxserver/baseimage-alpine:3.17
4
 
5
+ # set version label
6
+ ARG BUILD_DATE
7
+ ARG VERSION
8
+ ARG OPENSSH_RELEASE
9
+ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
10
+ LABEL maintainer="aptalca"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ RUN \
13
+ echo "**** install runtime packages ****" && \
14
+ apk add --no-cache --upgrade \
15
+ logrotate \
16
+ nano \
17
+ netcat-openbsd \
18
+ sudo && \
19
+ echo "**** install openssh-server ****" && \
20
+ if [ -z ${OPENSSH_RELEASE+x} ]; then \
21
+ OPENSSH_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp && \
22
+ awk '/^P:openssh-server-pam$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
23
+ fi && \
24
+ apk add --no-cache \
25
+ openssh-client==${OPENSSH_RELEASE} \
26
+ openssh-server-pam==${OPENSSH_RELEASE} \
27
+ openssh-sftp-server==${OPENSSH_RELEASE} && \
28
+ echo "**** setup openssh environment ****" && \
29
+ sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config && \
30
+ usermod --shell /bin/bash abc && \
31
+ rm -rf \
32
+ /tmp/*
33
 
34
+ # add local files
35
+ COPY /root /
 
 
36
 
37
+ EXPOSE 2222
 
 
 
38
 
39
+ VOLUME /config
 
 
 
 
 
 
 
 
 
Dockerfile.aarch64 ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # syntax=docker/dockerfile:1
2
+
3
+ FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.17
4
+
5
+ # set version label
6
+ ARG BUILD_DATE
7
+ ARG VERSION
8
+ ARG OPENSSH_RELEASE
9
+ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
10
+ LABEL maintainer="aptalca"
11
+
12
+ RUN \
13
+ echo "**** install runtime packages ****" && \
14
+ apk add --no-cache --upgrade \
15
+ logrotate \
16
+ nano \
17
+ netcat-openbsd \
18
+ sudo && \
19
+ echo "**** install openssh-server ****" && \
20
+ if [ -z ${OPENSSH_RELEASE+x} ]; then \
21
+ OPENSSH_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.17/main/aarch64/APKINDEX.tar.gz" | tar -xz -C /tmp && \
22
+ awk '/^P:openssh-server-pam$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
23
+ fi && \
24
+ apk add --no-cache \
25
+ openssh-client==${OPENSSH_RELEASE} \
26
+ openssh-server-pam==${OPENSSH_RELEASE} \
27
+ openssh-sftp-server==${OPENSSH_RELEASE} && \
28
+ echo "**** setup openssh environment ****" && \
29
+ sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config && \
30
+ usermod --shell /bin/bash abc && \
31
+ rm -rf \
32
+ /tmp/*
33
+
34
+ # add local files
35
+ COPY /root /
36
+
37
+ EXPOSE 2222
38
+
39
+ VOLUME /config
Dockerfile.armhf ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # syntax=docker/dockerfile:1
2
+
3
+ FROM ghcr.io/linuxserver/baseimage-alpine:arm32v7-3.17
4
+
5
+ # set version label
6
+ ARG BUILD_DATE
7
+ ARG VERSION
8
+ ARG OPENSSH_RELEASE
9
+ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
10
+ LABEL maintainer="aptalca"
11
+
12
+ RUN \
13
+ echo "**** install runtime packages ****" && \
14
+ apk add --no-cache --upgrade \
15
+ logrotate \
16
+ nano \
17
+ netcat-openbsd \
18
+ sudo && \
19
+ echo "**** install openssh-server ****" && \
20
+ if [ -z ${OPENSSH_RELEASE+x} ]; then \
21
+ OPENSSH_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.17/main/armhf/APKINDEX.tar.gz" | tar -xz -C /tmp && \
22
+ awk '/^P:openssh-server-pam$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
23
+ fi && \
24
+ apk add --no-cache \
25
+ openssh-client==${OPENSSH_RELEASE} \
26
+ openssh-server-pam==${OPENSSH_RELEASE} \
27
+ openssh-sftp-server==${OPENSSH_RELEASE} && \
28
+ echo "**** setup openssh environment ****" && \
29
+ sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config && \
30
+ usermod --shell /bin/bash abc && \
31
+ rm -rf \
32
+ /tmp/*
33
+
34
+ # add local files
35
+ COPY /root /
36
+
37
+ EXPOSE 2222
38
+
39
+ VOLUME /config
Dockerfile.debian DELETED
@@ -1,68 +0,0 @@
1
- #
2
- # Copyright (C) 2016-2023 Lin Song <linsongui@gmail.com>
3
- #
4
- # This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
5
- # Unported License: http://creativecommons.org/licenses/by-sa/3.0/
6
- #
7
- # Attribution required: please include my name in any derivative and let me
8
- # know how you have improved it!
9
-
10
- FROM debian:bullseye-slim
11
-
12
- ENV SWAN_VER 4.10
13
- WORKDIR /opt/src
14
-
15
- RUN apt-get -yqq update \
16
- && DEBIAN_FRONTEND=noninteractive \
17
- apt-get -yqq --no-install-recommends install \
18
- wget dnsutils openssl ca-certificates kmod iproute2 \
19
- gawk net-tools iptables bsdmainutils libcurl3-nss \
20
- libnss3-tools libevent-dev uuid-runtime xl2tpd \
21
- libnss3-dev libnspr4-dev pkg-config libpam0g-dev \
22
- libcap-ng-dev libcap-ng-utils libselinux1-dev \
23
- libcurl4-nss-dev flex bison gcc make \
24
- && wget -t 3 -T 30 -nv -O libreswan.tar.gz "https://github.com/libreswan/libreswan/archive/v${SWAN_VER}.tar.gz" \
25
- || wget -t 3 -T 30 -nv -O libreswan.tar.gz "https://download.libreswan.org/libreswan-${SWAN_VER}.tar.gz" \
26
- && tar xzf libreswan.tar.gz \
27
- && rm -f libreswan.tar.gz \
28
- && cd "libreswan-${SWAN_VER}" \
29
- && printf 'WERROR_CFLAGS=-w -s\nUSE_DNSSEC=false\nUSE_SYSTEMD_WATCHDOG=false\n' > Makefile.inc.local \
30
- && printf 'USE_DH2=true\nUSE_NSS_KDF=false\nFINALNSSDIR=/etc/ipsec.d\n' >> Makefile.inc.local \
31
- && make -s base \
32
- && make -s install-base \
33
- && cd /opt/src \
34
- && rm -rf "/opt/src/libreswan-${SWAN_VER}" \
35
- && apt-get -yqq remove \
36
- libnss3-dev libnspr4-dev pkg-config libpam0g-dev \
37
- libcap-ng-dev libcap-ng-utils libselinux1-dev \
38
- libcurl4-nss-dev flex bison gcc make \
39
- && apt-get -yqq autoremove \
40
- && apt-get -y clean \
41
- && rm -rf /var/lib/apt/lists/* \
42
- && rm -rf /var/log/* \
43
- && update-alternatives --set iptables /usr/sbin/iptables-legacy
44
-
45
- RUN wget -t 3 -T 30 -nv -O /opt/src/ikev2.sh https://github.com/hwdsl2/setup-ipsec-vpn/raw/2039f91151c4a339c57fff221d6b540d523dd262/extras/ikev2setup.sh \
46
- && chmod +x /opt/src/ikev2.sh \
47
- && ln -s /opt/src/ikev2.sh /usr/bin
48
-
49
- COPY ./run.sh /opt/src/run.sh
50
- RUN chmod 755 /opt/src/run.sh
51
- EXPOSE 500/udp 4500/udp
52
- CMD ["/opt/src/run.sh"]
53
-
54
- ARG BUILD_DATE
55
- ARG VERSION
56
- ARG VCS_REF
57
- ENV IMAGE_VER $BUILD_DATE
58
-
59
- LABEL maintainer="Lin Song <linsongui@gmail.com>" \
60
- org.opencontainers.image.created="$BUILD_DATE" \
61
- org.opencontainers.image.version="$VERSION" \
62
- org.opencontainers.image.revision="$VCS_REF" \
63
- org.opencontainers.image.authors="Lin Song <linsongui@gmail.com>" \
64
- org.opencontainers.image.title="IPsec VPN Server on Docker" \
65
- org.opencontainers.image.description="Docker image to run an IPsec VPN server, with IPsec/L2TP, Cisco IPsec and IKEv2." \
66
- org.opencontainers.image.url="https://github.com/hwdsl2/docker-ipsec-vpn-server" \
67
- org.opencontainers.image.source="https://github.com/hwdsl2/docker-ipsec-vpn-server" \
68
- org.opencontainers.image.documentation="https://github.com/hwdsl2/docker-ipsec-vpn-server"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Jenkinsfile ADDED
@@ -0,0 +1,986 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pipeline {
2
+ agent {
3
+ label 'X86-64-MULTI'
4
+ }
5
+ options {
6
+ buildDiscarder(logRotator(numToKeepStr: '10', daysToKeepStr: '60'))
7
+ parallelsAlwaysFailFast()
8
+ }
9
+ // Input to determine if this is a package check
10
+ parameters {
11
+ string(defaultValue: 'false', description: 'package check run', name: 'PACKAGE_CHECK')
12
+ }
13
+ // Configuration for the variables used for this specific repo
14
+ environment {
15
+ BUILDS_DISCORD=credentials('build_webhook_url')
16
+ GITHUB_TOKEN=credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab')
17
+ GITLAB_TOKEN=credentials('b6f0f1dd-6952-4cf6-95d1-9c06380283f0')
18
+ GITLAB_NAMESPACE=credentials('gitlab-namespace-id')
19
+ SCARF_TOKEN=credentials('scarf_api_key')
20
+ CONTAINER_NAME = 'openssh-server'
21
+ BUILD_VERSION_ARG = 'OPENSSH_RELEASE'
22
+ LS_USER = 'linuxserver'
23
+ LS_REPO = 'docker-openssh-server'
24
+ DOCKERHUB_IMAGE = 'linuxserver/openssh-server'
25
+ DEV_DOCKERHUB_IMAGE = 'lsiodev/openssh-server'
26
+ PR_DOCKERHUB_IMAGE = 'lspipepr/openssh-server'
27
+ DIST_IMAGE = 'alpine'
28
+ DIST_TAG = '3.17'
29
+ DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.17/main/'
30
+ DIST_REPO_PACKAGES = 'openssh-server-pam'
31
+ MULTIARCH='true'
32
+ CI='true'
33
+ CI_WEB='false'
34
+ CI_PORT='80'
35
+ CI_SSL='false'
36
+ CI_DELAY='60'
37
+ CI_DOCKERENV='TZ=US/Pacific'
38
+ CI_AUTH='user:password'
39
+ CI_WEBPATH=''
40
+ }
41
+ stages {
42
+ // Setup all the basic environment variables needed for the build
43
+ stage("Set ENV Variables base"){
44
+ steps{
45
+ script{
46
+ env.EXIT_STATUS = ''
47
+ env.LS_RELEASE = sh(
48
+ script: '''docker run --rm ghcr.io/linuxserver/alexeiled-skopeo sh -c 'skopeo inspect docker://docker.io/'${DOCKERHUB_IMAGE}':latest 2>/dev/null' | jq -r '.Labels.build_version' | awk '{print $3}' | grep '\\-ls' || : ''',
49
+ returnStdout: true).trim()
50
+ env.LS_RELEASE_NOTES = sh(
51
+ script: '''cat readme-vars.yml | awk -F \\" '/date: "[0-9][0-9].[0-9][0-9].[0-9][0-9]:/ {print $4;exit;}' | sed -E ':a;N;$!ba;s/\\r{0,1}\\n/\\\\n/g' ''',
52
+ returnStdout: true).trim()
53
+ env.GITHUB_DATE = sh(
54
+ script: '''date '+%Y-%m-%dT%H:%M:%S%:z' ''',
55
+ returnStdout: true).trim()
56
+ env.COMMIT_SHA = sh(
57
+ script: '''git rev-parse HEAD''',
58
+ returnStdout: true).trim()
59
+ env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT
60
+ env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
61
+ env.PULL_REQUEST = env.CHANGE_ID
62
+ env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE .editorconfig ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.yml ./.github/ISSUE_TEMPLATE/issue.feature.yml ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/external_trigger_scheduler.yml ./.github/workflows/greetings.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/call_issue_pr_tracker.yml ./.github/workflows/call_issues_cron.yml ./.github/workflows/permissions.yml ./.github/workflows/external_trigger.yml ./.github/workflows/package_trigger.yml'
63
+ }
64
+ script{
65
+ env.LS_RELEASE_NUMBER = sh(
66
+ script: '''echo ${LS_RELEASE} |sed 's/^.*-ls//g' ''',
67
+ returnStdout: true).trim()
68
+ }
69
+ script{
70
+ env.LS_TAG_NUMBER = sh(
71
+ script: '''#! /bin/bash
72
+ tagsha=$(git rev-list -n 1 ${LS_RELEASE} 2>/dev/null)
73
+ if [ "${tagsha}" == "${COMMIT_SHA}" ]; then
74
+ echo ${LS_RELEASE_NUMBER}
75
+ elif [ -z "${GIT_COMMIT}" ]; then
76
+ echo ${LS_RELEASE_NUMBER}
77
+ else
78
+ echo $((${LS_RELEASE_NUMBER} + 1))
79
+ fi''',
80
+ returnStdout: true).trim()
81
+ }
82
+ }
83
+ }
84
+ /* #######################
85
+ Package Version Tagging
86
+ ####################### */
87
+ // Grab the current package versions in Git to determine package tag
88
+ stage("Set Package tag"){
89
+ steps{
90
+ script{
91
+ env.PACKAGE_TAG = sh(
92
+ script: '''#!/bin/bash
93
+ if [ -e package_versions.txt ] ; then
94
+ cat package_versions.txt | md5sum | cut -c1-8
95
+ else
96
+ echo none
97
+ fi''',
98
+ returnStdout: true).trim()
99
+ }
100
+ }
101
+ }
102
+ /* ########################
103
+ External Release Tagging
104
+ ######################## */
105
+ // If this is an alpine repo change for external version determine an md5 from the version string
106
+ stage("Set tag Alpine Repo"){
107
+ steps{
108
+ script{
109
+ env.EXT_RELEASE = sh(
110
+ script: '''curl -sL "${DIST_REPO}x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
111
+ && awk '/^P:'"${DIST_REPO_PACKAGES}"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://' ''',
112
+ returnStdout: true).trim()
113
+ env.RELEASE_LINK = 'alpine_repo'
114
+ }
115
+ }
116
+ }
117
+ // Sanitize the release tag and strip illegal docker or github characters
118
+ stage("Sanitize tag"){
119
+ steps{
120
+ script{
121
+ env.EXT_RELEASE_CLEAN = sh(
122
+ script: '''echo ${EXT_RELEASE} | sed 's/[~,%@+;:/]//g' ''',
123
+ returnStdout: true).trim()
124
+
125
+ def semver = env.EXT_RELEASE_CLEAN =~ /(\d+)\.(\d+)\.(\d+)/
126
+ if (semver.find()) {
127
+ env.SEMVER = "${semver[0][1]}.${semver[0][2]}.${semver[0][3]}"
128
+ } else {
129
+ semver = env.EXT_RELEASE_CLEAN =~ /(\d+)\.(\d+)(?:\.(\d+))?(.*)/
130
+ if (semver.find()) {
131
+ if (semver[0][3]) {
132
+ env.SEMVER = "${semver[0][1]}.${semver[0][2]}.${semver[0][3]}"
133
+ } else if (!semver[0][3] && !semver[0][4]) {
134
+ env.SEMVER = "${semver[0][1]}.${semver[0][2]}.${(new Date()).format('YYYYMMdd')}"
135
+ }
136
+ }
137
+ }
138
+
139
+ if (env.SEMVER != null) {
140
+ if (BRANCH_NAME != "master" && BRANCH_NAME != "main") {
141
+ env.SEMVER = "${env.SEMVER}-${BRANCH_NAME}"
142
+ }
143
+ println("SEMVER: ${env.SEMVER}")
144
+ } else {
145
+ println("No SEMVER detected")
146
+ }
147
+
148
+ }
149
+ }
150
+ }
151
+ // If this is a master build use live docker endpoints
152
+ stage("Set ENV live build"){
153
+ when {
154
+ branch "master"
155
+ environment name: 'CHANGE_ID', value: ''
156
+ }
157
+ steps {
158
+ script{
159
+ env.IMAGE = env.DOCKERHUB_IMAGE
160
+ env.GITHUBIMAGE = 'ghcr.io/' + env.LS_USER + '/' + env.CONTAINER_NAME
161
+ env.GITLABIMAGE = 'registry.gitlab.com/linuxserver.io/' + env.LS_REPO + '/' + env.CONTAINER_NAME
162
+ env.QUAYIMAGE = 'quay.io/linuxserver.io/' + env.CONTAINER_NAME
163
+ if (env.MULTIARCH == 'true') {
164
+ env.CI_TAGS = 'amd64-' + env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER + '|arm32v7-' + env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER + '|arm64v8-' + env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER
165
+ } else {
166
+ env.CI_TAGS = env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER
167
+ }
168
+ env.VERSION_TAG = env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER
169
+ env.META_TAG = env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER
170
+ env.EXT_RELEASE_TAG = 'version-' + env.EXT_RELEASE_CLEAN
171
+ }
172
+ }
173
+ }
174
+ // If this is a dev build use dev docker endpoints
175
+ stage("Set ENV dev build"){
176
+ when {
177
+ not {branch "master"}
178
+ environment name: 'CHANGE_ID', value: ''
179
+ }
180
+ steps {
181
+ script{
182
+ env.IMAGE = env.DEV_DOCKERHUB_IMAGE
183
+ env.GITHUBIMAGE = 'ghcr.io/' + env.LS_USER + '/lsiodev-' + env.CONTAINER_NAME
184
+ env.GITLABIMAGE = 'registry.gitlab.com/linuxserver.io/' + env.LS_REPO + '/lsiodev-' + env.CONTAINER_NAME
185
+ env.QUAYIMAGE = 'quay.io/linuxserver.io/lsiodev-' + env.CONTAINER_NAME
186
+ if (env.MULTIARCH == 'true') {
187
+ env.CI_TAGS = 'amd64-' + env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA + '|arm32v7-' + env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA + '|arm64v8-' + env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA
188
+ } else {
189
+ env.CI_TAGS = env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA
190
+ }
191
+ env.VERSION_TAG = env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA
192
+ env.META_TAG = env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA
193
+ env.EXT_RELEASE_TAG = 'version-' + env.EXT_RELEASE_CLEAN
194
+ env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DEV_DOCKERHUB_IMAGE + '/tags/'
195
+ }
196
+ }
197
+ }
198
+ // If this is a pull request build use dev docker endpoints
199
+ stage("Set ENV PR build"){
200
+ when {
201
+ not {environment name: 'CHANGE_ID', value: ''}
202
+ }
203
+ steps {
204
+ script{
205
+ env.IMAGE = env.PR_DOCKERHUB_IMAGE
206
+ env.GITHUBIMAGE = 'ghcr.io/' + env.LS_USER + '/lspipepr-' + env.CONTAINER_NAME
207
+ env.GITLABIMAGE = 'registry.gitlab.com/linuxserver.io/' + env.LS_REPO + '/lspipepr-' + env.CONTAINER_NAME
208
+ env.QUAYIMAGE = 'quay.io/linuxserver.io/lspipepr-' + env.CONTAINER_NAME
209
+ if (env.MULTIARCH == 'true') {
210
+ env.CI_TAGS = 'amd64-' + env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST + '|arm32v7-' + env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST + '|arm64v8-' + env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST
211
+ } else {
212
+ env.CI_TAGS = env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST
213
+ }
214
+ env.VERSION_TAG = env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST
215
+ env.META_TAG = env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST
216
+ env.EXT_RELEASE_TAG = 'version-' + env.EXT_RELEASE_CLEAN
217
+ env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/pull/' + env.PULL_REQUEST
218
+ env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.PR_DOCKERHUB_IMAGE + '/tags/'
219
+ }
220
+ }
221
+ }
222
+ // Run ShellCheck
223
+ stage('ShellCheck') {
224
+ when {
225
+ environment name: 'CI', value: 'true'
226
+ }
227
+ steps {
228
+ withCredentials([
229
+ string(credentialsId: 'ci-tests-s3-key-id', variable: 'S3_KEY'),
230
+ string(credentialsId: 'ci-tests-s3-secret-access-key', variable: 'S3_SECRET')
231
+ ]) {
232
+ script{
233
+ env.SHELLCHECK_URL = 'https://ci-tests.linuxserver.io/' + env.IMAGE + '/' + env.META_TAG + '/shellcheck-result.xml'
234
+ }
235
+ sh '''curl -sL https://raw.githubusercontent.com/linuxserver/docker-shellcheck/master/checkrun.sh | /bin/bash'''
236
+ sh '''#! /bin/bash
237
+ docker run --rm \
238
+ -v ${WORKSPACE}:/mnt \
239
+ -e AWS_ACCESS_KEY_ID=\"${S3_KEY}\" \
240
+ -e AWS_SECRET_ACCESS_KEY=\"${S3_SECRET}\" \
241
+ ghcr.io/linuxserver/baseimage-alpine:3.17 s6-envdir -fn -- /var/run/s6/container_environment /bin/bash -c "\
242
+ apk add --no-cache py3-pip && \
243
+ pip install s3cmd && \
244
+ s3cmd put --no-preserve --acl-public -m text/xml /mnt/shellcheck-result.xml s3://ci-tests.linuxserver.io/${IMAGE}/${META_TAG}/shellcheck-result.xml" || :'''
245
+ }
246
+ }
247
+ }
248
+ // Use helper containers to render templated files
249
+ stage('Update-Templates') {
250
+ when {
251
+ branch "master"
252
+ environment name: 'CHANGE_ID', value: ''
253
+ expression {
254
+ env.CONTAINER_NAME != null
255
+ }
256
+ }
257
+ steps {
258
+ sh '''#! /bin/bash
259
+ set -e
260
+ TEMPDIR=$(mktemp -d)
261
+ docker pull ghcr.io/linuxserver/jenkins-builder:latest
262
+ docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=master -v ${TEMPDIR}:/ansible/jenkins ghcr.io/linuxserver/jenkins-builder:latest
263
+ # Stage 1 - Jenkinsfile update
264
+ if [[ "$(md5sum Jenkinsfile | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile | awk '{ print $1 }')" ]]; then
265
+ mkdir -p ${TEMPDIR}/repo
266
+ git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
267
+ cd ${TEMPDIR}/repo/${LS_REPO}
268
+ git checkout -f master
269
+ cp ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile ${TEMPDIR}/repo/${LS_REPO}/
270
+ git add Jenkinsfile
271
+ git commit -m 'Bot Updating Templated Files'
272
+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all
273
+ echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
274
+ echo "Updating Jenkinsfile"
275
+ rm -Rf ${TEMPDIR}
276
+ exit 0
277
+ else
278
+ echo "Jenkinsfile is up to date."
279
+ fi
280
+ # Stage 2 - Delete old templates
281
+ OLD_TEMPLATES=".github/ISSUE_TEMPLATE.md .github/ISSUE_TEMPLATE/issue.bug.md .github/ISSUE_TEMPLATE/issue.feature.md .github/workflows/call_invalid_helper.yml .github/workflows/stale.yml"
282
+ for i in ${OLD_TEMPLATES}; do
283
+ if [[ -f "${i}" ]]; then
284
+ TEMPLATES_TO_DELETE="${i} ${TEMPLATES_TO_DELETE}"
285
+ fi
286
+ done
287
+ if [[ -n "${TEMPLATES_TO_DELETE}" ]]; then
288
+ mkdir -p ${TEMPDIR}/repo
289
+ git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
290
+ cd ${TEMPDIR}/repo/${LS_REPO}
291
+ git checkout -f master
292
+ for i in ${TEMPLATES_TO_DELETE}; do
293
+ git rm "${i}"
294
+ done
295
+ git commit -m 'Bot Updating Templated Files'
296
+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all
297
+ echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
298
+ echo "Deleting old and deprecated templates"
299
+ rm -Rf ${TEMPDIR}
300
+ exit 0
301
+ else
302
+ echo "No templates to delete"
303
+ fi
304
+ # Stage 3 - Update templates
305
+ CURRENTHASH=$(grep -hs ^ ${TEMPLATED_FILES} | md5sum | cut -c1-8)
306
+ cd ${TEMPDIR}/docker-${CONTAINER_NAME}
307
+ NEWHASH=$(grep -hs ^ ${TEMPLATED_FILES} | md5sum | cut -c1-8)
308
+ if [[ "${CURRENTHASH}" != "${NEWHASH}" ]] || ! grep -q '.jenkins-external' "${WORKSPACE}/.gitignore" 2>/dev/null; then
309
+ mkdir -p ${TEMPDIR}/repo
310
+ git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
311
+ cd ${TEMPDIR}/repo/${LS_REPO}
312
+ git checkout -f master
313
+ cd ${TEMPDIR}/docker-${CONTAINER_NAME}
314
+ mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/workflows
315
+ mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github/ISSUE_TEMPLATE
316
+ cp --parents ${TEMPLATED_FILES} ${TEMPDIR}/repo/${LS_REPO}/ || :
317
+ cd ${TEMPDIR}/repo/${LS_REPO}/
318
+ if ! grep -q '.jenkins-external' .gitignore 2>/dev/null; then
319
+ echo ".jenkins-external" >> .gitignore
320
+ git add .gitignore
321
+ fi
322
+ git add ${TEMPLATED_FILES}
323
+ git commit -m 'Bot Updating Templated Files'
324
+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all
325
+ echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
326
+ else
327
+ echo "false" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
328
+ fi
329
+ mkdir -p ${TEMPDIR}/gitbook
330
+ git clone https://github.com/linuxserver/docker-documentation.git ${TEMPDIR}/gitbook/docker-documentation
331
+ if [[ ("${BRANCH_NAME}" == "master") || ("${BRANCH_NAME}" == "main") ]] && [[ (! -f ${TEMPDIR}/gitbook/docker-documentation/images/docker-${CONTAINER_NAME}.md) || ("$(md5sum ${TEMPDIR}/gitbook/docker-documentation/images/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')") ]]; then
332
+ cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md ${TEMPDIR}/gitbook/docker-documentation/images/
333
+ cd ${TEMPDIR}/gitbook/docker-documentation/
334
+ git add images/docker-${CONTAINER_NAME}.md
335
+ git commit -m 'Bot Updating Documentation'
336
+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git --all
337
+ fi
338
+ mkdir -p ${TEMPDIR}/unraid
339
+ git clone https://github.com/linuxserver/docker-templates.git ${TEMPDIR}/unraid/docker-templates
340
+ git clone https://github.com/linuxserver/templates.git ${TEMPDIR}/unraid/templates
341
+ if [[ -f ${TEMPDIR}/unraid/docker-templates/linuxserver.io/img/${CONTAINER_NAME}-logo.png ]]; then
342
+ sed -i "s|master/linuxserver.io/img/linuxserver-ls-logo.png|master/linuxserver.io/img/${CONTAINER_NAME}-logo.png|" ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml
343
+ fi
344
+ if [[ ("${BRANCH_NAME}" == "master") || ("${BRANCH_NAME}" == "main") ]] && [[ (! -f ${TEMPDIR}/unraid/templates/unraid/${CONTAINER_NAME}.xml) || ("$(md5sum ${TEMPDIR}/unraid/templates/unraid/${CONTAINER_NAME}.xml | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml | awk '{ print $1 }')") ]]; then
345
+ cd ${TEMPDIR}/unraid/templates/
346
+ if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then
347
+ echo "Image is on the ignore list, marking Unraid template as deprecated"
348
+ cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/
349
+ git add -u unraid/${CONTAINER_NAME}.xml
350
+ git mv unraid/${CONTAINER_NAME}.xml unraid/deprecated/${CONTAINER_NAME}.xml || :
351
+ git commit -m 'Bot Moving Deprecated Unraid Template' || :
352
+ else
353
+ cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/
354
+ git add unraid/${CONTAINER_NAME}.xml
355
+ git commit -m 'Bot Updating Unraid Template'
356
+ fi
357
+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git --all
358
+ fi
359
+ rm -Rf ${TEMPDIR}'''
360
+ script{
361
+ env.FILES_UPDATED = sh(
362
+ script: '''cat /tmp/${COMMIT_SHA}-${BUILD_NUMBER}''',
363
+ returnStdout: true).trim()
364
+ }
365
+ }
366
+ }
367
+ // Exit the build if the Templated files were just updated
368
+ stage('Template-exit') {
369
+ when {
370
+ branch "master"
371
+ environment name: 'CHANGE_ID', value: ''
372
+ environment name: 'FILES_UPDATED', value: 'true'
373
+ expression {
374
+ env.CONTAINER_NAME != null
375
+ }
376
+ }
377
+ steps {
378
+ script{
379
+ env.EXIT_STATUS = 'ABORTED'
380
+ }
381
+ }
382
+ }
383
+ /* #######################
384
+ GitLab Mirroring
385
+ ####################### */
386
+ // Ping into Gitlab to mirror this repo and have a registry endpoint
387
+ stage("GitLab Mirror"){
388
+ when {
389
+ environment name: 'EXIT_STATUS', value: ''
390
+ }
391
+ steps{
392
+ sh '''curl -H "Content-Type: application/json" -H "Private-Token: ${GITLAB_TOKEN}" -X POST https://gitlab.com/api/v4/projects \
393
+ -d '{"namespace_id":'${GITLAB_NAMESPACE}',\
394
+ "name":"'${LS_REPO}'",
395
+ "mirror":true,\
396
+ "import_url":"https://github.com/linuxserver/'${LS_REPO}'.git",\
397
+ "issues_access_level":"disabled",\
398
+ "merge_requests_access_level":"disabled",\
399
+ "repository_access_level":"enabled",\
400
+ "visibility":"public"}' '''
401
+ }
402
+ }
403
+ /* #######################
404
+ Scarf.sh package registry
405
+ ####################### */
406
+ // Add package to Scarf.sh and set permissions
407
+ stage("Scarf.sh package registry"){
408
+ when {
409
+ branch "master"
410
+ environment name: 'EXIT_STATUS', value: ''
411
+ }
412
+ steps{
413
+ sh '''#! /bin/bash
414
+ set -e
415
+ PACKAGE_UUID=$(curl -X GET -H "Authorization: Bearer ${SCARF_TOKEN}" https://scarf.sh/api/v1/organizations/linuxserver-ci/packages | jq -r '.[] | select(.name=="linuxserver/openssh-server") | .uuid')
416
+ if [ -z "${PACKAGE_UUID}" ]; then
417
+ echo "Adding package to Scarf.sh"
418
+ curl -sX POST https://scarf.sh/api/v1/organizations/linuxserver-ci/packages \
419
+ -H "Authorization: Bearer ${SCARF_TOKEN}" \
420
+ -H "Content-Type: application/json" \
421
+ -d '{"name":"linuxserver/openssh-server",\
422
+ "shortDescription":"example description",\
423
+ "libraryType":"docker",\
424
+ "website":"https://github.com/linuxserver/docker-openssh-server",\
425
+ "backendUrl":"https://ghcr.io/linuxserver/openssh-server",\
426
+ "publicUrl":"https://lscr.io/linuxserver/openssh-server"}' || :
427
+ else
428
+ echo "Package already exists on Scarf.sh"
429
+ fi
430
+ '''
431
+ }
432
+ }
433
+ /* ###############
434
+ Build Container
435
+ ############### */
436
+ // Build Docker container for push to LS Repo
437
+ stage('Build-Single') {
438
+ when {
439
+ expression {
440
+ env.MULTIARCH == 'false' || params.PACKAGE_CHECK == 'true'
441
+ }
442
+ environment name: 'EXIT_STATUS', value: ''
443
+ }
444
+ steps {
445
+ echo "Running on node: ${NODE_NAME}"
446
+ sh "sed -r -i 's|(^FROM .*)|\\1\\n\\nENV LSIO_FIRST_PARTY=true|g' Dockerfile"
447
+ sh "docker buildx build \
448
+ --label \"org.opencontainers.image.created=${GITHUB_DATE}\" \
449
+ --label \"org.opencontainers.image.authors=linuxserver.io\" \
450
+ --label \"org.opencontainers.image.url=https://github.com/linuxserver/docker-openssh-server/packages\" \
451
+ --label \"org.opencontainers.image.documentation=https://docs.linuxserver.io/images/docker-openssh-server\" \
452
+ --label \"org.opencontainers.image.source=https://github.com/linuxserver/docker-openssh-server\" \
453
+ --label \"org.opencontainers.image.version=${EXT_RELEASE_CLEAN}-ls${LS_TAG_NUMBER}\" \
454
+ --label \"org.opencontainers.image.revision=${COMMIT_SHA}\" \
455
+ --label \"org.opencontainers.image.vendor=linuxserver.io\" \
456
+ --label \"org.opencontainers.image.licenses=GPL-3.0-only\" \
457
+ --label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \
458
+ --label \"org.opencontainers.image.title=Openssh-server\" \
459
+ --label \"org.opencontainers.image.description=[Openssh-server](https://www.openssh.com/) is a sandboxed environment that allows ssh access without giving keys to the entire server. Giving ssh access via private key often means giving full access to the server. This container creates a limited and sandboxed environment that others can ssh into. The users only have access to the folders mapped and the processes running inside this container.\" \
460
+ --no-cache --pull -t ${IMAGE}:${META_TAG} --platform=linux/amd64 \
461
+ --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
462
+ }
463
+ }
464
+ // Build MultiArch Docker containers for push to LS Repo
465
+ stage('Build-Multi') {
466
+ when {
467
+ allOf {
468
+ environment name: 'MULTIARCH', value: 'true'
469
+ expression { params.PACKAGE_CHECK == 'false' }
470
+ }
471
+ environment name: 'EXIT_STATUS', value: ''
472
+ }
473
+ parallel {
474
+ stage('Build X86') {
475
+ steps {
476
+ echo "Running on node: ${NODE_NAME}"
477
+ sh "sed -r -i 's|(^FROM .*)|\\1\\n\\nENV LSIO_FIRST_PARTY=true|g' Dockerfile"
478
+ sh "docker buildx build \
479
+ --label \"org.opencontainers.image.created=${GITHUB_DATE}\" \
480
+ --label \"org.opencontainers.image.authors=linuxserver.io\" \
481
+ --label \"org.opencontainers.image.url=https://github.com/linuxserver/docker-openssh-server/packages\" \
482
+ --label \"org.opencontainers.image.documentation=https://docs.linuxserver.io/images/docker-openssh-server\" \
483
+ --label \"org.opencontainers.image.source=https://github.com/linuxserver/docker-openssh-server\" \
484
+ --label \"org.opencontainers.image.version=${EXT_RELEASE_CLEAN}-ls${LS_TAG_NUMBER}\" \
485
+ --label \"org.opencontainers.image.revision=${COMMIT_SHA}\" \
486
+ --label \"org.opencontainers.image.vendor=linuxserver.io\" \
487
+ --label \"org.opencontainers.image.licenses=GPL-3.0-only\" \
488
+ --label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \
489
+ --label \"org.opencontainers.image.title=Openssh-server\" \
490
+ --label \"org.opencontainers.image.description=[Openssh-server](https://www.openssh.com/) is a sandboxed environment that allows ssh access without giving keys to the entire server. Giving ssh access via private key often means giving full access to the server. This container creates a limited and sandboxed environment that others can ssh into. The users only have access to the folders mapped and the processes running inside this container.\" \
491
+ --no-cache --pull -t ${IMAGE}:amd64-${META_TAG} --platform=linux/amd64 \
492
+ --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
493
+ }
494
+ }
495
+ stage('Build ARMHF') {
496
+ agent {
497
+ label 'ARMHF'
498
+ }
499
+ steps {
500
+ echo "Running on node: ${NODE_NAME}"
501
+ echo 'Logging into Github'
502
+ sh '''#! /bin/bash
503
+ echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin
504
+ '''
505
+ sh "sed -r -i 's|(^FROM .*)|\\1\\n\\nENV LSIO_FIRST_PARTY=true|g' Dockerfile.armhf"
506
+ sh "docker buildx build \
507
+ --label \"org.opencontainers.image.created=${GITHUB_DATE}\" \
508
+ --label \"org.opencontainers.image.authors=linuxserver.io\" \
509
+ --label \"org.opencontainers.image.url=https://github.com/linuxserver/docker-openssh-server/packages\" \
510
+ --label \"org.opencontainers.image.documentation=https://docs.linuxserver.io/images/docker-openssh-server\" \
511
+ --label \"org.opencontainers.image.source=https://github.com/linuxserver/docker-openssh-server\" \
512
+ --label \"org.opencontainers.image.version=${EXT_RELEASE_CLEAN}-ls${LS_TAG_NUMBER}\" \
513
+ --label \"org.opencontainers.image.revision=${COMMIT_SHA}\" \
514
+ --label \"org.opencontainers.image.vendor=linuxserver.io\" \
515
+ --label \"org.opencontainers.image.licenses=GPL-3.0-only\" \
516
+ --label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \
517
+ --label \"org.opencontainers.image.title=Openssh-server\" \
518
+ --label \"org.opencontainers.image.description=[Openssh-server](https://www.openssh.com/) is a sandboxed environment that allows ssh access without giving keys to the entire server. Giving ssh access via private key often means giving full access to the server. This container creates a limited and sandboxed environment that others can ssh into. The users only have access to the folders mapped and the processes running inside this container.\" \
519
+ --no-cache --pull -f Dockerfile.armhf -t ${IMAGE}:arm32v7-${META_TAG} --platform=linux/arm/v7 \
520
+ --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
521
+ sh "docker tag ${IMAGE}:arm32v7-${META_TAG} ghcr.io/linuxserver/lsiodev-buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER}"
522
+ retry(5) {
523
+ sh "docker push ghcr.io/linuxserver/lsiodev-buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER}"
524
+ }
525
+ sh '''docker rmi \
526
+ ${IMAGE}:arm32v7-${META_TAG} \
527
+ ghcr.io/linuxserver/lsiodev-buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER} || :'''
528
+ }
529
+ }
530
+ stage('Build ARM64') {
531
+ agent {
532
+ label 'ARM64'
533
+ }
534
+ steps {
535
+ echo "Running on node: ${NODE_NAME}"
536
+ echo 'Logging into Github'
537
+ sh '''#! /bin/bash
538
+ echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin
539
+ '''
540
+ sh "sed -r -i 's|(^FROM .*)|\\1\\n\\nENV LSIO_FIRST_PARTY=true|g' Dockerfile.aarch64"
541
+ sh "docker buildx build \
542
+ --label \"org.opencontainers.image.created=${GITHUB_DATE}\" \
543
+ --label \"org.opencontainers.image.authors=linuxserver.io\" \
544
+ --label \"org.opencontainers.image.url=https://github.com/linuxserver/docker-openssh-server/packages\" \
545
+ --label \"org.opencontainers.image.documentation=https://docs.linuxserver.io/images/docker-openssh-server\" \
546
+ --label \"org.opencontainers.image.source=https://github.com/linuxserver/docker-openssh-server\" \
547
+ --label \"org.opencontainers.image.version=${EXT_RELEASE_CLEAN}-ls${LS_TAG_NUMBER}\" \
548
+ --label \"org.opencontainers.image.revision=${COMMIT_SHA}\" \
549
+ --label \"org.opencontainers.image.vendor=linuxserver.io\" \
550
+ --label \"org.opencontainers.image.licenses=GPL-3.0-only\" \
551
+ --label \"org.opencontainers.image.ref.name=${COMMIT_SHA}\" \
552
+ --label \"org.opencontainers.image.title=Openssh-server\" \
553
+ --label \"org.opencontainers.image.description=[Openssh-server](https://www.openssh.com/) is a sandboxed environment that allows ssh access without giving keys to the entire server. Giving ssh access via private key often means giving full access to the server. This container creates a limited and sandboxed environment that others can ssh into. The users only have access to the folders mapped and the processes running inside this container.\" \
554
+ --no-cache --pull -f Dockerfile.aarch64 -t ${IMAGE}:arm64v8-${META_TAG} --platform=linux/arm64 \
555
+ --build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${VERSION_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
556
+ sh "docker tag ${IMAGE}:arm64v8-${META_TAG} ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
557
+ retry(5) {
558
+ sh "docker push ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
559
+ }
560
+ sh '''docker rmi \
561
+ ${IMAGE}:arm64v8-${META_TAG} \
562
+ ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} || :'''
563
+ }
564
+ }
565
+ }
566
+ }
567
+ // Take the image we just built and dump package versions for comparison
568
+ stage('Update-packages') {
569
+ when {
570
+ branch "master"
571
+ environment name: 'CHANGE_ID', value: ''
572
+ environment name: 'EXIT_STATUS', value: ''
573
+ }
574
+ steps {
575
+ sh '''#! /bin/bash
576
+ set -e
577
+ TEMPDIR=$(mktemp -d)
578
+ if [ "${MULTIARCH}" == "true" ] && [ "${PACKAGE_CHECK}" == "false" ]; then
579
+ LOCAL_CONTAINER=${IMAGE}:amd64-${META_TAG}
580
+ else
581
+ LOCAL_CONTAINER=${IMAGE}:${META_TAG}
582
+ fi
583
+ touch ${TEMPDIR}/package_versions.txt
584
+ docker run --rm \
585
+ -v /var/run/docker.sock:/var/run/docker.sock:ro \
586
+ -v ${TEMPDIR}:/tmp \
587
+ ghcr.io/anchore/syft:latest \
588
+ ${LOCAL_CONTAINER} -o table=/tmp/package_versions.txt
589
+ NEW_PACKAGE_TAG=$(md5sum ${TEMPDIR}/package_versions.txt | cut -c1-8 )
590
+ echo "Package tag sha from current packages in buit container is ${NEW_PACKAGE_TAG} comparing to old ${PACKAGE_TAG} from github"
591
+ if [ "${NEW_PACKAGE_TAG}" != "${PACKAGE_TAG}" ]; then
592
+ git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/${LS_REPO}
593
+ git --git-dir ${TEMPDIR}/${LS_REPO}/.git checkout -f master
594
+ cp ${TEMPDIR}/package_versions.txt ${TEMPDIR}/${LS_REPO}/
595
+ cd ${TEMPDIR}/${LS_REPO}/
596
+ wait
597
+ git add package_versions.txt
598
+ git commit -m 'Bot Updating Package Versions'
599
+ git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all
600
+ echo "true" > /tmp/packages-${COMMIT_SHA}-${BUILD_NUMBER}
601
+ echo "Package tag updated, stopping build process"
602
+ else
603
+ echo "false" > /tmp/packages-${COMMIT_SHA}-${BUILD_NUMBER}
604
+ echo "Package tag is same as previous continue with build process"
605
+ fi
606
+ rm -Rf ${TEMPDIR}'''
607
+ script{
608
+ env.PACKAGE_UPDATED = sh(
609
+ script: '''cat /tmp/packages-${COMMIT_SHA}-${BUILD_NUMBER}''',
610
+ returnStdout: true).trim()
611
+ }
612
+ }
613
+ }
614
+ // Exit the build if the package file was just updated
615
+ stage('PACKAGE-exit') {
616
+ when {
617
+ branch "master"
618
+ environment name: 'CHANGE_ID', value: ''
619
+ environment name: 'PACKAGE_UPDATED', value: 'true'
620
+ environment name: 'EXIT_STATUS', value: ''
621
+ }
622
+ steps {
623
+ sh '''#! /bin/bash
624
+ echo "Packages were updated. Cleaning up the image and exiting."
625
+ if [ "${MULTIARCH}" == "true" ] && [ "${PACKAGE_CHECK}" == "false" ]; then
626
+ docker rmi ${IMAGE}:amd64-${META_TAG}
627
+ else
628
+ docker rmi ${IMAGE}:${META_TAG}
629
+ fi'''
630
+ script{
631
+ env.EXIT_STATUS = 'ABORTED'
632
+ }
633
+ }
634
+ }
635
+ // Exit the build if this is just a package check and there are no changes to push
636
+ stage('PACKAGECHECK-exit') {
637
+ when {
638
+ branch "master"
639
+ environment name: 'CHANGE_ID', value: ''
640
+ environment name: 'PACKAGE_UPDATED', value: 'false'
641
+ environment name: 'EXIT_STATUS', value: ''
642
+ expression {
643
+ params.PACKAGE_CHECK == 'true'
644
+ }
645
+ }
646
+ steps {
647
+ sh '''#! /bin/bash
648
+ echo "There are no package updates. Cleaning up the image and exiting."
649
+ if [ "${MULTIARCH}" == "true" ] && [ "${PACKAGE_CHECK}" == "false" ]; then
650
+ docker rmi ${IMAGE}:amd64-${META_TAG}
651
+ else
652
+ docker rmi ${IMAGE}:${META_TAG}
653
+ fi'''
654
+ script{
655
+ env.EXIT_STATUS = 'ABORTED'
656
+ }
657
+ }
658
+ }
659
+ /* #######
660
+ Testing
661
+ ####### */
662
+ // Run Container tests
663
+ stage('Test') {
664
+ when {
665
+ environment name: 'CI', value: 'true'
666
+ environment name: 'EXIT_STATUS', value: ''
667
+ }
668
+ steps {
669
+ withCredentials([
670
+ string(credentialsId: 'ci-tests-s3-key-id', variable: 'S3_KEY'),
671
+ string(credentialsId: 'ci-tests-s3-secret-access-key ', variable: 'S3_SECRET')
672
+ ]) {
673
+ script{
674
+ env.CI_URL = 'https://ci-tests.linuxserver.io/' + env.IMAGE + '/' + env.META_TAG + '/index.html'
675
+ }
676
+ sh '''#! /bin/bash
677
+ set -e
678
+ docker pull ghcr.io/linuxserver/ci:latest
679
+ if [ "${MULTIARCH}" == "true" ]; then
680
+ docker pull ghcr.io/linuxserver/lsiodev-buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER}
681
+ docker pull ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}
682
+ docker tag ghcr.io/linuxserver/lsiodev-buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm32v7-${META_TAG}
683
+ docker tag ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm64v8-${META_TAG}
684
+ fi
685
+ docker run --rm \
686
+ --shm-size=1gb \
687
+ -v /var/run/docker.sock:/var/run/docker.sock \
688
+ -e IMAGE=\"${IMAGE}\" \
689
+ -e DELAY_START=\"${CI_DELAY}\" \
690
+ -e TAGS=\"${CI_TAGS}\" \
691
+ -e META_TAG=\"${META_TAG}\" \
692
+ -e PORT=\"${CI_PORT}\" \
693
+ -e SSL=\"${CI_SSL}\" \
694
+ -e BASE=\"${DIST_IMAGE}\" \
695
+ -e SECRET_KEY=\"${S3_SECRET}\" \
696
+ -e ACCESS_KEY=\"${S3_KEY}\" \
697
+ -e DOCKER_ENV=\"${CI_DOCKERENV}\" \
698
+ -e WEB_SCREENSHOT=\"${CI_WEB}\" \
699
+ -e WEB_AUTH=\"${CI_AUTH}\" \
700
+ -e WEB_PATH=\"${CI_WEBPATH}\" \
701
+ -e DO_REGION="ams3" \
702
+ -e DO_BUCKET="lsio-ci" \
703
+ -t ghcr.io/linuxserver/ci:latest \
704
+ python3 test_build.py'''
705
+ }
706
+ }
707
+ }
708
+ /* ##################
709
+ Release Logic
710
+ ################## */
711
+ // If this is an amd64 only image only push a single image
712
+ stage('Docker-Push-Single') {
713
+ when {
714
+ environment name: 'MULTIARCH', value: 'false'
715
+ environment name: 'EXIT_STATUS', value: ''
716
+ }
717
+ steps {
718
+ withCredentials([
719
+ [
720
+ $class: 'UsernamePasswordMultiBinding',
721
+ credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207',
722
+ usernameVariable: 'DOCKERUSER',
723
+ passwordVariable: 'DOCKERPASS'
724
+ ],
725
+ [
726
+ $class: 'UsernamePasswordMultiBinding',
727
+ credentialsId: 'Quay.io-Robot',
728
+ usernameVariable: 'QUAYUSER',
729
+ passwordVariable: 'QUAYPASS'
730
+ ]
731
+ ]) {
732
+ retry(5) {
733
+ sh '''#! /bin/bash
734
+ set -e
735
+ echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin
736
+ echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin
737
+ echo $GITLAB_TOKEN | docker login registry.gitlab.com -u LinuxServer.io --password-stdin
738
+ echo $QUAYPASS | docker login quay.io -u $QUAYUSER --password-stdin
739
+ for PUSHIMAGE in "${GITHUBIMAGE}" "${GITLABIMAGE}" "${QUAYIMAGE}" "${IMAGE}"; do
740
+ docker tag ${IMAGE}:${META_TAG} ${PUSHIMAGE}:${META_TAG}
741
+ docker tag ${PUSHIMAGE}:${META_TAG} ${PUSHIMAGE}:latest
742
+ docker tag ${PUSHIMAGE}:${META_TAG} ${PUSHIMAGE}:${EXT_RELEASE_TAG}
743
+ if [ -n "${SEMVER}" ]; then
744
+ docker tag ${PUSHIMAGE}:${META_TAG} ${PUSHIMAGE}:${SEMVER}
745
+ fi
746
+ docker push ${PUSHIMAGE}:latest
747
+ docker push ${PUSHIMAGE}:${META_TAG}
748
+ docker push ${PUSHIMAGE}:${EXT_RELEASE_TAG}
749
+ if [ -n "${SEMVER}" ]; then
750
+ docker push ${PUSHIMAGE}:${SEMVER}
751
+ fi
752
+ done
753
+ '''
754
+ }
755
+ sh '''#! /bin/bash
756
+ for DELETEIMAGE in "${GITHUBIMAGE}" "${GITLABIMAGE}" "${QUAYIMAGE}" "${IMAGE}"; do
757
+ docker rmi \
758
+ ${DELETEIMAGE}:${META_TAG} \
759
+ ${DELETEIMAGE}:${EXT_RELEASE_TAG} \
760
+ ${DELETEIMAGE}:latest || :
761
+ if [ -n "${SEMVER}" ]; then
762
+ docker rmi ${DELETEIMAGE}:${SEMVER} || :
763
+ fi
764
+ done
765
+ '''
766
+ }
767
+ }
768
+ }
769
+ // If this is a multi arch release push all images and define the manifest
770
+ stage('Docker-Push-Multi') {
771
+ when {
772
+ environment name: 'MULTIARCH', value: 'true'
773
+ environment name: 'EXIT_STATUS', value: ''
774
+ }
775
+ steps {
776
+ withCredentials([
777
+ [
778
+ $class: 'UsernamePasswordMultiBinding',
779
+ credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207',
780
+ usernameVariable: 'DOCKERUSER',
781
+ passwordVariable: 'DOCKERPASS'
782
+ ],
783
+ [
784
+ $class: 'UsernamePasswordMultiBinding',
785
+ credentialsId: 'Quay.io-Robot',
786
+ usernameVariable: 'QUAYUSER',
787
+ passwordVariable: 'QUAYPASS'
788
+ ]
789
+ ]) {
790
+ retry(5) {
791
+ sh '''#! /bin/bash
792
+ set -e
793
+ echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin
794
+ echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin
795
+ echo $GITLAB_TOKEN | docker login registry.gitlab.com -u LinuxServer.io --password-stdin
796
+ echo $QUAYPASS | docker login quay.io -u $QUAYUSER --password-stdin
797
+ if [ "${CI}" == "false" ]; then
798
+ docker pull ghcr.io/linuxserver/lsiodev-buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER}
799
+ docker tag ghcr.io/linuxserver/lsiodev-buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm32v7-${META_TAG}
800
+ docker pull ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}
801
+ docker tag ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm64v8-${META_TAG}
802
+ fi
803
+ for MANIFESTIMAGE in "${IMAGE}" "${GITLABIMAGE}" "${GITHUBIMAGE}" "${QUAYIMAGE}"; do
804
+ docker tag ${IMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:amd64-${META_TAG}
805
+ docker tag ${MANIFESTIMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:amd64-latest
806
+ docker tag ${MANIFESTIMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:amd64-${EXT_RELEASE_TAG}
807
+ docker tag ${IMAGE}:arm32v7-${META_TAG} ${MANIFESTIMAGE}:arm32v7-${META_TAG}
808
+ docker tag ${MANIFESTIMAGE}:arm32v7-${META_TAG} ${MANIFESTIMAGE}:arm32v7-latest
809
+ docker tag ${MANIFESTIMAGE}:arm32v7-${META_TAG} ${MANIFESTIMAGE}:arm32v7-${EXT_RELEASE_TAG}
810
+ docker tag ${IMAGE}:arm64v8-${META_TAG} ${MANIFESTIMAGE}:arm64v8-${META_TAG}
811
+ docker tag ${MANIFESTIMAGE}:arm64v8-${META_TAG} ${MANIFESTIMAGE}:arm64v8-latest
812
+ docker tag ${MANIFESTIMAGE}:arm64v8-${META_TAG} ${MANIFESTIMAGE}:arm64v8-${EXT_RELEASE_TAG}
813
+ if [ -n "${SEMVER}" ]; then
814
+ docker tag ${MANIFESTIMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:amd64-${SEMVER}
815
+ docker tag ${MANIFESTIMAGE}:arm32v7-${META_TAG} ${MANIFESTIMAGE}:arm32v7-${SEMVER}
816
+ docker tag ${MANIFESTIMAGE}:arm64v8-${META_TAG} ${MANIFESTIMAGE}:arm64v8-${SEMVER}
817
+ fi
818
+ docker push ${MANIFESTIMAGE}:amd64-${META_TAG}
819
+ docker push ${MANIFESTIMAGE}:amd64-${EXT_RELEASE_TAG}
820
+ docker push ${MANIFESTIMAGE}:amd64-latest
821
+ docker push ${MANIFESTIMAGE}:arm32v7-${META_TAG}
822
+ docker push ${MANIFESTIMAGE}:arm32v7-latest
823
+ docker push ${MANIFESTIMAGE}:arm32v7-${EXT_RELEASE_TAG}
824
+ docker push ${MANIFESTIMAGE}:arm64v8-${META_TAG}
825
+ docker push ${MANIFESTIMAGE}:arm64v8-latest
826
+ docker push ${MANIFESTIMAGE}:arm64v8-${EXT_RELEASE_TAG}
827
+ if [ -n "${SEMVER}" ]; then
828
+ docker push ${MANIFESTIMAGE}:amd64-${SEMVER}
829
+ docker push ${MANIFESTIMAGE}:arm32v7-${SEMVER}
830
+ docker push ${MANIFESTIMAGE}:arm64v8-${SEMVER}
831
+ fi
832
+ docker manifest push --purge ${MANIFESTIMAGE}:latest || :
833
+ docker manifest create ${MANIFESTIMAGE}:latest ${MANIFESTIMAGE}:amd64-latest ${MANIFESTIMAGE}:arm32v7-latest ${MANIFESTIMAGE}:arm64v8-latest
834
+ docker manifest annotate ${MANIFESTIMAGE}:latest ${MANIFESTIMAGE}:arm32v7-latest --os linux --arch arm
835
+ docker manifest annotate ${MANIFESTIMAGE}:latest ${MANIFESTIMAGE}:arm64v8-latest --os linux --arch arm64 --variant v8
836
+ docker manifest push --purge ${MANIFESTIMAGE}:${META_TAG} || :
837
+ docker manifest create ${MANIFESTIMAGE}:${META_TAG} ${MANIFESTIMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:arm32v7-${META_TAG} ${MANIFESTIMAGE}:arm64v8-${META_TAG}
838
+ docker manifest annotate ${MANIFESTIMAGE}:${META_TAG} ${MANIFESTIMAGE}:arm32v7-${META_TAG} --os linux --arch arm
839
+ docker manifest annotate ${MANIFESTIMAGE}:${META_TAG} ${MANIFESTIMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant v8
840
+ docker manifest push --purge ${MANIFESTIMAGE}:${EXT_RELEASE_TAG} || :
841
+ docker manifest create ${MANIFESTIMAGE}:${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:amd64-${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:arm32v7-${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:arm64v8-${EXT_RELEASE_TAG}
842
+ docker manifest annotate ${MANIFESTIMAGE}:${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:arm32v7-${EXT_RELEASE_TAG} --os linux --arch arm
843
+ docker manifest annotate ${MANIFESTIMAGE}:${EXT_RELEASE_TAG} ${MANIFESTIMAGE}:arm64v8-${EXT_RELEASE_TAG} --os linux --arch arm64 --variant v8
844
+ if [ -n "${SEMVER}" ]; then
845
+ docker manifest push --purge ${MANIFESTIMAGE}:${SEMVER} || :
846
+ docker manifest create ${MANIFESTIMAGE}:${SEMVER} ${MANIFESTIMAGE}:amd64-${SEMVER} ${MANIFESTIMAGE}:arm32v7-${SEMVER} ${MANIFESTIMAGE}:arm64v8-${SEMVER}
847
+ docker manifest annotate ${MANIFESTIMAGE}:${SEMVER} ${MANIFESTIMAGE}:arm32v7-${SEMVER} --os linux --arch arm
848
+ docker manifest annotate ${MANIFESTIMAGE}:${SEMVER} ${MANIFESTIMAGE}:arm64v8-${SEMVER} --os linux --arch arm64 --variant v8
849
+ fi
850
+ docker manifest push --purge ${MANIFESTIMAGE}:latest
851
+ docker manifest push --purge ${MANIFESTIMAGE}:${META_TAG}
852
+ docker manifest push --purge ${MANIFESTIMAGE}:${EXT_RELEASE_TAG}
853
+ if [ -n "${SEMVER}" ]; then
854
+ docker manifest push --purge ${MANIFESTIMAGE}:${SEMVER}
855
+ fi
856
+ done
857
+ '''
858
+ }
859
+ sh '''#! /bin/bash
860
+ for DELETEIMAGE in "${GITHUBIMAGE}" "${GITLABIMAGE}" "${QUAYIMAGE}" "${IMAGE}"; do
861
+ docker rmi \
862
+ ${DELETEIMAGE}:amd64-${META_TAG} \
863
+ ${DELETEIMAGE}:amd64-latest \
864
+ ${DELETEIMAGE}:amd64-${EXT_RELEASE_TAG} \
865
+ ${DELETEIMAGE}:arm32v7-${META_TAG} \
866
+ ${DELETEIMAGE}:arm32v7-latest \
867
+ ${DELETEIMAGE}:arm32v7-${EXT_RELEASE_TAG} \
868
+ ${DELETEIMAGE}:arm64v8-${META_TAG} \
869
+ ${DELETEIMAGE}:arm64v8-latest \
870
+ ${DELETEIMAGE}:arm64v8-${EXT_RELEASE_TAG} || :
871
+ if [ -n "${SEMVER}" ]; then
872
+ docker rmi \
873
+ ${DELETEIMAGE}:amd64-${SEMVER} \
874
+ ${DELETEIMAGE}:arm32v7-${SEMVER} \
875
+ ${DELETEIMAGE}:arm64v8-${SEMVER} || :
876
+ fi
877
+ done
878
+ docker rmi \
879
+ ghcr.io/linuxserver/lsiodev-buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER} \
880
+ ghcr.io/linuxserver/lsiodev-buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} || :
881
+ '''
882
+ }
883
+ }
884
+ }
885
+ // If this is a public release tag it in the LS Github
886
+ stage('Github-Tag-Push-Release') {
887
+ when {
888
+ branch "master"
889
+ expression {
890
+ env.LS_RELEASE != env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER
891
+ }
892
+ environment name: 'CHANGE_ID', value: ''
893
+ environment name: 'EXIT_STATUS', value: ''
894
+ }
895
+ steps {
896
+ echo "Pushing New tag for current commit ${META_TAG}"
897
+ sh '''curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/git/tags \
898
+ -d '{"tag":"'${META_TAG}'",\
899
+ "object": "'${COMMIT_SHA}'",\
900
+ "message": "Tagging Release '${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}' to master",\
901
+ "type": "commit",\
902
+ "tagger": {"name": "LinuxServer Jenkins","email": "jenkins@linuxserver.io","date": "'${GITHUB_DATE}'"}}' '''
903
+ echo "Pushing New release for Tag"
904
+ sh '''#! /bin/bash
905
+ echo "Updating external repo packages to ${EXT_RELEASE_CLEAN}" > releasebody.json
906
+ echo '{"tag_name":"'${META_TAG}'",\
907
+ "target_commitish": "master",\
908
+ "name": "'${META_TAG}'",\
909
+ "body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n\\n**Repo Changes:**\\n\\n' > start
910
+ printf '","draft": false,"prerelease": false}' >> releasebody.json
911
+ paste -d'\\0' start releasebody.json > releasebody.json.done
912
+ curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''
913
+ }
914
+ }
915
+ // Use helper container to sync the current README on master to the dockerhub endpoint
916
+ stage('Sync-README') {
917
+ when {
918
+ environment name: 'CHANGE_ID', value: ''
919
+ environment name: 'EXIT_STATUS', value: ''
920
+ }
921
+ steps {
922
+ withCredentials([
923
+ [
924
+ $class: 'UsernamePasswordMultiBinding',
925
+ credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207',
926
+ usernameVariable: 'DOCKERUSER',
927
+ passwordVariable: 'DOCKERPASS'
928
+ ]
929
+ ]) {
930
+ sh '''#! /bin/bash
931
+ set -e
932
+ TEMPDIR=$(mktemp -d)
933
+ docker pull ghcr.io/linuxserver/jenkins-builder:latest
934
+ docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH="${BRANCH_NAME}" -v ${TEMPDIR}:/ansible/jenkins ghcr.io/linuxserver/jenkins-builder:latest
935
+ docker pull ghcr.io/linuxserver/readme-sync
936
+ docker run --rm=true \
937
+ -e DOCKERHUB_USERNAME=$DOCKERUSER \
938
+ -e DOCKERHUB_PASSWORD=$DOCKERPASS \
939
+ -e GIT_REPOSITORY=${LS_USER}/${LS_REPO} \
940
+ -e DOCKER_REPOSITORY=${IMAGE} \
941
+ -e GIT_BRANCH=master \
942
+ -v ${TEMPDIR}/docker-${CONTAINER_NAME}:/mnt \
943
+ ghcr.io/linuxserver/readme-sync bash -c 'node sync'
944
+ rm -Rf ${TEMPDIR} '''
945
+ }
946
+ }
947
+ }
948
+ // If this is a Pull request send the CI link as a comment on it
949
+ stage('Pull Request Comment') {
950
+ when {
951
+ not {environment name: 'CHANGE_ID', value: ''}
952
+ environment name: 'CI', value: 'true'
953
+ environment name: 'EXIT_STATUS', value: ''
954
+ }
955
+ steps {
956
+ sh '''curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/issues/${PULL_REQUEST}/comments \
957
+ -d '{"body": "I am a bot, here are the test results for this PR: \\n'${CI_URL}' \\n'${SHELLCHECK_URL}'"}' '''
958
+ }
959
+ }
960
+ }
961
+ /* ######################
962
+ Send status to Discord
963
+ ###################### */
964
+ post {
965
+ always {
966
+ script{
967
+ if (env.EXIT_STATUS == "ABORTED"){
968
+ sh 'echo "build aborted"'
969
+ }
970
+ else if (currentBuild.currentResult == "SUCCESS"){
971
+ sh ''' curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/jenkins-avatar.png","embeds": [{"color": 1681177,\
972
+ "description": "**Build:** '${BUILD_NUMBER}'\\n**CI Results:** '${CI_URL}'\\n**ShellCheck Results:** '${SHELLCHECK_URL}'\\n**Status:** Success\\n**Job:** '${RUN_DISPLAY_URL}'\\n**Change:** '${CODE_URL}'\\n**External Release:**: '${RELEASE_LINK}'\\n**DockerHub:** '${DOCKERHUB_LINK}'\\n"}],\
973
+ "username": "Jenkins"}' ${BUILDS_DISCORD} '''
974
+ }
975
+ else {
976
+ sh ''' curl -X POST -H "Content-Type: application/json" --data '{"avatar_url": "https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/jenkins-avatar.png","embeds": [{"color": 16711680,\
977
+ "description": "**Build:** '${BUILD_NUMBER}'\\n**CI Results:** '${CI_URL}'\\n**ShellCheck Results:** '${SHELLCHECK_URL}'\\n**Status:** failure\\n**Job:** '${RUN_DISPLAY_URL}'\\n**Change:** '${CODE_URL}'\\n**External Release:**: '${RELEASE_LINK}'\\n**DockerHub:** '${DOCKERHUB_LINK}'\\n"}],\
978
+ "username": "Jenkins"}' ${BUILDS_DISCORD} '''
979
+ }
980
+ }
981
+ }
982
+ cleanup {
983
+ cleanWs()
984
+ }
985
+ }
986
+ }
LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <https://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <https://www.gnu.org/licenses/why-not-lgpl.html>.
LICENSE.md DELETED
@@ -1,406 +0,0 @@
1
- ### Creative Commons Attribution-ShareAlike 3.0 Unported License
2
- Link to license summary: https://creativecommons.org/licenses/by-sa/3.0/
3
-
4
- Copyright (C) 2016-2023 [Lin Song](https://github.com/hwdsl2)
5
- Based on [the work of Thomas Sarlandie](https://github.com/sarfata/voodooprivacy) (Copyright 2012)
6
-
7
- <p>THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS
8
- OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR
9
- "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER
10
- APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
11
- AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS
12
- PROHIBITED.</p>
13
- <p>BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU
14
- ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE.
15
- TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A
16
- CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE
17
- IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
18
- CONDITIONS.</p>
19
- <p><strong>1. Definitions</strong></p>
20
- <ol type="a">
21
- <li><strong>"Adaptation"</strong> means a work based upon
22
- the Work, or upon the Work and other pre-existing works,
23
- such as a translation, adaptation, derivative work,
24
- arrangement of music or other alterations of a literary
25
- or artistic work, or phonogram or performance and
26
- includes cinematographic adaptations or any other form in
27
- which the Work may be recast, transformed, or adapted
28
- including in any form recognizably derived from the
29
- original, except that a work that constitutes a
30
- Collection will not be considered an Adaptation for the
31
- purpose of this License. For the avoidance of doubt,
32
- where the Work is a musical work, performance or
33
- phonogram, the synchronization of the Work in
34
- timed-relation with a moving image ("synching") will be
35
- considered an Adaptation for the purpose of this
36
- License.</li>
37
- <li><strong>"Collection"</strong> means a collection of
38
- literary or artistic works, such as encyclopedias and
39
- anthologies, or performances, phonograms or broadcasts,
40
- or other works or subject matter other than works listed
41
- in Section 1(f) below, which, by reason of the selection
42
- and arrangement of their contents, constitute
43
- intellectual creations, in which the Work is included in
44
- its entirety in unmodified form along with one or more
45
- other contributions, each constituting separate and
46
- independent works in themselves, which together are
47
- assembled into a collective whole. A work that
48
- constitutes a Collection will not be considered an
49
- Adaptation (as defined below) for the purposes of this
50
- License.</li>
51
- <li><strong>"Creative Commons Compatible
52
- License"</strong> means a license that is listed at
53
- https://creativecommons.org/compatiblelicenses that has
54
- been approved by Creative Commons as being essentially
55
- equivalent to this License, including, at a minimum,
56
- because that license: (i) contains terms that have the
57
- same purpose, meaning and effect as the License Elements
58
- of this License; and, (ii) explicitly permits the
59
- relicensing of adaptations of works made available under
60
- that license under this License or a Creative Commons
61
- jurisdiction license with the same License Elements as
62
- this License.</li>
63
- <li><strong>"Distribute"</strong> means to make available
64
- to the public the original and copies of the Work or
65
- Adaptation, as appropriate, through sale or other
66
- transfer of ownership.</li>
67
- <li><strong>"License Elements"</strong> means the
68
- following high-level license attributes as selected by
69
- Licensor and indicated in the title of this License:
70
- Attribution, ShareAlike.</li>
71
- <li><strong>"Licensor"</strong> means the individual,
72
- individuals, entity or entities that offer(s) the Work
73
- under the terms of this License.</li>
74
- <li><strong>"Original Author"</strong> means, in the case
75
- of a literary or artistic work, the individual,
76
- individuals, entity or entities who created the Work or
77
- if no individual or entity can be identified, the
78
- publisher; and in addition (i) in the case of a
79
- performance the actors, singers, musicians, dancers, and
80
- other persons who act, sing, deliver, declaim, play in,
81
- interpret or otherwise perform literary or artistic works
82
- or expressions of folklore; (ii) in the case of a
83
- phonogram the producer being the person or legal entity
84
- who first fixes the sounds of a performance or other
85
- sounds; and, (iii) in the case of broadcasts, the
86
- organization that transmits the broadcast.</li>
87
- <li><strong>"Work"</strong> means the literary and/or
88
- artistic work offered under the terms of this License
89
- including without limitation any production in the
90
- literary, scientific and artistic domain, whatever may be
91
- the mode or form of its expression including digital
92
- form, such as a book, pamphlet and other writing; a
93
- lecture, address, sermon or other work of the same
94
- nature; a dramatic or dramatico-musical work; a
95
- choreographic work or entertainment in dumb show; a
96
- musical composition with or without words; a
97
- cinematographic work to which are assimilated works
98
- expressed by a process analogous to cinematography; a
99
- work of drawing, painting, architecture, sculpture,
100
- engraving or lithography; a photographic work to which
101
- are assimilated works expressed by a process analogous to
102
- photography; a work of applied art; an illustration, map,
103
- plan, sketch or three-dimensional work relative to
104
- geography, topography, architecture or science; a
105
- performance; a broadcast; a phonogram; a compilation of
106
- data to the extent it is protected as a copyrightable
107
- work; or a work performed by a variety or circus
108
- performer to the extent it is not otherwise considered a
109
- literary or artistic work.</li>
110
- <li><strong>"You"</strong> means an individual or entity
111
- exercising rights under this License who has not
112
- previously violated the terms of this License with
113
- respect to the Work, or who has received express
114
- permission from the Licensor to exercise rights under
115
- this License despite a previous violation.</li>
116
- <li><strong>"Publicly Perform"</strong> means to perform
117
- public recitations of the Work and to communicate to the
118
- public those public recitations, by any means or process,
119
- including by wire or wireless means or public digital
120
- performances; to make available to the public Works in
121
- such a way that members of the public may access these
122
- Works from a place and at a place individually chosen by
123
- them; to perform the Work to the public by any means or
124
- process and the communication to the public of the
125
- performances of the Work, including by public digital
126
- performance; to broadcast and rebroadcast the Work by any
127
- means including signs, sounds or images.</li>
128
- <li><strong>"Reproduce"</strong> means to make copies of
129
- the Work by any means including without limitation by
130
- sound or visual recordings and the right of fixation and
131
- reproducing fixations of the Work, including storage of a
132
- protected performance or phonogram in digital form or
133
- other electronic medium.</li>
134
- </ol>
135
- <p><strong>2. Fair Dealing Rights.</strong> Nothing in this
136
- License is intended to reduce, limit, or restrict any uses
137
- free from copyright or rights arising from limitations or
138
- exceptions that are provided for in connection with the
139
- copyright protection under copyright law or other
140
- applicable laws.</p>
141
- <p><strong>3. License Grant.</strong> Subject to the terms
142
- and conditions of this License, Licensor hereby grants You
143
- a worldwide, royalty-free, non-exclusive, perpetual (for
144
- the duration of the applicable copyright) license to
145
- exercise the rights in the Work as stated below:</p>
146
- <ol type="a">
147
- <li>to Reproduce the Work, to incorporate the Work into
148
- one or more Collections, and to Reproduce the Work as
149
- incorporated in the Collections;</li>
150
- <li>to create and Reproduce Adaptations provided that any
151
- such Adaptation, including any translation in any medium,
152
- takes reasonable steps to clearly label, demarcate or
153
- otherwise identify that changes were made to the original
154
- Work. For example, a translation could be marked "The
155
- original work was translated from English to Spanish," or
156
- a modification could indicate "The original work has been
157
- modified.";</li>
158
- <li>to Distribute and Publicly Perform the Work including
159
- as incorporated in Collections; and,</li>
160
- <li>to Distribute and Publicly Perform Adaptations.</li>
161
- <li>
162
- <p>For the avoidance of doubt:</p>
163
- <ol type="i">
164
- <li><strong>Non-waivable Compulsory License
165
- Schemes</strong>. In those jurisdictions in which the
166
- right to collect royalties through any statutory or
167
- compulsory licensing scheme cannot be waived, the
168
- Licensor reserves the exclusive right to collect such
169
- royalties for any exercise by You of the rights
170
- granted under this License;</li>
171
- <li><strong>Waivable Compulsory License
172
- Schemes</strong>. In those jurisdictions in which the
173
- right to collect royalties through any statutory or
174
- compulsory licensing scheme can be waived, the
175
- Licensor waives the exclusive right to collect such
176
- royalties for any exercise by You of the rights
177
- granted under this License; and,</li>
178
- <li><strong>Voluntary License Schemes</strong>. The
179
- Licensor waives the right to collect royalties,
180
- whether individually or, in the event that the
181
- Licensor is a member of a collecting society that
182
- administers voluntary licensing schemes, via that
183
- society, from any exercise by You of the rights
184
- granted under this License.</li>
185
- </ol>
186
- </li>
187
- </ol>
188
- <p>The above rights may be exercised in all media and
189
- formats whether now known or hereafter devised. The above
190
- rights include the right to make such modifications as are
191
- technically necessary to exercise the rights in other media
192
- and formats. Subject to Section 8(f), all rights not
193
- expressly granted by Licensor are hereby reserved.</p>
194
- <p><strong>4. Restrictions.</strong> The license granted in
195
- Section 3 above is expressly made subject to and limited by
196
- the following restrictions:</p>
197
- <ol type="a">
198
- <li>You may Distribute or Publicly Perform the Work only
199
- under the terms of this License. You must include a copy
200
- of, or the Uniform Resource Identifier (URI) for, this
201
- License with every copy of the Work You Distribute or
202
- Publicly Perform. You may not offer or impose any terms
203
- on the Work that restrict the terms of this License or
204
- the ability of the recipient of the Work to exercise the
205
- rights granted to that recipient under the terms of the
206
- License. You may not sublicense the Work. You must keep
207
- intact all notices that refer to this License and to the
208
- disclaimer of warranties with every copy of the Work You
209
- Distribute or Publicly Perform. When You Distribute or
210
- Publicly Perform the Work, You may not impose any
211
- effective technological measures on the Work that
212
- restrict the ability of a recipient of the Work from You
213
- to exercise the rights granted to that recipient under
214
- the terms of the License. This Section 4(a) applies to
215
- the Work as incorporated in a Collection, but this does
216
- not require the Collection apart from the Work itself to
217
- be made subject to the terms of this License. If You
218
- create a Collection, upon notice from any Licensor You
219
- must, to the extent practicable, remove from the
220
- Collection any credit as required by Section 4(c), as
221
- requested. If You create an Adaptation, upon notice from
222
- any Licensor You must, to the extent practicable, remove
223
- from the Adaptation any credit as required by Section
224
- 4(c), as requested.</li>
225
- <li>You may Distribute or Publicly Perform an Adaptation
226
- only under the terms of: (i) this License; (ii) a later
227
- version of this License with the same License Elements as
228
- this License; (iii) a Creative Commons jurisdiction
229
- license (either this or a later license version) that
230
- contains the same License Elements as this License (e.g.,
231
- Attribution-ShareAlike 3.0 US)); (iv) a Creative Commons
232
- Compatible License. If you license the Adaptation under
233
- one of the licenses mentioned in (iv), you must comply
234
- with the terms of that license. If you license the
235
- Adaptation under the terms of any of the licenses
236
- mentioned in (i), (ii) or (iii) (the "Applicable
237
- License"), you must comply with the terms of the
238
- Applicable License generally and the following
239
- provisions: (I) You must include a copy of, or the URI
240
- for, the Applicable License with every copy of each
241
- Adaptation You Distribute or Publicly Perform; (II) You
242
- may not offer or impose any terms on the Adaptation that
243
- restrict the terms of the Applicable License or the
244
- ability of the recipient of the Adaptation to exercise
245
- the rights granted to that recipient under the terms of
246
- the Applicable License; (III) You must keep intact all
247
- notices that refer to the Applicable License and to the
248
- disclaimer of warranties with every copy of the Work as
249
- included in the Adaptation You Distribute or Publicly
250
- Perform; (IV) when You Distribute or Publicly Perform the
251
- Adaptation, You may not impose any effective
252
- technological measures on the Adaptation that restrict
253
- the ability of a recipient of the Adaptation from You to
254
- exercise the rights granted to that recipient under the
255
- terms of the Applicable License. This Section 4(b)
256
- applies to the Adaptation as incorporated in a
257
- Collection, but this does not require the Collection
258
- apart from the Adaptation itself to be made subject to
259
- the terms of the Applicable License.</li>
260
- <li>If You Distribute, or Publicly Perform the Work or
261
- any Adaptations or Collections, You must, unless a
262
- request has been made pursuant to Section 4(a), keep
263
- intact all copyright notices for the Work and provide,
264
- reasonable to the medium or means You are utilizing: (i)
265
- the name of the Original Author (or pseudonym, if
266
- applicable) if supplied, and/or if the Original Author
267
- and/or Licensor designate another party or parties (e.g.,
268
- a sponsor institute, publishing entity, journal) for
269
- attribution ("Attribution Parties") in Licensor's
270
- copyright notice, terms of service or by other reasonable
271
- means, the name of such party or parties; (ii) the title
272
- of the Work if supplied; (iii) to the extent reasonably
273
- practicable, the URI, if any, that Licensor specifies to
274
- be associated with the Work, unless such URI does not
275
- refer to the copyright notice or licensing information
276
- for the Work; and (iv) , consistent with Ssection 3(b),
277
- in the case of an Adaptation, a credit identifying the
278
- use of the Work in the Adaptation (e.g., "French
279
- translation of the Work by Original Author," or
280
- "Screenplay based on original Work by Original Author").
281
- The credit required by this Section 4(c) may be
282
- implemented in any reasonable manner; provided, however,
283
- that in the case of a Adaptation or Collection, at a
284
- minimum such credit will appear, if a credit for all
285
- contributing authors of the Adaptation or Collection
286
- appears, then as part of these credits and in a manner at
287
- least as prominent as the credits for the other
288
- contributing authors. For the avoidance of doubt, You may
289
- only use the credit required by this Section for the
290
- purpose of attribution in the manner set out above and,
291
- by exercising Your rights under this License, You may not
292
- implicitly or explicitly assert or imply any connection
293
- with, sponsorship or endorsement by the Original Author,
294
- Licensor and/or Attribution Parties, as appropriate, of
295
- You or Your use of the Work, without the separate,
296
- express prior written permission of the Original Author,
297
- Licensor and/or Attribution Parties.</li>
298
- <li>Except as otherwise agreed in writing by the Licensor
299
- or as may be otherwise permitted by applicable law, if
300
- You Reproduce, Distribute or Publicly Perform the Work
301
- either by itself or as part of any Adaptations or
302
- Collections, You must not distort, mutilate, modify or
303
- take other derogatory action in relation to the Work
304
- which would be prejudicial to the Original Author's honor
305
- or reputation. Licensor agrees that in those
306
- jurisdictions (e.g. Japan), in which any exercise of the
307
- right granted in Section 3(b) of this License (the right
308
- to make Adaptations) would be deemed to be a distortion,
309
- mutilation, modification or other derogatory action
310
- prejudicial to the Original Author's honor and
311
- reputation, the Licensor will waive or not assert, as
312
- appropriate, this Section, to the fullest extent
313
- permitted by the applicable national law, to enable You
314
- to reasonably exercise Your right under Section 3(b) of
315
- this License (right to make Adaptations) but not
316
- otherwise.</li>
317
- </ol>
318
- <p><strong>5. Representations, Warranties and
319
- Disclaimer</strong></p>
320
- <p>UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN
321
- WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO
322
- REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE
323
- WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING,
324
- WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
325
- FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE
326
- ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE
327
- PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE.
328
- SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED
329
- WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.</p>
330
- <p><strong>6. Limitation on Liability.</strong> EXCEPT TO
331
- THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL
332
- LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY
333
- SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY
334
- DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK,
335
- EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF
336
- SUCH DAMAGES.</p>
337
- <p><strong>7. Termination</strong></p>
338
- <ol type="a">
339
- <li>This License and the rights granted hereunder will
340
- terminate automatically upon any breach by You of the
341
- terms of this License. Individuals or entities who have
342
- received Adaptations or Collections from You under this
343
- License, however, will not have their licenses terminated
344
- provided such individuals or entities remain in full
345
- compliance with those licenses. Sections 1, 2, 5, 6, 7,
346
- and 8 will survive any termination of this License.</li>
347
- <li>Subject to the above terms and conditions, the
348
- license granted here is perpetual (for the duration of
349
- the applicable copyright in the Work). Notwithstanding
350
- the above, Licensor reserves the right to release the
351
- Work under different license terms or to stop
352
- distributing the Work at any time; provided, however that
353
- any such election will not serve to withdraw this License
354
- (or any other license that has been, or is required to
355
- be, granted under the terms of this License), and this
356
- License will continue in full force and effect unless
357
- terminated as stated above.</li>
358
- </ol>
359
- <p><strong>8. Miscellaneous</strong></p>
360
- <ol type="a">
361
- <li>Each time You Distribute or Publicly Perform the Work
362
- or a Collection, the Licensor offers to the recipient a
363
- license to the Work on the same terms and conditions as
364
- the license granted to You under this License.</li>
365
- <li>Each time You Distribute or Publicly Perform an
366
- Adaptation, Licensor offers to the recipient a license to
367
- the original Work on the same terms and conditions as the
368
- license granted to You under this License.</li>
369
- <li>If any provision of this License is invalid or
370
- unenforceable under applicable law, it shall not affect
371
- the validity or enforceability of the remainder of the
372
- terms of this License, and without further action by the
373
- parties to this agreement, such provision shall be
374
- reformed to the minimum extent necessary to make such
375
- provision valid and enforceable.</li>
376
- <li>No term or provision of this License shall be deemed
377
- waived and no breach consented to unless such waiver or
378
- consent shall be in writing and signed by the party to be
379
- charged with such waiver or consent.</li>
380
- <li>This License constitutes the entire agreement between
381
- the parties with respect to the Work licensed here. There
382
- are no understandings, agreements or representations with
383
- respect to the Work not specified here. Licensor shall
384
- not be bound by any additional provisions that may appear
385
- in any communication from You. This License may not be
386
- modified without the mutual written agreement of the
387
- Licensor and You.</li>
388
- <li>The rights granted under, and the subject matter
389
- referenced, in this License were drafted utilizing the
390
- terminology of the Berne Convention for the Protection of
391
- Literary and Artistic Works (as amended on September 28,
392
- 1979), the Rome Convention of 1961, the WIPO Copyright
393
- Treaty of 1996, the WIPO Performances and Phonograms
394
- Treaty of 1996 and the Universal Copyright Convention (as
395
- revised on July 24, 1971). These rights and subject
396
- matter take effect in the relevant jurisdiction in which
397
- the License terms are sought to be enforced according to
398
- the corresponding provisions of the implementation of
399
- those treaty provisions in the applicable national law.
400
- If the standard suite of rights granted under applicable
401
- copyright law includes additional rights not granted
402
- under this License, such additional rights are deemed to
403
- be included in the License; this License is not intended
404
- to restrict the license of any rights under applicable
405
- law.</li>
406
- </ol>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README-zh.md DELETED
@@ -1,360 +0,0 @@
1
- [English](README.md) | [中文](README-zh.md)
2
-
3
- # Docker 上的 IPsec VPN 服务器
4
-
5
- [![Build Status](https://github.com/hwdsl2/docker-ipsec-vpn-server/actions/workflows/main-alpine.yml/badge.svg)](https://github.com/hwdsl2/docker-ipsec-vpn-server/actions/workflows/main-alpine.yml) [![GitHub Stars](docs/images/badges/github-stars.svg)](https://github.com/hwdsl2/docker-ipsec-vpn-server/stargazers) [![Docker Stars](docs/images/badges/docker-stars.svg)](https://hub.docker.com/r/hwdsl2/ipsec-vpn-server/) [![Docker Pulls](docs/images/badges/docker-pulls.svg)](https://hub.docker.com/r/hwdsl2/ipsec-vpn-server/)
6
-
7
- 使用这个 Docker 镜像快速搭建 IPsec VPN 服务器。支持 IPsec/L2TP,Cisco IPsec 和 IKEv2 协议。
8
-
9
- 本镜像以 Alpine 3.17 或 Debian 11 为基础,并使用 [Libreswan](https://libreswan.org) (IPsec VPN 软件) 和 [xl2tpd](https://github.com/xelerance/xl2tpd) (L2TP 服务进程)。
10
-
11
- IPsec VPN 可以加密你的网络流量,以防止在通过因特网传送时,你和 VPN 服务器之间的任何人对你的数据的未经授权的访问。在使用不安全的网络时,这是特别有用的,例如在咖啡厅,机场或旅馆房间。
12
-
13
- [**&raquo; 另见:IPsec VPN 服务器一键安装脚本**](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/README-zh.md)
14
-
15
- ## 快速开始
16
-
17
- 使用以下命令在 Docker 上快速搭建 IPsec VPN 服务器:
18
-
19
- ```
20
- docker run \
21
- --name ipsec-vpn-server \
22
- --restart=always \
23
- -v ikev2-vpn-data:/etc/ipsec.d \
24
- -v /lib/modules:/lib/modules:ro \
25
- -p 500:500/udp \
26
- -p 4500:4500/udp \
27
- -d --privileged \
28
- hwdsl2/ipsec-vpn-server
29
- ```
30
-
31
- 你的 VPN 登录凭证将会被自动随机生成。请参见 [获取 VPN 登录信息](#获取-vpn-登录信息)。
32
-
33
- 要了解更多有关如何使用本镜像的信息,请继续阅读以下部分。
34
-
35
- ## 功能特性
36
-
37
- - 支持具有强大和快速加密算法(例如 AES-GCM)的 IKEv2 模式
38
- - 生成 VPN 配置文件以自动配置 iOS, macOS 和 Android 设备
39
- - 支持 Windows, macOS, iOS, Android, Chrome OS 和 Linux 客户端
40
- - 包括辅助脚本以管理 IKEv2 用户和证书
41
-
42
- ## 安装 Docker
43
-
44
- 首先在你的 Linux 服务器上 [安装 Docker](https://docs.docker.com/engine/install/)。另外你也可以使用 [Podman](https://podman.io) 运行本镜像,需要首先为 `docker` 命令 [创建一个别名](https://podman.io/whatis.html)。
45
-
46
- 高级用户可以在 macOS 上通过安装 [Docker for Mac](https://docs.docker.com/docker-for-mac/) 使用本镜像。在使用 IPsec/L2TP 模式之前,你可能需要运行 `docker restart ipsec-vpn-server` 重启一次 Docker 容器。本镜像不支持 Docker for Windows。
47
-
48
- ## 下载
49
-
50
- 预构建的可信任镜像可在 [Docker Hub registry](https://hub.docker.com/r/hwdsl2/ipsec-vpn-server/) 下载:
51
-
52
- ```
53
- docker pull hwdsl2/ipsec-vpn-server
54
- ```
55
-
56
- 或者,你也可以从 [Quay.io](https://quay.io/repository/hwdsl2/ipsec-vpn-server) 下载:
57
-
58
- ```
59
- docker pull quay.io/hwdsl2/ipsec-vpn-server
60
- docker image tag quay.io/hwdsl2/ipsec-vpn-server hwdsl2/ipsec-vpn-server
61
- ```
62
-
63
- 支持以下架构系统:`linux/amd64`, `linux/arm64` 和 `linux/arm/v7`。
64
-
65
- 高级用户可以自己从 GitHub [编译源代码](docs/advanced-usage-zh.md#从源代码构建)。
66
-
67
- ### 镜像对照表
68
-
69
- 有两个预构建的镜像可用。默认的基于 Alpine 的镜像大小仅 ~17MB。
70
-
71
- | | 基于 Alpine | 基于 Debian |
72
- | --------------- | ------------------------ | ------------------------------ |
73
- | 镜像名称 | hwdsl2/ipsec-vpn-server | hwdsl2/ipsec-vpn-server:debian |
74
- | 压缩后大小 | ~ 17 MB | ~ 62 MB |
75
- | 基础镜像 | Alpine Linux 3.17 | Debian Linux 11 |
76
- | 系统架构 | amd64, arm64, arm/v7 | amd64, arm64, arm/v7 |
77
- | Libreswan 版本 | 4.10 | 4.10 |
78
- | IPsec/L2TP | ✅ | ✅ |
79
- | Cisco IPsec | ✅ | ✅ |
80
- | IKEv2 | ✅ | ✅ |
81
-
82
- **注:** 要使用基于 Debian 的镜像,请将本自述文件中所有的 `hwdsl2/ipsec-vpn-server` 替换为 `hwdsl2/ipsec-vpn-server:debian`。这些镜像当前与 Synology NAS 系统不兼容。
83
-
84
- ## 如何使用本镜像
85
-
86
- ### 环境变量
87
-
88
- **注:** 所有这些变量对于本镜像都是可选的,也就是说无需定义它们就可以搭建 IPsec VPN 服务器。你可以运行 `touch vpn.env` 创建一个空的 `env` 文件,然后跳到下一节。
89
-
90
- 这个 Docker 镜像使用以下几个变量,可以在一个 `env` 文件中定义(参见[示例](vpn.env.example)):
91
-
92
- ```
93
- VPN_IPSEC_PSK=your_ipsec_pre_shared_key
94
- VPN_USER=your_vpn_username
95
- VPN_PASSWORD=your_vpn_password
96
- ```
97
-
98
- 这将创建一个用于 VPN 登录的用户账户,它可以在你的多个���备上使用[*](#重要提示)。 IPsec PSK (预共享密钥) 由 `VPN_IPSEC_PSK` 环境变量指定。 VPN 用户名和密码分别在 `VPN_USER` 和 `VPN_PASSWORD` 中定义。
99
-
100
- 支持创建额外的 VPN 用户,如果需要,可以像下面这样在你的 `env` 文件中定义。用户名和密码必须分别使用空格进行分隔,并且用户名不能有重复。所有的 VPN 用户将共享同一个 IPsec PSK。
101
-
102
- ```
103
- VPN_ADDL_USERS=additional_username_1 additional_username_2
104
- VPN_ADDL_PASSWORDS=additional_password_1 additional_password_2
105
- ```
106
-
107
- **注:** 在你的 `env` 文件中,**不要**为变量值添加 `""` 或者 `''`,或在 `=` 两边添加空格。**不要**在值中使用这些字符: `\ " '`。一个安全的 IPsec PSK 应该至少包含 20 个随机字符。
108
-
109
- **注:** 如果在创建 Docker 容器后修改 `env` 文件,则必须删除并重新创建容器才能使更改生效。参见[更新 Docker 镜像](#更新-docker-镜像)。
110
-
111
- <details>
112
- <summary>
113
- :information_source: 你可以指定一个域名,客户端名称和/或另外的 DNS 服务器。这是可选的。:information_source:
114
- </summary>
115
-
116
- 高级用户可以指定一个域名作为 IKEv2 服务器地址。这是可选的。该域名必须是一个全称域名 (FQDN)。示例如下:
117
-
118
- ```
119
- VPN_DNS_NAME=vpn.example.com
120
- ```
121
-
122
- 你可以指定第一个 IKEv2 客户端的名称。该名称不能包含空格或者除 `-` `_` 之外的任何特殊字符。如果未指定,则使用默认值 `vpnclient`。
123
-
124
- ```
125
- VPN_CLIENT_NAME=your_client_name
126
- ```
127
-
128
- 在 VPN 已连接时,客户端默认配置为使用 [Google Public DNS](https://developers.google.com/speed/public-dns/)。你可以为所有的 VPN 模式指定另外的 DNS 服务器。示例如下:
129
-
130
- ```
131
- VPN_DNS_SRV1=1.1.1.1
132
- VPN_DNS_SRV2=1.0.0.1
133
- ```
134
-
135
- 默认情况下,导入 IKEv2 客户端配置时不需要密码。你可以选择使用随机密码保护客户端配置文件。
136
-
137
- ```
138
- VPN_PROTECT_CONFIG=yes
139
- ```
140
-
141
- **注:** 如果在 Docker 容器中已经配置了 IKEv2,则以上变量对 IKEv2 模式无效。在这种情况下,你可以移除 IKEv2 并使用自定义选项重新配置它。参见 [配置并使用 IKEv2 VPN](#配置并使用-ikev2-vpn)。
142
- </details>
143
-
144
- ### 运行 IPsec VPN 服务器
145
-
146
- 使用本镜像创建一个新的 Docker 容器 (将 `./vpn.env` 替换为你自己的 `env` 文件):
147
-
148
- ```
149
- docker run \
150
- --name ipsec-vpn-server \
151
- --env-file ./vpn.env \
152
- --restart=always \
153
- -v ikev2-vpn-data:/etc/ipsec.d \
154
- -v /lib/modules:/lib/modules:ro \
155
- -p 500:500/udp \
156
- -p 4500:4500/udp \
157
- -d --privileged \
158
- hwdsl2/ipsec-vpn-server
159
- ```
160
-
161
- 在该命令中,我们使用 `docker run` 的 `-v` 选项来创建一个名为 `ikev2-vpn-data` 的新 [Docker 卷](https://docs.docker.com/storage/volumes/),并且将它挂载到容器内的 `/etc/ipsec.d` 目录下。IKEv2 的相关数据(比如证书和密钥)在该卷中保存,之后当你需要重新创建 Docker 容器的时候,只需指定同一个卷。
162
-
163
- 推荐在使用本镜像时启用 IKEv2。如果你不想启用 IKEv2 而仅使用 IPsec/L2TP 和 IPsec/XAuth ("Cisco IPsec") 模式连接到 VPN,可以去掉上面 `docker run` 命令中的第一个 `-v` 选项。
164
-
165
- **注:** 高级用户也可以 [不启用 privileged 模式运行](docs/advanced-usage-zh.md#不启用-privileged-模式运行)。
166
-
167
- ### 获取 VPN 登录信息
168
-
169
- 如果你在上述 `docker run` 命令中没有指定 `env` 文件,`VPN_USER` 会默认为 `vpnuser`,并且 `VPN_IPSEC_PSK` 和 `VPN_PASSWORD` 会被自动随机生成。要获取这些登录信息,可以查看容器的日志:
170
-
171
- ```
172
- docker logs ipsec-vpn-server
173
- ```
174
-
175
- 在命令输出中查找这些行:
176
-
177
- ```
178
- Connect to your new VPN with these details:
179
-
180
- Server IP: 你的VPN服务器IP
181
- IPsec PSK: 你的IPsec预共享密钥
182
- Username: 你的VPN用户名
183
- Password: 你的VPN密码
184
- ```
185
-
186
- 在命令输出中也会包含 IKEv2 配置信息(如果已启用)。
187
-
188
- (可选步骤)备份自动生成的 VPN 登录信息(如果有)到当前目录:
189
-
190
- ```
191
- docker cp ipsec-vpn-server:/etc/ipsec.d/vpn-gen.env ./
192
- ```
193
-
194
- ## 下一步
195
-
196
- *其他语言版本: [English](README.md#next-steps), [中文](README-zh.md#下一步)。*
197
-
198
- 配置你的计算机或其它设备使用 VPN。请参见:
199
-
200
- **[配置并使用 IKEv2 VPN(推荐)](#配置并使用-ikev2-vpn)**
201
-
202
- **[配置 IPsec/L2TP VPN 客户端](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients-zh.md)**
203
-
204
- **[配置 IPsec/XAuth ("Cisco IPsec") VPN 客户端](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients-xauth-zh.md)**
205
-
206
- **[:book: 电子书:搭建自己的 IPsec VPN, OpenVPN 和 WireGuard 服务器](https://mybook.to/vpnzhs)**
207
-
208
- 开始使用自己的专属 VPN! :sparkles::tada::rocket::sparkles:
209
-
210
- 喜欢这个项目?[:heart: 赞助](https://github.com/sponsors/hwdsl2?metadata_o=dz) 或 [:coffee: 支持](https://ko-fi.com/hwdsl2) 并访问 [额外内容](https://ko-fi.com/post/Support-this-project-and-get-access-to-supporter-o-X8X5FVFZC)。
211
-
212
- ## 重要提示
213
-
214
- **Windows 用户** 对于 IPsec/L2TP 模式,在首次连接之前需要 [修改注册表](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients-zh.md#windows-错误-809),以解决 VPN 服务器或客户端与 NAT(比如家用路由器)的兼容问题。
215
-
216
- 同一个 VPN 账户可以在你的多个设备上使用。但是由于 IPsec/L2TP 的局限性,如果需要连接在同一个 NAT(比如家用路由器)后面的多个设备,你必须使用 [IKEv2](#配置并使用-ikev2-vpn) 或者 [IPsec/XAuth](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients-xauth-zh.md) 模式。
217
-
218
- 如需添加,修改或者删除 VPN 用户账户,首先更新你的 `env` 文件,然后你必须按照 [下一节](#更新-docker-镜像) 的说明来删除并重新创建 Docker 容器。高级用户可以 [绑定挂载](docs/advanced-usage-zh.md#绑定挂载-env-文件) `env` 文件。
219
-
220
- 对于有外部防火墙的服务器(比如 [EC2](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html)/[GCE](https://cloud.google.com/vpc/docs/firewalls)),请为 VPN 打开 UDP 端口 500 和 4500。阿里云用户请参见 [#433](https://github.com/hwdsl2/setup-ipsec-vpn/issues/433)。
221
-
222
- 在 VPN 已连接时,客户端配置为使用 [Google Public DNS](https://developers.google.com/speed/public-dns/)。如果偏好其它的域名解析服务,请看 [这里](docs/advanced-usage-zh.md#使用其他的-dns-服务器)。
223
-
224
- ## 更新 Docker 镜像
225
-
226
- 要更新 Docker 镜像和容器,首先 [下载](#下载) 最新版本:
227
-
228
- ```
229
- docker pull hwdsl2/ipsec-vpn-server
230
- ```
231
-
232
- 如果 Docker 镜像已经是最新的,你会看到提示:
233
-
234
- ```
235
- Status: Image is up to date for hwdsl2/ipsec-vpn-server:latest
236
- ```
237
-
238
- 否则将会下载最新版本。要更新你的 Docker 容器,首先在纸上记下你所有的 [VPN 登录信息](#获取-vpn-登录信息)。然后删除 Docker 容器: `docker rm -f ipsec-vpn-server`。最后按照 [如何使用本镜像](#如何使用本镜像) 的说明来重新创建它。
239
-
240
- ## 配置并使用 IKEv2 VPN
241
-
242
- IKEv2 模式是比 IPsec/L2TP 和 IPsec/XAuth ("Cisco IPsec") 更佳的连接模式,该模式无需 IPsec PSK, 用户名或密码。更多信息请看[这里](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/ikev2-howto-zh.md)。
243
-
244
- 首先,查看容器的日志以获取 IKEv2 配置信息:
245
-
246
- ```bash
247
- docker logs ipsec-vpn-server
248
- ```
249
-
250
- **注:** 如果你无法找到 IKEv2 配置信息,IKEv2 可能没有在容器中启用。尝试按照 [更新 Docker 镜像](#更新-docker-镜像) 一节的说明更新 Docker 镜像和容器。
251
-
252
- 在 IKEv2 安装过程中会创建一个 IKEv2 客户端(默认名称为 `vpnclient`),并且导出它的配置到 **容器内** 的 `/etc/ipsec.d` 目录下。你可以将配置文件复制到 Docker 主机:
253
-
254
- ```bash
255
- # 查看容器内的 /etc/ipsec.d 目录的文件
256
- docker exec -it ipsec-vpn-server ls -l /etc/ipsec.d
257
- # 示例:将一个客户端配置文件从容器复制到 Docker 主机当前目录
258
- docker cp ipsec-vpn-server:/etc/ipsec.d/vpnclient.p12 ./
259
- ```
260
-
261
- **下一步:** [配置你的设备](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/ikev2-howto-zh.md) 以使用 IKEv2 VPN。
262
-
263
- <details>
264
- <summary>
265
- 了解如何管理 IKEv2 客户端。
266
- </summary>
267
-
268
- 你可以使用辅助脚本管理 IKEv2 客户端。示例如下。如需自定义客户端选项,可以在不添加参数的情况下运行脚本。
269
-
270
- ```bash
271
- # 添加一个客户端(使用默认选项)
272
- docker exec -it ipsec-vpn-server ikev2.sh --addclient [client name]
273
- # 导出一个已有的客户端的配置
274
- docker exec -it ipsec-vpn-server ikev2.sh --exportclient [client name]
275
- # 列出已有的客户端
276
- docker exec -it ipsec-vpn-server ikev2.sh --listclients
277
- # 显示使用信息
278
- docker exec -it ipsec-vpn-server ikev2.sh -h
279
- ```
280
-
281
- **注:** 如果你遇到错误 "executable file not found",将上面的 `ikev2.sh` 换成 `/opt/src/ikev2.sh`。
282
- </details>
283
- <details>
284
- <summary>
285
- 了解如何更改 IKEv2 服务器地址。
286
- </summary>
287
-
288
- 在某些情况下,你可能需要更改 IKEv2 服务器地址。例如切换为使用域名,或者在服务器的 IP 更改之后。要更改 IKEv2 服务器地址,首先[在容器中运行 Bash shell](docs/advanced-usage-zh.md#在容器中运行-bash-shell),然后[按照这里的说明操作](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/ikev2-howto-zh.md#更改-ikev2-服务器地址)。请注意,容器的日志在你重启 Docker 容器之前将不显示新的 IKEv2 服务器地址。
289
- </details>
290
- <details>
291
- <summary>
292
- 移除 IKEv2 并使用自定义选项重新配置。
293
- </summary>
294
-
295
- 在某些情况下,你可能需要移除 IKEv2 并使用自定义选项重新配置它。
296
-
297
- **警告:** 这将**永久删除**所有的 IKEv2 配置(包括证书和密钥),并且**不可撤销**!
298
-
299
- **选项 1:** 使用辅助脚本移除 IKEv2 并重新配置。
300
-
301
- 请��意,这将覆盖你在 `env` 文件中指定的变量,例如 `VPN_DNS_NAME` 和 `VPN_CLIENT_NAME`,并且容器的日志将不再显示 IKEv2 的最新信息。
302
-
303
- ```bash
304
- # 移除 IKEv2 并删除所有的 IKEv2 配置
305
- docker exec -it ipsec-vpn-server ikev2.sh --removeikev2
306
- # 使用自定义选项重新配置 IKEv2
307
- docker exec -it ipsec-vpn-server ikev2.sh
308
- ```
309
-
310
- **选项 2:** 移除 `ikev2-vpn-data` 并重新创建容器。
311
-
312
- 1. 在纸上记下你所有的 [VPN 登录信息](#获取-vpn-登录信息)。
313
- 1. 删除 Docker 容器:`docker rm -f ipsec-vpn-server`。
314
- 1. 删除 `ikev2-vpn-data` 卷:`docker volume rm ikev2-vpn-data`。
315
- 1. 更新你的 `env` 文件并添加自定义 IKEv2 选项,例如 `VPN_DNS_NAME` 和 `VPN_CLIENT_NAME`,然后重新创建容器。参见[如何使用本镜像](#如何使用本镜像)。
316
- </details>
317
-
318
- ## 高级用法
319
-
320
- 请参见 [高级用法](docs/advanced-usage-zh.md)。
321
-
322
- - [使用其他的 DNS 服务器](docs/advanced-usage-zh.md#使用其他的-dns-服务器)
323
- - [不启用 privileged 模式运行](docs/advanced-usage-zh.md#不启用-privileged-模式运行)
324
- - [选择 VPN 模式](docs/advanced-usage-zh.md#选择-vpn-模式)
325
- - [访问 Docker 主机上的其它容器](docs/advanced-usage-zh.md#访问-docker-主机上的其它容器)
326
- - [指定 VPN 服务器的公有 IP](docs/advanced-usage-zh.md#指定-vpn-服务器的公有-ip)
327
- - [为 VPN 客户端指定静态 IP](docs/advanced-usage-zh.md#为-vpn-客户端指定静态-ip)
328
- - [自定义 VPN 子网](docs/advanced-usage-zh.md#自定义-vpn-子网)
329
- - [关于 host network 模式](docs/advanced-usage-zh.md#关于-host-network-模式)
330
- - [启用 Libreswan 日志](docs/advanced-usage-zh.md#启用-libreswan-日志)
331
- - [查看服务器状态](docs/advanced-usage-zh.md#查看服务器状态)
332
- - [从源代码构建](docs/advanced-usage-zh.md#从源代码构建)
333
- - [在容器中运行 Bash shell](docs/advanced-usage-zh.md#在容器中运行-bash-shell)
334
- - [绑定挂载 env 文件](docs/advanced-usage-zh.md#绑定挂载-env-文件)
335
- - [部署 Google BBR 拥塞控制](docs/advanced-usage-zh.md#部署-google-bbr-拥塞控制)
336
-
337
- ## 技术细节
338
-
339
- 需要运行以下两个服务:`Libreswan (pluto)` 提供 IPsec VPN,`xl2tpd` 提供 L2TP 支持。
340
-
341
- 默认的 IPsec 配置支持以下协议:
342
-
343
- * IPsec/L2TP with PSK
344
- * IKEv1 with PSK and XAuth ("Cisco IPsec")
345
- * IKEv2
346
-
347
- 为使 VPN 服务器正常工作,将会打开以下端口:
348
-
349
- * 4500/udp and 500/udp for IPsec
350
-
351
- ## 授权协议
352
-
353
- **注:** 预构建镜像中的软件组件(例如 Libreswan 和 xl2tpd)在其各自版权所有者选择的相应许可下。对于任何预构建的镜像的使用,用户有责任确保对该镜像的任何使用符合其中包含的所有软件的任何相关许可。
354
-
355
- 版权所有 (C) 2016-2023 [Lin Song](https://github.com/hwdsl2) [![View my profile on LinkedIn](https://static.licdn.com/scds/common/u/img/webpromo/btn_viewmy_160x25.png)](https://www.linkedin.com/in/linsongui)
356
- 基于 [Thomas Sarlandie 的工作](https://github.com/sarfata/voodooprivacy) (版权所有 2012)
357
-
358
- [![Creative Commons License](https://i.creativecommons.org/l/by-sa/3.0/88x31.png)](http://creativecommons.org/licenses/by-sa/3.0/)
359
- 这个项目是以 [知识共享署名-相同方式共享3.0](http://creativecommons.org/licenses/by-sa/3.0/) 许可协议授权。
360
- 必须署名: 请包括我的名字在任何衍生产品,并且让我知道你是如何改善它的!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docker-compose.yml DELETED
@@ -1,20 +0,0 @@
1
- version: '3'
2
-
3
- volumes:
4
- ikev2-vpn-data:
5
-
6
- services:
7
- vpn:
8
- image: hwdsl2/ipsec-vpn-server
9
- restart: always
10
- env_file:
11
- - ./vpn.env
12
- ports:
13
- - "500:500/udp"
14
- - "4500:4500/udp"
15
- privileged: true
16
- hostname: ipsec-vpn-server
17
- container_name: ipsec-vpn-server
18
- volumes:
19
- - ikev2-vpn-data:/etc/ipsec.d
20
- - /lib/modules:/lib/modules:ro
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/advanced-usage-zh.md DELETED
@@ -1,319 +0,0 @@
1
- [English](advanced-usage.md) | [中文](advanced-usage-zh.md)
2
-
3
- # 高级用法
4
-
5
- - [使用其他的 DNS 服务器](#使用其他的-dns-服务器)
6
- - [不启用 privileged 模式运行](#不启用-privileged-模式运行)
7
- - [选择 VPN 模式](#选择-vpn-模式)
8
- - [访问 Docker 主机上的其它容器](#访问-docker-主机上的其它容器)
9
- - [指定 VPN 服务器的公有 IP](#指定-vpn-服务器的公有-ip)
10
- - [为 VPN 客户端指定静态 IP](#为-vpn-客户端指定静态-ip)
11
- - [自定义 VPN 子网](#自定义-vpn-子网)
12
- - [关于 host network 模式](#关于-host-network-模式)
13
- - [启用 Libreswan 日志](#启用-libreswan-日志)
14
- - [查看服务器状态](#查看服务器状态)
15
- - [从源代码构建](#从源代码构建)
16
- - [在容器中运行 Bash shell](#在容器中运行-bash-shell)
17
- - [绑定挂载 env 文件](#绑定挂载-env-文件)
18
- - [部署 Google BBR 拥塞控制](#部署-google-bbr-拥塞控制)
19
-
20
- ## 使用其他的 DNS 服务器
21
-
22
- 在 VPN 已连接时,客户端配置为使用 [Google Public DNS](https://developers.google.com/speed/public-dns/)。如果偏好其它的域名解析服务,你可以在 `env` 文件中定义 `VPN_DNS_SRV1` 和 `VPN_DNS_SRV2`(可选),然后按照[说明](../README-zh.md#更新-docker-镜像)重新创建 Docker 容器。比如你想使用 [Cloudflare 的 DNS 服务](https://1.1.1.1):
23
-
24
- ```
25
- VPN_DNS_SRV1=1.1.1.1
26
- VPN_DNS_SRV2=1.0.0.1
27
- ```
28
-
29
- 请注意,如果 Docker 容器中已经配置了 IKEv2,你还需要编辑 Docker 容器内的 `/etc/ipsec.d/ikev2.conf` 并将 `8.8.8.8` 和 `8.8.4.4` 替换为你的其他的 DNS 服务器,然后重新启动 Docker 容器。
30
-
31
- ## 不启用 privileged 模式运行
32
-
33
- 高级用户可以在不启用 [privileged 模式](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) 的情况下使用本镜像创建一个 Docker 容器(将以下命令中的 `./vpn.env` 替换为你自己的 `env` 文件)。
34
-
35
- **注:** 如果你的 Docker 主机运行 CentOS Stream, Oracle Linux 8+, Rocky Linux 或者 AlmaLinux,推荐使用 [privileged 模式](../README-zh.md#运行-ipsec-vpn-服务器)。如果你想要不启用 privileged 模式运行,则 **必须** 在创建 Docker 容器之前以及系统启动时运行 `modprobe ip_tables`。
36
-
37
- ```
38
- docker run \
39
- --name ipsec-vpn-server \
40
- --env-file ./vpn.env \
41
- --restart=always \
42
- -v ikev2-vpn-data:/etc/ipsec.d \
43
- -p 500:500/udp \
44
- -p 4500:4500/udp \
45
- -d --cap-add=NET_ADMIN \
46
- --device=/dev/ppp \
47
- --sysctl net.ipv4.ip_forward=1 \
48
- --sysctl net.ipv4.conf.all.accept_redirects=0 \
49
- --sysctl net.ipv4.conf.all.send_redirects=0 \
50
- --sysctl net.ipv4.conf.all.rp_filter=0 \
51
- --sysctl net.ipv4.conf.default.accept_redirects=0 \
52
- --sysctl net.ipv4.conf.default.send_redirects=0 \
53
- --sysctl net.ipv4.conf.default.rp_filter=0 \
54
- --sysctl net.ipv4.conf.eth0.send_redirects=0 \
55
- --sysctl net.ipv4.conf.eth0.rp_filter=0 \
56
- hwdsl2/ipsec-vpn-server
57
- ```
58
-
59
- 在不启用 privileged 模式运行时,容器不能更改 `sysctl` 设置。这可能会影响本镜像的某些功能。一个已知问题是 [Android MTU/MSS fix](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients-zh.md#android-mtumss-问题) 需要另外在 `docker run` 命令添加 `--sysctl net.ipv4.ip_no_pmtu_disc=1` 才有效。如果你遇到任何问题,可以尝试换用 [privileged 模式](../README-zh.md#运行-ipsec-vpn-服务器) 重新创建容器。
60
-
61
- 在创建 Docker 容器之后,请转到 [获取 VPN 登录信息](../README-zh.md#获取-vpn-登录信息)。
62
-
63
- 类似地,如果你使用 [Docker compose](https://docs.docker.com/compose/),可以将 [docker-compose.yml](../docker-compose.yml) 中的 `privileged: true` 替换为:
64
-
65
- ```
66
- cap_add:
67
- - NET_ADMIN
68
- devices:
69
- - "/dev/ppp:/dev/ppp"
70
- sysctls:
71
- - net.ipv4.ip_forward=1
72
- - net.ipv4.conf.all.accept_redirects=0
73
- - net.ipv4.conf.all.send_redirects=0
74
- - net.ipv4.conf.all.rp_filter=0
75
- - net.ipv4.conf.default.accept_redirects=0
76
- - net.ipv4.conf.default.send_redirects=0
77
- - net.ipv4.conf.default.rp_filter=0
78
- - net.ipv4.conf.eth0.send_redirects=0
79
- - net.ipv4.conf.eth0.rp_filter=0
80
- ```
81
-
82
- 更多信息请参见 [compose file reference](https://docs.docker.com/compose/compose-file/)。
83
-
84
- ## 选择 VPN 模式
85
-
86
- 在使用此 Docker 镜像时,默认启用 IPsec/L2TP 和 IPsec/XAuth ("Cisco IPsec") 模式。此外,如果在创建 Docker 容器时在 `docker run` 命令中[指定](../README-zh.md#运行-ipsec-vpn-服务器)了 `-v ikev2-vpn-data:/etc/ipsec.d` 选项,则会启用 IKEv2 模式。
87
-
88
- 高级用户可以有选择性地禁用 VPN 模式,通过在 `env` 文件中设置以下变量并重新创建 Docker 容器来实现。
89
-
90
- 禁用 IPsec/L2TP 模式:`VPN_DISABLE_IPSEC_L2TP=yes`
91
- 禁用 IPsec/XAuth ("Cisco IPsec") 模式:`VPN_DISABLE_IPSEC_XAUTH=yes`
92
- 禁用 IPsec/L2TP 和 IPsec/XAuth 模式:`VPN_IKEV2_ONLY=yes`
93
-
94
- ## 访问 Docker 主机上的其它容器
95
-
96
- 连接到 VPN 后,VPN 客户端通常可以访问在同一 Docker 主机上其他容器中运行的服务,而无需进行其他配置。
97
-
98
- 例如,如果 IPsec VPN 服务器容器的 IP 为 `172.17.0.2`,并且一个 IP 为 `172.17.0.3` 的 Nginx 容器在同一 Docker 主机上运行,则 VPN 客户端可以使用 IP `172.17.0.3` 来访问 Nginx 容器上的服务。要找出分配给容器的 IP ,可以运行 `docker inspect <container name>`。
99
-
100
- ## 指定 VPN 服务器的公有 IP
101
-
102
- 在具有多个公有 IP 地址的 Docker 主机上,高级用户可以使用 `env` 文件中的变量 `VPN_PUBLIC_IP` 为 VPN 服务器指定一个公有 IP,然后重新创建 Docker 容器。例如,如果 Docker 主机的 IP 为 `192.0.2.1` 和 `192.0.2.2`,并且你想要 VPN 服务器使用 `192.0.2.2`:
103
-
104
- ```
105
- VPN_PUBLIC_IP=192.0.2.2
106
- ```
107
-
108
- 请注意,如果在 Docker 容器中已经配置了 IKEv2,则此变量对 IKEv2 模式无效。在这种情况下,你可以移除 IKEv2 并使用自定义选项重新配置它。参见 [配置并使用 IKEv2 VPN](../README-zh.md#配置并使用-ikev2-vpn)。
109
-
110
- 如果你想要 VPN 客户端在 VPN 连接处于活动状态时使用指定的公有 IP 作为其 "出站 IP",并且指定的 IP **不是** Docker 主机上的主 IP(或默认路由),则可能需要额外的配置。在这种情况下,你可以尝试在 Docker 主机上添加一个 IPTables `SNAT` 规则。如果要在重启后继续有效,你可以将命令添加到 `/etc/rc.local`。
111
-
112
- 继续上面的例子,如果 Docker 容器具有内部 IP `172.17.0.2`(使用 `docker inspect ipsec-vpn-server` 查看),Docker 的网络接口名称为 `docker0`(使用 `iptables -nvL -t nat` 查看),并且你希望 "出站 IP" 为 `192.0.2.2`:
113
-
114
- ```
115
- iptables -t nat -I POSTROUTING -s 172.17.0.2 ! -o docker0 -j SNAT --to 192.0.2.2
116
- ```
117
-
118
- 要检查一个已连接的 VPN 客户端的 "出站 IP",你可以在该客户端上打开浏览器并到 [这里](https://www.ipchicken.com) 检测 IP 地址。
119
-
120
- ## 为 VPN 客户端指定静态 IP
121
-
122
- 在使用 IPsec/L2TP 模式连接时,VPN 服务器(Docker 容器)在虚拟网络 `192.168.42.0/24` 内具有内网 IP `192.168.42.1`。为客户端分配的内网 IP 在这个范围内:`192.168.42.10` 到 `192.168.42.250`。要找到为特定的客户端分配的 IP,可以查看该 VPN 客户端上的连接状态。
123
-
124
- 在使用 IPsec/XAuth ("Cisco IPsec") 或 IKEv2 模式连接时,VPN 服务器(Docker 容器)在虚拟网络 `192.168.43.0/24` 内 **没有** 内网 IP。为客户端分配的内网 IP 在这个范围内:`192.168.43.10` 到 `192.168.43.250`。
125
-
126
- 高级用户可以将静态 IP 分配给 VPN 客户端。这是可选的。IKEv2 模式 **不支持** 此功能。要分配静态 IP,在你的 `env` 文件中定义 `VPN_ADDL_IP_ADDRS` 变量,然后重新创建 Docker 容器。例如:
127
-
128
- ```
129
- VPN_ADDL_USERS=user1 user2 user3 user4 user5
130
- VPN_ADDL_PASSWORDS=pass1 pass2 pass3 pass4 pass5
131
- VPN_ADDL_IP_ADDRS=* * 192.168.42.2 192.168.43.2
132
- ```
133
-
134
- 在此示例中,我们为 IPsec/L2TP 模式的 `user3` 分配静态 IP `192.168.42.2`,并为 IPsec/XAuth ("Cisco IPsec") 模式的 `user4` 分配静态 IP `192.168.43.2`。`user1`, `user2` 和 `user5` 的内网 IP 将被自动分配。`user3` 在 IPsec/XAuth 模式下的内网 IP 和 `user4` 在 IPsec/L2TP 模式下的内网 IP 也将被自动分配。你可以使用 `*` 来指定自动分配的 IP,或者将这些用户放在列表的末尾。
135
-
136
- 你为 IPsec/L2TP 模式指定的静态 IP 必须在 `192.168.42.2` 到 `192.168.42.9` 范围内。你为 IPsec/XAuth ("Cisco IPsec") 模式指定的静态 IP 必须在 `192.168.43.2` 到 `192.168.43.9` 范围内。
137
-
138
- 如果你需要分配更多静态 IP,则必须缩小自动分配的 IP 地址池。示例如下:
139
-
140
- ```
141
- VPN_L2TP_POOL=192.168.42.100-192.168.42.250
142
- VPN_XAUTH_POOL=192.168.43.100-192.168.43.250
143
- ```
144
-
145
- 这将允许你为 IPsec/L2TP 模式在 `192.168.42.2` 到 `192.168.42.99` 范围内分配静态 IP,并且为 IPsec/XAuth ("Cisco IPsec") 模式在 `192.168.43.2` 到 `192.168.43.99` 范围内分配静态 IP。
146
-
147
- 请注意,如果你在 `env` 文件中指定了 `VPN_XAUTH_POOL`,并且在 Docker 容器中已经配置了 IKEv2,你 **必须** 在重新创建 Docker 容器之前手动编辑容器内的 `/etc/ipsec.d/ikev2.conf` 并将 `rightaddresspool=192.168.43.10-192.168.43.250` 替换为与 `VPN_XAUTH_POOL` **相同的值**。否则 IKEv2 可能会停止工作。
148
-
149
- **注:** 在你的 `env` 文件中,**不要**为变量值添加 `""` 或者 `''`,或在 `=` 两边添加空格。**不要**在值中使用这些字符: `\ " '`。
150
-
151
- ## 自定义 VPN 子网
152
-
153
- 默认情况下,IPsec/L2TP VPN 客户端将使用内部 VPN 子网 `192.168.42.0/24`,而 IPsec/XAuth ("Cisco IPsec") 和 IKEv2 VPN 客户端将使用内部 VPN 子网 `192.168.43.0/24`。有关更多详细信息,请阅读上一节。
154
-
155
- 对于大多数用例,没有必要也 **不建议** 自定义这些子网。但是,如果你的用例需要它,你可以在 `env` 文件中指定自定义子网,然后你必须重新创建 Docker 容器。
156
-
157
- ```
158
- # 示例:为 IPsec/L2TP 模式指定自定义 VPN 子网
159
- # 注:必须指定所有三个变量。
160
- VPN_L2TP_NET=10.1.0.0/16
161
- VPN_L2TP_LOCAL=10.1.0.1
162
- VPN_L2TP_POOL=10.1.0.10-10.1.254.254
163
- ```
164
-
165
- ```
166
- # 示例:为 IPsec/XAuth 和 IKEv2 模式指定自定义 VPN 子网
167
- # 注:必须指定以下两个变量。
168
- VPN_XAUTH_NET=10.2.0.0/16
169
- VPN_XAUTH_POOL=10.2.0.10-10.2.254.254
170
- ```
171
-
172
- **注:** 在你的 `env` 文件中,**不要**为变量值添加 `""` 或者 `''`,或在 `=` 两边添加空格。
173
-
174
- 在上面的例子中,`VPN_L2TP_LOCAL` 是在 IPsec/L2TP 模式下的 VPN 服务器的内网 IP。`VPN_L2TP_POOL` 和 `VPN_XAUTH_POOL` 是为 VPN 客户端自动分配的 IP 地址池。
175
-
176
- 请注意,如果你在 `env` 文件中指定了 `VPN_XAUTH_POOL`,并且在 Docker 容器中已经配置了 IKEv2,你 **必须** 在重新创建 Docker 容器之前手动编辑容器内的 `/etc/ipsec.d/ikev2.conf` 并将 `rightaddresspool=192.168.43.10-192.168.43.250` 替换为与 `VPN_XAUTH_POOL` **相同的值**。否则 IKEv2 可能会停止工作。
177
-
178
- ## 关于 host network 模式
179
-
180
- 高级用户可以使用 [host network 模式](https://docs.docker.com/network/host/) 运行本镜像,通过为 `docker run` 命令添加 `--network=host` 参数来实现。另外,如果 [不启用 privileged 模式运行](#不启用-privileged-模式运行),你可能还需要将 `eth0` 替换为你的 Docker 主机的网络接口名称。
181
-
182
- 在非必要的情况下,**不推荐**使用 host network 模式运行本镜像。在该模式下,容器的网络栈未与 Docker 主机隔离,从而在使用 IPsec/L2TP 模式连接之后,VPN 客户端可以使用 Docker 主机的 VPN 内网 IP `192.168.42.1` 访问主机上的端口或服务。请注意,当你不再使用本镜像时,你需要手动清理 [run.sh](../run.sh) 所更改的 IPTables 规则和 sysctl 设置,或者重启服务器。
183
-
184
- 某些 Docker 主机操作系统,比如 Debian 10,不能使用 host network 模式运行本镜像,因为它们使用 nftables。
185
-
186
- ## 启用 Libreswan 日志
187
-
188
- 为了保持较小的 Docker 镜像,Libreswan (IPsec) 日志默认未开启。如果你需要启用它以进行故障排除,首先在正在运行的 Docker 容器中开始一个 Bash 会话:
189
-
190
- ```
191
- docker exec -it ipsec-vpn-server env TERM=xterm bash -l
192
- ```
193
-
194
- 然后运行以下命令:
195
-
196
- ```
197
- # For Alpine-based image
198
- apk add --no-cache rsyslog
199
- rsyslogd
200
- rc-service ipsec stop; rc-service -D ipsec start >/dev/null 2>&1
201
- sed -i '/pluto\.pid/a rsyslogd' /opt/src/run.sh
202
- exit
203
- # For Debian-based image
204
- apt-get update && apt-get -y install rsyslog
205
- service rsyslog restart
206
- service ipsec restart
207
- sed -i '/pluto\.pid/a service rsyslog restart' /opt/src/run.sh
208
- exit
209
- ```
210
-
211
- **注:** 如果你在不启用 privileged 模式的情况下使用本镜像,则错误 `rsyslogd: imklog: cannot open kernel log` 是正常的。
212
-
213
- 完成后你可以这样查看 Libreswan 日志:
214
-
215
- ```
216
- docker exec -it ipsec-vpn-server grep pluto /var/log/auth.log
217
- ```
218
-
219
- 如需查看 xl2tpd 日志,请运行 `docker logs ipsec-vpn-server`。
220
-
221
- ## 查看服务器状态
222
-
223
- 检查 IPsec VPN 服务器状态:
224
-
225
- ```
226
- docker exec -it ipsec-vpn-server ipsec status
227
- ```
228
-
229
- 查看当前已建立的 VPN 连接:
230
-
231
- ```
232
- docker exec -it ipsec-vpn-server ipsec trafficstatus
233
- ```
234
-
235
- ## 从源代码构建
236
-
237
- 高级用户可以从 GitHub 下载并自行编译源代码:
238
-
239
- ```
240
- git clone https://github.com/hwdsl2/docker-ipsec-vpn-server
241
- cd docker-ipsec-vpn-server
242
- # To build Alpine-based image
243
- docker build -t hwdsl2/ipsec-vpn-server .
244
- # To build Debian-based image
245
- docker build -f Dockerfile.debian -t hwdsl2/ipsec-vpn-server:debian .
246
- ```
247
-
248
- 若不需要改动源码,也可以这样:
249
-
250
- ```
251
- # To build Alpine-based image
252
- docker build -t hwdsl2/ipsec-vpn-server github.com/hwdsl2/docker-ipsec-vpn-server
253
- # To build Debian-based image
254
- docker build -f Dockerfile.debian -t hwdsl2/ipsec-vpn-server:debian \
255
- github.com/hwdsl2/docker-ipsec-vpn-server
256
- ```
257
-
258
- ## 在容器中运行 Bash shell
259
-
260
- 在正在运行的 Docker 容器中开始一个 Bash 会话:
261
-
262
- ```
263
- docker exec -it ipsec-vpn-server env TERM=xterm bash -l
264
- ```
265
-
266
- (可选步骤)安装 `nano` 编辑器:
267
-
268
- ```
269
- # For Alpine-based image
270
- apk add --no-cache nano
271
- # For Debian-based image
272
- apt-get update && apt-get -y install nano
273
- ```
274
-
275
- 然后在容器中运行你的命令。完成后退出并重启 Docker 容器(如果需要):
276
-
277
- ```
278
- exit
279
- docker restart ipsec-vpn-server
280
- ```
281
-
282
- ## 绑定挂载 env 文件
283
-
284
- 作为 `--env-file` 选项的替代方案,高级用户可以绑定挂载 `env` 文件。该方法的好处是你在更新 `env` 文件之后可以重启 Docker 容器以生效,而不需要重新创建它。要使用这个方法,你必须首先编辑你的 `env` 文件并将所有的变量值用单引号 `''` 括起来。然后(重新)创建 Docker 容器(将第一个 `vpn.env` 替换为你自己的 `env` 文��):
285
-
286
- ```
287
- docker run \
288
- --name ipsec-vpn-server \
289
- --restart=always \
290
- -v "$(pwd)/vpn.env:/opt/src/env/vpn.env:ro" \
291
- -v ikev2-vpn-data:/etc/ipsec.d \
292
- -v /lib/modules:/lib/modules:ro \
293
- -p 500:500/udp \
294
- -p 4500:4500/udp \
295
- -d --privileged \
296
- hwdsl2/ipsec-vpn-server
297
- ```
298
-
299
- ## 部署 Google BBR 拥塞控制
300
-
301
- VPN 服务器搭建完成后,可以通过在 Docker 主机上部署 Google BBR 拥塞控制算法提升性能。
302
-
303
- 这通常只需要在配置文件 `/etc/sysctl.conf` 中插入设定即可完成。但是部分 Linux 发行版可能需要额外更新 Linux 内核。
304
-
305
- 详细的部署方法,可以参考[这篇文档](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/bbr-zh.md)。在完成后重启 Docker 容器:
306
-
307
- ```
308
- docker restart ipsec-vpn-server
309
- ```
310
-
311
- ## 授权协议
312
-
313
- **注:** 预构建镜像中的软件组件(例如 Libreswan 和 xl2tpd)在其各自版权所有者选择的相应许可下。对于任何预构建的镜像的使用,用户有责任确保对该镜像的任何使用符合其中包含的所有软件的任何相关许可。
314
-
315
- 版权所有 (C) 2016-2023 [Lin Song](https://github.com/hwdsl2) [![View my profile on LinkedIn](https://static.licdn.com/scds/common/u/img/webpromo/btn_viewmy_160x25.png)](https://www.linkedin.com/in/linsongui)
316
-
317
- [![Creative Commons License](https://i.creativecommons.org/l/by-sa/3.0/88x31.png)](http://creativecommons.org/licenses/by-sa/3.0/)
318
- 这个项目是以 [知识共享署名-相同方式共享3.0](http://creativecommons.org/licenses/by-sa/3.0/) 许可协议授权。
319
- 必须署名: 请包括我的名字在任何衍生产品,并且让我知道你是如何改善它的!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/advanced-usage.md DELETED
@@ -1,319 +0,0 @@
1
- [English](advanced-usage.md) | [中文](advanced-usage-zh.md)
2
-
3
- # Advanced Usage
4
-
5
- - [Use alternative DNS servers](#use-alternative-dns-servers)
6
- - [Run without privileged mode](#run-without-privileged-mode)
7
- - [Select VPN modes](#select-vpn-modes)
8
- - [Access other containers on the Docker host](#access-other-containers-on-the-docker-host)
9
- - [Specify VPN server's public IP](#specify-vpn-servers-public-ip)
10
- - [Assign static IPs to VPN clients](#assign-static-ips-to-vpn-clients)
11
- - [Customize VPN subnets](#customize-vpn-subnets)
12
- - [About host network mode](#about-host-network-mode)
13
- - [Enable Libreswan logs](#enable-libreswan-logs)
14
- - [Check server status](#check-server-status)
15
- - [Build from source code](#build-from-source-code)
16
- - [Bash shell inside container](#bash-shell-inside-container)
17
- - [Bind mount the env file](#bind-mount-the-env-file)
18
- - [Deploy Google BBR congestion control](#deploy-google-bbr-congestion-control)
19
-
20
- ## Use alternative DNS servers
21
-
22
- Clients are set to use [Google Public DNS](https://developers.google.com/speed/public-dns/) when the VPN is active. If another DNS provider is preferred, define `VPN_DNS_SRV1` and optionally `VPN_DNS_SRV2` in your `env` file, then follow [instructions](../README.md#update-docker-image) to re-create the Docker container. For example, if you want to use [Cloudflare's DNS service](https://1.1.1.1/dns/):
23
-
24
- ```
25
- VPN_DNS_SRV1=1.1.1.1
26
- VPN_DNS_SRV2=1.0.0.1
27
- ```
28
-
29
- Note that if IKEv2 is already set up in the Docker container, you will also need to edit `/etc/ipsec.d/ikev2.conf` inside the Docker container and replace `8.8.8.8` and `8.8.4.4` with your alternative DNS server(s), then restart the Docker container.
30
-
31
- ## Run without privileged mode
32
-
33
- Advanced users can create a Docker container from this image without using [privileged mode](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) (replace `./vpn.env` in the command below with your own `env` file).
34
-
35
- **Note:** If your Docker host runs CentOS Stream, Oracle Linux 8+, Rocky Linux or AlmaLinux, it is recommended to use [privileged mode](../README.md#start-the-ipsec-vpn-server). If you want to run without privileged mode, you **must** run `modprobe ip_tables` before creating the Docker container and also on boot.
36
-
37
- ```
38
- docker run \
39
- --name ipsec-vpn-server \
40
- --env-file ./vpn.env \
41
- --restart=always \
42
- -v ikev2-vpn-data:/etc/ipsec.d \
43
- -p 500:500/udp \
44
- -p 4500:4500/udp \
45
- -d --cap-add=NET_ADMIN \
46
- --device=/dev/ppp \
47
- --sysctl net.ipv4.ip_forward=1 \
48
- --sysctl net.ipv4.conf.all.accept_redirects=0 \
49
- --sysctl net.ipv4.conf.all.send_redirects=0 \
50
- --sysctl net.ipv4.conf.all.rp_filter=0 \
51
- --sysctl net.ipv4.conf.default.accept_redirects=0 \
52
- --sysctl net.ipv4.conf.default.send_redirects=0 \
53
- --sysctl net.ipv4.conf.default.rp_filter=0 \
54
- --sysctl net.ipv4.conf.eth0.send_redirects=0 \
55
- --sysctl net.ipv4.conf.eth0.rp_filter=0 \
56
- hwdsl2/ipsec-vpn-server
57
- ```
58
-
59
- When running without privileged mode, the container is unable to change `sysctl` settings. This could affect certain features of this image. A known issue is that the [Android MTU/MSS fix](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients.md#android-mtumss-issues) also requires adding `--sysctl net.ipv4.ip_no_pmtu_disc=1` to the `docker run` command. If you encounter any issues, try re-creating the container using [privileged mode](../README.md#start-the-ipsec-vpn-server).
60
-
61
- After creating the Docker container, see [Retrieve VPN login details](../README.md#retrieve-vpn-login-details).
62
-
63
- Similarly, if using [Docker compose](https://docs.docker.com/compose/), you may replace `privileged: true` in [docker-compose.yml](../docker-compose.yml) with:
64
-
65
- ```
66
- cap_add:
67
- - NET_ADMIN
68
- devices:
69
- - "/dev/ppp:/dev/ppp"
70
- sysctls:
71
- - net.ipv4.ip_forward=1
72
- - net.ipv4.conf.all.accept_redirects=0
73
- - net.ipv4.conf.all.send_redirects=0
74
- - net.ipv4.conf.all.rp_filter=0
75
- - net.ipv4.conf.default.accept_redirects=0
76
- - net.ipv4.conf.default.send_redirects=0
77
- - net.ipv4.conf.default.rp_filter=0
78
- - net.ipv4.conf.eth0.send_redirects=0
79
- - net.ipv4.conf.eth0.rp_filter=0
80
- ```
81
-
82
- For more information, see [compose file reference](https://docs.docker.com/compose/compose-file/).
83
-
84
- ## Select VPN modes
85
-
86
- Using this Docker image, the IPsec/L2TP and IPsec/XAuth ("Cisco IPsec") modes are enabled by default. In addition, IKEv2 mode will be enabled if the `-v ikev2-vpn-data:/etc/ipsec.d` option [is specified](../README.md#start-the-ipsec-vpn-server) in the `docker run` command when creating the Docker container.
87
-
88
- Advanced users can selectively disable VPN modes by setting the following variable(s) in the `env` file, then re-create the Docker container.
89
-
90
- Disable IPsec/L2TP mode: `VPN_DISABLE_IPSEC_L2TP=yes`
91
- Disable IPsec/XAuth ("Cisco IPsec") mode: `VPN_DISABLE_IPSEC_XAUTH=yes`
92
- Disable both IPsec/L2TP and IPsec/XAuth modes: `VPN_IKEV2_ONLY=yes`
93
-
94
- ## Access other containers on the Docker host
95
-
96
- After connecting to the VPN, VPN clients can generally access services running in other containers on the same Docker host, without additional configuration.
97
-
98
- For example, if the IPsec VPN server container has IP `172.17.0.2`, and an Nginx container with IP `172.17.0.3` is running on the same Docker host, VPN clients can use IP `172.17.0.3` to access services on the Nginx container. To find out which IP is assigned to a container, run `docker inspect <container name>`.
99
-
100
- ## Specify VPN server's public IP
101
-
102
- On Docker hosts with multiple public IP addresses, advanced users can specify a public IP for the VPN server using variable `VPN_PUBLIC_IP` in the `env` file, then re-create the Docker container. For example, if the Docker host has IPs `192.0.2.1` and `192.0.2.2`, and you want the VPN server to use `192.0.2.2`:
103
-
104
- ```
105
- VPN_PUBLIC_IP=192.0.2.2
106
- ```
107
-
108
- Note that this variable has no effect for IKEv2 mode, if IKEv2 is already set up in the Docker container. In this case, you may remove IKEv2 and set it up again using custom options. Refer to [Configure and use IKEv2 VPN](../README.md#configure-and-use-ikev2-vpn).
109
-
110
- Additional configuration may be required if you want VPN clients to use the specified public IP as their "outgoing IP" when the VPN connection is active, and the specified IP is NOT the main IP (or default route) on the Docker host. In this case, you can try adding an IPTables `SNAT` rule on the Docker host. To persist after reboot, you may add the command to `/etc/rc.local`.
111
-
112
- Continuing with the example above, if the Docker container has internal IP `172.17.0.2` (check using `docker inspect ipsec-vpn-server`), Docker's network interface name is `docker0` (check using `iptables -nvL -t nat`), and you want the "outgoing IP" to be `192.0.2.2`:
113
-
114
- ```
115
- iptables -t nat -I POSTROUTING -s 172.17.0.2 ! -o docker0 -j SNAT --to 192.0.2.2
116
- ```
117
-
118
- To check the "outgoing IP" for a connected VPN client, you may open a browser on the client and [look up the IP address on Google](https://www.google.com/search?q=my+ip).
119
-
120
- ## Assign static IPs to VPN clients
121
-
122
- When connecting using IPsec/L2TP mode, the VPN server (Docker container) has internal IP `192.168.42.1` within the VPN subnet `192.168.42.0/24`. Clients are assigned internal IPs from `192.168.42.10` to `192.168.42.250`. To check which IP is assigned to a client, view the connection status on the VPN client.
123
-
124
- When connecting using IPsec/XAuth ("Cisco IPsec") or IKEv2 mode, the VPN server (Docker container) does NOT have an internal IP within the VPN subnet `192.168.43.0/24`. Clients are assigned internal IPs from `192.168.43.10` to `192.168.43.250`.
125
-
126
- Advanced users may optionally assign static IPs to VPN clients. IKEv2 mode does NOT support this feature. To assign static IPs, declare the `VPN_ADDL_IP_ADDRS` variable in your `env` file, then re-create the Docker container. Example:
127
-
128
- ```
129
- VPN_ADDL_USERS=user1 user2 user3 user4 user5
130
- VPN_ADDL_PASSWORDS=pass1 pass2 pass3 pass4 pass5
131
- VPN_ADDL_IP_ADDRS=* * 192.168.42.2 192.168.43.2
132
- ```
133
-
134
- In this example, we assign static IP `192.168.42.2` for `user3` for IPsec/L2TP mode, and assign static IP `192.168.43.2` for `user4` for IPsec/XAuth ("Cisco IPsec") mode. Internal IPs for `user1`, `user2` and `user5` will be auto-assigned. The internal IP for `user3` for IPsec/XAuth mode and the internal IP for `user4` for IPsec/L2TP mode will also be auto-assigned. You may use `*` to specify auto-assigned IPs, or put those user(s) at the end of the list.
135
-
136
- Static IPs that you specify for IPsec/L2TP mode must be within the range from `192.168.42.2` to `192.168.42.9`. Static IPs that you specify for IPsec/XAuth ("Cisco IPsec") mode must be within the range from `192.168.43.2` to `192.168.43.9`.
137
-
138
- If you need to assign more static IPs, you must shrink the pool of auto-assigned IP addresses. Example:
139
-
140
- ```
141
- VPN_L2TP_POOL=192.168.42.100-192.168.42.250
142
- VPN_XAUTH_POOL=192.168.43.100-192.168.43.250
143
- ```
144
-
145
- This will allow you to assign static IPs within the range from `192.168.42.2` to `192.168.42.99` for IPsec/L2TP mode, and within the range from `192.168.43.2` to `192.168.43.99` for IPsec/XAuth ("Cisco IPsec") mode.
146
-
147
- Note that if you specify `VPN_XAUTH_POOL` in the `env` file, and IKEv2 is already set up in the Docker container, you **must** manually edit `/etc/ipsec.d/ikev2.conf` inside the container and replace `rightaddresspool=192.168.43.10-192.168.43.250` with the **same value** as `VPN_XAUTH_POOL`, before re-creating the Docker container. Otherwise, IKEv2 may stop working.
148
-
149
- **Note:** In your `env` file, DO NOT put `""` or `''` around values, or add space around `=`. DO NOT use these special characters within values: `\ " '`.
150
-
151
- ## Customize VPN subnets
152
-
153
- By default, IPsec/L2TP VPN clients will use internal VPN subnet `192.168.42.0/24`, while IPsec/XAuth ("Cisco IPsec") and IKEv2 VPN clients will use internal VPN subnet `192.168.43.0/24`. For more details, read the previous section.
154
-
155
- For most use cases, it is NOT necessary and NOT recommended to customize these subnets. If your use case requires it, however, you may specify custom subnet(s) in your `env` file, then you must re-create the Docker container.
156
-
157
- ```
158
- # Example: Specify custom VPN subnet for IPsec/L2TP mode
159
- # Note: All three variables must be specified.
160
- VPN_L2TP_NET=10.1.0.0/16
161
- VPN_L2TP_LOCAL=10.1.0.1
162
- VPN_L2TP_POOL=10.1.0.10-10.1.254.254
163
- ```
164
-
165
- ```
166
- # Example: Specify custom VPN subnet for IPsec/XAuth and IKEv2 modes
167
- # Note: Both variables must be specified.
168
- VPN_XAUTH_NET=10.2.0.0/16
169
- VPN_XAUTH_POOL=10.2.0.10-10.2.254.254
170
- ```
171
-
172
- **Note:** In your `env` file, DO NOT put `""` or `''` around values, or add space around `=`.
173
-
174
- In the examples above, `VPN_L2TP_LOCAL` is the VPN server's internal IP for IPsec/L2TP mode. `VPN_L2TP_POOL` and `VPN_XAUTH_POOL` are the pools of auto-assigned IP addresses for VPN clients.
175
-
176
- Note that if you specify `VPN_XAUTH_POOL` in the `env` file, and IKEv2 is already set up in the Docker container, you **must** manually edit `/etc/ipsec.d/ikev2.conf` inside the container and replace `rightaddresspool=192.168.43.10-192.168.43.250` with the **same value** as `VPN_XAUTH_POOL`, before re-creating the Docker container. Otherwise, IKEv2 may stop working.
177
-
178
- ## About host network mode
179
-
180
- Advanced users can run this image in [host network mode](https://docs.docker.com/network/host/), by adding `--network=host` to the `docker run` command. In addition, if [running without privileged mode](#run-without-privileged-mode), you may also need to replace `eth0` with the network interface name of your Docker host.
181
-
182
- Host network mode is NOT recommended for this image, unless your use case requires it. In this mode, the container's network stack is not isolated from the Docker host, and VPN clients may be able to access ports or services on the Docker host using its internal VPN IP `192.168.42.1` after connecting using IPsec/L2TP mode. Note that you will need to manually clean up the changes to IPTables rules and sysctl settings by [run.sh](../run.sh) or reboot the server when you no longer use this image.
183
-
184
- Some Docker host OS, such as Debian 10, cannot run this image in host network mode due to the use of nftables.
185
-
186
- ## Enable Libreswan logs
187
-
188
- To keep the Docker image small, Libreswan (IPsec) logs are not enabled by default. If you need to enable it for troubleshooting purposes, first start a Bash session in the running container:
189
-
190
- ```
191
- docker exec -it ipsec-vpn-server env TERM=xterm bash -l
192
- ```
193
-
194
- Then run the following commands:
195
-
196
- ```
197
- # For Alpine-based image
198
- apk add --no-cache rsyslog
199
- rsyslogd
200
- rc-service ipsec stop; rc-service -D ipsec start >/dev/null 2>&1
201
- sed -i '/pluto\.pid/a rsyslogd' /opt/src/run.sh
202
- exit
203
- # For Debian-based image
204
- apt-get update && apt-get -y install rsyslog
205
- service rsyslog restart
206
- service ipsec restart
207
- sed -i '/pluto\.pid/a service rsyslog restart' /opt/src/run.sh
208
- exit
209
- ```
210
-
211
- **Note:** The error `rsyslogd: imklog: cannot open kernel log` is normal if you use this Docker image without privileged mode.
212
-
213
- When finished, you may check Libreswan logs with:
214
-
215
- ```
216
- docker exec -it ipsec-vpn-server grep pluto /var/log/auth.log
217
- ```
218
-
219
- To check xl2tpd logs, run `docker logs ipsec-vpn-server`.
220
-
221
- ## Check server status
222
-
223
- Check the status of the IPsec VPN server:
224
-
225
- ```
226
- docker exec -it ipsec-vpn-server ipsec status
227
- ```
228
-
229
- Show currently established VPN connections:
230
-
231
- ```
232
- docker exec -it ipsec-vpn-server ipsec trafficstatus
233
- ```
234
-
235
- ## Build from source code
236
-
237
- Advanced users can download and compile the source code from GitHub:
238
-
239
- ```
240
- git clone https://github.com/hwdsl2/docker-ipsec-vpn-server
241
- cd docker-ipsec-vpn-server
242
- # To build Alpine-based image
243
- docker build -t hwdsl2/ipsec-vpn-server .
244
- # To build Debian-based image
245
- docker build -f Dockerfile.debian -t hwdsl2/ipsec-vpn-server:debian .
246
- ```
247
-
248
- Or use this if not modifying the source code:
249
-
250
- ```
251
- # To build Alpine-based image
252
- docker build -t hwdsl2/ipsec-vpn-server github.com/hwdsl2/docker-ipsec-vpn-server
253
- # To build Debian-based image
254
- docker build -f Dockerfile.debian -t hwdsl2/ipsec-vpn-server:debian \
255
- github.com/hwdsl2/docker-ipsec-vpn-server
256
- ```
257
-
258
- ## Bash shell inside container
259
-
260
- To start a Bash session in the running container:
261
-
262
- ```
263
- docker exec -it ipsec-vpn-server env TERM=xterm bash -l
264
- ```
265
-
266
- (Optional) Install the `nano` editor:
267
-
268
- ```
269
- # For Alpine-based image
270
- apk add --no-cache nano
271
- # For Debian-based image
272
- apt-get update && apt-get -y install nano
273
- ```
274
-
275
- Then run your commands inside the container. When finished, exit the container and restart if needed:
276
-
277
- ```
278
- exit
279
- docker restart ipsec-vpn-server
280
- ```
281
-
282
- ## Bind mount the env file
283
-
284
- As an alternative to the `--env-file` option, advanced users can bind mount the `env` file. The advantage of this method is that after updating the `env` file, you can restart the Docker container to take effect instead of re-creating it. To use this method, you must first edit your `env` file and use single quotes `''` to enclose the values of all variables. Then (re-)create the Docker container (replace the first `vpn.env` with your own `env` file):
285
-
286
- ```
287
- docker run \
288
- --name ipsec-vpn-server \
289
- --restart=always \
290
- -v "$(pwd)/vpn.env:/opt/src/env/vpn.env:ro" \
291
- -v ikev2-vpn-data:/etc/ipsec.d \
292
- -v /lib/modules:/lib/modules:ro \
293
- -p 500:500/udp \
294
- -p 4500:4500/udp \
295
- -d --privileged \
296
- hwdsl2/ipsec-vpn-server
297
- ```
298
-
299
- ## Deploy Google BBR congestion control
300
-
301
- After the VPN server is set up, the performance can be improved by deploying the Google BBR congestion control algorithm on your Docker host.
302
-
303
- This is usually done by modifying the configuration file `/etc/sysctl.conf`. However, some Linux distributions may additionally require updates to the Linux kernel.
304
-
305
- For detailed deployment methods, please refer to [this document](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/bbr.md). When finished, restart the Docker container:
306
-
307
- ```
308
- docker restart ipsec-vpn-server
309
- ```
310
-
311
- ## License
312
-
313
- **Note:** The software components inside the pre-built image (such as Libreswan and xl2tpd) are under the respective licenses chosen by their respective copyright holders. As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
314
-
315
- Copyright (C) 2016-2023 [Lin Song](https://github.com/hwdsl2) [![View my profile on LinkedIn](https://static.licdn.com/scds/common/u/img/webpromo/btn_viewmy_160x25.png)](https://www.linkedin.com/in/linsongui)
316
-
317
- [![Creative Commons License](https://i.creativecommons.org/l/by-sa/3.0/88x31.png)](http://creativecommons.org/licenses/by-sa/3.0/)
318
- This work is licensed under the [Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/)
319
- Attribution required: please include my name in any derivative and let me know how you have improved it!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/images/badges/docker-pulls.svg DELETED
docs/images/badges/docker-stars.svg DELETED
docs/images/badges/github-stars.svg DELETED
jenkins-vars.yml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+
3
+ # jenkins variables
4
+ project_name: docker-openssh-server
5
+ external_type: alpine_repo
6
+ release_type: stable
7
+ release_tag: latest
8
+ ls_branch: master
9
+ repo_vars:
10
+ - CONTAINER_NAME = 'openssh-server'
11
+ - BUILD_VERSION_ARG = 'OPENSSH_RELEASE'
12
+ - LS_USER = 'linuxserver'
13
+ - LS_REPO = 'docker-openssh-server'
14
+ - DOCKERHUB_IMAGE = 'linuxserver/openssh-server'
15
+ - DEV_DOCKERHUB_IMAGE = 'lsiodev/openssh-server'
16
+ - PR_DOCKERHUB_IMAGE = 'lspipepr/openssh-server'
17
+ - DIST_IMAGE = 'alpine'
18
+ - DIST_TAG = '3.17'
19
+ - DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.17/main/'
20
+ - DIST_REPO_PACKAGES = 'openssh-server-pam'
21
+ - MULTIARCH='true'
22
+ - CI='true'
23
+ - CI_WEB='false'
24
+ - CI_PORT='80'
25
+ - CI_SSL='false'
26
+ - CI_DELAY='60'
27
+ - CI_DOCKERENV='TZ=US/Pacific'
28
+ - CI_AUTH='user:password'
29
+ - CI_WEBPATH=''
package_versions.txt ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ NAME VERSION TYPE
2
+ alpine-baselayout 3.4.0-r0 apk
3
+ alpine-baselayout-data 3.4.0-r0 apk
4
+ alpine-keys 2.4-r1 apk
5
+ alpine-release 3.17.3-r0 apk
6
+ apk-tools 2.12.10-r1 apk
7
+ bash 5.2.15-r0 apk
8
+ brotli-libs 1.0.9-r9 apk
9
+ busybox 1.35.0 binary
10
+ busybox 1.35.0-r29 apk
11
+ busybox-binsh 1.35.0-r29 apk
12
+ ca-certificates 20220614-r4 apk
13
+ ca-certificates-bundle 20220614-r4 apk
14
+ coreutils 9.1-r0 apk
15
+ curl 7.88.1-r1 apk
16
+ jq 1.6-r2 apk
17
+ libacl 2.3.1-r1 apk
18
+ libattr 2.5.1-r2 apk
19
+ libbsd 0.11.7-r0 apk
20
+ libc-utils 0.7.2-r3 apk
21
+ libcrypto3 3.0.8-r3 apk
22
+ libcurl 7.88.1-r1 apk
23
+ libedit 20221030.3.1-r0 apk
24
+ libintl 0.21.1-r1 apk
25
+ libmd 1.0.4-r0 apk
26
+ libproc 3.3.17-r2 apk
27
+ libssl3 3.0.8-r3 apk
28
+ linux-pam 1.5.2-r1 apk
29
+ logrotate 3.20.1-r3 apk
30
+ musl 1.2.3-r4 apk
31
+ musl-utils 1.2.3-r4 apk
32
+ nano 7.0-r0 apk
33
+ ncurses-libs 6.3_p20221119-r0 apk
34
+ ncurses-terminfo-base 6.3_p20221119-r0 apk
35
+ netcat-openbsd 1.130-r4 apk
36
+ nghttp2-libs 1.51.0-r0 apk
37
+ oniguruma 6.9.8-r0 apk
38
+ openssh-client-common 9.1_p1-r2 apk
39
+ openssh-client-default 9.1_p1-r2 apk
40
+ openssh-keygen 9.1_p1-r2 apk
41
+ openssh-server-common 9.1_p1-r2 apk
42
+ openssh-server-pam 9.1_p1-r2 apk
43
+ openssh-sftp-server 9.1_p1-r2 apk
44
+ popt 1.19-r0 apk
45
+ procps 3.3.17-r2 apk
46
+ readline 8.2.0-r0 apk
47
+ scanelf 1.3.5-r1 apk
48
+ shadow 4.13-r0 apk
49
+ skalibs 2.12.0.1-r0 apk
50
+ ssl_client 1.35.0-r29 apk
51
+ sudo 1.9.12_p2-r1 apk
52
+ tzdata 2023c-r0 apk
53
+ utmps-libs 0.1.2.0-r1 apk
54
+ xz 5.2.9-r0 apk
55
+ xz-libs 5.2.9-r0 apk
56
+ zlib 1.2.13-r0 apk
readme-vars.yml ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+
3
+ # project information
4
+ project_name: openssh-server
5
+ project_url: "https://www.openssh.com/"
6
+ project_logo: "https://upload.wikimedia.org/wikipedia/en/6/65/OpenSSH_logo.png"
7
+ project_blurb: "[{{ project_name|capitalize }}]({{ project_url }}) is a sandboxed environment that allows ssh access without giving keys to the entire server.
8
+
9
+ Giving ssh access via private key often means giving full access to the server. This container creates a limited and sandboxed environment that others can ssh into.
10
+
11
+ The users only have access to the folders mapped and the processes running inside this container."
12
+
13
+ project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_name }}"
14
+
15
+ # supported architectures
16
+ available_architectures:
17
+ - { arch: "{{ arch_x86_64 }}", tag: "amd64-latest"}
18
+ - { arch: "{{ arch_arm64 }}", tag: "arm64v8-latest"}
19
+ - { arch: "{{ arch_armhf }}", tag: "arm32v7-latest"}
20
+
21
+ # development version
22
+ development_versions: false
23
+ development_versions_items:
24
+ - { tag: "latest", desc: "Stable releases" }
25
+
26
+ # container parameters
27
+ common_param_env_vars_enabled: true
28
+ param_container_name: "{{ project_name }}"
29
+ param_usage_include_hostname: 'optional' #you can set it to 'optional'
30
+ param_hostname: "{{ project_name }}"
31
+ param_hostname_desc: "Optionally the hostname can be defined."
32
+ param_usage_include_vols: true
33
+ param_volumes:
34
+ - { vol_path: "/config", vol_host_path: "/path/to/appdata/config", desc: "Contains all relevant configuration files." }
35
+ param_usage_include_ports: true
36
+ param_ports:
37
+ - { external_port: "2222", internal_port: "2222", port_desc: "ssh port" }
38
+ param_usage_include_env: true
39
+ param_env_vars:
40
+ - { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London"}
41
+
42
+ # optional container parameters
43
+ opt_param_usage_include_env: true
44
+ opt_param_env_vars:
45
+ - { env_var: "PUBLIC_KEY", env_value: "yourpublickey", desc: "Optional ssh public key, which will automatically be added to authorized_keys."}
46
+ - { env_var: "PUBLIC_KEY_FILE", env_value: "/path/to/file", desc: "Optionally specify a file containing the public key (works with docker secrets)."}
47
+ - { env_var: "PUBLIC_KEY_DIR", env_value: "/path/to/directory/containing/_only_/pubkeys", desc: "Optionally specify a directory containing the public keys (works with docker secrets)."}
48
+ - { env_var: "PUBLIC_KEY_URL", env_value: "https://github.com/username.keys", desc: "Optionally specify a URL containing the public key."}
49
+ - { env_var: "SUDO_ACCESS", env_value: "false", desc: "Set to `true` to allow `linuxserver.io`, the ssh user, sudo access. Without `USER_PASSWORD` set, this will allow passwordless sudo access."}
50
+ - { env_var: "PASSWORD_ACCESS", env_value: "false", desc: "Set to `true` to allow user/password ssh access. You will want to set `USER_PASSWORD` or `USER_PASSWORD_FILE` as well."}
51
+ - { env_var: "USER_PASSWORD", env_value: "password", desc: "Optionally set a sudo password for `linuxserver.io`, the ssh user. If this or `USER_PASSWORD_FILE` are not set but `SUDO_ACCESS` is set to true, the user will have passwordless sudo access."}
52
+ - { env_var: "USER_PASSWORD_FILE", env_value: "/path/to/file", desc: "Optionally specify a file that contains the password. This setting supersedes the `USER_PASSWORD` option (works with docker secrets)."}
53
+ - { env_var: "USER_NAME", env_value: "linuxserver.io", desc: "Optionally specify a user name (Default:`linuxserver.io`)"}
54
+
55
+ optional_block_1: false
56
+ optional_block_1_items: ""
57
+
58
+ # application setup block
59
+ app_setup_block_enabled: true
60
+ app_setup_block: |
61
+ If `PUBLIC_KEY` or `PUBLIC_KEY_FILE`, or `PUBLIC_KEY_DIR` variables are set, the specified keys will automatically be added to `authorized_keys`. If not, the keys can manually be added to `/config/.ssh/authorized_keys` and the container should be restarted.
62
+ Removing `PUBLIC_KEY` or `PUBLIC_KEY_FILE` variables from docker run environment variables will not remove the keys from `authorized_keys`. `PUBLIC_KEY_FILE` and `PUBLIC_KEY_DIR` can be used with docker secrets.
63
+
64
+ We provide the ability to set and allow password based access via the `PASSWORD_ACCESS` and `USER_PASSWORD` variables, though we as an organization discourage using password auth for public facing ssh endpoints.
65
+
66
+ Connect to server via `ssh -i /path/to/private/key -p PORT USER_NAME@SERVERIP`
67
+
68
+ Setting `SUDO_ACCESS` to `true` by itself will allow passwordless sudo. `USER_PASSWORD` and `USER_PASSWORD_FILE` allow setting an optional sudo password.
69
+
70
+ The users only have access to the folders mapped and the processes running inside this container.
71
+ Add any volume mappings you like for the users to have access to.
72
+ To install packages or services for users to access, use the LinuxServer container customization methods described [in this blog article](https://blog.linuxserver.io/2019/09/14/customizing-our-containers/).
73
+
74
+ Sample use case is when a server admin would like to have automated incoming backups from a remote server to the local server, but they might not want all the other admins of the remote server to have full access to the local server.
75
+ This container can be set up with a mounted folder for incoming backups, and rsync installed via LinuxServer container customization described above, so that the incoming backups can proceed, but remote server and its admins' access would be limited to the backup folder.
76
+
77
+ It is also possible to run multiple copies of this container with different ports mapped, different folders mounted and access to different private keys for compartmentalized access.
78
+
79
+ #### TIPS
80
+ You can volume map your own text file to `/etc/motd` to override the message displayed upon connection.
81
+ You can optionally set the docker argument `hostname`
82
+
83
+ ## Key Generation
84
+
85
+ This container has a helper script to generate an ssh private/public key. In order to generate a key please run:
86
+ ```
87
+ docker run --rm -it --entrypoint /keygen.sh linuxserver/openssh-server
88
+ ```
89
+
90
+ Then simply follow the prompts.
91
+ The keys generated by this script are only displayed on your console output, so make sure to save them somewhere after generation.
92
+
93
+
94
+ # changelog
95
+ changelogs:
96
+ - { date: "05.03.23:", desc: "Rebase to Alpine 3.17."}
97
+ - { date: "18.10.22:", desc: "Fix wrong behavior of password/passwordless sudo"}
98
+ - { date: "11.10.22:", desc: "Rebase to Alpine 3.16, migrate to s6v3."}
99
+ - { date: "15.09.22:", desc: "add netcat-openbsd with support for proxies."}
100
+ - { date: "18.07.22:", desc: "Fix service perms to comply with upgrade to s6 v3."}
101
+ - { date: "16.04.22:", desc: "Rebase to alpine 3.15."}
102
+ - { date: "16.11.21:", desc: "Add PUBLIC_KEY_URL option"}
103
+ - { date: "28.06.21:", desc: "Rebasing to alpine 3.14. Add support for PAM." }
104
+ - { date: "10.02.21:", desc: "Rebasing to alpine 3.13. Add openssh-client for scp." }
105
+ - { date: "21.10.20:", desc: "Implement s6-log for openssh, which adds local timestamps to logs and can be used with a log parser like fail2ban." }
106
+ - { date: "20.10.20:", desc: "Set umask for sftp." }
107
+ - { date: "01.06.20:", desc: "Rebasing to alpine 3.12." }
108
+ - { date: "18.01.20:", desc: "Add key generation script." }
109
+ - { date: "13.01.20:", desc: "Add openssh-sftp-server." }
110
+ - { date: "19.12.19:", desc: "Rebasing to alpine 3.11." }
111
+ - { date: "17.10.19:", desc: "Initial Release." }
root/etc/motd ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ Welcome to OpenSSH Server
2
+
root/etc/s6-overlay/s6-rc.d/init-adduser/run ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/with-contenv bash
2
+ # shellcheck shell=bash
3
+
4
+ USER_NAME=${USER_NAME:-linuxserver.io}
5
+
6
+ PUID=${PUID:-911}
7
+ PGID=${PGID:-911}
8
+
9
+ if [[ "$USER_NAME" != "abc" ]]; then
10
+ usermod -l "$USER_NAME" abc
11
+ groupmod -n "$USER_NAME" abc
12
+ fi
13
+
14
+ groupmod -o -g "$PGID" "$USER_NAME"
15
+ usermod -o -u "$PUID" "$USER_NAME"
16
+
17
+ cat /etc/s6-overlay/s6-rc.d/init-adduser/branding
18
+
19
+ if [[ -f /donate.txt ]]; then
20
+ echo '
21
+ To support the app dev(s) visit:'
22
+ cat /donate.txt
23
+ fi
24
+ echo '
25
+ To support LSIO projects visit:
26
+ https://www.linuxserver.io/donate/
27
+
28
+ ───────────────────────────────────────
29
+ GID/UID
30
+ ───────────────────────────────────────'
31
+ echo "
32
+ User UID: $(id -u "${USER_NAME}")
33
+ User GID: $(id -g "${USER_NAME}")
34
+ ───────────────────────────────────────
35
+ "
36
+
37
+ time32="$(date +%Y)"
38
+
39
+ if [[ "${time32}" == "1970" || "${time32}" == "1969" ]] && [ "$(uname -m)" == "armv7l" ]; then
40
+ echo '
41
+ ╔═════════════════════════════════════════════════════════════════════════════╗
42
+ ║ ║
43
+ ║ Your Docker Host is running an outdated version of libseccomp ║
44
+ ║ ║
45
+ ║ To fix this, please visit https://docs.linuxserver.io/faq#libseccomp ║
46
+ ║ ║
47
+ ║ Apps will not behave correctly without this ║
48
+ ║ ║
49
+ ╚═════════════════════════════════════════════════════════════════════════════╝
50
+ '
51
+ sleep infinity
52
+ fi
53
+
54
+ lsiown "${USER_NAME}":"${USER_NAME}" /app
55
+ lsiown "${USER_NAME}":"${USER_NAME}" /config
56
+ lsiown "${USER_NAME}":"${USER_NAME}" /defaults
root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-openssh-server-config ADDED
File without changes