File tree Expand file tree Collapse file tree 4 files changed +43
-6
lines changed Expand file tree Collapse file tree 4 files changed +43
-6
lines changed Original file line number Diff line number Diff line change @@ -1188,9 +1188,9 @@ Default value: `false`
11881188
11891189##### <a name =" -openvpn--server--local " ></a >` local `
11901190
1191- Data type: ` String `
1191+ Data type: ` Variant[ String, Array[String]] `
11921192
1193- Interface for openvpn to bind to.
1193+ Interface(s) for openvpn to bind to. To use the array form you need OpenVPN 2.7 or newer .
11941194
11951195Default value: ` $facts['networking']['ip'] `
11961196
Original file line number Diff line number Diff line change 1717# @param group User to drop privileges to after startup
1818# @param ipp Persist ifconfig information to a file to retain client IP addresses between sessions
1919# @param duplicate_cn Allow multiple connections on one cn
20- # @param local Interface for openvpn to bind to.
20+ # @param local Interface(s) for openvpn to bind to. To use the array form you need OpenVPN 2.7 or newer .
2121# @param logfile Logfile for this openvpn server
2222# @param manage_logfile_directory Manage the directory that the logfile is located in
2323# @param logdirectory_user The owner user of the logfile directory
163163 Optional[String] $group = undef ,
164164 Boolean $ipp = false ,
165165 Boolean $duplicate_cn = false ,
166- String $local = $facts[' networking' ][' ip' ],
166+ Variant[ String, Array[String]] $local = $facts[' networking' ][' ip' ],
167167 Variant[Boolean, String] $logfile = false ,
168168 Boolean $manage_logfile_directory = false ,
169169 String[1] $logdirectory_user = ' nobody' ,
Original file line number Diff line number Diff line change 201201 it { is_expected . to contain_file ( "#{ server_directory } /test_server.conf" ) . with_content ( %r{^rcvbuf\s +393215$} ) }
202202 end
203203
204+ context 'with empty local' do
205+ let ( :params ) do
206+ {
207+ 'country' => 'CO' ,
208+ 'province' => 'ST' ,
209+ 'city' => 'Some City' ,
210+ 'organization' => 'example.org' ,
211+ 212+ 'local' => '' ,
213+ }
214+ end
215+
216+ it { is_expected . to contain_file ( "#{ server_directory } /test_server.conf" ) .
217+ without_content ( %r{^local} ) }
218+ end
219+
220+ context 'with array local' do
221+ let ( :params ) do
222+ {
223+ 'country' => 'CO' ,
224+ 'province' => 'ST' ,
225+ 'city' => 'Some City' ,
226+ 'organization' => 'example.org' ,
227+ 228+ 'local' => [ '1.2.3.4 1194 udp4' , '1111::2:3:4 1194 udp6' ] ,
229+ }
230+ end
231+
232+ it { is_expected . to contain_file ( "#{ server_directory } /test_server.conf" ) .
233+ with_content ( %r{^local\s +1\. 2\. 3\. 4 1194 udp4} ) .
234+ with_content ( %r{^local\s +1111::2:3:4 1194 udp6} ) }
235+ end
236+
237+
204238 %w[ udp tcp udp4 tcp4 udp6 tcp6 ] . each do |proto |
205239 context "with proto=#{ proto } " do
206240 let ( :params ) do
Original file line number Diff line number Diff line change @@ -88,8 +88,11 @@ status <%= @status_log %>
8888status-version <%= @status_version %>
8989<% end -%>
9090dev <%= @dev %>
91- <% if @local != '' -%>
92- local <%= @local %>
91+ <% @local = [@local] unless @local.kind_of?(Array) -%>
92+ <% @local.each do |item| -%>
93+ <% if item != '' -%>
94+ local <%= item %>
95+ <% end -%>
9396<% end -%>
9497<% if @ipp -%>
9598ifconfig-pool-persist <%= @name %> /vpn-ipp.txt
You can’t perform that action at this time.
0 commit comments