Skip to content
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

Feature: Add SCP Support #354

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Feature: Add SCP Support #354

wants to merge 3 commits into from

Conversation

jmcombs
Copy link
Contributor

@jmcombs jmcombs commented Dec 28, 2022

Adding SCP support based on requests from allowing an option for a limited ssh shell instead of internal-sftp #116.

rssh and scponly appear to be stale projects and the replacement is GNU Rush.Based on initial review, it seems this would be a bit overkill and overneingeering for the stated goal of this project. Also, Rush is available in apt for Debian but not in apk for Alpine which makes installing and maintaining in CI a little more challenging, as well.

I borrowed from this answer to a question on serverfault Allow SCP but not actual login using SSH to create the solution.

Unit tests are passing for both Alpine and Debian.

Passing Unit Tests

Debian Image:

sudo ./run jmcombs/sftp:latest
Generating public/private ed25519 key pair.
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Your identification has been saved in /tmp/atmoz_sftp_C9yP/ssh_host_ed25519_key
Your public key has been saved in /tmp/atmoz_sftp_C9yP/ssh_host_ed25519_key.pub
The key fingerprint is:
SHA256:VF5BbAza5a2GMWa2T1rrHzIzn/kKFE9qVL8gMM7cj8o root@osadmin-virtual-machine
The key's randomart image is:
+--[ED25519 256]--+
|         oo==..  |
|        +=+++o . |
|        o+O++.o .|
|       . + *+*. .|
|        S o.O... |
|        . .O .   |
|         E. O .  |
|           . B + |
|            ..*o.|
+----[SHA256]-----+
testSmallestUserConfig
testCreateUserWithDot
testUserCustomUidAndGid
testCommandPassthrough
testUsersConf
Waiting for atmoz_sftp_testUsersConf to open port 22 .... OPEN
testLegacyUsersConf
Waiting for atmoz_sftp_testLegacyUsersConf to open port 22 .... OPEN
testCreateUsersUsingEnv
Waiting for atmoz_sftp_testCreateUsersUsingEnv to open port 22 .... OPEN
testCreateUsersUsingCombo
Waiting for atmoz_sftp_testCreateUsersUsingCombo to open port 22 .... OPEN
testWriteAccessToAutocreatedDirs
Waiting for atmoz_sftp_testWriteAccessToAutocreatedDirs to open port 22 .... OPEN
testWriteAccessToLimitedChroot
Waiting for atmoz_sftp_testWriteAccessToLimitedChroot to open port 22 .... OPEN
testBindmountDirScript
Waiting for atmoz_sftp_testBindmountDirScript to open port 22 .... OPEN
testDuplicateSshKeys
Waiting for atmoz_sftp_testDuplicateSshKeys to open port 22 .... OPEN

Ran 12 tests.

OK

Alpine Image:

sudo ./run jmcombs/sftp:alpine
Generating public/private ed25519 key pair.
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Your identification has been saved in /tmp/atmoz_sftp_gh4u/ssh_host_ed25519_key
Your public key has been saved in /tmp/atmoz_sftp_gh4u/ssh_host_ed25519_key.pub
The key fingerprint is:
SHA256:T5fba5otjFZmzROQx7Qt+rpeUuOAkFMuXnMNJ8jLKUM root@osadmin-virtual-machine
The key's randomart image is:
+--[ED25519 256]--+
|         ...o+o  |
|        E+o o=oo |
|       .=.+o.o+ .|
|       .o=++ o.. |
|        Soo =oo. |
|         o .+B+. |
|          .*o =. |
|          o o*.. |
|         . .*=o  |
+----[SHA256]-----+
testSmallestUserConfig
testCreateUserWithDot
testUserCustomUidAndGid
testCommandPassthrough
testUsersConf
Waiting for atmoz_sftp_testUsersConf to open port 22 ..... OPEN
testLegacyUsersConf
Waiting for atmoz_sftp_testLegacyUsersConf to open port 22 ....... OPEN
testCreateUsersUsingEnv
Waiting for atmoz_sftp_testCreateUsersUsingEnv to open port 22 ..... OPEN
testCreateUsersUsingCombo
Waiting for atmoz_sftp_testCreateUsersUsingCombo to open port 22 ..... OPEN
testWriteAccessToAutocreatedDirs
Waiting for atmoz_sftp_testWriteAccessToAutocreatedDirs to open port 22 ..... OPEN
testWriteAccessToLimitedChroot
Waiting for atmoz_sftp_testWriteAccessToLimitedChroot to open port 22 ...... OPEN
testBindmountDirScript
Waiting for atmoz_sftp_testBindmountDirScript to open port 22 ..... OPEN
testDuplicateSshKeys
Waiting for atmoz_sftp_testDuplicateSshKeys to open port 22 .... OPEN

Ran 12 tests.

OK

@jmcombs jmcombs marked this pull request as ready for review December 28, 2022 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant