Improve readme, automatically fix up and down scripts in configuration.

This commit is contained in:
redxef 2021-11-28 03:03:09 +01:00
parent 7ca9b5016e
commit fce34cdff0
4 changed files with 20 additions and 23 deletions

View file

@ -7,16 +7,18 @@ TAG = openvpn-aria2
build: build-docker $(START_SCRIPT) build: build-docker $(START_SCRIPT)
build-docker: $(DOCKERFILE) start-openvpn.sh build-docker: $(DOCKERFILE) start-openvpn.sh
docker pull alpine
docker build --tag=$(TAG) . docker build --tag=$(TAG) .
echo "This is a marker for the docker build." > $@ @echo "This is a marker for the docker build." > $@
$(START_SCRIPT): $(START_SCRIPT_SRC) $(START_SCRIPT): $(START_SCRIPT_SRC)
sed -e "s/{TAG}/$(TAG)/g" -e "s/{INSTALLATION_NAME}/$(INSTALLATION_NAME)/g" $< > $@ sed -e "s/{TAG}/$(TAG)/g" -e "s/{INSTALLATION_NAME}/$(INSTALLATION_NAME)/g" $< > $@
chmod +x $@ chmod +x $@
clean: clean:
$(RM) build-docker $(START_SCRIPT) $(RM) build-docker $(START_SCRIPT)
install: install: build
install -D --mode=755 $(START_SCRIPT) /usr/local/bin/$(INSTALLATION_NAME) install -D --mode=755 $(START_SCRIPT) /usr/local/bin/$(INSTALLATION_NAME)
.PHONY: clean

View file

@ -1,7 +1,13 @@
# Openvpn with torrent client # Openvpn with torrent client
Just add your openvpn configuration `config.ovpn` and the authorization file Put configuration files into `/etc/openvpn/client` and create
`auth.txt` and modify `config.ovpn` to use the auth file: `auth-user-pass /opt/auth.txt` a file `/etc/openvpn-aria2.conf`:
Next run `./start` to drop into a shell as your user in your home directory. ```
Now you can use aria2 to download everything over a VPN. OVPN_CONFIGURATION_FILE=#name of file in /etc/openvpn/client, NOT the full path
```
Run `make build` to generate the docker image and `./start` to start
connect to the vpn inside the image.
`make install` installs the start script under `/usr/local/bin/openvpn-aria2`.

View file

@ -1,15 +0,0 @@
version: '2.0'
services:
openvpn:
restart: never
build:
context: ./
dockerfile: Dockerfile
volumes:
- ./config.ovpn:/opt/config.ovpn
- ./ovpn_config:/opt/ovpn_config
- ./auth.txt:/opt/auth.txt
- /etc/passwd:/etc/passwd
cap_add:
- NET_ADMIN
env_file: ./configuration.env

View file

@ -13,7 +13,11 @@ create_net_dev() {
} }
connect_vpn() { connect_vpn() {
openvpn --config "$OVPN_CONFIGURATION_FILE" --daemon sed -e 's|^up .*$|up /etc/openvpn/up.sh|' \
-e 's|^down .*$|down /etc/openvpn/down.sh|' \
-e 's|^auth-user-pass.*$|auth-user-pass|' \
"$OVPN_CONFIGURATION_FILE" > /tmp/ovpn.conf
openvpn --config /tmp/ovpn.conf --daemon
} }
get_ip() { get_ip() {