Skip to content

Commit 994750e

Browse files
authored
feat(snap): vendor ssh in openshell snap and remove ssh-keys interface (#2280)
Previously, the openshell snap used the ssh-keys interface to get access to the host's ssh binary, which is used for sandbox connect/exec/forward. However, ssh-keys is a privileged interface which also grants access to the public and private ssh keys on the host. As such, it required manual connection in order to be used. This weakened the security sandbox of the snap, and hurt the UX of installing it. This commit changes this by removing the `ssh-keys` interface and instead vendoring the `ssh` binary within the snap. This is safe because OpenShell always invokes the `ssh` binary with `StrictHostKeyChecking=no`, `UserKnownHostsFile=/dev/null`, and `GlobalKnownHostsFile=/dev/null`, and never uses any host credentials or ssh configuration. Openshell only ever access to `~/.ssh/config` to write OpenShell-managed aliases, and this can safely live within the snap sandbox, rather than leaking into the host environment. Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
1 parent e8c16eb commit 994750e

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

.github/workflows/release-canary.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ jobs:
185185
sudo snap connect openshell:docker docker:docker-daemon
186186
sudo snap connect openshell:log-observe
187187
sudo snap connect openshell:system-observe
188-
sudo snap connect openshell:ssh-keys
189188
190189
- name: Register snap gateway and check status
191190
run: |

docs/about/installation.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ typically `~/snap/openshell/common`. Gateway registrations live under
9797
### Snap store installs
9898

9999
When installing from the Snap Store, snapd automatically connects the `home`,
100-
`network`, `network-bind`, and `ssh-keys` plugs. The `docker` plug still
100+
`network`, and `network-bind` plugs. The `docker` plug still
101101
requires manual connection:
102102

103103
```shell
@@ -117,7 +117,6 @@ sudo snap install ./openshell_*.snap --dangerous
117117
sudo snap connect openshell:home
118118
sudo snap connect openshell:network
119119
sudo snap connect openshell:network-bind
120-
sudo snap connect openshell:ssh-keys
121120
sudo snap connect openshell:docker docker:docker-daemon
122121
sudo snap connect openshell:log-observe
123122
sudo snap connect openshell:system-observe

snapcraft.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ description: |
2727
sudo snap connect openshell:docker docker:docker-daemon
2828
sudo snap connect openshell:log-observe
2929
sudo snap connect openshell:system-observe
30-
sudo snap connect openshell:ssh-keys
3130
sudo snap start openshell.gateway
3231
3332
3. Verify the gateway and register it locally:
@@ -69,7 +68,6 @@ apps:
6968
plugs:
7069
- home
7170
- network
72-
- ssh-keys
7371
- system-observe
7472
term:
7573
command: bin/openshell term
@@ -81,7 +79,6 @@ apps:
8179
plugs:
8280
- home
8381
- network
84-
- ssh-keys
8582
- system-observe
8683
gateway:
8784
command: bin/openshell-gateway-wrapper
@@ -104,7 +101,6 @@ apps:
104101
- log-observe
105102
- network
106103
- network-bind
107-
- ssh-keys
108104
- system-observe
109105

110106
parts:
@@ -150,3 +146,14 @@ parts:
150146
"$CRAFT_PART_INSTALL/usr/share/doc/openshell/LICENSE"
151147
install -D -m 0644 "$CRAFT_PART_SRC/README.md" \
152148
"$CRAFT_PART_INSTALL/usr/share/doc/openshell/README.md"
149+
150+
ssh:
151+
# Vendor the openssh-client `ssh` binary into the snap so the CLI/TUI
152+
# can spawn `ssh` for sandbox connect/exec/forward without relying on
153+
# the host's ssh-keys interface. The binary lands at
154+
# $SNAP/usr/bin/ssh and is found via the snap runtime PATH.
155+
plugin: nil
156+
stage-packages:
157+
- openssh-client
158+
prime:
159+
- usr/bin/ssh

0 commit comments

Comments
 (0)