#!/bin/bash ############################################################################### # # # IPFire.org - A linux based firewall # # Copyright (C) 2010 Michael Tremer & Christian Schmidt # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # # # ############################################################################### . /usr/lib/network/header-zone HOOK_SETTINGS="HOOK PROTOCOL USER SECRET SERVER TUNNEL_ID" USER= SECRET= SERVER="tic.sixxs.net" PROTOCOL="tic" TUNNEL_ID= function _check() { assert isset USER assert isset SECRET assert isset SERVER assert isset PROTOCOL } function _parse_cmdline() { local value while [ $# -gt 0 ]; do case "$1" in --user=*) USER=$(cli_get_val ${1}) ;; --secret=*) SECRET=$(cli_get_val ${1}) ;; --server=*) SERVER=$(cli_get_val ${1}) ;; --protocol=*) PROTOCOL=$(cli_get_val ${1}) ;; --tunnel-id=*) TUNNEL_ID=$(cli_get_val ${1}) ;; *) echo "Unknown option: $1" >&2 exit ${EXIT_ERROR} ;; esac shift done } function _up() { local zone=${1} shift assert isset zone zone_config_read ${zone} aiccu_start ${zone} \ --server="${SERVER}" \ --protocol="${PROTOCOL}" \ --user="${USER}" \ --secret="${SECRET}" \ --tunnel-id="${TUNNEL_ID}" exit $? } function _down() { local zone=${1} shift aiccu_stop ${zone} exit ${EXIT_OK} } function _status() { local zone=${1} assert isset zone cli_device_headline ${zone} zone_config_read ${zone} cli_headline 2 "Configuration" cli_print_fmt1 2 "User" "${USER}" cli_print_fmt1 2 "Secret" "" cli_space cli_print_fmt1 2 "Server" "${SERVER}" cli_print_fmt1 2 "Protocol" "${PROTOCOL}" if isset TUNNEL_ID; then cli_space cli_print_fmt1 2 "Tunnel ID" "${TUNNEL_ID}" fi cli_space exit ${EXIT_OK} }