@@ -116,70 +116,27 @@ m1 = Map("openvpn", translate("OpenVPN Server"))
116
116
s1 = m1 :section (NamedSection , " openvpn_server" , " openvpn" )
117
117
118
118
o = s1 :option (Value , " port" , translate (" Server port" ))
119
- o .default = 1194
120
119
121
120
o = s1 :option (ListValue , " proto" , translate (" Protocol" ))
122
121
o :value (" tcp" , " TCP" )
123
122
o :value (" udp" , " UDP" )
124
- o .default = " udp"
125
123
126
124
o = s1 :option (Value ," server" ,translate (" Addresses range" ))
127
- o .default = " 10.8.0.0 255.255.255.0"
128
125
129
126
o = s1 :option (Flag , " enabled" , translate (" Enabled" ))
130
- o .default = true
131
127
132
128
o = s1 :option (DynamicList , " push" , translate (" Push options to peer" ))
133
- o .default = {" redirect-gateway" , " dhcp-option DNS 10.8.0.1" }
134
129
135
130
o = s1 :option (Flag , " client_to_client" , translate (" Allow client-to-client traffic" ))
136
- o .default = true
137
131
138
- o = s1 :option (ListValue , " verb" , translate (" Set output verbosity " ))
132
+ o = s1 :option (ListValue , " verb" , translate (" Set log level " ))
139
133
o :value (" 0" , " No log" )
140
134
o :value (" 3" , " Normal log" )
141
135
o :value (" 5" , " Dump traffic" )
142
136
o :value (" 11" , " Debug" )
143
137
144
- local params = {
145
- {" dev" , " tun" , translate (" Type of used device" )},
146
- {" ca" , " /etc/openvpn/ca.crt" , translate (" Certificate authority" )},
147
- {" cert" , " /etc/openvpn/server.crt" , translate (" Local certificate" )},
148
- {" key" , " /etc/openvpn/server.key" , translate (" Local private key" )},
149
- {" dh" , " /etc/openvpn/dh1024.pem" , translate (" Diffie Hellman parameters" )},
150
- {" ifconfig_pool_persist" , " /tmp/ipp.txt" , translate (" Persist/unpersist ifconfig-pool" )},
151
- {" remote_cert_tls" , " client" , translate (" Require explicit key usage on certificate" )},
152
- {" keepalive" , " 10 120" , translate (" Keepalive" )},
153
- {" tls_auth" , " /etc/openvpn/ta.key 0" , translate (" Additional authentication over TLS" )},
154
- {" cipher" , " BF-CBC" , translate (" Encryption cipher for packets" )},
155
- {" compress" , " lzo" , translate (" Copmression" )},
156
- {" persist_key" , " 1" , translate (" Don't re-read key on restart" )},
157
- {" persist_tun" , " 1" , translate (" Keep tun/tap device open on restart" )},
158
- {" status" , " /tmp/openvpn-status.log" , translate (" Write status to file every n seconds" )},
159
- {" script_security" , " 2" , translate (" Policy level over usage of external programs an)d scripts" )},
160
- {" auth_user_pass_verify" , " /usr/bin/ovpnauth.sh via-file" , translate (" Script used to authenticate users" )},
161
- {" username_as_common_name" , " 1" , translate (" Use username as common name" )}
162
- }
163
-
164
- for _ , option in ipairs (params ) do
165
- local o = s1 :option (HiddenValue , option [1 ], option [3 ])
166
- o .default = option [2 ]
167
- end
168
-
169
138
function m1 .on_after_commit (self )
170
139
sys .call (" /etc/init.d/openvpn reload" )
171
140
end
172
141
173
- function m1 .on_save (self )
174
- local section = self .uci :section (" openvpn" , " openvpn" , " openvpn_server" )
175
- self .uci :delete (" openvpn" , section , " user" )
176
- self .uci :delete (" openvpn" , section , " group" )
177
-
178
- local section = self .uci :section (" network" , " interface" , " ovpn" )
179
- self .uci :set (" network" , section , " auto" , " 1" )
180
- self .uci :set (" network" , section , " ifname" , " tun0" )
181
- self .uci :set (" network" , section , " proto" , " none" )
182
- self .uci :set (" network" , section , " auto" , " 1" )
183
- end
184
-
185
142
return m ,m1
0 commit comments