]>
Commit | Line | Data |
---|---|---|
671fa0bd MT |
1 | #!/bin/bash |
2 | ############################################################################### | |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2010 Michael Tremer & Christian Schmidt # | |
6 | # # | |
7 | # This program is free software: you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation, either version 3 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # This program is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
19 | # # | |
20 | ############################################################################### | |
21 | ||
22 | . /lib/network/header-zone | |
23 | ||
24 | HOOK_SETTINGS="HOOK PROTOCOL USER SECRET SERVER TUNNEL_ID" | |
25 | ||
26 | USER= | |
27 | SECRET= | |
28 | SERVER="tic.sixxs.net" | |
29 | PROTOCOL="tic" | |
30 | TUNNEL_ID= | |
31 | ||
32 | function _check() { | |
33 | assert isset USER | |
34 | assert isset SECRET | |
35 | assert isset SERVER | |
36 | assert isset PROTOCOL | |
37 | } | |
38 | ||
39 | function _parse_cmdline() { | |
40 | local value | |
41 | ||
42 | while [ $# -gt 0 ]; do | |
43 | case "$1" in | |
44 | --user=*) | |
45 | USER=$(cli_get_val ${1}) | |
46 | ;; | |
47 | --secret=*) | |
48 | SECRET=$(cli_get_val ${1}) | |
49 | ;; | |
50 | --server=*) | |
51 | SERVER=$(cli_get_val ${1}) | |
52 | ;; | |
53 | --protocol=*) | |
54 | PROTOCOL=$(cli_get_val ${1}) | |
55 | ;; | |
56 | --tunnel-id=*) | |
57 | TUNNEL_ID=$(cli_get_val ${1}) | |
58 | ;; | |
59 | *) | |
60 | echo "Unknown option: $1" >&2 | |
61 | exit ${EXIT_ERROR} | |
62 | ;; | |
63 | esac | |
64 | shift | |
65 | done | |
66 | } | |
67 | ||
68 | function _up() { | |
69 | local zone=${1} | |
70 | shift | |
71 | ||
72 | assert isset zone | |
73 | ||
74 | zone_config_read ${zone} | |
75 | ||
76 | aiccu_start ${zone} \ | |
77 | --server="${SERVER}" \ | |
78 | --protocol="${PROTOCOL}" \ | |
79 | --user="${USER}" \ | |
80 | --secret="${SECRET}" \ | |
81 | --tunnel-id="${TUNNEL_ID}" | |
82 | ||
83 | exit $? | |
84 | } | |
85 | ||
86 | function _down() { | |
87 | local zone=${1} | |
88 | shift | |
89 | ||
90 | aiccu_stop ${zone} | |
91 | ||
92 | exit ${EXIT_OK} | |
93 | } | |
94 | ||
95 | function _status() { | |
96 | local zone=${1} | |
671fa0bd MT |
97 | assert isset zone |
98 | ||
3cb2fc42 | 99 | cli_device_headline ${zone} |
671fa0bd MT |
100 | |
101 | zone_config_read ${zone} | |
102 | ||
3cb2fc42 MT |
103 | cli_headline 2 "Configuration" |
104 | cli_print_fmt1 2 "User" "${USER}" | |
105 | cli_print_fmt1 2 "Secret" "<hidden>" | |
106 | cli_space | |
107 | cli_print_fmt1 2 "Server" "${SERVER}" | |
108 | cli_print_fmt1 2 "Protocol" "${PROTOCOL}" | |
671fa0bd | 109 | if isset TUNNEL_ID; then |
3cb2fc42 MT |
110 | cli_space |
111 | cli_print_fmt1 2 "Tunnel ID" "${TUNNEL_ID}" | |
671fa0bd | 112 | fi |
3cb2fc42 | 113 | cli_space |
671fa0bd MT |
114 | |
115 | exit ${EXIT_OK} | |
116 | } | |
117 | ||
118 | run $@ |