mirror of
https://github.com/warp-tech/warpgate.git
synced 2025-02-22 22:43:29 +08:00
feat(ssh): make inactivity timeout configurable (#990)
With this change, the SSH inactivity timeout is now configurable. By default, is set at 5 minutes (300 seconds), which was the already existing value. Solves #943
This commit is contained in:
parent
72236d004a
commit
9582a6e0ae
3 changed files with 9 additions and 1 deletions
|
@ -79,3 +79,7 @@ pub(crate) fn _default_ssh_listen() -> ListenEndpoint {
|
|||
pub(crate) fn _default_ssh_keys_path() -> String {
|
||||
"./data/keys".to_owned()
|
||||
}
|
||||
|
||||
pub(crate) fn _default_ssh_inactivity_timeout() -> Duration {
|
||||
Duration::SECOND * 60 * 5
|
||||
}
|
||||
|
|
|
@ -118,6 +118,9 @@ pub struct SshConfig {
|
|||
|
||||
#[serde(default)]
|
||||
pub host_key_verification: SshHostKeyVerificationMode,
|
||||
|
||||
#[serde(default = "_default_ssh_inactivity_timeout", with = "humantime_serde")]
|
||||
pub inactivity_timeout: Duration,
|
||||
}
|
||||
|
||||
impl Default for SshConfig {
|
||||
|
@ -128,6 +131,7 @@ impl Default for SshConfig {
|
|||
keys: _default_ssh_keys_path(),
|
||||
host_key_verification: Default::default(),
|
||||
external_port: None,
|
||||
inactivity_timeout: _default_ssh_inactivity_timeout(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ pub async fn run_server(services: Services, address: SocketAddr) -> Result<()> {
|
|||
russh::server::Config {
|
||||
auth_rejection_time: Duration::from_secs(1),
|
||||
auth_rejection_time_initial: Some(Duration::from_secs(0)),
|
||||
inactivity_timeout: Some(Duration::from_secs(300)),
|
||||
inactivity_timeout: Some(config.store.ssh.inactivity_timeout),
|
||||
methods: MethodSet::PUBLICKEY | MethodSet::PASSWORD | MethodSet::KEYBOARD_INTERACTIVE,
|
||||
keys: load_host_keys(&config)?,
|
||||
event_buffer_size: 100,
|
||||
|
|
Loading…
Reference in a new issue