mumtazhusain opened a new issue, #283:
URL: https://github.com/apache/mina-sshd/issues/283

   ### Version
   
   2.9.0
   
   ### Bug description
   
   Trying to find out if the reported in 
   
   https://issues.apache.org/jira/browse/SSHD-1159
   
   has been fixed or not. Don't have ASF Jira account, so cannot update the 
information there.
   
   For SSHD-1159, comment by Lyor Goldstein says
   
   "Version 2.2.0 is quite old - please try 2.7.0"
   
   I tried with version 2.9.0 and see the same behavior. SSH server is 
reporting two login attempts even though we run the following program only 
once. sshd daemon is configured with two auth methods, 
Publickey,keyboard-interactive
   
   package sshclient;
   
   import java.io.IOException;
   import java.util.Collections;
   import java.util.concurrent.TimeUnit;
   import org.apache.sshd.client.SshClient;
   import 
org.apache.sshd.client.auth.keyboard.UserAuthKeyboardInteractiveFactory;
   import org.apache.sshd.client.session.ClientSession;
   import org.apache.sshd.common.PropertyResolverUtils;
   import org.apache.sshd.core.CoreModuleProperties;
   
   public class ApacheSshDemo {
   
       public static void main(String[] args) throws Exception {
           ApacheSshDemo demo = new ApacheSshDemo();
           System.err.print("starting apache sshd demo");
           demo.newSession("localhost", "_v_10.0.1.1_v_admin", "blahblahblah", 
830, 30);
       }
   
    public void newSession(String host, String username,
            String password, int port, long defaultTimeout) throws IOException {
     SshClient client = SshClient.setUpDefaultClient();
     PropertyResolverUtils.updateProperty(client, 
CoreModuleProperties.PASSWORD_PROMPTS.getName(), 1);
     client.start();
     
client.setUserAuthFactories(Collections.singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
     try (ClientSession session = client.connect(username, host, port)
             .verify(defaultTimeout, TimeUnit.SECONDS)
             .getSession()) {
      session.addPasswordIdentity(password);
      session.auth()
              .verify(defaultTimeout, TimeUnit.SECONDS);
      System.err.println("ssh connection was successful");
     } catch (Exception e) {
         System.err.println("ssh exception is "+e);
     } finally {
      client.stop();
     }
    }
   }
   
   This is sshd dependency specified in pom.xml
   
   <dependencies>
           <dependency>
               <groupId>org.apache.sshd</groupId>
               <artifactId>sshd-core</artifactId>
               <version>2.9.0</version>
           </dependency>
       </dependencies
   
   ### Actual behavior
   
   Utility on SSH server is indicating two login attempts.
   
   vm12:/var/log# !fail
   faillock --dir /var/log/faillock --user admin
   admin:
   When                Type  Source                                           
Valid
   2022-12-08 13:54:25 RHOST 10.0.1.1                                           
  V
   2022-12-08 13:54:29 RHOST 10.0.1.1                                           
  V
   
   ### Expected behavior
   
   vm12:/var/log# !fail
   faillock --dir /var/log/faillock --user admin
   admin:
   When                Type  Source                                           
Valid
   2022-12-08 13:54:25 RHOST 10.0.1.1                                           
  V
   
   
   ### Relevant log output
   
   _No response_
   
   ### Other information
   
   OpenSSH_8.2


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to