3 |
validate_client() |
validate_client() |
4 |
{ |
{ |
5 |
local mac_address="$1" |
local mac_address="$1" |
6 |
|
local ip_address="$2" |
7 |
local serial |
local serial |
8 |
local mtime |
local mtime |
9 |
|
local cmd |
10 |
|
|
11 |
if [[ -z ${mac_address} ]] |
if [[ -z ${mac_address} ]] |
12 |
then |
then |
14 |
return 1 |
return 1 |
15 |
fi |
fi |
16 |
|
|
17 |
|
if [[ -z ${ip_address} ]] |
18 |
|
then |
19 |
|
eecho "Error: No ip_address given" |
20 |
|
return 1 |
21 |
|
fi |
22 |
|
|
23 |
decho "registering mac_address='${mac_address}'" |
decho "registering mac_address='${mac_address}'" |
24 |
|
|
25 |
# first check if mac is registered |
# first check if mac is registered |
37 |
then |
then |
38 |
return 1 |
return 1 |
39 |
else |
else |
40 |
echo "serial='${serial}'" |
decho "serial='${serial}'" |
41 |
|
rvecho "${serial}" |
42 |
|
|
43 |
|
cmd+="quiet" |
44 |
|
cmd+="register '${serial}'" |
45 |
|
SSLSAY_IP="${IP}" |
46 |
|
SSLSAY_PORT="6666" |
47 |
|
nsslsay_fingerprint ${cmd} |
48 |
|
|
49 |
return 0 |
return 0 |
50 |
fi |
fi |
51 |
} |
} |
56 |
local iface_ip |
local iface_ip |
57 |
local iface |
local iface |
58 |
local mac_address |
local mac_address |
59 |
|
local cmd |
60 |
|
|
61 |
control_server_ip=$(dns_to_ip ${MCORE_CONTROL_SERVER}) |
control_server_ip=$(dns_to_ip ${MCORE_CONTROL_SERVER}) |
62 |
iface_ip=$(iface_for_remote_addr ${control_server_ip}) |
iface_ip=$(iface_for_remote_addr ${control_server_ip}) |
69 |
decho "mac_address='${mac_address}'" |
decho "mac_address='${mac_address}'" |
70 |
|
|
71 |
decho "register '${mac_address}'" |
decho "register '${mac_address}'" |
72 |
nsslsay_fingerprint "register '${mac_address}'" |
|
73 |
|
cmd+="quiet" |
74 |
|
cmd+="register '${mac_address}' '${iface_ip}'" |
75 |
|
nsslsay_fingerprint ${cmd} |
76 |
|
} |
77 |
|
|
78 |
|
register_client_local() |
79 |
|
{ |
80 |
|
local serial="$1" |
81 |
|
|
82 |
|
if [[ -z ${serial} ]] |
83 |
|
then |
84 |
|
eecho "No serial given" |
85 |
|
return 1 |
86 |
|
fi |
87 |
|
|
88 |
|
CONFIG="${MCORE_CONFIG_PATH}/serial" |
89 |
|
clearconfig |
90 |
|
addconfig "CLIENT_SERIAL=\"${serial}\"" |
91 |
} |
} |