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
6f19276d
Commit
6f19276d
authored
Mar 21, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vpn: kill config dirs consistently
parent
fc381754
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
vpn.inc
src/etc/inc/plugins.inc.d/vpn.inc
+13
-13
No files found.
src/etc/inc/plugins.inc.d/vpn.inc
View file @
6f19276d
...
@@ -35,7 +35,7 @@ function vpn_configure()
...
@@ -35,7 +35,7 @@ function vpn_configure()
return
array
(
return
array
(
'vpn_pptpd_configure'
,
'vpn_pptpd_configure'
,
'vpn_pppoes_configure'
,
'vpn_pppoes_configure'
,
'vpn_l2tp_configure'
'vpn_l2tp_configure'
,
);
);
}
}
...
@@ -111,6 +111,7 @@ function vpn_pptpd_configure()
...
@@ -111,6 +111,7 @@ function vpn_pptpd_configure()
$pptpdcfg
=
$config
[
'pptpd'
];
$pptpdcfg
=
$config
[
'pptpd'
];
killbypid
(
'/var/run/pptp-vpn.pid'
,
'TERM'
,
true
);
killbypid
(
'/var/run/pptp-vpn.pid'
,
'TERM'
,
true
);
mwexec
(
'rm -rf /var/etc/pptp-vpn'
);
if
(
!
isset
(
$pptpdcfg
[
'mode'
])
||
$pptpdcfg
[
'mode'
]
==
'off'
)
{
if
(
!
isset
(
$pptpdcfg
[
'mode'
])
||
$pptpdcfg
[
'mode'
]
==
'off'
)
{
return
0
;
return
0
;
...
@@ -125,7 +126,6 @@ function vpn_pptpd_configure()
...
@@ -125,7 +126,6 @@ function vpn_pptpd_configure()
return
;
return
;
}
}
mwexec
(
'rm -rf /var/etc/pptp-vpn'
);
mkdir
(
'/var/etc/pptp-vpn'
);
mkdir
(
'/var/etc/pptp-vpn'
);
switch
(
$pptpdcfg
[
'mode'
])
{
switch
(
$pptpdcfg
[
'mode'
])
{
...
@@ -331,6 +331,7 @@ function vpn_pppoe_configure(&$pppoecfg)
...
@@ -331,6 +331,7 @@ function vpn_pppoe_configure(&$pppoecfg)
$syscfg
=
$config
[
'system'
];
$syscfg
=
$config
[
'system'
];
killbypid
(
"/var/run/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn.pid"
,
'TERM'
,
true
);
killbypid
(
"/var/run/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn.pid"
,
'TERM'
,
true
);
mwexec
(
"rm -rf /var/etc/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn"
);
if
(
!
isset
(
$pppoecfg
[
'mode'
])
||
$pppoecfg
[
'mode'
]
==
'off'
)
{
if
(
!
isset
(
$pppoecfg
[
'mode'
])
||
$pppoecfg
[
'mode'
]
==
'off'
)
{
return
0
;
return
0
;
...
@@ -340,12 +341,10 @@ function vpn_pppoe_configure(&$pppoecfg)
...
@@ -340,12 +341,10 @@ function vpn_pppoe_configure(&$pppoecfg)
echo
gettext
(
"Configuring PPPoE VPN service..."
);
echo
gettext
(
"Configuring PPPoE VPN service..."
);
}
}
switch
(
$pppoecfg
[
'mode'
])
{
mkdir
(
"/var/etc/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn"
);
switch
(
$pppoecfg
[
'mode'
])
{
case
'server'
:
case
'server'
:
/* create directory if it does not exist */
@
mkdir
(
"/var/etc/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn"
);
$pppoe_interface
=
get_real_interface
(
$pppoecfg
[
'interface'
]);
$pppoe_interface
=
get_real_interface
(
$pppoecfg
[
'interface'
]);
if
(
$pppoecfg
[
'paporchap'
]
==
"chap"
)
{
if
(
$pppoecfg
[
'paporchap'
]
==
"chap"
)
{
...
@@ -354,7 +353,7 @@ function vpn_pppoe_configure(&$pppoecfg)
...
@@ -354,7 +353,7 @@ function vpn_pppoe_configure(&$pppoecfg)
$paporchap
=
"set link enable pap"
;
$paporchap
=
"set link enable pap"
;
}
}
/* write mpd.conf */
/* write mpd.conf */
$fd
=
fopen
(
"/var/etc/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn/mpd.conf"
,
"w"
);
$fd
=
fopen
(
"/var/etc/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn/mpd.conf"
,
"w"
);
if
(
!
$fd
)
{
if
(
!
$fd
)
{
printf
(
gettext
(
"Error: cannot open mpd.conf in vpn_pppoe_configure()."
)
.
"
\n
"
);
printf
(
gettext
(
"Error: cannot open mpd.conf in vpn_pppoe_configure()."
)
.
"
\n
"
);
...
@@ -468,7 +467,7 @@ EOD;
...
@@ -468,7 +467,7 @@ EOD;
fclose
(
$fd
);
fclose
(
$fd
);
unset
(
$mpdconf
);
unset
(
$mpdconf
);
/* write mpd.links */
/* write mpd.links */
$fd
=
fopen
(
"/var/etc/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn/mpd.links"
,
"w"
);
$fd
=
fopen
(
"/var/etc/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn/mpd.links"
,
"w"
);
if
(
!
$fd
)
{
if
(
!
$fd
)
{
printf
(
gettext
(
"Error: cannot open mpd.links in vpn_pppoe_configure()."
)
.
"
\n
"
);
printf
(
gettext
(
"Error: cannot open mpd.links in vpn_pppoe_configure()."
)
.
"
\n
"
);
...
@@ -495,7 +494,7 @@ EOD;
...
@@ -495,7 +494,7 @@ EOD;
unset
(
$mpdlinks
);
unset
(
$mpdlinks
);
if
(
$pppoecfg
[
'username'
])
{
if
(
$pppoecfg
[
'username'
])
{
/* write mpd.secret */
/* write mpd.secret */
$fd
=
fopen
(
"/var/etc/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn/mpd.secret"
,
"w"
);
$fd
=
fopen
(
"/var/etc/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn/mpd.secret"
,
"w"
);
if
(
!
$fd
)
{
if
(
!
$fd
)
{
printf
(
gettext
(
"Error: cannot open mpd.secret in vpn_pppoe_configure()."
)
.
"
\n
"
);
printf
(
gettext
(
"Error: cannot open mpd.secret in vpn_pppoe_configure()."
)
.
"
\n
"
);
...
@@ -537,6 +536,7 @@ function vpn_l2tp_configure()
...
@@ -537,6 +536,7 @@ function vpn_l2tp_configure()
global
$config
;
global
$config
;
killbypid
(
'/var/run/l2tp-vpn.pid'
,
'TERM'
,
true
);
killbypid
(
'/var/run/l2tp-vpn.pid'
,
'TERM'
,
true
);
mwexec
(
'rm -rf /var/etc/l2tp-vpn'
);
$syscfg
=
$config
[
'system'
];
$syscfg
=
$config
[
'system'
];
if
(
isset
(
$config
[
'l2tp'
]))
{
if
(
isset
(
$config
[
'l2tp'
]))
{
...
@@ -553,7 +553,7 @@ function vpn_l2tp_configure()
...
@@ -553,7 +553,7 @@ function vpn_l2tp_configure()
echo
gettext
(
'Configuring L2TP VPN service...'
);
echo
gettext
(
'Configuring L2TP VPN service...'
);
}
}
@
mkdir
(
'/var/etc/l2tp-vpn'
);
mkdir
(
'/var/etc/l2tp-vpn'
);
switch
(
isset
(
$l2tpcfg
[
'mode'
])
?
$l2tpcfg
[
'mode'
]
:
null
)
{
switch
(
isset
(
$l2tpcfg
[
'mode'
])
?
$l2tpcfg
[
'mode'
]
:
null
)
{
...
@@ -564,7 +564,7 @@ function vpn_l2tp_configure()
...
@@ -564,7 +564,7 @@ function vpn_l2tp_configure()
$paporchap
=
"set link enable pap"
;
$paporchap
=
"set link enable pap"
;
}
}
/* write mpd.conf */
/* write mpd.conf */
$fd
=
fopen
(
"/var/etc/l2tp-vpn/mpd.conf"
,
"w"
);
$fd
=
fopen
(
"/var/etc/l2tp-vpn/mpd.conf"
,
"w"
);
if
(
!
$fd
)
{
if
(
!
$fd
)
{
printf
(
gettext
(
"Error: cannot open mpd.conf in vpn_l2tp_configure()."
)
.
"
\n
"
);
printf
(
gettext
(
"Error: cannot open mpd.conf in vpn_l2tp_configure()."
)
.
"
\n
"
);
...
@@ -666,7 +666,7 @@ EOD;
...
@@ -666,7 +666,7 @@ EOD;
fclose
(
$fd
);
fclose
(
$fd
);
unset
(
$mpdconf
);
unset
(
$mpdconf
);
/* write mpd.links */
/* write mpd.links */
$fd
=
fopen
(
"/var/etc/l2tp-vpn/mpd.links"
,
"w"
);
$fd
=
fopen
(
"/var/etc/l2tp-vpn/mpd.links"
,
"w"
);
if
(
!
$fd
)
{
if
(
!
$fd
)
{
printf
(
gettext
(
"Error: cannot open mpd.links in vpn_l2tp_configure()."
)
.
"
\n
"
);
printf
(
gettext
(
"Error: cannot open mpd.links in vpn_l2tp_configure()."
)
.
"
\n
"
);
...
@@ -693,7 +693,7 @@ EOD;
...
@@ -693,7 +693,7 @@ EOD;
fclose
(
$fd
);
fclose
(
$fd
);
unset
(
$mpdlinks
);
unset
(
$mpdlinks
);
/* write mpd.secret */
/* write mpd.secret */
$fd
=
fopen
(
"/var/etc/l2tp-vpn/mpd.secret"
,
"w"
);
$fd
=
fopen
(
"/var/etc/l2tp-vpn/mpd.secret"
,
"w"
);
if
(
!
$fd
)
{
if
(
!
$fd
)
{
printf
(
gettext
(
"Error: cannot open mpd.secret in vpn_l2tp_configure()."
)
.
"
\n
"
);
printf
(
gettext
(
"Error: cannot open mpd.secret in vpn_l2tp_configure()."
)
.
"
\n
"
);
...
...
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