Score:0

"Multiple --up scripts defined" when running OpenVPN inside a Docker container

pt flag

I'm using binhex/arch-rtorrentvpn and the contents of my docker-compose.yml are as follows:

version: "2"
services:
  rtorrent:
    image: binhex/arch-rtorrentvpn
    container_name: rtorrent
    cap_add:
      - NET_ADMIN
    environment:
      - VPN_ENABLED=yes
      - VPN_USER=<myusername>
      - VPN_PASS=<mypassword>
      - VPN_PROV=custom
      - VPN_OPTIONS=--script-security 2 --up /config/persists/tun_up.sh
      - VPN_CLIENT=openvpn
      - STRICT_PORT_FORWARD=no
      - ENABLE_AUTODL_IRSSI=yes
      - ENABLE_RPC2=yes
      - ENABLE_RPC2_AUTH=no
      - ENABLE_WEBUI_AUTH=no
      - LAN_NETWORK=192.168.1.0/24
      - NAME_SERVERS=1.1.1.1,1.0.0.1
      - DEBUG=true
      - PHP_TZ=Europe/London
      - UMASK=000
      - PUID=1000
      - PGID=1000
    volumes:
      - ./config:/config
      - ./downloads:/downloads
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 9080:9080
      - 9443:9443
      - 8118:8118
    restart: unless-stopped

The issue I have is that, according to the [debug] output, my OpenVPN command line is as follows:

[debug] OpenVPN command line:- /usr/bin/openvpn 
--reneg-sec 0 
--mute-replay-warnings 
--auth-nocache 
--setenv VPN_PROV 'custom' 
--setenv VPN_CLIENT 'openvpn' 
--setenv DEBUG 'true' 
--setenv VPN_DEVICE_TYPE 'tun0' 
--setenv VPN_ENABLED 'yes' 
--setenv VPN_REMOTE_SERVER '213.152.188.3' 
--setenv APPLICATION 'rtorrent' 
--script-security 2 
--writepid /root/openvpn.pid 
--remap-usr1 SIGHUP 
--log-append /dev/stdout 
--pull-filter ignore 'up' 
--pull-filter ignore 'down' 
--pull-filter ignore 'route-ipv6' 
--pull-filter ignore 'ifconfig-ipv6' 
--pull-filter ignore 'tun-ipv6' 
--pull-filter ignore 'dhcp-option DNS6' 
--pull-filter ignore 'persist-tun' 
--pull-filter ignore 'reneg-sec' 
--up /root/openvpnup.sh 
--up-delay 
--up-restart 
--auth-user-pass credentials.conf 
--script-security 2 
--up /config/persists/tun_up.sh 
--cd /config/openvpn 
--config '/config/openvpn/nl910.nordvpn.com.tcp443.ovpn' 
--remote 213.152.188.3 443 tcp-client 
--remote-random

This throws the error: Multiple --up scripts defined. The previously configured script is overridden and the container will not start

I have tried calling the script by the below two methods, both of which resulted in the same error.

  • Calling the /root/openvpnup.sh script via using the ; separator. e.g.: VPN_OPTIONS=--script-security 2 --up /config/persists/tun_up.sh;/root/openvpnup.sh
  • Calling the /root/openvpnup.sh script by adding /root/openvpnup.sh to the end of my tun_up.sh script.
  • Running the script via other parameters (e.g.: --tls-verify) instead of --up

How can I get this to work?

Score:0
in flag

My suspicion is that this is happening because you are defining the up script before the config. If you try to add running the --up /config/persists/tun_up.sh inside the ovpn config itself might work.

Another suggestion is to copy the script inside /etc/openvpn and not specify an absolute path to it.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.