1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 13:16:39 +03:00

Ensure /run/sshd exists, explicitly set username in sshd fixture, add back use_privilege_mode no

This commit is contained in:
Chip Senkbeil 2021-09-27 00:14:06 -05:00 committed by Wez Furlong
parent d98a2cbbc2
commit 7d5c301c66
29 changed files with 110 additions and 3 deletions

View File

@ -13,7 +13,7 @@ task:
- chmod +x /tmp/rustup.sh - chmod +x /tmp/rustup.sh
- RUSTUP_IO_THREADS=1 /tmp/rustup.sh -y -q - RUSTUP_IO_THREADS=1 /tmp/rustup.sh -y -q
- env PATH=$HOME/.cargo/bin:$PATH bash get-deps - env PATH=$HOME/.cargo/bin:$PATH bash get-deps
- chmod og-rw $HOME - mkdir -p /run/sshd
test_script: test_script:
- env PATH=$HOME/.cargo/bin:$PATH cargo build --all --release - env PATH=$HOME/.cargo/bin:$PATH cargo build --all --release
- env PATH=$HOME/.cargo/bin:$PATH cargo test --all --release - env PATH=$HOME/.cargo/bin:$PATH cargo test --all --release

View File

@ -45,6 +45,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "yum install -y curl" run: "yum install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "yum install -y openssh-server" run: "yum install -y openssh-server"

View File

@ -54,6 +54,11 @@ jobs:
run: | run: |
export BUILD_REASON=Schedule export BUILD_REASON=Schedule
yum install -y curl yum install -y curl
- name: "Ensure /run/sshd exists"
shell: bash
run: |
export BUILD_REASON=Schedule
mkdir -p /run/sshd
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: | run: |

View File

@ -36,6 +36,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "yum install -y curl" run: "yum install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "yum install -y openssh-server" run: "yum install -y openssh-server"

View File

@ -31,6 +31,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "yum install -y curl" run: "yum install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "yum install -y openssh-server" run: "yum install -y openssh-server"

View File

@ -41,6 +41,11 @@ jobs:
run: | run: |
export BUILD_REASON=Schedule export BUILD_REASON=Schedule
yum install -y curl yum install -y curl
- name: "Ensure /run/sshd exists"
shell: bash
run: |
export BUILD_REASON=Schedule
mkdir -p /run/sshd
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: | run: |

View File

@ -22,6 +22,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "yum install -y curl" run: "yum install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "yum install -y openssh-server" run: "yum install -y openssh-server"

View File

@ -31,6 +31,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "apt-get install -y curl" run: "apt-get install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "apt-get install -y openssh-server" run: "apt-get install -y openssh-server"

View File

@ -41,6 +41,11 @@ jobs:
run: | run: |
export BUILD_REASON=Schedule export BUILD_REASON=Schedule
apt-get install -y curl apt-get install -y curl
- name: "Ensure /run/sshd exists"
shell: bash
run: |
export BUILD_REASON=Schedule
mkdir -p /run/sshd
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: | run: |

View File

@ -22,6 +22,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "apt-get install -y curl" run: "apt-get install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "apt-get install -y openssh-server" run: "apt-get install -y openssh-server"

View File

@ -31,6 +31,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "apt-get install -y curl" run: "apt-get install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "apt-get install -y openssh-server" run: "apt-get install -y openssh-server"

View File

@ -41,6 +41,11 @@ jobs:
run: | run: |
export BUILD_REASON=Schedule export BUILD_REASON=Schedule
apt-get install -y curl apt-get install -y curl
- name: "Ensure /run/sshd exists"
shell: bash
run: |
export BUILD_REASON=Schedule
mkdir -p /run/sshd
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: | run: |

View File

@ -22,6 +22,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "apt-get install -y curl" run: "apt-get install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "apt-get install -y openssh-server" run: "apt-get install -y openssh-server"

View File

@ -45,6 +45,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "apt-get install -y curl" run: "apt-get install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "apt-get install -y openssh-server" run: "apt-get install -y openssh-server"

View File

@ -54,6 +54,11 @@ jobs:
run: | run: |
export BUILD_REASON=Schedule export BUILD_REASON=Schedule
apt-get install -y curl apt-get install -y curl
- name: "Ensure /run/sshd exists"
shell: bash
run: |
export BUILD_REASON=Schedule
mkdir -p /run/sshd
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: | run: |

View File

@ -36,6 +36,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "apt-get install -y curl" run: "apt-get install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "apt-get install -y openssh-server" run: "apt-get install -y openssh-server"

View File

@ -25,6 +25,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "yum install -y curl" run: "yum install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "yum install -y openssh-server" run: "yum install -y openssh-server"

View File

@ -31,6 +31,11 @@ jobs:
run: | run: |
export BUILD_REASON=Schedule export BUILD_REASON=Schedule
yum install -y curl yum install -y curl
- name: "Ensure /run/sshd exists"
shell: bash
run: |
export BUILD_REASON=Schedule
mkdir -p /run/sshd
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: | run: |

View File

@ -16,6 +16,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "yum install -y curl" run: "yum install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "yum install -y openssh-server" run: "yum install -y openssh-server"

