1 |
5b4ee05e
|
Ermal
|
<?php
|
2 |
|
|
/*
|
3 |
ac24dc24
|
Renato Botelho
|
* openvpn.attributes.php
|
4 |
|
|
*
|
5 |
|
|
* part of pfSense (https://www.pfsense.org)
|
6 |
38809d47
|
Renato Botelho do Couto
|
* Copyright (c) 2011-2013 BSD Perimeter
|
7 |
|
|
* Copyright (c) 2013-2016 Electric Sheep Fencing
|
8 |
402c98a2
|
Reid Linnemann
|
* Copyright (c) 2014-2023 Rubicon Communications, LLC (Netgate)
|
9 |
ac24dc24
|
Renato Botelho
|
* All rights reserved.
|
10 |
|
|
*
|
11 |
b12ea3fb
|
Renato Botelho
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
12 |
|
|
* you may not use this file except in compliance with the License.
|
13 |
|
|
* You may obtain a copy of the License at
|
14 |
ac24dc24
|
Renato Botelho
|
*
|
15 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
16 |
ac24dc24
|
Renato Botelho
|
*
|
17 |
b12ea3fb
|
Renato Botelho
|
* Unless required by applicable law or agreed to in writing, software
|
18 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
19 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
20 |
|
|
* See the License for the specific language governing permissions and
|
21 |
|
|
* limitations under the License.
|
22 |
ac24dc24
|
Renato Botelho
|
*/
|
23 |
09221bc3
|
Renato Botelho
|
|
24 |
4537e922
|
Viktor G
|
global $attributes, $username, $dev, $untrusted_port;
|
25 |
5b4ee05e
|
Ermal
|
|
26 |
ae472dc1
|
Shawn Bruce
|
if (empty($dev)) {
|
27 |
|
|
$dev = "openvpn";
|
28 |
b37a2e8c
|
Phil Davis
|
}
|
29 |
5b4ee05e
|
Ermal
|
|
30 |
4537e922
|
Viktor G
|
$rules = parse_cisco_acl($attributes, $dev);
|
31 |
a96a7151
|
Viktor G
|
$filename = "{$g['tmp_path']}/ovpn_{$dev}_{$username}_{$untrusted_port}.rules";
|
32 |
5b4ee05e
|
Ermal
|
if (!empty($rules)) {
|
33 |
a2e92e18
|
jim-p
|
@file_put_contents($filename, $rules);
|
34 |
a96a7151
|
Viktor G
|
} else {
|
35 |
|
|
unlink_if_exists($filename);
|
36 |
5b4ee05e
|
Ermal
|
}
|
37 |
|
|
|
38 |
|
|
?>
|