Skip to content

Commit a37cc6e

Browse files
committed
Remove public key auth
1 parent e31bd7c commit a37cc6e

File tree

4 files changed

+1
-47
lines changed

4 files changed

+1
-47
lines changed

rust/src/nasl/builtin/ssh/libssh/session.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -203,26 +203,6 @@ impl SshSession {
203203
}
204204
}
205205

206-
pub async fn auth_public_key(
207-
&mut self,
208-
login: &str,
209-
private_key: &str,
210-
passphrase: &str,
211-
) -> Result<()> {
212-
self.ensure_user_set(Some(login))?;
213-
let key = SshKey::from_privkey_base64(private_key, Some(passphrase))
214-
.map_err(|_| SshErrorKind::ConvertPrivateKey.with(self.id))?;
215-
let status = self.userauth_try_publickey(None, &key)?;
216-
if let AuthStatus::Success = status {
217-
return Ok(());
218-
}
219-
let status = self.userauth_publickey(None, &key)?;
220-
if let AuthStatus::Success = status {
221-
return Ok(());
222-
}
223-
Ok(())
224-
}
225-
226206
fn get_authmethods(&mut self) -> Result<AuthMethods> {
227207
let authmethods = match self.userauth_none(None)? {
228208
AuthStatus::Success => {
@@ -273,7 +253,6 @@ impl SshSession {
273253
inherit_method!(userauth_none, AuthStatus, UserAuthNone, username: Option<&str>);
274254
inherit_method!(userauth_list, AuthMethods, UserAuthList, username: Option<&str>);
275255
inherit_method!(userauth_try_publickey, AuthStatus, UserAuthTryPublicKey, username: Option<&str>, key: &SshKey);
276-
inherit_method!(userauth_publickey, AuthStatus, UserAuthPublicKey, username: Option<&str>, key: &SshKey);
277256
inherit_method!(
278257
userauth_keyboard_interactive_info,
279258
InteractiveAuthInfo,

rust/src/nasl/builtin/ssh/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,6 @@ impl Ssh {
311311
return Ok(());
312312
}
313313
}
314-
// If we have a private key, try public key authentication.
315-
if session.auth_method_allowed(AuthMethods::PUBLIC_KEY).await? {
316-
if let Some(private_key) = privatekey {
317-
let passphrase = passphrase.unwrap_or_default();
318-
session
319-
.auth_public_key(login, private_key, passphrase)
320-
.await?;
321-
}
322-
}
323314
Ok(())
324315
}
325316

rust/src/nasl/builtin/ssh/russh/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub type Socket = i32;
1919

2020
// This is a 'clone' of the libssh::AuthMethods, so
2121
// the capital case names are intentional.
22-
#[allow(non_camel_case_types, clippy::upper_case_acronyms)]
22+
#[allow(non_camel_case_types, clippy::upper_case_acronyms, unused)]
2323
pub enum AuthMethods {
2424
PASSWORD,
2525
INTERACTIVE,

rust/src/nasl/builtin/ssh/russh/session.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -165,22 +165,6 @@ impl SshSession {
165165
.map(|_| ())
166166
}
167167

168-
pub async fn auth_public_key(
169-
&mut self,
170-
_login: &str,
171-
_private_key: &str,
172-
_passphrase: &str,
173-
) -> Result<(), SshError> {
174-
// TODO: Construct the key pair to provide publickey auth
175-
error!("Public key auth not yet supported.");
176-
Err(SshErrorKind::Unimplemented.into())
177-
// self.session
178-
// .authenticate_publickey(login, key_pair)
179-
// .await
180-
// .map_err(|_| SshError::UserauthPassword(self.id))
181-
// .map(|_| ())
182-
}
183-
184168
pub async fn auth_keyboard_interactive(
185169
&mut self,
186170
login: &str,

0 commit comments

Comments
 (0)