View File

@ -25,6 +25,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "yum install -y curl" run: "yum install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "yum install -y openssh-server" run: "yum install -y openssh-server"

View File

@ -31,6 +31,11 @@ jobs:
run: | run: |
export BUILD_REASON=Schedule export BUILD_REASON=Schedule
yum install -y curl yum install -y curl
- name: "Ensure /run/sshd exists"
shell: bash
run: |
export BUILD_REASON=Schedule
mkdir -p /run/sshd
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: | run: |

View File

@ -16,6 +16,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "yum install -y curl" run: "yum install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "yum install -y openssh-server" run: "yum install -y openssh-server"

View File

@ -31,6 +31,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "apt-get install -y curl" run: "apt-get install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "apt-get install -y openssh-server" run: "apt-get install -y openssh-server"

View File

@ -41,6 +41,11 @@ jobs:
run: | run: |
export BUILD_REASON=Schedule export BUILD_REASON=Schedule
apt-get install -y curl apt-get install -y curl
- name: "Ensure /run/sshd exists"
shell: bash
run: |
export BUILD_REASON=Schedule
mkdir -p /run/sshd
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: | run: |

View File

@ -22,6 +22,9 @@ jobs:
- name: "Install curl" - name: "Install curl"
shell: bash shell: bash
run: "apt-get install -y curl" run: "apt-get install -y curl"
- name: "Ensure /run/sshd exists"
shell: bash
run: "mkdir -p /run/sshd"
- name: "Install openssh-server" - name: "Install openssh-server"
shell: bash shell: bash
run: "apt-get install -y openssh-server" run: "apt-get install -y openssh-server"

11
Cargo.lock generated
View File

@ -5382,6 +5382,7 @@ dependencies = [
"structopt", "structopt",
"termwiz", "termwiz",
"thiserror", "thiserror",
"whoami",
] ]
[[package]] [[package]]
@ -5485,6 +5486,16 @@ dependencies = [
"bitflags", "bitflags",
] ]
[[package]]
name = "whoami"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cabfe22aa4936611957e0b5ad9ed0472ac52b2bfb9aedac4a3f3a91a03bd1ff0"
dependencies = [
"wasm-bindgen",
"web-sys",
]
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.2.8" version = "0.2.8"

View File

@ -162,7 +162,10 @@ class Target(object):
def install_openssh_server(self): def install_openssh_server(self):
if self.uses_yum() or (self.uses_apt() and self.container): if self.uses_yum() or (self.uses_apt() and self.container):
return self.install_system_package("openssh-server") return (
[RunStep("Ensure /run/sshd exists", "mkdir -p /run/sshd")]
+ self.install_system_package("openssh-server")
)
return [] return []
def install_newer_compiler(self): def install_newer_compiler(self):

View File

@ -41,3 +41,4 @@ shell-words = "1.0"
smol-potat = "1.1.2" smol-potat = "1.1.2"
structopt = "0.3" structopt = "0.3"
termwiz = { path = "../termwiz" } termwiz = { path = "../termwiz" }
whoami = "1.1"

View File

@ -1,5 +1,5 @@
use assert_fs::{prelude::*, TempDir}; use assert_fs::{prelude::*, TempDir};
use once_cell::sync::OnceCell; use once_cell::sync::{Lazy, OnceCell};
use rstest::*; use rstest::*;
use std::{ use std::{
collections::HashMap, collections::HashMap,
@ -21,6 +21,8 @@ const BIN_PATH_STR: &str = "/usr/sbin/sshd";
/// Port range to use when finding a port to bind to (using IANA guidance) /// Port range to use when finding a port to bind to (using IANA guidance)
const PORT_RANGE: (u16, u16) = (49152, 65535); const PORT_RANGE: (u16, u16) = (49152, 65535);
const USERNAME: Lazy<String> = Lazy::new(|| whoami::username());
pub struct SshKeygen; pub struct SshKeygen;
impl SshKeygen { impl SshKeygen {
@ -92,6 +94,7 @@ impl Default for SshdConfig {
let mut config = Self::new(); let mut config = Self::new();
config.set_authentication_methods(vec!["publickey".to_string()]); config.set_authentication_methods(vec!["publickey".to_string()]);
config.set_use_privilege_separation(false);
config.set_subsystem(true, true); config.set_subsystem(true, true);
config.set_use_pam(false); config.set_use_pam(false);
config.set_x11_forwarding(true); config.set_x11_forwarding(true);
@ -400,6 +403,7 @@ pub async fn session(sshd: &'_ Sshd) -> Session {
// generated identity file, and host file // generated identity file, and host file
let mut config = config.for_host("localhost"); let mut config = config.for_host("localhost");
config.insert("port".to_string(), port.to_string()); config.insert("port".to_string(), port.to_string());
config.insert("user".to_string(), USERNAME.to_string());
config.insert("identitiesonly".to_string(), "yes".to_string()); config.insert("identitiesonly".to_string(), "yes".to_string());
config.insert( config.insert(
"identityfile".to_string(), "identityfile".to_string(),