diff --git a/connect_to_wireguard_with_token.sh b/connect_to_wireguard_with_token.sh index bda0ce1..3b7d7ec 100755 --- a/connect_to_wireguard_with_token.sh +++ b/connect_to_wireguard_with_token.sh @@ -19,6 +19,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +# absolute path ot this file directory +CURRENT_FILE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + # This function allows you to check if the required tools have been installed. function check_tool() { cmd=$1 @@ -94,7 +97,7 @@ export pubKey echo Trying to connect to the PIA WireGuard API on $WG_SERVER_IP... wireguard_json="$(curl -s -G \ --connect-to "$WG_HOSTNAME::$WG_SERVER_IP:" \ - --cacert "ca.rsa.4096.crt" \ + --cacert "$CURRENT_FILE_DIR/ca.rsa.4096.crt" \ --data-urlencode "pt=${PIA_TOKEN}" \ --data-urlencode "pubkey=$pubKey" \ "https://${WG_HOSTNAME}:1337/addKey" )" diff --git a/port_forwarding.sh b/port_forwarding.sh index 2e48198..dac5026 100755 --- a/port_forwarding.sh +++ b/port_forwarding.sh @@ -19,6 +19,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +# absolute path ot this file directory +CURRENT_FILE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + # This function allows you to check if the required tools have been installed. function check_tool() { cmd=$1 @@ -86,7 +89,7 @@ if [[ ! $PAYLOAD_AND_SIGNATURE ]]; then echo -n "Getting new signature... " payload_and_signature="$(curl -s -m 5 \ --connect-to "$PF_HOSTNAME::$PF_GATEWAY:" \ - --cacert "ca.rsa.4096.crt" \ + --cacert "$CURRENT_FILE_DIR/ca.rsa.4096.crt" \ -G --data-urlencode "token=${PIA_TOKEN}" \ "https://${PF_HOSTNAME}:19999/getSignature")" else @@ -133,7 +136,7 @@ Trying to bind the port... " while true; do bind_port_response="$(curl -Gs -m 5 \ --connect-to "$PF_HOSTNAME::$PF_GATEWAY:" \ - --cacert "ca.rsa.4096.crt" \ + --cacert "$CURRENT_FILE_DIR/ca.rsa.4096.crt" \ --data-urlencode "payload=${payload}" \ --data-urlencode "signature=${signature}" \ "https://${PF_HOSTNAME}:19999/bindPort")"