Project

General

Profile

« Previous | Next » 

Revision faf61f12

Added by Phil Davis almost 12 years ago

Add option to specify client management port for OpenVPN client export use

See forum http://forum.pfsense.org/index.php/topic,63668.0.html and OpenVPN Manager GitHub discussion https://github.com/jochenwierum/openvpn-manager/issues/17
This allows a different client management port to be specified for use by OpenVPN client export when generating a client config for use with OpenVPN manager. Typically a company could have multiple offices with OpenVPN "road-warrior" access. Some users might need to connect to different offices at different times, so they would have multiple OpenVPN client configs installed on their laptop. For this to work with OpenVPN Manager, each client config needs to have a different management channel - only 1 can use the default of "166". The company can chooose a different number in the road-warrior server "client parameters" section at each office. Then the generated client config from each office will have a unique management channel port number.

View differences:

usr/local/www/vpn_openvpn_server.php
187 187
			$pconfig['wins_server2'])
188 188
			$pconfig['wins_server_enable'] = true;
189 189

  
190
		$pconfig['client_mgmt_port'] = $a_server[$id]['client_mgmt_port'];
191
		if ($pconfig['client_mgmt_port'])
192
			$pconfig['client_mgmt_port_enable'] = true;
193

  
190 194
		$pconfig['nbdd_server1'] = $a_server[$id]['nbdd_server1'];
191 195
		if ($pconfig['nbdd_server1'])
192 196
			$pconfig['nbdd_server_enable'] = true;
......
300 304
				$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address");
301 305
	}
302 306

  
307
	if ($pconfig['client_mgmt_port_enable']) {
308
		if ($result = openvpn_validate_port($pconfig['client_mgmt_port'], 'Client management port'))
309
			$input_errors[] = $result;
310
	}
311

  
303 312
	if ($pconfig['maxclients'] && !is_numeric($pconfig['maxclients']))
304 313
		$input_errors[] = gettext("The field 'Concurrent connections' must be numeric.");
305 314

  
......
425 434
				$server['nbdd_server1'] = $pconfig['nbdd_server1'];
426 435
		}
427 436

  
437
		if ($pconfig['client_mgmt_port_enable'])
438
			$server['client_mgmt_port'] = $pconfig['client_mgmt_port'];
439

  
428 440
		if ($_POST['duplicate_cn'] == "yes")
429 441
			$server['duplicate_cn'] = true;
430 442

  
......
607 619
		document.getElementById("wins_server_data").style.display="none";
608 620
}
609 621

  
622
function client_mgmt_port_change() {
623

  
624
	if (document.iform.client_mgmt_port_enable.checked)
625
		document.getElementById("client_mgmt_port_data").style.display="";
626
	else
627
		document.getElementById("client_mgmt_port_data").style.display="none";
628
}
629

  
610 630
function ntp_server_change() {
611 631

  
612 632
	if (document.iform.ntp_server_enable.checked)
......
1635 1655
							</table>
1636 1656
						</td>
1637 1657
					</tr>
1658
					<tr>
1659
						<td width="22%" valign="top" class="vncell"><?=gettext("Client Management Port"); ?></td>
1660
						<td width="78%" class="vtable">
1661
							<table border="0" cellpadding="2" cellspacing="0">
1662
								<tr>
1663
									<td>
1664
										<?php set_checked($pconfig['client_mgmt_port_enable'],$chk); ?>
1665
										<input name="client_mgmt_port_enable" type="checkbox" id="client_mgmt_port_enable" value="yes" <?=$chk;?> onClick="client_mgmt_port_change()">
1666
									</td>
1667
									<td>
1668
										<span class="vexpl">
1669
	                                        <?=gettext("Use a different management port on clients. The default port is 166. Specify a different port if the client machines need to select from multiple OpenVPN links."); ?><br>
1670
										</span>
1671
									</td>
1672
								</tr>
1673
							</table>
1674
							<table border="0" cellpadding="2" cellspacing="0" id="client_mgmt_port_data">
1675
								<tr>
1676
									<td>
1677
										<input name="client_mgmt_port" type="text" class="formfld unknown" id="client_mgmt_port" size="30" value="<?=htmlspecialchars($pconfig['client_mgmt_port']);?>">
1678
									</td>
1679
								</tr>
1680
							</table>
1681
						</td>
1682
					</tr>
1638 1683
				</table>
1639 1684

  
1640 1685
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
......
1751 1796
dns_domain_change();
1752 1797
dns_server_change();
1753 1798
wins_server_change();
1799
client_mgmt_port_change();
1754 1800
ntp_server_change();
1755 1801
netbios_change();
1756 1802
tuntap_change();

Also available in: Unified diff