-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remote access switch #3485
Remote access switch #3485
Changes from all commits
0ccf56a
47ca804
077ce2b
0c78ecb
314ea82
3f40f1c
dd45b22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,15 @@ echo -1 > /proc/sys/kernel/perf_event_paranoid | |
KEYS=$(find /etc/ssh -name 'ssh_host_*_key') | ||
[ -z "$KEYS" ] && ssh-keygen -A >/dev/null 2>/dev/null | ||
|
||
exec /usr/sbin/sshd -D -e | ||
|
||
if [ -f "/config/remote_access_disabled" ]; then | ||
# this is picked up by newlogd | ||
echo "Remote access disabled, ssh server not started" > /dev/kmsg | ||
while true; do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can just use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are you sure busybox implements all the GNU version options? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked and it works: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks, changed it. |
||
# sleep for INT_MAX, keep the container running | ||
sleep inf | ||
done | ||
else | ||
exec /usr/sbin/sshd -D -e | ||
fi | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,21 @@ | ||||||
// Copyright (c) 2017-2023 Zededa, Inc. | ||||||
// SPDX-License-Identifier: Apache-2.0 | ||||||
|
||||||
package utils | ||||||
|
||||||
import ( | ||||||
"os" | ||||||
|
||||||
"github.com/lf-edge/eve/pkg/pillar/types" | ||||||
) | ||||||
|
||||||
// RemoteAccessDisabled checks if remote access is enabled/disabled | ||||||
// by checking if the file /config/remote_access_disabled exists or not. | ||||||
func RemoteAccessDisabled() bool { | ||||||
if _, err := os.Stat(types.RemoteAccessFlagFileName); err == nil { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
from utils package |
||||||
// file exists, remote access is disabled | ||||||
return true | ||||||
} else { | ||||||
return false | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shjala , is there any particular reason to use a file for this feature (disabled remote access)? I'm wondering if it couldn't be integrated to the config properties? Also, I'm wondering if you could use this file to hold more config options (for remote access), instead of just mark it as disabled.... for instance, the file could be named as "remote_access", and contains inside the enable/disable option along with other properties (if that's the case).... I'm not against the current implementation though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I save that for a future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rene The requirement is that it can not be possible to change this from the controller; only a user with local access should be able to enable it. The config properties are all about changes from the controller.
We could make the file more generic, but that means more care (writeRename) to avoid ending up with a corrupted file when there is a power outage. And we don't know what the scope would be for future items which would have the same requirement for local-only modifications. There might be none.