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
d4ecff6f
Commit
d4ecff6f
authored
Aug 08, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rc: add sshd for installer (2/2); closes #1072
parent
bde361f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
20 deletions
+18
-20
rc.bootup
src/etc/rc.bootup
+2
-2
rc.sshd
src/etc/rc.sshd
+16
-18
No files found.
src/etc/rc.bootup
View file @
d4ecff6f
...
...
@@ -211,9 +211,7 @@ interfaces_loopback_configure();
/* start syslogd */
system_syslogd_start
();
echo
"Starting Secure Shell Services..."
;
mwexec
(
"/usr/local/etc/rc.sshd"
);
echo
"done.
\n
"
;
/* set up interfaces */
mute_kernel_msgs
();
...
...
@@ -370,5 +368,7 @@ if ($setup_installer) {
$root
[
'shell'
]
=
'/usr/local/etc/rc.installer'
;
$root
[
'name'
]
=
'installer'
;
local_user_set
(
$root
);
mwexec
(
"/usr/local/etc/rc.sshd installer"
);
}
}
src/etc/rc.sshd
View file @
d4ecff6f
...
...
@@ -4,7 +4,7 @@
/*
Copyright (C) 2004 Scott K Ullrich
Copyright (C) 2004 Fred Mol <fredmol@xs4all.nl>.
Copyright (C) 2015 Franco Fichtner <franco@opnsense.org>
Copyright (C) 2015
-2016
Franco Fichtner <franco@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
...
...
@@ -39,7 +39,18 @@ $etc_ssh = '/usr/local/etc/ssh';
/* if run from a shell session, `-af' and the full path is needed */
mwexecf
(
'/bin/pkill -af %s'
,
$sbin_sshd
);
if
(
!
isset
(
$config
[
'system'
][
'ssh'
][
'enabled'
]))
{
$sshcfg
=
null
;
if
(
isset
(
$config
[
'system'
][
'ssh'
]))
{
if
(
isset
(
$config
[
'system'
][
'ssh'
][
'enabled'
]))
{
$sshcfg
=
$config
[
'system'
][
'ssh'
];
}
}
elseif
(
count
(
$argv
)
>
1
&&
$argv
[
1
]
==
'installer'
)
{
/* only revert to installer config when ssh is not set at all */
$sshcfg
=
array
(
'permitrootlogin'
=>
1
,
'passwordauth'
=>
1
);
}
if
(
$sshcfg
===
null
)
{
return
;
}
...
...
@@ -73,21 +84,8 @@ foreach($keys as $name) {
/* Login related files. */
touch
(
"/var/log/lastlog"
);
if
(
isset
(
$config
[
'system'
][
'ssh'
][
'port'
]))
{
$sshport
=
$config
[
'system'
][
'ssh'
][
'port'
];
}
else
{
$sshport
=
22
;
}
$sshport
=
isset
(
$sshcfg
[
'port'
])
?
$sshcfg
[
'port'
]
:
22
;
/*
* XXX ZOMG sshd_config BOOTSTRAPPING ACTION
*
* We can't just ditch the system file by default and roll
* our own. Instead, use the current file to find the actual
* settings that need toggling, then toggle them!
*/
/* Include default configuration for OPNsense */
$sshconf
=
"# This file was automatically generated by /usr/local/etc/rc.sshd
\n
"
;
$sshconf
.=
"Port
{
$sshport
}
\n
"
;
$sshconf
.=
"Protocol 2
\n
"
;
...
...
@@ -98,10 +96,10 @@ $sshconf .= "UseDNS no\n";
$sshconf
.=
"X11Forwarding no
\n
"
;
$sshconf
.=
"PubkeyAuthentication yes
\n
"
;
$sshconf
.=
"Subsystem
\t
sftp
\t
internal-sftp
\n
"
;
if
(
isset
(
$
config
[
'system'
][
'ssh'
]
[
'permitrootlogin'
]))
{
if
(
isset
(
$
sshcfg
[
'permitrootlogin'
]))
{
$sshconf
.=
"PermitRootLogin yes
\n
"
;
}
if
(
isset
(
$
config
[
'system'
][
'ssh'
]
[
'passwordauth'
]))
{
if
(
isset
(
$
sshcfg
[
'passwordauth'
]))
{
$sshconf
.=
"ChallengeResponseAuthentication yes
\n
"
;
$sshconf
.=
"PasswordAuthentication yes
\n
"
;
}
else
{
...
...
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