Skip to content

Commit 78e6d65

Browse files
shjalaeriknordmark
authored andcommitted
add remote access switch
This is backport of #3485, which adds remote access switch to eve, blocking ssh and edge-view if remote access is disabled. Signed-off-by: Shahriyar Jalayeri <[email protected]>
1 parent 0e978f0 commit 78e6d65

File tree

15 files changed

+5711
-5607
lines changed

15 files changed

+5711
-5607
lines changed

api/go/info/info.pb.go

Lines changed: 857 additions & 845 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/images/devconfig.dot

Lines changed: 250 additions & 250 deletions
Large diffs are not rendered by default.

api/images/devconfig.dot.svg

Lines changed: 3554 additions & 3554 deletions
Loading

api/images/devconfig.png

-25.3 KB
Loading

api/proto/info/info.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,9 @@ message ZInfoDevice {
620620

621621
// Capability indicating which new EdgeDevConfig fields which are supported
622622
APICapability api_capability = 51;
623+
624+
// Reports the remote access status
625+
bool remote_access_disabled = 52;
623626
}
624627

625628
// Capabilities indicates features in the EdgeDevConfig where there is

api/python/info/info_pb2.py

Lines changed: 119 additions & 112 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/CONFIG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ In general, EVE is trying to make sure that its controller always has the last w
1313
* `wpa_supplicant.conf` - a legacy way of configuring EVE's WiFi
1414
* `authorized_keys` - initial authorized SSH keys for accessing EVE's debug console
1515
* `bootstrap-config.pb`- initial device configuration used only until device is onboarded (see below for details)
16+
* `remote_access_disabled`- a file indicating remote access status, if it exist remote access (edge-view and ssh) is disabled. Please check [config document](SECURITY.md#disabling-remote-access) for more information.
1617

1718
The initial content of these configuration files is stored in the EVE's source tree under [config](../config) folder. From there, these configuration files are baked into the EVE installer images. For the read-write bootable disk installer image these files can further be tweaked by mounting the "EVE" partition and editing those files directly on the installer image. This gives you an ability to take the default installer image and tweak it for your needs without re-building EVE from scratch (obviously this is not an option for a read-only ISO installer image). A typical workflow is to take an installer image from the official EVE build, flash it onto a USB flash drive, insert that USB flash drive into your desktop and edit file on the partition called EVE.
1819

docs/SECURITY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ Two ECOs communicating using the overlay will get an secure channel since LISP w
152152

153153
In addition, the LISP map server can provide ability to limit access to the mappings for certain EIDs based on the EID which is trying to look them up.
154154

155+
## Disabling Remote Access
156+
157+
EVE provides a mechanism to build an image with remote access disabled (edge-view and ssh), this can be done by configuring EVE when building an installer. Enabling remote access back requires access to the cloud controller to enable console keyboard access on the edge node, plus physical access to the edge node to issue `eve remote-access` command on the edge node. In addition changing remote access status from its initial value to anything else will result in change of PCR-14 value and subsequent failure in unsealing the vault key that needs to be handled using the cloud controller. Check [config document](CONFIG.md#eve-configuration) for more information.
158+
155159
## Details on keys and certificates
156160

157161
These details are specified in [KEYS-AND-CERTS](KEYS-AND-CERTS.md).

pkg/debug/ssh.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,15 @@ echo -1 > /proc/sys/kernel/perf_event_paranoid
77
KEYS=$(find /etc/ssh -name 'ssh_host_*_key')
88
[ -z "$KEYS" ] && ssh-keygen -A >/dev/null 2>/dev/null
99

10-
exec /usr/sbin/sshd -D -e
10+
11+
if [ -f "/config/remote_access_disabled" ]; then
12+
# this is picked up by newlogd
13+
echo "Remote access disabled, ssh server not started" > /dev/kmsg
14+
while true; do
15+
# sleep for INT_MAX, keep the container running
16+
sleep inf
17+
done
18+
else
19+
exec /usr/sbin/sshd -D -e
20+
fi
21+

pkg/dom0-ztools/rootfs/bin/eve

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Welcome to EVE!
1919
persist attach <disk>
2020
config mount <mountpoint>
2121
config unmount
22+
remote-access on|off
2223
firewall drop
2324
verbose on|off
2425
version
@@ -151,6 +152,27 @@ __EOT__
151152
;;
152153
esac
153154
;;
155+
remote-access)
156+
CONFIGDIR_RW="/tmp/config_rw"
157+
mkdir $CONFIGDIR_RW
158+
if eval "$(mount_partlabel "CONFIG" $CONFIGDIR_RW)"; then
159+
case "$2" in
160+
on) rm -f $CONFIGDIR_RW/remote_access_disabled
161+
eval "$(unmount_partlabel "CONFIG")" && rm -rf $CONFIGDIR_RW
162+
echo "Remote access enabled. Please reboot to apply changes."
163+
;;
164+
off) touch $CONFIGDIR_RW/remote_access_disabled
165+
eval "$(unmount_partlabel "CONFIG")" && rm -rf $CONFIGDIR_RW
166+
echo "Remote access disabled. Please reboot to apply changes."
167+
;;
168+
*) eval "$(unmount_partlabel "CONFIG")" && rm -rf $CONFIGDIR_RW
169+
help
170+
;;
171+
esac
172+
else
173+
echo "Failed to set the remote access configuration!"
174+
fi
175+
;;
154176
version)
155177
v=$(cat /run/eve-release)
156178
echo "$v"

0 commit comments

Comments
 (0)