OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | #!/bin/sh /etc/rc.common |
1 | #!/bin/sh /etc/rc.common |
|
2 | # Copyright (C) 2006-2010 OpenWrt.org |
2 | # Copyright (C) 2006-2010 OpenWrt.org |
|
3 | # Copyright (C) 2006 Carlos Sobrinho |
3 | # Copyright (C) 2006 Carlos Sobrinho |
|
Line 4... | Line 4... | |||
4 | |
4 | |
|
5 | START=19 |
5 | START=50 |
|
Line 6... | Line 6... | |||
6 | STOP=50 |
6 | STOP=50 |
|
7 | |
7 | |
|
8 | USE_PROCD=1 |
8 | USE_PROCD=1 |
|
Line 27... | Line 27... | |||
27 | done |
27 | done |
|
28 | } |
28 | } |
|
Line 29... | Line 29... | |||
29 | |
29 | |
|
30 | validate_section_dropbear() |
30 | validate_section_dropbear() |
|
31 | { |
31 | { |
|
32 | uci_load_validate dropbear dropbear "$1" "$2" \ |
32 | uci_validate_section dropbear dropbear "${1}" \ |
|
33 | 'PasswordAuth:bool:1' \ |
33 | 'PasswordAuth:bool:1' \ |
|
34 | 'enable:bool:1' \ |
34 | 'enable:bool:1' \ |
|
35 | 'Interface:string' \ |
35 | 'Interface:string' \ |
|
36 | 'GatewayPorts:bool:0' \ |
36 | 'GatewayPorts:bool:0' \ |
|
Line 46... | Line 46... | |||
46 | 'mdns:bool:1' |
46 | 'mdns:bool:1' |
|
47 | } |
47 | } |
|
Line 48... | Line 48... | |||
48 | |
48 | |
|
49 | dropbear_instance() |
49 | dropbear_instance() |
|
- | 50 | { |
||
- | 51 | local PasswordAuth enable Interface GatewayPorts \ |
||
- | 52 | RootPasswordAuth RootLogin rsakeyfile \ |
||
50 | { |
53 | BannerFile Port SSHKeepAlive IdleTimeout \ |
|
Line 51... | Line 54... | |||
51 | local ipaddrs |
54 | MaxAuthTries RecvWindowSize mdns ipaddrs |
|
52 | |
55 | |
|
53 | [ "$2" = 0 ] || { |
56 | validate_section_dropbear "${1}" || { |
|
54 | echo "validation failed" |
57 | echo "validation failed" |
|
Line 55... | Line 58... | |||
55 | return 1 |
58 | return 1 |
|
56 | } |
- | ||
57 | |
- | ||
58 | [ -n "${Interface}" ] && { |
59 | } |
|
59 | [ -n "${BOOT}" ] && return 0 |
60 | |
|
60 | |
61 | [ -n "${Interface}" ] && { |
|
61 | network_get_ipaddrs_all ipaddrs "${Interface}" || { |
62 | network_get_ipaddrs_all ipaddrs "${Interface}" || { |
|
62 | echo "interface ${Interface} has no physdev or physdev has no suitable ip" |
63 | echo "interface ${Interface} has no physdev or physdev has no suitable ip" |
|
Line 116... | Line 117... | |||
116 | config_get enable "$1" enable 1 |
117 | config_get enable "$1" enable 1 |
|
Line 117... | Line 118... | |||
117 | |
118 | |
|
118 | [ "${enable}" = "1" ] && interfaces=" ${interface} ${interfaces}" |
119 | [ "${enable}" = "1" ] && interfaces=" ${interface} ${interfaces}" |
|
Line 119... | Line -... | |||
119 | } |
- | ||
120 | |
- | ||
121 | boot() |
- | ||
122 | { |
- | ||
123 | BOOT=1 |
- | ||
124 | start "$@" |
- | ||
125 | } |
120 | } |
|
126 | |
121 | |
|
127 | start_service() |
122 | start_service() |
|
Line 128... | Line 123... | |||
128 | { |
123 | { |
|
129 | [ -s /etc/dropbear/dropbear_rsa_host_key ] || keygen |
124 | [ -s /etc/dropbear/dropbear_rsa_host_key ] || keygen |
|
Line 130... | Line 125... | |||
130 | |
125 | |
|
131 | . /lib/functions.sh |
126 | . /lib/functions.sh |
|
132 | . /lib/functions/network.sh |
127 | . /lib/functions/network.sh |
|
Line 133... | Line 128... | |||
133 | |
128 | |
|
134 | config_load "${NAME}" |
129 | config_load "${NAME}" |
|
135 | config_foreach validate_section_dropbear dropbear dropbear_instance |
130 | config_foreach dropbear_instance dropbear |