fix path to cert file, it must be dynamicly computed in absolute to be independent of the current running dir

This commit is contained in:
StudioEtrange 2021-01-29 04:09:20 +01:00
parent 2e29ad2d8d
commit 16c1e465d4
2 changed files with 9 additions and 3 deletions

View File

@ -19,6 +19,9 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # 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. # This function allows you to check if the required tools have been installed.
function check_tool() { function check_tool() {
cmd=$1 cmd=$1
@ -94,7 +97,7 @@ export pubKey
echo Trying to connect to the PIA WireGuard API on $WG_SERVER_IP... echo Trying to connect to the PIA WireGuard API on $WG_SERVER_IP...
wireguard_json="$(curl -s -G \ wireguard_json="$(curl -s -G \
--connect-to "$WG_HOSTNAME::$WG_SERVER_IP:" \ --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 "pt=${PIA_TOKEN}" \
--data-urlencode "pubkey=$pubKey" \ --data-urlencode "pubkey=$pubKey" \
"https://${WG_HOSTNAME}:1337/addKey" )" "https://${WG_HOSTNAME}:1337/addKey" )"

View File

@ -19,6 +19,9 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # 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. # This function allows you to check if the required tools have been installed.
function check_tool() { function check_tool() {
cmd=$1 cmd=$1
@ -86,7 +89,7 @@ if [[ ! $PAYLOAD_AND_SIGNATURE ]]; then
echo -n "Getting new signature... " echo -n "Getting new signature... "
payload_and_signature="$(curl -s -m 5 \ payload_and_signature="$(curl -s -m 5 \
--connect-to "$PF_HOSTNAME::$PF_GATEWAY:" \ --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}" \ -G --data-urlencode "token=${PIA_TOKEN}" \
"https://${PF_HOSTNAME}:19999/getSignature")" "https://${PF_HOSTNAME}:19999/getSignature")"
else else
@ -133,7 +136,7 @@ Trying to bind the port... "
while true; do while true; do
bind_port_response="$(curl -Gs -m 5 \ bind_port_response="$(curl -Gs -m 5 \
--connect-to "$PF_HOSTNAME::$PF_GATEWAY:" \ --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 "payload=${payload}" \
--data-urlencode "signature=${signature}" \ --data-urlencode "signature=${signature}" \
"https://${PF_HOSTNAME}:19999/bindPort")" "https://${PF_HOSTNAME}:19999/bindPort")"