Rundeck - Invalid Password running an Inline Script on a PowerShell off Windows Node

999 Views Asked by At

Hi everyone and thanks in advance,

First of all sorry for my bad english. I have a problem executing a inline script to remote windows node using Rundeck. My Rundeck is running on Centos7. My objective: Write my script on rundeck and execute it on remote powershell.

Actual state:

I configured the winrm plugin, the node… and it works if I use the remote command options in job configuration. For example a simple ipconfig. Also works execute a local script on the node, for example using: powershell.exe $PATH/script.ps1. It could be a solution, but I need modify the script without connect to Windows node. This scripts are in constant update. For that reason I only have the inline script option.

I configured the OpenSSH server on the Windows node for run the SCP. If I connect to rundeck via ssh, and type ssh Administrator@ipwindows I can loggind without password.

Well, when I try to launch job with this step:

    -Step type: Script – Inline script
    -Script to execute: ipconfig (for example)
    -Invocatión script: powershell.exe
    -File extensión:  .ps1
    -Execution preview: $ powershell.exe "scriptfile.ps1 "

When I run the job I have the next error:

Authentication failure connecting to node: "Windoes Node". Password incorrect. Failed dispatching to node “Windows Node”: [jsch-scp] Failed copying the file: Authentication failure connecting to node: "Windows Node". Password incorrect.

Any ideas? I can’t find the problem…

Thank you

1

There are 1 best solutions below

0
On

The error come from step two Script to execute: ipconfig (for example). For all script executions, rundeck will scp the file into target server first, then run the script. By default, rundeck use ssh key for ssh authentication. As you are trying to use SSH password authentication(even though you don't have a password on the target server), it is still necessary to make some config on your node resource file.

Set a password for your Administrator user in Rundeck node resource file.

Node resource file:

<node name="egon" description="egon" osFamily="unix"
username="rundeck"
hostname="egon"
ssh-authentication="password"
ssh-password-option="option.sshPassword1" />

Job definition:

<joblist>
    <job>
        <!-- ... -->
        <context>
          <project>project</project>
          <options>
            <option required='true' name='sshPassword1' secure='true' valueExposed="false"/>
          </options>
        </context>
        <!-- ... -->
    </job>
</joblist>

Read more here SSH Password Authentication