8000 GitHub - abacuspix/ocserv-docker: 用于初始化 ocserv 的 Dockfile 脚本
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

用于初始化 ocserv 的 Dockfile 脚本

Notifications You must be signed in to change notification settings

abacuspix/ocserv-docker

{"props":{"initialPayload":{"allShortcutsEnabled":false,"path":"/","repo":{"id":91166031,"defaultBranch":"master","name":"ocserv-docker","ownerLogin":"abacuspix","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2017-05-13T10:18:00.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/4737552?v=4","public":true,"private":false,"isOrgOwned":false},"currentUser":null,"refInfo":{"name":"master","listCacheKey":"v0:1615744895.020802","canEdit":false,"refType":"branch","currentOid":"3d38c98a1c24705bd075822427963e0517b18fae"},"tree":{"items":[{"name":"bin","path":"bin","contentType":"directory"},{"name":"certs","path":"certs","contentType":"directory"},{"name":"deploys","path":"deploys","contentType":"directory"},{"name":"ocserv","path":"ocserv","contentType":"directory"},{"name":"Dockerfile","path":"Dockerfile","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"changelog","path":"changelog","contentType":"file"},{"name":"dnsmasq.conf","path":"dnsmasq.conf","contentType":"file"}],"templateDirectorySuggestionUrl":null,"readme":null,"totalCount":8,"showBranchInfobar":true},"fileTree":null,"fileTreeProcessingTime":null,"foldersToFetch":[],"treeExpanded":false,"symbolsExpanded":false,"isOverview":true,"overview":{"banners":{"shouldRecommendReadme":false,"isPersonalRepo":false,"showUseActionBanner":false,"actionSlug":null,"actionId":null,"showProtectBranchBanner":false,"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_repo","releasePath":"/abacuspix/ocserv-docker/releases/new?marketplace=true","showPublishActionBanner":false},"interactionLimitBanner":null,"showInvitationBanner":false,"inviterName":null,"actionsMigrationBannerInfo":{"releaseTags":[],"showImmutableActionsMigrationBanner":false,"initialMigrationStatus":null}},"codeButton":{"contactPath":"/contact","isEnterprise":false,"local":{"protocolInfo":{"httpAvailable":true,"sshAvailable":null,"httpUrl":"https://github.com/abacuspix/ocserv-docker.git","showCloneWarning":null,"sshUrl":null,"sshCertificatesRequired":null,"sshCertificatesAvailable":null,"ghCliUrl":"gh repo clone abacuspix/ocserv-docker","defaultProtocol":"http","newSshKeyUrl":"/settings/ssh/new","setProtocolPath":"/users/set_protocol"},"platformInfo":{"cloneUrl":"https://desktop.github.com","showVisualStudioCloneButton":false,"visualStudioCloneUrl":"https://windows.github.com","showXcodeCloneButton":false,"xcodeCloneUrl":"xcode://clone?repo=https%3A%2F%2Fgithub.com%2Fabacuspix%2Focserv-docker","zipballUrl":"/abacuspix/ocserv-docker/archive/refs/heads/master.zip"}},"newCodespacePath":"/codespaces/new?hide_repo_select=true\u0026repo=91166031"},"popovers":{"rename":null,"renamedParentRepo":null},"commitCount":"127","overviewFiles":[{"displayName":"README.md","repoName":"ocserv-docker","refName":"master","path":"README.md","preferredFileType":"readme","tabName":"README","richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e用途\u003c/h2\u003e\u003ca id=\"user-content-用途\" class=\"anchor\" aria-label=\"Permalink: 用途\" href=\"#用途\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e因为安装一个 Open Connect 的步骤实在太麻烦了, 特别对于新手, 所以特意参考了 jpetazzo 的 \u003ca href=\"https://github.com/jpetazzo/dockvpn\"\u003edockvpn\u003c/a\u003e 弄了一个 ocserv 的. 此项目的原因和一点点介绍可见 \u003ca href=\"http://wppurking.github.io/2014/10/11/use-ocserv-docker-to-enjoy-freedom-internet.html\" rel=\"nofollow\"\u003e使用 ocserv-docker 享受自由网络\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e有啥问题可以直接 \u003ca href=\"https://twitter.com/wyatt_pan\" rel=\"nofollow\"\u003e@wyatt_pan\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e简单部署\u003c/h2\u003e\u003ca id=\"user-content-简单部署\" class=\"anchor\" aria-label=\"Permalink: 简单部署\" href=\"#简单部署\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e在 \u003ca href=\"https://gist.github.com/wppurking/55db8651a88425e0f977\"\u003e安装好 Docker 1.0+\u003c/a\u003e 并且正常启动 Docker 后:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003ecd ~;git clone https://github.com/wppurking/ocserv-docker.git\u003c/code\u003e : 将当前 repo 下载, 拥有可调整的 ocserv.conf 配置文件以及 ocpasswd 用户密码文件\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003edocker run -d --privileged --name ocserv-docker -v ~/ocserv-docker/ocserv:/etc/ocserv -p 443:443/tcp wppurking/ocserv\u003c/code\u003e : Box 自动下载. ocserv 的一些功能需要 Docker 在 privileged 权限下处理\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003edocker logs ocserv-docker\u003c/code\u003e : 查看运行日志, 检查是否正常运行(可重复执行).\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"listening (TCP) on 0.0.0.0:443...\nlistening (TCP) on [::]:443...\nlistening (UDP) on 0.0.0.0:443...\nlistening (UDP) on [::]:443...\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003elistening (TCP) on 0.0.0.0:443...\nlistening (TCP) on [::]:443...\nlistening (UDP) on 0.0.0.0:443...\nlistening (UDP) on [::]:443...\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e构建部署\u003c/h2\u003e\u003ca id=\"user-content-构建部署\" class=\"anchor\" aria-label=\"Permalink: 构建部署\" href=\"#构建部署\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e构建自己本地的 images, 计算自己的 ssl key (自签名). 可以避免 N 多人使用一个证书的问题.\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003ecd ~ \u0026amp;\u0026amp; git clone https://github.com/wppurking/ocserv-docker.git\u003c/code\u003e : 将当前 repo 下载, 拥有可调整的 ocserv.conf 配置文件以及 ocpasswd 用户密码文件\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003ecd ~/ocserv-docker \u0026amp;\u0026amp; docker build --no-cache -t ocserv-docker .\u003c/code\u003e : 在 ocserv-docker 目录下, 重新构建全新的镜像使用. (例: 版本更新, 重新生成证书)\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003edocker run -d --privileged --name ocserv-docker -v ~/ocserv-docker/ocserv:/etc/ocserv -p 443:443/tcp ocserv-docker\u003c/code\u003e : ocserv 的一些功能需要 Docker 在 privileged 权限下处理\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003edocker logs ocserv-docker\u003c/code\u003e : 查看运行日志, 检查是否正常运行(可重复执行).\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e使用\u003c/h2\u003e\u003ca id=\"user-content-使用\" class=\"anchor\" aria-label=\"Permalink: 使用\" href=\"#使用\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e初始化好的两个账户: wyatt:616 holly:525\u003c/li\u003e\n\u003cli\u003e如果主服务器上开启了 iptables, 一定要记得将 443 端口的 tcp 与 udp 都开放\u003c/li\u003e\n\u003cli\u003e已经做了其能够处理的下发路由数量 (ocserv.conf 中, 感谢: kevinzhow 的 \u003ca href=\"https://gist.github.com/kevinzhow/9661732\"\u003eroute.sh\u003c/a\u003e 和 \u003ca href=\"https://gist.github.com/kevinzhow/9661753\"\u003eip_cook.rb\u003c/a\u003e )\u003c/li\u003e\n\u003cli\u003e接下来 就是 AnyConnect 的客户端了. Win, Mac, Linux \u003ca href=\"https://www.haskins.yale.edu/docdepot/published/WG/show.php?q=SEFTSzAx-58c63f59\" rel=\"nofollow\"\u003eLink1\u003c/a\u003e (Cisco 官方需要注册...), \u003ca href=\"https://itunes.apple.com/us/app/cisco-anyconnect/id392790924?mt=8\" rel=\"nofollow\"\u003eiOS\u003c/a\u003e, \u003ca href=\"https://play.google.com/store/apps/details?id=com.cisco.anyconnect.vpn.android.avf\u0026amp;hl=en\" rel=\"nofollow\"\u003eAndroid\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e因为我们自己生成的 CA 证书是没有权威组织认证的, 所以 AnyConnect 需要接受这些 \"不信任的 VPN\" :P\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e自定义证书, 密钥\u003c/h2\u003e\u003ca id=\"user-content-自定义证书-密钥\" class=\"anchor\" aria-label=\"Permalink: 自定义证书, 密钥\" href=\"#自定义证书-密钥\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e因为是构建一个独立的 box 进行分发, 方便快速部署一个 ocserv, 所以将证书, 密钥, 用户都集成在里面了, 此刻方便使用. 如果对于有担心的, 可以 \u003ccode\u003edocker run -t -i wppurking/ocserv bash\u003c/code\u003e 进入到 box 中使用 \u003ccode\u003ecerttool\u003c/code\u003e 重新进行处理, 具体操作步骤参考 \u003ca href=\"http://luoqkk.com/linode-vps-debian-installation-and-configuration-ocserv-openconnect-server.html\" rel=\"nofollow\"\u003e[原创]linode vps debian7.5安装配置ocserv(OpenConnect server)\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e证书是在 Docker Build 的过程中自动生成的, 其生成的目的地为 \u003ccode\u003e/opt/certs\u003c/code\u003e\n\u003ca href=\"https://twitter.com/douglas_lee/status/590245251257737216\" rel=\"nofollow\"\u003e成功更换 certs 的例子\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTODO: 自签名客户端证书登陆\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e用户名\u003c/h2\u003e\u003ca id=\"user-content-用户名\" class=\"anchor\" aria-label=\"Permalink: 用户名\" href=\"#用户名\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e为了使新手能够最快的使用上 AnyConnect (也方便我自己同一设备能方便的链接多个不同地域的 VPS) 我预先设置了两个初始化的账号密码, 但同时将用于提供账号密码的 \u003ccode\u003eocserv/ocpasswd\u003c/code\u003e 文件放在 Box 外面, 运行 Container 时使用 Volume 挂在进去, 这样方便熟悉 Docker 的用户能够方便的 使用 \u003ccode\u003eocpasswd\u003c/code\u003e 命令修改或者重新生成自己的用户密码.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e提供一个非常简单的更换密码操作, 复制命令就好了(建立在按照上面的操作基础上哈):\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e新添加用户\u003c/h3\u003e\u003ca id=\"user-content-新添加用户\" class=\"anchor\" aria-label=\"Permalink: 新添加用户\" href=\"#新添加用户\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"$\u0026gt; docker exec -it $(docker ps -a | grep vpn_run | awk '{print $1}') ocpasswd yourname\n$\u0026gt; Enter password:\n$\u0026gt; Re-enter password:\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e$\u0026gt; docker exec -it $(docker ps -a | grep vpn_run | awk '{print $1}') ocpasswd yourname\n$\u0026gt; Enter password:\n$\u0026gt; Re-enter password:\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e这个的原理是借用 docker 运行中的 container , 在其里面运行 \u003ccode\u003eocpasswd\u003c/code\u003e 改变 Volumn 进去的 \u003ccode\u003e./ocserv/ocpasswd\u003c/code\u003e 文件内容, 所以当你运行完这行命令, 本机(非 container 中)的 \u003ccode\u003e./ocserv/ocpasswd\u003c/code\u003e 的文件内容会真实发生变化\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e清理掉预设的两个用户名\u003c/h3\u003e\u003ca id=\"user-content-清理掉预设的两个用户名\" class=\"anchor\" aria-label=\"Permalink: 清理掉预设的两个用户名\" href=\"#清理掉预设的两个用户名\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e直接打开 \u003ccode\u003e./ocserv/ocpasswd\u003c/code\u003e 删掉 wyatt/holly 开头的两行就好了.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e信息\u003c/h2\u003e\u003ca id=\"user-content-信息\" class=\"anchor\" aria-label=\"Permalink: 信息\" href=\"#信息\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eBox Size: 164 MB (原来是 380+ MB, 基础镜像缩减)\u003c/li\u003e\n\u003cli\u003e基础 Box: ubuntu:trusty\u003c/li\u003e\n\u003cli\u003e测试过的环境:\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e[Linode 1G Ubuntu 14.04 LTS]\u003c/li\u003e\n\u003cli\u003e[Vultr 768MB Ubuntu 14.04 LTS]\u003c/li\u003e\n\u003cli\u003e[DigitalOcean 512MB Docker 1.2.0 on Ubuntu 14.04]\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRefs\u003c/h2\u003e\u003ca id=\"user-content-refs\" class=\"anchor\" aria-label=\"Permalink: Refs\" href=\"#refs\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"http://www.infradead.org/ocserv/manual.html\" rel=\"nofollow\"\u003eocserv 0.8.2 Manual\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://luoqkk.com/linode-vps-debian-installation-and-configuration-ocserv-openconnect-server.html\" rel=\"nofollow\"\u003e[原创]linode vps debian7.5安装配置ocserv(OpenConnect server)\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://izhaom.in/2014/08/install-cisco-anyconnect-server-on-a-generic-linux-server/\" rel=\"nofollow\"\u003eInstall Cisco AnyConnect Server on a Generic Linux Server\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://imkevin.me/post/80157872840/anyconnect-iphone\" rel=\"nofollow\"\u003eAnyConnect 带来 iPhone 上的新生活\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://botu.me/install-ocserv-on-centos6/\" rel=\"nofollow\"\u003eInstall Ocserv on CentOS 6.5\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://www.bauer-power.net/2014/06/how-to-install-gnutls-3123-from-source.html\" rel=\"nofollow\"\u003eGnutls 3.1.23 on Ubuntu 14.04\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e问题\u003c/h2\u003e\u003ca id=\"user-content-问题\" class=\"anchor\" aria-label=\"Permalink: 问题\" href=\"#问题\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e大家最近连接上 ocserv 就断开, 我猜测因为有比较多的人使用同一个 Docker Image 使得太多人使用同一个证书, 然后我做了处理,\u003c/h3\u003e\u003ca id=\"user-content-大家最近连接上-ocserv-就断开-我猜测因为有比较多的人使用同一个-docker-image-使得太多人使用同一个证书-然后我做了处理\" class=\"anchor\" aria-label=\"Permalink: 大家最近连接上 ocserv 就断开, 我猜测因为有比较多的人使用同一个 Docker Image 使得太多人使用同一个证书, 然后我做了处理,\" href=\"#大家最近连接上-ocserv-就断开-我猜测因为有比较多的人使用同一个-docker-image-使得太多人使用同一个证书-然后我做了处理\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e至少我的几台服务器已经正常, 不会断开了. 请大家 \u003ccode\u003edocker rmi wppurking/ocserv\u003c/code\u003e 然后再执行运行的命令下载最新的 image, 如果有条件自己 build 以下或者使用自己的证书即可.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e关于限速, 我想应该是网络的干扰. 我部署的服务器 ( \u003ca href=\"https://toolstud.io/data/bandwidth.php?compare=network\u0026amp;speed=1.5\u0026amp;speed_unit=MB%2Fs\" rel=\"nofollow\"\u003e1.5 MB/s\u003c/a\u003e 大概 12 Mbps) 如下:\u003c/h3\u003e\u003ca id=\"user-content-关于限速-我想应该是网络的干扰-我部署的服务器--15-mbs-大概-12-mbps-如下\" class=\"anchor\" aria-label=\"Permalink: 关于限速, 我想应该是网络的干扰. 我部署的服务器 ( 1.5 MB/s 大概 12 Mbps) 如下:\" href=\"#关于限速-我想应该是网络的干扰-我部署的服务器--15-mbs-大概-12-mbps-如下\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://camo.githubusercontent.com/3ea497f7bda5b4fcc31db32d99c19a8706d2243cbf06041b1a4c76cc24eeba3a/687474703a2f2f37376738717a2e636f6d312e7a302e676c622e636c6f7564646e2e636f6d2f616e79636f6e6e6563742e706e673f696d61676556696577322f322f772f333030\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/3ea497f7bda5b4fcc31db32d99c19a8706d2243cbf06041b1a4c76cc24eeba3a/687474703a2f2f37376738717a2e636f6d312e7a302e676c622e636c6f7564646e2e636f6d2f616e79636f6e6e6563742e706e673f696d61676556696577322f322f772f333030\" alt=\"AnyConnect\" data-canonical-src=\"http://77g8qz.com1.z0.glb.clouddn.com/anyconnect.png?imageView2/2/w/300\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e如果你网络好的话, 那么可以看到如下的情况 ( \u003ca href=\"https://toolstud.io/data/bandwidth.php?compare=network\u0026amp;speed=7.1\u0026amp;speed_unit=MB%2Fs\" rel=\"nofollow\"\u003e7.1MB/s\u003c/a\u003e 的峰值, 56.8 Mbps) :\u003c/h3\u003e\u003ca id=\"user-content-如果你网络好的话-那么可以看到如下的情况--71mbs-的峰值-568-mbps-\" class=\"anchor\" aria-label=\"Permalink: 如果你网络好的话, 那么可以看到如下的情况 ( 7.1MB/s 的峰值, 56.8 Mbps) :\" href=\"#如果你网络好的话-那么可以看到如下的情况--71mbs-的峰值-568-mbps-\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://camo.githubusercontent.com/461fc6ce2ff4e3fd38bf9c308e19cfffede12e9242251020ab6a1fd27afa213e/687474703a2f2f37376738717a2e636f6d312e7a302e676c622e636c6f7564646e2e636f6d2f616e79636f6e6e6563742d746f702e6a70673f696d61676556696577322f302f682f3430302f712f313030\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/461fc6ce2ff4e3fd38bf9c308e19cfffede12e9242251020ab6a1fd27afa213e/687474703a2f2f37376738717a2e636f6d312e7a302e676c622e636c6f7564646e2e636f6d2f616e79636f6e6e6563742d746f702e6a70673f696d61676556696577322f302f682f3430302f712f313030\" alt=\"AnyConnect Speed\" data-canonical-src=\"http://77g8qz.com1.z0.glb.clouddn.com/anyconnect-top.jpg?imageView2/0/h/400/q/100\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003c/article\u003e","loaded":true,"timedOut":false,"errorMessage":null,"headerInfo":{"toc":[{"level":2,"text":"用途","anchor":"用途","htmlText":"用途"},{"level":2,"text":"简单部署","anchor":"简单部署","htmlText":"简单部署"},{"level":2,"text":"构建部署","anchor":"构建部署","htmlText":"构建部署"},{"level":2,"text":"使用","anchor":"使用","htmlText":"使用"},{"level":2,"text":"自定义证书, 密钥","anchor":"自定义证书-密钥","htmlText":"自定义证书, 密钥"},{"level":2,"text":"用户名","anchor":"用户名","htmlText":"用户名"},{"level":3,"text":"新添加用户","anchor":"新添加用户","htmlText":"新添加用户"},{"level":3,"text":"清理掉预设的两个用户名","anchor":"清理掉预设的两个用户名","htmlText":"清理掉预设的两个用户名"},{"level":2,"text":"信息","anchor":"信息","htmlText":"信息"},{"level":2,"text":"Refs","anchor":"refs","htmlText":"Refs"},{"level":2,"text":"问题","anchor":"问题","htmlText":"问题"},{"level":3,"text":"大家最近连接上 ocserv 就断开, 我猜测因为有比较多的人使用同一个 Docker Image 使得太多人使用同一个证书, 然后我做了处理,","anchor":"大家最近连接上-ocserv-就断开-我猜测因为有比较多的人使用同一个-docker-image-使得太多人使用同一个证书-然后我做了处理","htmlText":"大家最近连接上 ocserv 就断开, 我猜测因为有比较多的人使用同一个 Docker Image 使得太多人使用同一个证书, 然后我做了处理,"},{"level":3,"text":"关于限速, 我想应该是网络的干扰. 我部署的服务器 ( 1.5 MB/s 大概 12 Mbps) 如下:","anchor":"关于限速-我想应该是网络的干扰-我部署的服务器--15-mbs-大概-12-mbps-如下","htmlText":"关于限速, 我想应该是网络的干扰. 我部署的服务器 ( 1.5 MB/s 大概 12 Mbps) 如下:"},{"level":3,"text":"如果你网络好的话, 那么可以看到如下的情况 ( 7.1MB/s 的峰值, 56.8 Mbps) :","anchor":"如果你网络好的话-那么可以看到如下的情况--71mbs-的峰值-568-mbps-","htmlText":"如果你网络好的话, 那么可以看到如下的情况 ( 7.1MB/s 的峰值, 56.8 Mbps) :"}],"siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fabacuspix%2Focserv-docker"}}],"overviewFilesProcessingTime":0}},"appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-881e9a930386.js","githubDevUrl":null,"enabled_features":{"copilot_workspace":null,"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}}
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

用途

因为安装一个 Open Connect 的步骤实在太麻烦了, 特别对于新手, 所以特意参考了 jpetazzo 的 dockvpn 弄了一个 ocserv 的. 此项目的原因和一点点介绍可见 使用 ocserv-docker 享受自由网络

有啥问题可以直接 @wyatt_pan

简单部署

安装好 Docker 1.0+ 并且正常启动 Docker 后:

  • cd ~;git clone https://github.com/wppurking/ocserv-docker.git : 将当前 repo 下载, 拥有可调整的 ocserv.conf 配置文件以及 ocpasswd 用户密码文件
  • docker run -d --privileged --name ocserv-docker -v ~/ocserv-docker/ocserv:/etc/ocserv -p 443:443/tcp wppurking/ocserv : Box 自动下载. ocserv 的一些功能需要 Docker 在 privileged 权限下处理
  • docker logs ocserv-docker : 查看运行日志, 检查是否正常运行(可重复执行).
listening (TCP) on 0.0.0.0:443...
listening (TCP) on [::]:443...
listening (UDP) on 0.0.0.0:443...
listening (UDP) on [::]:443...

构建部署

构建自己本地的 images, 计算自己的 ssl key (自签名). 可以避免 N 多人使用一个证书的问题.

  • cd ~ && git clone https://github.com/wppurking/ocserv-docker.git : 将当前 repo 下载, 拥有可调整的 ocserv.conf 配置文件以及 ocpasswd 用户密码文件
  • cd ~/ocserv-docker && docker build --no-cache -t ocserv-docker . : 在 ocserv-docker 目录下, 重新构建全新的镜像使用. (例: 版本更新, 重新生成证书)
  • docker run -d --privileged --name ocserv-docker -v ~/ocserv-docker/ocserv:/etc/ocserv -p 443:443/tcp ocserv-docker : ocserv 的一些功能需要 Docker 在 privileged 权限下处理
  • docker logs ocserv-docker : 查看运行日志, 检查是否正常运行(可重复执行).

使用

  • 初始化好的两个账户: wyatt:616 holly:525
  • 如果主服务器上开启了 iptables, 一定要记得将 443 端口的 tcp 与 udp 都开放
  • 已经做了其能够处理的下发路由数量 (ocserv.conf 中, 感谢: kevinzhow 的 route.ship_cook.rb )
  • 接下来 就是 AnyConnect 的客户端了. Win, Mac, Linux Link1 (Cisco 官方需要注册...), iOS, Android
  • 因为我们自己生成的 CA 证书是没有权威组织认证的, 所以 AnyConnect 需要接受这些 "不信任的 VPN" :P

自定义证书, 密钥

因为是构建一个独立的 box 进行分发, 方便快速部署一个 ocserv, 所以将证书, 密钥, 用户都集成在里面了, 此刻方便使用. 如果对于有担心的, 可以 docker run -t -i wppurking/ocserv bash 进入到 box 中使用 certtool 重新进行处理, 具体操作步骤参考 [原创]linode vps debian7.5安装配置ocserv(OpenConnect server)

证书是在 Docker Build 的过程中自动生成的, 其生成的目的地为 /opt/certs 成功更换 certs 的例子

TODO: 自签名客户端证书登陆

用户名

为了使新手能够最快的使用上 AnyConnect (也方便我自己同一设备能方便的链接多个不同地域的 VPS) 我预先设置了两个初始化的账号密码, 但同时将用于提供账号密码的 ocserv/ocpasswd 文件放在 Box 外面, 运行 Container 时使用 Volume 挂在进去, 这样方便熟悉 Docker 的用户能够方便的 使用 ocpasswd 命令修改或者重新生成自己的用户密码.

提供一个非常简单的更换密码操作, 复制命令就好了(建立在按照上面的操作基础上哈):

新添加用户

$> docker exec -it $(docker ps -a | grep vpn_run | awk '{print $1}') ocpasswd yourname
$> Enter password:
$> Re-enter password:

这个的原理是借用 docker 运行中的 container , 在其里面运行 ocpasswd 改变 Volumn 进去的 ./ocserv/ocpasswd 文件内容, 所以当你运行完这行命令, 本机(非 container 中)的 ./ocserv/ocpasswd 的文件内容会真实发生变化

清理掉预设的两个用户名

直接打开 ./ocserv/ocpasswd 删掉 wyatt/holly 开头的两行就好了.

信息

  • Box Size: 164 MB (原来是 380+ MB, 基础镜像缩减)
  • 基础 Box: ubuntu:trusty
  • 测试过的环境:
    • [Linode 1G Ubuntu 14.04 LTS]
    • [Vultr 768MB Ubuntu 14.04 LTS]
    • [DigitalOcean 512MB Docker 1.2.0 on Ubuntu 14.04]

Refs

问题

大家最近连接上 ocserv 就断开, 我猜测因为有比较多的人使用同一个 Docker Image 使得太多人使用同一个证书, 然后我做了处理,

至少我的几台服务器已经正常, 不会断开了. 请大家 docker rmi wppurking/ocserv 然后再执行运行的命令下载最新的 image, 如果有条件自己 build 以下或者使用自己的证书即可.

关于限速, 我想应该是网络的干扰. 我部署的服务器 ( 1.5 MB/s 大概 12 Mbps) 如下:

AnyConnect

如果你网络好的话, 那么可以看到如下的情况 ( 7.1MB/s 的峰值, 56.8 Mbps) :

AnyConnect Speed

About

用于初始化 ocserv 的 Dockfile 脚本

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 89.6%
  • Shell 10.4%
0