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
c831f3c6
Commit
c831f3c6
authored
Apr 11, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openvpn: remove pbi remnants and add proper 7z package
PR:
https://forum.opnsense.org/index.php?topic=2273.0
parent
8353aea4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
23 deletions
+9
-23
Makefile
Makefile
+1
-0
openvpn-client-export.inc
src/etc/inc/openvpn-client-export.inc
+8
-23
No files found.
Makefile
View file @
c831f3c6
...
@@ -85,6 +85,7 @@ CORE_DEPENDS?= apinger \
...
@@ -85,6 +85,7 @@ CORE_DEPENDS?= apinger \
openssh-portable
\
openssh-portable
\
openvpn
\
openvpn
\
opnsense-update
\
opnsense-update
\
p7zip
\
pecl-radius
\
pecl-radius
\
pftop
\
pftop
\
phalcon
\
phalcon
\
...
...
src/etc/inc/openvpn-client-export.inc
View file @
c831f3c6
...
@@ -474,21 +474,20 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $veri
...
@@ -474,21 +474,20 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $veri
$client_install_exe
=
"openvpn-install-
{
$current_openvpn_version
}
-I6
{
$current_openvpn_version_rev
}
-x86_64.exe"
;
$client_install_exe
=
"openvpn-install-
{
$current_openvpn_version
}
-I6
{
$current_openvpn_version_rev
}
-x86_64.exe"
;
break
;
break
;
default
:
default
:
$client_install_exe
=
"openvpn-install-
{
$current_openvpn_version
}
-I0
{
$current_openvpn_version_rev
}
-i686.exe"
;
$input_errors
[]
=
gettext
(
"Could not find matching OpenVPN architecture."
);
return
false
;
}
}
$ovpndir
=
"/usr/local/opnsense/contrib/openvpn"
;
$workdir
=
"
{
$ovpndir
}
/client-export"
;
$validconfig
=
openvpn_client_export_validate_config
(
$srvid
,
$usrid
,
$crtid
);
$validconfig
=
openvpn_client_export_validate_config
(
$srvid
,
$usrid
,
$crtid
);
if
(
!
$validconfig
)
{
if
(
!
$validconfig
)
{
$input_errors
[]
=
gettext
(
"Could not validate OpenVPN config."
);
return
false
;
return
false
;
}
}
list
(
$settings
,
$server_cert
,
$server_ca
,
$servercn
,
$user
,
$cert
,
$nokeys
)
=
$validconfig
;
list
(
$settings
,
$server_cert
,
$server_ca
,
$servercn
,
$user
,
$cert
,
$nokeys
)
=
$validconfig
;
// create template directory
// create template directory
$tempdir
=
"/tmp//openvpn-export-"
.
uniqid
();
$tempdir
=
'/tmp/openvpn-export-'
.
uniqid
();
mkdir
(
$tempdir
,
0700
,
true
);
mkdir
(
$tempdir
,
0700
,
true
);
// create config directory
// create config directory
...
@@ -498,7 +497,7 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $veri
...
@@ -498,7 +497,7 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $veri
}
}
// copy the template directory
// copy the template directory
exec
(
"cp -r
{
$workdir
}
/template/*
{
$tempdir
}
"
);
exec
(
"cp -r
/usr/local/opnsense/contrib/openvpn/client-export
/template/*
{
$tempdir
}
"
);
// and put the required installer exe in place
// and put the required installer exe in place
exec
(
"/bin/cp
{
$tempdir
}
/
{
$client_install_exe
}
{
$tempdir
}
/openvpn-install.exe"
);
exec
(
"/bin/cp
{
$tempdir
}
/
{
$client_install_exe
}
{
$tempdir
}
/openvpn-install.exe"
);
if
(
stristr
(
$openvpn_version
,
"x64"
))
{
if
(
stristr
(
$openvpn_version
,
"x64"
))
{
...
@@ -565,11 +564,7 @@ RunProgram="openvpn-postinstall.exe"
...
@@ -565,11 +564,7 @@ RunProgram="openvpn-postinstall.exe"
}
}
file_put_contents
(
"
{
$tempdir
}
/7zipConfig"
,
$procchain
);
file_put_contents
(
"
{
$tempdir
}
/7zipConfig"
,
$procchain
);
if
(
file_exists
(
"/usr/pbi/p7zip-
{
$uname_p
}
/bin/7z"
))
{
exec
(
"/usr/local/bin/7z -y a archive.7z
{
$files
}
"
);
exec
(
"/usr/pbi/p7zip-
{
$uname_p
}
/bin/7z -y a archive.7z
{
$files
}
"
);
}
else
{
exec
(
"/usr/local/libexec/p7zip/7z -y a archive.7z
{
$files
}
"
);
}
// create the final installer
// create the final installer
$outfile
=
"
{
$tempdir
}
-install.exe"
;
$outfile
=
"
{
$tempdir
}
-install.exe"
;
...
@@ -587,8 +582,6 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead
...
@@ -587,8 +582,6 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead
global
$config
;
global
$config
;
$uname_p
=
trim
(
exec
(
"uname -p"
));
$uname_p
=
trim
(
exec
(
"uname -p"
));
$ovpndir
=
"/usr/local/opnsense/contrib/openvpn/"
;
$uniq
=
uniqid
();
$uniq
=
uniqid
();
$tempdir
=
"/tmp/openvpn-export-
{
$uniq
}
"
;
$tempdir
=
"/tmp/openvpn-export-
{
$uniq
}
"
;
$zipfile
=
"/tmp/
{
$uniq
}
-Viscosity.visc.zip"
;
$zipfile
=
"/tmp/
{
$uniq
}
-Viscosity.visc.zip"
;
...
@@ -687,11 +680,7 @@ EOF;
...
@@ -687,11 +680,7 @@ EOF;
}
}
// Zip Viscosity file
// Zip Viscosity file
if
(
file_exists
(
"/usr/pbi/zip-
{
$uname_p
}
/bin/zip"
))
{
exec
(
"cd
{
$tempdir
}
/.. && /usr/pbi/zip-
{
$uname_p
}
/bin/zip -r
{
$zipfile
}
Viscosity.visc"
);
}
else
{
exec
(
"cd
{
$tempdir
}
/.. && /usr/local/bin/zip -r
{
$zipfile
}
Viscosity.visc"
);
exec
(
"cd
{
$tempdir
}
/.. && /usr/local/bin/zip -r
{
$zipfile
}
Viscosity.visc"
);
}
// Remove temporary directory
// Remove temporary directory
exec
(
"rm -rf
{
$tempdir
}
"
);
exec
(
"rm -rf
{
$tempdir
}
"
);
...
@@ -818,11 +807,7 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco
...
@@ -818,11 +807,7 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco
$shkeyfile
=
"
{
$tempdir
}
/
{
$shkeyfile
}
"
;
$shkeyfile
=
"
{
$tempdir
}
/
{
$shkeyfile
}
"
;
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"
))
{
exec
(
"cd
{
$tempdir
}
/.. && /usr/pbi/zip-
{
$uname_p
}
/bin/zip -r /tmp/
{
$prefix
}
-config.zip
{
$prefix
}
"
);
}
else
{
exec
(
"cd
{
$tempdir
}
/.. && /usr/local/bin/zip -r /tmp/
{
$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
}
"
);
...
...
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