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
f10cedbe
Commit
f10cedbe
authored
Dec 11, 2014
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rc: prune shell menu some more
parent
b3f9d883
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
96 deletions
+8
-96
rc.initial
src/etc/rc.initial
+8
-22
rc.initial.toggle_sshd
src/etc/rc.initial.toggle_sshd
+0
-74
No files found.
src/etc/rc.initial
View file @
f10cedbe
...
...
@@ -23,13 +23,6 @@ fi
# endless loop
while
:
;
do
# Check to see if SSH is running.
if
pgrep
-q
-a
-F
/var/run/sshd.pid sshd
>
/dev/null 2>&1
;
then
sshd_option
=
"14) Disable Secure Shell (sshd)"
;
else
sshd_option
=
"14) Enable Secure Shell (sshd)"
;
fi
# If we are on the LiveCD advertise the installer
if
_tmpdir
=
$(
mktemp
-d
-q
/.diskless.XXXXXX
)
;
then
rmdir
${
_tmpdir
}
...
...
@@ -37,14 +30,13 @@ else
option99
=
"99) Launch the installer"
fi
echo
" 0) Logout 8) Shell"
echo
" 1) Assign Interfaces 9) pfTop"
echo
" 2) Set interface(s) IP address 10) Filter Logs"
echo
" 3) Reset the root password 11) Restart web interface"
echo
" 4) Reset to factory defaults 12) Developer Shell"
echo
" 5) Reboot system 13) Upgrade from console"
echo
" 6) Halt system
${
sshd_option
}
"
echo
" 7) Ping host 15) Restore a configuration"
echo
" 0) Logout 7) Ping host"
echo
" 1) Assign Interfaces 8) Shell"
echo
" 2) Set interface(s) IP address 9) pfTop"
echo
" 3) Reset the root password 10) Filter Logs"
echo
" 4) Reset to factory defaults 11) Restart web interface"
echo
" 5) Reboot system 12) Upgrade from console"
echo
" 6) Halt system 13) Restore a configuration"
if
[
-n
"
${
option99
}
"
]
;
then
# flat for alignment...
echo
"
${
option99
}
"
...
...
@@ -93,15 +85,9 @@ case ${opmode} in
/usr/local/etc/rc.restart_webgui
;;
12
)
/usr/local/sbin/pfSsh.php
;;
13
)
/usr/local/etc/rc.initial.firmware_update
;;
14
)
/usr/local/etc/rc.initial.toggle_sshd
;;
15
)
13
)
/usr/local/etc/rc.restore_config_backup
;;
99
)
...
...
src/etc/rc.initial.toggle_sshd
deleted
100755 → 0
View file @
b3f9d883
#!/usr/local/bin/php -f
<?php
/*
sshd - Modified to work on disk based system
Copyright 2004 Scott K Ullrich
Original Copyright (C) 2004 Fred Mol <fredmol@xs4all.nl>.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
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
POSSIBILITY OF SUCH DAMAGE.
*/
require_once
(
"config.inc"
);
require_once
(
"functions.inc"
);
require_once
(
"filter.inc"
);
conf_mount_rw
();
$fp
=
fopen
(
'php://stdin'
,
'r'
);
if
(
isset
(
$config
[
'system'
][
'enablesshd'
]))
{
echo
"SSHD is currently enabled. Would you like to disable? [y/n]? "
;
$yn
=
chop
(
fgets
(
$fp
));
if
(
$yn
[
0
]
==
"y"
)
{
unset
(
$config
[
'system'
][
'enablesshd'
]);
echo
"
\n
Writing configuration..."
;
write_config
();
echo
" done.
\n
"
;
echo
"
\n
Disabling SSHD..."
;
send_event
(
"service reload sshd"
);
echo
"
\n
Reloading firewall rules."
;
filter_configure
();
echo
" done.
\n
"
;
exec
(
"ps awux | grep '/usr/sbin/sshd' | grep -v grep | awk '{print $2}' | xargs kill"
);
}
}
else
{
echo
"SSHD is currently disabled. Would you like to enable? [y/n]? "
;
$yn
=
chop
(
fgets
(
$fp
));
if
(
$yn
[
0
]
==
"y"
)
{
$config
[
'system'
][
'enablesshd'
]
=
true
;
echo
"
\n
Writing configuration..."
;
write_config
();
echo
" done.
\n
"
;
echo
"
\n
Enabling SSHD..."
;
send_event
(
"service reload sshd"
);
echo
"
\n
Reloading firewall rules."
;
filter_configure
();
echo
" done.
\n\n
"
;
}
}
fclose
(
$fp
);
conf_mount_ro
();
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