【问题标题】:Uipath SFTP connectionUipath SFTP 连接
【发布时间】:2019-08-28 13:45:01
【问题描述】:

我想使用“With Ftp session”组件来配置我与 SFTP 服务器的连接,但是我使用的是密钥文件而不是密码。 但是当我尝试连接时总是出现这个错误

这是我的配置:

【问题讨论】:

  • 您的活动属性屏幕看起来不像您使用的是最新版本的 FTP 活动包。您能否在问题中添加有关 UiPath 平台版本和 Activity 版本的详细信息?
  • 我用的是UiPath 2019.7,ftp版本是1.0.7053.27728
  • 我可以确认这是最新版本的开源社区活动与 FTP 会话活动的错误
  • JFYI 我确定了修复程序(SftpSession.cs 中缺少代码),并将尝试尽快将活动的更新版本上传到 Github

标签: sftp uipath uipath-activity


【解决方案1】:

With FTP Session 活动忽略了私钥参数,并始终尝试使用密码进行连接。您遇到的错误是由于 SSH 库收到了一个未初始化的密码变量。

这是Activities/FTP/UiPath.FTP/SftpSession.cs 的更新代码,添加了 PrivateKey 身份验证机制。同时,我会将此修复程序贡献给 Github。

请注意,您必须克隆和构建 https://github.com/UiPath/Community.Activities) 让它工作。

 public SftpSession(FtpConfiguration ftpConfiguration)
    {
        if (ftpConfiguration == null)
        {
            throw new ArgumentNullException(nameof(ftpConfiguration));
        }

        ConnectionInfo connectionInfo = null;

        var auths = new List<AuthenticationMethod>();
        if (!String.IsNullOrEmpty(ftpConfiguration.Password))
        {
            auths.Add(new PasswordAuthenticationMethod(ftpConfiguration.Username, ftpConfiguration.Password));
        }

        if (!String.IsNullOrEmpty(ftpConfiguration.ClientCertificatePath)) {
            PrivateKeyFile keyFile = new PrivateKeyFile(ftpConfiguration.ClientCertificatePath, ftpConfiguration.ClientCertificatePassword);
            var keyFiles = new[] { keyFile };
            auths.Add(new PrivateKeyAuthenticationMethod(ftpConfiguration.Username, keyFiles));
        }

        if (auths.Count == 0)
        {
            throw new ArgumentNullException("Need to provide either private key or password");
        }

        if (ftpConfiguration.Port == null)
        {
            connectionInfo = new ConnectionInfo(ftpConfiguration.Host, ftpConfiguration.Username, auths.ToArray());
        }
        else
        {
            connectionInfo = new ConnectionInfo(ftpConfiguration.Host, ftpConfiguration.Port.Value, ftpConfiguration.Username, auths.ToArray());
        }

        _sftpClient = new SftpClient(connectionInfo);

    }

【讨论】:

    猜你喜欢
    • 2017-07-31
    • 2011-10-08
    • 2013-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-21
    • 1970-01-01
    相关资源
    最近更新 更多