Project

General

Profile

« Previous | Next » 

Revision 6e0b68bf

Added by Jim Pingle about 13 years ago

List logged-in IPsec xauth users and provide a mechanism to disconnect them. Implements #1986

View differences:

usr/local/www/diag_ipsec.php
57 57
	}
58 58
}
59 59

  
60

  
61
if ($_GET['act'] == "disconnect") {
62
	if (!empty($_GET['user'])) {
63
		ipsec_disconnect_mobile($_GET['user']);
64
		sleep(1);
65
		$savemsg = gettext("Disconnected user") . " " . $_GET['user'];
66
	}
67
}
68

  
60 69
if (!is_array($config['ipsec']['phase2']))
61 70
    $config['ipsec']['phase2'] = array();
62 71

  
......
64 73

  
65 74
$spd = ipsec_dump_spd();
66 75
$sad = ipsec_dump_sad();
76
$mobile = ipsec_dump_mobile();
67 77

  
68 78
?>
69 79

  
70
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
80
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?php echo $jsevents["body"]["onload"]; ?>">
71 81
<?php include("fbegin.inc"); ?>
72 82
<div id="inputerrors"></div>
73 83
<table width="100%" border="0" cellpadding="0" cellspacing="0">
......
84 94
		</td>
85 95
	</tr>
86 96
	<tr>
87
    	<td>
97
	<td>
88 98
			<div id="mainarea">
89 99
				<table width="100%" border="0" cellpadding="6" cellspacing="0" class="tabcont sortable">
100
					<thead>
90 101
					<tr>
91
						<td nowrap class="listhdrr"><?=gettext("Local IP");?></td>
92
						<td nowrap class="listhdrr"><?=gettext("Remote IP");?></a></td>
93
						<td nowrap class="listhdrr"><?=gettext("Local Network");?></td>
94
						<td nowrap class="listhdrr"><?=gettext("Remote Network");?></a></td>
95
						<td nowrap class="listhdrr"><?=gettext("Description");?></a></td>
96
						<td nowrap class="listhdrr"><?=gettext("Status");?></td>
102
						<th nowrap class="listhdrr"><?php echo gettext("Local IP");?></th>
103
						<th nowrap class="listhdrr"><?php echo gettext("Remote IP");?></a></th>
104
						<th nowrap class="listhdrr"><?php echo gettext("Local Network");?></th>
105
						<th nowrap class="listhdrr"><?php echo gettext("Remote Network");?></a></th>
106
						<th nowrap class="listhdrr"><?php echo gettext("Description");?></a></th>
107
						<th nowrap class="listhdrr"><?php echo gettext("Status");?></th>
97 108
					</tr>
109
					</thead>
110
					<tbody>
98 111
					<?php
99 112
						foreach ($a_phase2 as $ph2ent) {
113
							if ($ph2ent['remoteid']['type'] == "mobile")
114
								continue;
100 115
							ipsec_lookup_phase1($ph2ent,$ph1ent);
101 116
							if (!isset($ph2ent['disabled']) && !isset($ph1ent['disabled'])) {
102 117
								if(ipsec_phase2_status($spd,$sad,$ph1ent,$ph2ent)) {
......
112 127
					?>
113 128
					<tr>
114 129
						<td class="listlr">
115
							<?=htmlspecialchars(ipsec_get_phase1_src($ph1ent));?>
130
							<?php echo htmlspecialchars(ipsec_get_phase1_src($ph1ent));?>
116 131
						</td>
117 132
						<td class="listr">
118
							<?=htmlspecialchars($ph1ent['remote-gateway']);?>
133
							<?php echo htmlspecialchars($ph1ent['remote-gateway']);?>
119 134
						</td>
120 135
						<td class="listr">
121 136
							<?php echo ipsec_idinfo_to_text($ph2ent['localid']); ?>
......
123 138
						<td class="listr">
124 139
							<?php echo ipsec_idinfo_to_text($ph2ent['remoteid']); ?>
125 140
						</td>
126
						<td class="listr"><?=htmlspecialchars($ph2ent['descr']);?></td>
141
						<td class="listr"><?php echo htmlspecialchars($ph2ent['descr']);?></td>
127 142
						<td class="listr">
128 143
							<center>
129
								<img src ="/themes/<?=$g['theme']?>/images/icons/icon_<?=$icon?>.gif" title="<?=$status?>">
144
								<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_<?php echo $icon; ?>.gif" title="<?php echo $status; ?>">
130 145
							</center>
131 146
						</td>
132 147
						<td class="list">
......
155 170
							?>
156 171
							<?php if (($ph2ent['remoteid']['type'] != "mobile") && ($icon != "pass") && ($source != "")): ?>
157 172
							<center>
158
								<a href="diag_ipsec.php?act=connect&remoteid=<?= $ph2ent['remoteid']['address'] ?>&source=<?= $source ?>">
159
								<img src ="/themes/<?=$g['theme']?>/images/icons/icon_service_start.gif" alt="Connect VPN" title="Connect VPN" border="0">
173
								<a href="diag_ipsec.php?act=connect&remoteid=<?php echo $ph2ent['remoteid']['address']; ?>&source=<?php echo $source; ?>">
174
								<img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_service_start.gif" alt="Connect VPN" title="Connect VPN" border="0">
160 175
								</a>
161 176
							</center>
162 177
							<?php else: ?>
......
168 183
							}
169 184
						}
170 185
					?>
186
					</tbody>
187
				</table>
188
				<?php if (isset($config['ipsec']['client']['enable'])): ?>
189
				<table width="100%" border="0" cellpadding="6" cellspacing="0" class="tabcont sortable">
190
					<thead>
191
					<tr>
192
						<th nowrap class="listhdrr"><?php echo gettext("Mobile User");?></th>
193
						<th nowrap class="listhdrr"><?php echo gettext("Login Time");?></a></th>
194
						<th nowrap class="listhdrr"><?php echo gettext("Local");?></th>
195
						<th nowrap class="listhdrr"><?php echo gettext("Remote");?></a></th>
196
						<th nowrap class="list">&nbsp;</th>
197
					</tr>
198
					</thead>
199
					<tbody>
200
					<?php	foreach ($mobile as $muser): ?>
201
					<tr>
202
						<td class="listlr"><?php echo $muser['username']; ?></td>
203
						<td class="listr" align="center"><?php echo $muser['logintime']; ?></td>
204
						<td class="listr" align="center"><?php echo $muser['local']; ?></td>
205
						<td class="listr" align="center"><?php echo $muser['remote']; ?></td>
206
						<td class="list" align="center"><a href="diag_ipsec.php?act=disconnect&user=<?php echo $muser['username']; ?>"><img src='/themes/<?php echo $g['theme']; ?>/images/icons/icon_x.gif' height='17' width='17' border='0'/></a></td>
207
					</tr>
208
					<?php	endforeach; ?>
209
					</tbody>
171 210
				</table>
211
				<?php endif; ?>
172 212
			</div>
173 213
		</td>
174 214
	</tr>
......
178 218

  
179 219
<span class="vexpl">
180 220
	<span class="red">
181
		<strong><?=gettext("Note:");?><br /></strong>
221
		<strong><?php echo gettext("Note:");?><br /></strong>
182 222
	</span>
183
	<?=gettext("You can configure your IPsec");?> 
223
	<?php echo gettext("You can configure IPsec");?>
184 224
	<a href="vpn_ipsec.php">here</a>.
185 225
</span>
186 226

  

Also available in: Unified diff