Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,19 @@ jobs:
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/gradle-build-action@v2
- run: ./gradlew build

os-integration-test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/gradle-build-action@v2
- run: bash os-integration-test/generate-keys.sh
- run: ./gradlew :os-integration-test:build
env:
SSH_PORT: 22
2 changes: 0 additions & 2 deletions os-integration-test/bin/.gitignore

This file was deleted.

3 changes: 3 additions & 0 deletions os-integration-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ dependencies {
}

test {
useJUnitPlatform()
mustRunAfter ':server-integration-test:check'
}

test.enabled = System.getenv('SSH_PORT') != null

task startSshAgent(type: Exec) {
commandLine 'ssh-agent'
standardOutput = new ByteArrayOutputStream()
Expand Down
10 changes: 0 additions & 10 deletions os-integration-test/etc/ssh/id_ecdsa

This file was deleted.

1 change: 0 additions & 1 deletion os-integration-test/etc/ssh/id_ecdsa.pub

This file was deleted.

27 changes: 0 additions & 27 deletions os-integration-test/etc/ssh/id_rsa

This file was deleted.

1 change: 0 additions & 1 deletion os-integration-test/etc/ssh/id_rsa.pub

This file was deleted.

30 changes: 0 additions & 30 deletions os-integration-test/etc/ssh/id_rsa_pass

This file was deleted.

1 change: 0 additions & 1 deletion os-integration-test/etc/ssh/id_rsa_pass.pub

This file was deleted.

1 change: 0 additions & 1 deletion os-integration-test/etc/ssh/known_hosts

This file was deleted.

21 changes: 0 additions & 21 deletions os-integration-test/etc/ssh/ssh_host_dsa_key

This file was deleted.

1 change: 0 additions & 1 deletion os-integration-test/etc/ssh/ssh_host_dsa_key.pub

This file was deleted.

9 changes: 0 additions & 9 deletions os-integration-test/etc/ssh/ssh_host_ecdsa_key

This file was deleted.

1 change: 0 additions & 1 deletion os-integration-test/etc/ssh/ssh_host_ecdsa_key.pub

This file was deleted.

7 changes: 0 additions & 7 deletions os-integration-test/etc/ssh/ssh_host_ed25519_key

This file was deleted.

1 change: 0 additions & 1 deletion os-integration-test/etc/ssh/ssh_host_ed25519_key.pub

This file was deleted.

27 changes: 0 additions & 27 deletions os-integration-test/etc/ssh/ssh_host_rsa_key

This file was deleted.

1 change: 0 additions & 1 deletion os-integration-test/etc/ssh/ssh_host_rsa_key.pub

This file was deleted.

20 changes: 20 additions & 0 deletions os-integration-test/generate-keys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# Generate key pairs and known_hosts.
# For GitHub Codespaces, set SSH_PORT=2222

set -ex
mkdir -m 700 -vp ~/.ssh

# user keys
ssh-keygen -t ecdsa -N '' -C '' -f ~/.ssh/id_ecdsa
ssh-keygen -t ecdsa -N gradle -C '' -f ~/.ssh/id_ecdsa_pass

# authorized_keys
cat ~/.ssh/id_*.pub > ~/.ssh/authorized_keys

# known_hosts
ssh -v \
-o StrictHostKeyChecking=accept-new \
-o HostKeyAlgorithms=ecdsa-sha2-nistp256 \
-p "${SSH_PORT:-22}" \
localhost true
10 changes: 0 additions & 10 deletions os-integration-test/run-sshd.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,20 @@ class Fixture {
service.remotes {
Default {
host = 'localhost'
port = 22
user = 'tester'
identity = new File("etc/ssh/id_rsa")
port = System.getenv('SSH_PORT') as int
user = System.properties['user.name']
identity = new File("${System.properties['user.home']}/.ssh/id_ecdsa")
knownHosts = addHostKey(new File("build/known_hosts"))
}
}
service.remotes {
DefaultWithECDSAKey {
host = service.remotes.Default.host
port = service.remotes.Default.port
user = service.remotes.Default.user
identity = new File("etc/ssh/id_ecdsa")
knownHosts = service.remotes.Default.knownHosts
}
DefaultWithPassphrase {
host = service.remotes.Default.host
port = service.remotes.Default.port
user = service.remotes.Default.user
knownHosts = service.remotes.Default.knownHosts

identity = new File("etc/ssh/id_rsa_pass")
identity = new File("${System.properties['user.home']}/.ssh/id_ecdsa_pass")
passphrase = 'gradle'
}
DefaultWithOpenSSHKnownHosts {
Expand All @@ -45,7 +38,7 @@ class Fixture {
user = service.remotes.Default.user
identity = service.remotes.Default.identity

knownHosts = new File("etc/ssh/known_hosts")
knownHosts = new File("${System.properties['user.home']}/.ssh/known_hosts")
}
DefaultWithAgent {
host = service.remotes.Default.host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,7 @@ class UserAuthenticationSpec extends Specification {
ssh.settings.extensions.add(UserManagementExtension)
}

def 'should authenticate by ECDSA key'() {
given:
def x = randomInt()
def y = randomInt()

when:
def r = ssh.run {
session(ssh.remotes.DefaultWithECDSAKey) {
execute "expr $x + $y"
}
} as int

then:
r == (x + y)
}

def 'should authenticate by pass-phrased RSA key'() {
def 'should authenticate by pass-phrased key'() {
given:
def x = randomInt()
def y = randomInt()
Expand Down