X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=hooks%2Fzones%2Faiccu;h=e31f897775180184bc0deedd858bbfc023ff26bb;hb=2181765d1c16758c03e4a5fd242d878a00b42e65;hp=b49cb62d7dd407711b61ded045b60d9b687cdca7;hpb=3cb2fc42e552f747b53123dfe6910664bede0c0a;p=people%2Fms%2Fnetwork.git diff --git a/hooks/zones/aiccu b/hooks/zones/aiccu index b49cb62d..e31f8977 100755 --- a/hooks/zones/aiccu +++ b/hooks/zones/aiccu @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2010 Michael Tremer & Christian Schmidt # +# Copyright (C) 2013 IPFire Network Development Team # # # # 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 # @@ -19,42 +19,60 @@ # # ############################################################################### -. /lib/network/header-zone +. /usr/lib/network/header-zone -HOOK_SETTINGS="HOOK PROTOCOL USER SECRET SERVER TUNNEL_ID" +HOOK_SETTINGS="HOOK PASSWORD PROTOCOL REQUIRE_TLS USERNAME SERVER TUNNEL_ID" -USER= -SECRET= +USERNAME= +PASSWORD= SERVER="tic.sixxs.net" PROTOCOL="tic" TUNNEL_ID= +REQUIRE_TLS="true" -function _check() { - assert isset USER - assert isset SECRET +function hook_check() { + assert isset USERNAME + assert isset PASSWORD assert isset SERVER assert isset PROTOCOL + assert isset REQUIRE_TLS + + # Check if a supported protocol has been given. + if ! list_match "${PROTOCOL}" ${AICCU_SUPPORTED_PROTOCOLS}; then + log ERROR "This protocol is not supported by aiccu: ${PROTOCOL}" + log ERROR "Valid protocols are: ${AICCU_SUPPORTED_PROTOCOLS}" + return ${EXIT_ERROR} + fi } -function _parse_cmdline() { +function hook_parse_cmdline() { local value while [ $# -gt 0 ]; do case "$1" in - --user=*) - USER=$(cli_get_val ${1}) + --username=*) + USERNAME="$(cli_get_val ${1})" ;; - --secret=*) - SECRET=$(cli_get_val ${1}) + --password=*) + PASSWORD="$(cli_get_val ${1})" ;; --server=*) - SERVER=$(cli_get_val ${1}) + SERVER="$(cli_get_val ${1})" ;; --protocol=*) - PROTOCOL=$(cli_get_val ${1}) + PROTOCOL="$(cli_get_val ${1})" ;; --tunnel-id=*) - TUNNEL_ID=$(cli_get_val ${1}) + TUNNEL_ID="$(cli_get_val ${1})" + ;; + --require-tls=*) + REQUIRE_TLS="$(cli_get_val ${1})" + + if enabled val; then + REQUIRE_TLS="true" + else + REQUIRE_TLS="false" + fi ;; *) echo "Unknown option: $1" >&2 @@ -65,34 +83,27 @@ function _parse_cmdline() { done } -function _up() { +function hook_up() { local zone=${1} - shift - assert isset zone - zone_config_read ${zone} + # Start aiccu on this zone. + aiccu_start ${zone} - aiccu_start ${zone} \ - --server="${SERVER}" \ - --protocol="${PROTOCOL}" \ - --user="${USER}" \ - --secret="${SECRET}" \ - --tunnel-id="${TUNNEL_ID}" - - exit $? + exit ${EXIT_OK} } -function _down() { +function hook_down() { local zone=${1} - shift + assert isset zone + # Stop aiccu on this zone. aiccu_stop ${zone} exit ${EXIT_OK} } -function _status() { +function hook_status() { local zone=${1} assert isset zone @@ -101,7 +112,7 @@ function _status() { zone_config_read ${zone} cli_headline 2 "Configuration" - cli_print_fmt1 2 "User" "${USER}" + cli_print_fmt1 2 "User" "${USERNAME}" cli_print_fmt1 2 "Secret" "" cli_space cli_print_fmt1 2 "Server" "${SERVER}" @@ -114,5 +125,3 @@ function _status() { exit ${EXIT_OK} } - -run $@