Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
785b03f5
Commit
785b03f5
authored
Apr 24, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: imported software needs to be ported ;)
parent
f9cf7910
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
26 deletions
+21
-26
openvpn-client-export.inc
src/pkg/openvpn-client-export.inc
+16
-18
vpn_openvpn_export_shared.php
src/www/vpn_openvpn_export_shared.php
+5
-8
No files found.
src/pkg/openvpn-client-export.inc
View file @
785b03f5
...
@@ -363,7 +363,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys
...
@@ -363,7 +363,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys
switch
(
$expformat
)
{
switch
(
$expformat
)
{
case
"zip"
:
case
"zip"
:
// create template directory
// create template directory
$tempdir
=
"
{
$g
[
'tmp_path'
]
}
/
{
$prefix
}
"
;
$tempdir
=
"
/tmp
/
{
$prefix
}
"
;
@
mkdir
(
$tempdir
,
0700
,
true
);
@
mkdir
(
$tempdir
,
0700
,
true
);
file_put_contents
(
"
{
$tempdir
}
/
{
$prefix
}
.ovpn"
,
$conf
);
file_put_contents
(
"
{
$tempdir
}
/
{
$prefix
}
.ovpn"
,
$conf
);
...
@@ -391,12 +391,12 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys
...
@@ -391,12 +391,12 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys
}
}
$command
=
"cd "
.
escapeshellarg
(
"
{
$tempdir
}
/.."
)
$command
=
"cd "
.
escapeshellarg
(
"
{
$tempdir
}
/.."
)
.
" && /usr/local/bin/zip -r "
.
" && /usr/local/bin/zip -r "
.
escapeshellarg
(
"
{
$g
[
'tmp_path'
]
}
/
{
$prefix
}
-config.zip"
)
.
escapeshellarg
(
"
/tmp
/
{
$prefix
}
-config.zip"
)
.
" "
.
escapeshellarg
(
$prefix
);
.
" "
.
escapeshellarg
(
$prefix
);
exec
(
$command
);
exec
(
$command
);
// Remove temporary directory
// Remove temporary directory
exec
(
"rm -rf "
.
escapeshellarg
(
$tempdir
));
exec
(
"rm -rf "
.
escapeshellarg
(
$tempdir
));
return
"
{
$g
[
'tmp_path'
]
}
/
{
$prefix
}
-config.zip"
;
return
"
/tmp
/
{
$prefix
}
-config.zip"
;
break
;
break
;
case
"inline"
:
case
"inline"
:
case
"inlinedroid"
:
case
"inlinedroid"
:
...
@@ -422,7 +422,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys
...
@@ -422,7 +422,7 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys
case
"yealink_t38g"
:
case
"yealink_t38g"
:
case
"yealink_t38g2"
:
case
"yealink_t38g2"
:
// create template directory
// create template directory
$tempdir
=
"
{
$g
[
'tmp_path'
]
}
/
{
$prefix
}
"
;
$tempdir
=
"
/tmp
/
{
$prefix
}
"
;
$keydir
=
"
{
$tempdir
}
/keys"
;
$keydir
=
"
{
$tempdir
}
/keys"
;
mkdir
(
$tempdir
,
0700
,
true
);
mkdir
(
$tempdir
,
0700
,
true
);
mkdir
(
$keydir
,
0700
,
true
);
mkdir
(
$keydir
,
0700
,
true
);
...
@@ -443,14 +443,13 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys
...
@@ -443,14 +443,13 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys
$keyfile
=
"
{
$keydir
}
/client1.key"
;
$keyfile
=
"
{
$keydir
}
/client1.key"
;
file_put_contents
(
$keyfile
,
base64_decode
(
$cert
[
'prv'
]));
file_put_contents
(
$keyfile
,
base64_decode
(
$cert
[
'prv'
]));
}
}
exec
(
"tar -C
{
$tempdir
}
-cf
{
$g
[
'tmp_path'
]
}
/client.tar ./keys ./vpn.cnf"
);
exec
(
"tar -C
{
$tempdir
}
-cf
/tmp
/client.tar ./keys ./vpn.cnf"
);
// Remove temporary directory
// Remove temporary directory
exec
(
"rm -rf
{
$tempdir
}
"
);
exec
(
"rm -rf
{
$tempdir
}
"
);
return
$g
[
'tmp_path'
]
.
"/client.tar"
;
return
'/tmp/client.tar'
;
break
;
case
"snom"
:
case
"snom"
:
// create template directory
// create template directory
$tempdir
=
"
{
$g
[
'tmp_path'
]
}
/
{
$prefix
}
"
;
$tempdir
=
"
/tmp
/
{
$prefix
}
"
;
mkdir
(
$tempdir
,
0700
,
true
);
mkdir
(
$tempdir
,
0700
,
true
);
file_put_contents
(
"
{
$tempdir
}
/vpn.cnf"
,
$conf
);
file_put_contents
(
"
{
$tempdir
}
/vpn.cnf"
,
$conf
);
...
@@ -469,11 +468,10 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys
...
@@ -469,11 +468,10 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $verifys
$keyfile
=
"
{
$tempdir
}
/phone1.key"
;
$keyfile
=
"
{
$tempdir
}
/phone1.key"
;
file_put_contents
(
$keyfile
,
base64_decode
(
$cert
[
'prv'
]));
file_put_contents
(
$keyfile
,
base64_decode
(
$cert
[
'prv'
]));
}
}
exec
(
"cd
{
$tempdir
}
/ && tar -cf
{
$g
[
'tmp_path'
]
}
/vpnclient.tar *"
);
exec
(
"cd
{
$tempdir
}
/ && tar -cf
/tmp
/vpnclient.tar *"
);
// Remove temporary directory
// Remove temporary directory
exec
(
"rm -rf
{
$tempdir
}
"
);
exec
(
"rm -rf
{
$tempdir
}
"
);
return
$g
[
'tmp_path'
]
.
"/vpnclient.tar"
;
return
'/tmp/vpnclient.tar'
;
break
;
default
:
default
:
return
$conf
;
return
$conf
;
}
}
...
@@ -513,7 +511,7 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $veri
...
@@ -513,7 +511,7 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $veri
}
}
// create template directory
// create template directory
$tempdir
=
$g
[
'tmp_path'
]
.
"
/openvpn-export-"
.
uniqid
();
$tempdir
=
"/tmp/
/openvpn-export-"
.
uniqid
();
mkdir
(
$tempdir
,
0700
,
true
);
mkdir
(
$tempdir
,
0700
,
true
);
// create config directory
// create config directory
...
@@ -593,7 +591,7 @@ RunProgram="openvpn-postinstall.exe"
...
@@ -593,7 +591,7 @@ RunProgram="openvpn-postinstall.exe"
// create the final installer
// create the final installer
$outfile
=
"
{
$tempdir
}
-install.exe"
;
$outfile
=
"
{
$tempdir
}
-install.exe"
;
chdir
(
$g
[
'tmp_path'
]
);
chdir
(
'/tmp'
);
exec
(
"/bin/cat
{
$tempdir
}
/7zS.sfx
{
$tempdir
}
/7zipConfig
{
$tempdir
}
/archive.7z >
{
$outfile
}
"
);
exec
(
"/bin/cat
{
$tempdir
}
/7zS.sfx
{
$tempdir
}
/7zipConfig
{
$tempdir
}
/archive.7z >
{
$outfile
}
"
);
// cleanup
// cleanup
...
@@ -611,8 +609,8 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead
...
@@ -611,8 +609,8 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead
openvpn_client_export_install
();
openvpn_client_export_install
();
$uniq
=
uniqid
();
$uniq
=
uniqid
();
$tempdir
=
$g
[
'tmp_path'
]
.
"/openvpn-export-"
.
$uniq
;
$tempdir
=
"/tmp/openvpn-export-
{
$uniq
}
"
;
$zipfile
=
$g
[
'tmp_path'
]
.
"
/
{
$uniq
}
-Viscosity.visc.zip"
;
$zipfile
=
"/tmp
/
{
$uniq
}
-Viscosity.visc.zip"
;
$validconfig
=
openvpn_client_export_validate_config
(
$srvid
,
$usrid
,
$crtid
);
$validconfig
=
openvpn_client_export_validate_config
(
$srvid
,
$usrid
,
$crtid
);
if
(
$validconfig
)
{
if
(
$validconfig
)
{
...
@@ -821,7 +819,7 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco
...
@@ -821,7 +819,7 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco
if
(
$zipconf
==
true
)
{
if
(
$zipconf
==
true
)
{
// create template directory
// create template directory
$tempdir
=
"
{
$g
[
'tmp_path'
]
}
/
{
$prefix
}
"
;
$tempdir
=
"
/tmp
/
{
$prefix
}
"
;
mkdir
(
$tempdir
,
0700
,
true
);
mkdir
(
$tempdir
,
0700
,
true
);
file_put_contents
(
"
{
$tempdir
}
/
{
$prefix
}
.ovpn"
,
$conf
);
file_put_contents
(
"
{
$tempdir
}
/
{
$prefix
}
.ovpn"
,
$conf
);
...
@@ -830,9 +828,9 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco
...
@@ -830,9 +828,9 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco
file_put_contents
(
"
{
$shkeyfile
}
"
,
base64_decode
(
$settings
[
'shared_key'
]));
file_put_contents
(
"
{
$shkeyfile
}
"
,
base64_decode
(
$settings
[
'shared_key'
]));
if
(
file_exists
(
"/usr/pbi/zip-
{
$uname_p
}
/bin/zip"
))
if
(
file_exists
(
"/usr/pbi/zip-
{
$uname_p
}
/bin/zip"
))
exec
(
"cd
{
$tempdir
}
/.. && /usr/pbi/zip-
{
$uname_p
}
/bin/zip -r
{
$g
[
'tmp_path'
]
}
/
{
$prefix
}
-config.zip
{
$prefix
}
"
);
exec
(
"cd
{
$tempdir
}
/.. && /usr/pbi/zip-
{
$uname_p
}
/bin/zip -r
/tmp
/
{
$prefix
}
-config.zip
{
$prefix
}
"
);
else
else
exec
(
"cd
{
$tempdir
}
/.. && /usr/local/bin/zip -r
{
$g
[
'tmp_path'
]
}
/
{
$prefix
}
-config.zip
{
$prefix
}
"
);
exec
(
"cd
{
$tempdir
}
/.. && /usr/local/bin/zip -r
/tmp
/
{
$prefix
}
-config.zip
{
$prefix
}
"
);
// Remove temporary directory
// Remove temporary directory
exec
(
"rm -rf
{
$tempdir
}
"
);
exec
(
"rm -rf
{
$tempdir
}
"
);
...
...
src/www/vpn_openvpn_export_shared.php
View file @
785b03f5
<?php
<?php
/*
vpn_openvpn_export_shared.php
/*
Copyright (C) 2008 Shrew Soft Inc.
Copyright (C) 2008 Shrew Soft Inc.
Copyright (C) 2010 Ermal Luçi
Copyright (C) 2010 Ermal Luçi
All rights reserved.
All rights reserved.
...
@@ -26,13 +25,11 @@
...
@@ -26,13 +25,11 @@
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
POSSIBILITY OF SUCH DAMAGE.
DISABLE_PHP_LINT_CHECKING
*/
*/
require_once
(
"globals.inc"
);
require_once
(
"globals.inc"
);
require_once
(
"guiconfig.inc"
);
require_once
(
"guiconfig.inc"
);
require
(
"openvpn-client-export.inc"
);
require
_once
(
"openvpn-client-export.inc"
);
$pgtitle
=
array
(
"OpenVPN"
,
"Client Export Utility"
);
$pgtitle
=
array
(
"OpenVPN"
,
"Client Export Utility"
);
...
@@ -125,7 +122,7 @@ if(($act == "skconf") || ($act == "skzipconf")) {
...
@@ -125,7 +122,7 @@ if(($act == "skconf") || ($act == "skzipconf")) {
if
(
!
$error
)
{
if
(
!
$error
)
{
if
(
$zipconf
)
{
if
(
$zipconf
)
{
$exp_name
=
urlencode
(
$exp_data
);
$exp_name
=
urlencode
(
$exp_data
);
$exp_size
=
filesize
(
"
{
$g
[
'tmp_path'
]
}
/
{
$exp_data
}
"
);
$exp_size
=
filesize
(
"
/tmp
/
{
$exp_data
}
"
);
}
else
{
}
else
{
$exp_name
=
urlencode
(
$exp_name
.
"-config.ovpn"
);
$exp_name
=
urlencode
(
$exp_name
.
"-config.ovpn"
);
$exp_size
=
strlen
(
$exp_data
);
$exp_size
=
strlen
(
$exp_data
);
...
@@ -137,11 +134,11 @@ if(($act == "skconf") || ($act == "skzipconf")) {
...
@@ -137,11 +134,11 @@ if(($act == "skconf") || ($act == "skzipconf")) {
header
(
"Content-Disposition: attachment; filename=
{
$exp_name
}
"
);
header
(
"Content-Disposition: attachment; filename=
{
$exp_name
}
"
);
header
(
"Content-Length:
$exp_size
"
);
header
(
"Content-Length:
$exp_size
"
);
if
(
$zipconf
)
if
(
$zipconf
)
readfile
(
"
{
$g
[
'tmp_path'
]
}
/
{
$exp_data
}
"
);
readfile
(
"
/tmp
/
{
$exp_data
}
"
);
else
else
echo
$exp_data
;
echo
$exp_data
;
@
unlink
(
"
{
$g
[
'tmp_path'
]
}
/
{
$exp_data
}
"
);
@
unlink
(
"
/tmp
/
{
$exp_data
}
"
);
exit
;
exit
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment