-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* install as distro * add config option for forwarding * small edits to readme * move distro files to dir * use same dir to install distro as readme * build npiperelay.exe * verify Docker Desktop Installer file * add build ref to distro image * update readme * show installed package versions * update build * Create LICENSE
- Loading branch information
Showing
11 changed files
with
282 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.git | ||
.github | ||
.dockerignore | ||
distro/Dockerfile | ||
README.md | ||
distro/test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: [ $default-branch ] | ||
|
||
env: | ||
TAG_NAME: ${{ format('wslvpnkit:{0}-{1}', github.sha, github.run_number) }} | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build | ||
run: | | ||
docker build -t $TAG_NAME -f ./distro/Dockerfile --build-arg REF=$TAG_NAME . | ||
- name: Package | ||
run: | | ||
CONTAINER_ID=$(docker create $TAG_NAME) | ||
docker export $CONTAINER_ID | gzip > wsl-vpnkit.tar.gz | ||
sha256sum wsl-vpnkit.tar.gz | tee wsl-vpnkit.tar.gz.sha256 | ||
ls -la wsl-vpnkit.tar.gz wsl-vpnkit.tar.gz.sha256 | ||
- name: Artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wsl-vpnkit | ||
path: | | ||
wsl-vpnkit.tar.gz | ||
wsl-vpnkit.tar.gz.sha256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Keiichi Shimamura | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM alpine:3.14.2 AS vpnkit | ||
WORKDIR /files | ||
COPY ./distro/sha256sums ./ | ||
RUN apk add --no-cache p7zip && \ | ||
wget https://desktop.docker.com/win/stable/amd64/67351/Docker%20Desktop%20Installer.exe && \ | ||
sha256sum -c sha256sums && \ | ||
7z e Docker%20Desktop%20Installer.exe resources/vpnkit.exe resources/wsl/docker-for-wsl.iso && \ | ||
7z e docker-for-wsl.iso containers/services/vpnkit-tap-vsockd/lower/sbin/vpnkit-tap-vsockd && \ | ||
chmod +x vpnkit-tap-vsockd && \ | ||
rm Docker%20Desktop%20Installer.exe docker-for-wsl.iso && \ | ||
wget https://raw.githubusercontent.com/moby/vpnkit/v0.5.0/LICENSE | ||
|
||
FROM golang:1.17.1-alpine3.14 AS npiperelay | ||
ENV GOOS=windows | ||
WORKDIR /files | ||
RUN go mod init local/build && \ | ||
go get -d -v github.com/jstarks/[email protected] && \ | ||
GOOS=windows go build -o ./npiperelay.exe github.com/jstarks/npiperelay && \ | ||
cp /go/pkg/mod/github.com/jstarks/[email protected]/LICENSE ./ | ||
|
||
FROM alpine:3.14.2 | ||
ARG REF=0 | ||
WORKDIR /app | ||
COPY --from=npiperelay /files /files/npiperelay | ||
COPY --from=vpnkit /files /files/vpnkit | ||
COPY ./ ./ | ||
RUN apk add --no-cache socat openrc iptables && \ | ||
apk list --installed && \ | ||
echo "$REF" > /app/ref && \ | ||
ln -s /files/vpnkit/vpnkit-tap-vsockd /app/wsl-vpnkit /usr/sbin/ && \ | ||
ln -s /app/distro/wsl-vpnkit.service /etc/init.d/wsl-vpnkit && \ | ||
ln -s /app/distro/startup.sh /etc/profile.d/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8f36a5b306442d03a87bb80a492558c81902fdabe497af44a39ca07c161c60a5 Docker%20Desktop%20Installer.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#! /bin/sh | ||
|
||
LOG_PATH="/var/log/wsl-vpnkit.log" | ||
USERPROFILE=$(wslpath "$(/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe -c '$env:USERPROFILE' | tr -d '\r')") | ||
|
||
touch $LOG_PATH | ||
|
||
echo " | ||
This distro is only intended to run wsl-vpnkit. | ||
Run the following commands from Windows or other WSL 2 distros to use. | ||
wsl.exe -d $WSL_DISTRO_NAME service wsl-vpnkit start | ||
wsl.exe -d $WSL_DISTRO_NAME service wsl-vpnkit stop | ||
The following files will be copied if they do not already exist. | ||
$USERPROFILE/wsl-vpnkit/wsl-vpnkit.exe | ||
$USERPROFILE/wsl-vpnkit/npiperelay.exe | ||
Logs for wsl-vpnkit can be viewed here. | ||
wsl.exe -d $WSL_DISTRO_NAME tail -f $LOG_PATH | ||
Config for wsl-vpnkit can be edited here. See the wsl-vpnkit script for possible values. | ||
$USERPROFILE/wsl-vpnkit/wsl-vpnkit.conf | ||
wsl.exe -d $WSL_DISTRO_NAME cat /usr/sbin/wsl-vpnkit | ||
Press [enter] key to continue... | ||
" | ||
read _ | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#! /bin/sh | ||
|
||
# run from repo root | ||
# ./distro/test.sh | ||
|
||
USERPROFILE="$(/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe -c '$env:USERPROFILE' | tr -d '\r')" | ||
DUMP=wsl-vpnkit.tar.gz | ||
TAG_NAME=wslvpnkit | ||
|
||
docker build -t $TAG_NAME -f ./distro/Dockerfile . | ||
CONTAINER_ID=$(docker create $TAG_NAME) | ||
docker export $CONTAINER_ID | gzip > $DUMP | ||
docker container rm $CONTAINER_ID | ||
ls -la $DUMP | ||
|
||
wsl.exe --unregister wsl-vpnkit | ||
wsl.exe --import wsl-vpnkit "$USERPROFILE\\wsl-vpnkit" $DUMP | ||
rm $DUMP | ||
wsl.exe -d wsl-vpnkit |
Oops, something went wrong.