#!/bin/bash

# This shell script is part of package cp-vpn
#
# Copyright (c) 2014 Com-Pro, Germany
#
# It will mark a registered client as offline.
# If there's no registration file found, it will exit.

EXITSTATE=1
CONFIGDIR="$1"

if [ -e "${CONFIGDIR}cp-vpn.reg" ]; then
  AUTHSTRING=`cat ${CONFIGDIR}cp-vpn.reg`
  wget https://vpn.dsx1.org/peeroff.php?as=${AUTHSTRING} --ca-certificate="${CONFIGDIR}cp-vpn-ca.crt" --certificate="${CONFIGDIR}cp-vpn.crt" --private-key="${CONFIGDIR}cp-vpn.key" -O "${CONFIGDIR}peeroff.log"
  
  EXITSTATE=$?
fi

exit ${EXITSTATE}
