VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Request passphrase twice (https://forums.vandyke.com/showthread.php?t=12117)

Bob 10-05-2015 01:07 PM

Request passphrase twice
 
Hello,

I have this command :

SFXCL /Q /Log 'D:\Log20151005150316.log' /P 'passphrase' \\bob\file.txt SFTP://user@bob.com:/RepUpload

Even if I specify the passphrase in the command, if the windows application is not open, he request another time the passphrase.

Why ?

bgagnon 10-05-2015 01:21 PM

Hi Bob,

You have not actually pointed to a specific key file via your command-line. Have you configured Default Session with a key file for public-key authentication?

If not, if you add /I "path_to_key_file" to your command-line, what are the results?

SFXCL /Q /Log 'D:\Log20151005150316.log' /I "path_to_key_file" /P 'passphrase' \\bob\file.txt SFTP://user@bob.com:/RepUpload


By the way, what version of SecureFX are you using?

Please note that if it is SecureFX v7.3.3 or later, we added this functionality:

Changes in SecureFX 7.3.3 (Official) -- March 31, 2015
------------------------------------------------------

New features:

  • Previous versions of SecureFX supported saving passwords and other sensitive data. In order to improve the security of this feature, SecureFX now requires a passphrase to be created the first time version 7.3.3 runs. This passphrase will be used to encrypt and decrypt sensitive data stored in the session database.
Are you sure the prompt is not for the *config passphrase*?

SFXCL cannot work if a config passphrase is set.

Bob 10-06-2015 09:23 AM

I've remove the config passphrase but he still prompt me to enter the passphrase. But if I have the application open with the connection open, he dont prompt me for the passphrase.

I've the latest version of SecureFX. I try to do a transfert via a powershell on windows.

bgagnon 10-06-2015 09:28 AM

Hi Bob,

It's very important that *all instances* of SecureFX and SFXCL be closed prior to attempting removal of the config passphrase. Did you verify all instances of both applications were closed?

Bob 10-06-2015 09:39 AM

Ok.

I've made a little try. I've copy the line in the DOS command prompt and it work well. Then I must deduct it's the way I call it in powershell.

I build each argument in variable and call it. Like this :

[string]$CMD = 'SFXCL'
[string]$arg1 = '/Q'
[string]$arg2 = '/Log ' + $CheminLog + '\Log' + $(get-date -f yyyyMMddHHmmss) + '.log'
[string]$arg3 = '/I ' + $CheminClePrive
[string]$arg4 = '/P ''' + $Passphrase + ''''
[string]$arg5 = '/F ' + $CheminConfigSecureFX
[string]$arg6 = '\\' + $Serveur + $CheminFichier + $fichier
[string]$arg7 = 'SFTP://' + $UserCCD + '@' + $HostaddressCCD + ':/' + $RepertoireCCD

# The call
& $CMD $arg1 $arg2 $arg3 $arg4 $arg5 $arg6 $arg7

How can I call it to work ?

bgagnon 10-06-2015 10:10 AM

Sorry, Bob, I am not a PowerShell expert.

I can tell you this SFXCL syntax is valid, but you already know that from your Windows command shell test:

Code:

SFXCL /Q /Log "some log file path" /I "path to key file" /P "passphrase" /F "path to alternate config" \\fileserver\sourcefile.txt sftp://user@host:/someremotedirectory

It's likely you could have missed escaping some special character.

Are you getting an error?

If so, what is it?

Troubleshooting PowerShell is outside the scope of SecureFX support, but if you post it, maybe the user community can help.

Bob 10-06-2015 11:27 AM

In fact, I have two type of message :

Invalid argument specified for command line option '/Log D:\Log20151006132248.log'.

And if I remove the log parameter, I have this error :

Copying local files is not supported.

I will try some other way to launch SecureFx

Thanks

bgagnon 10-06-2015 11:46 AM

Hi Bob,

I think you have forgotten leading (or trailing) spaces when assigning the info to variables.

In my tests, I did get errors if the assigned variable started with '/Option', because when you run the PowerShell statement:

Code:

# The call
& $CMD $arg1 $arg2 $arg3 $arg4 $arg5 $arg6 $arg7

The spaces between the args are not literal.

So each variable assignment will likely need a leading or trailing space to separate the SFXCL options:

Code:

[string]$CMD = 'SFXCL'
[string]$arg1 = ' /Q'
[string]$arg2 = ' /Log ' + $CheminLog + '\Log' + $(get-date -f yyyyMMddHHmmss) + '.log'
[string]$arg3 = ' /I ' + $CheminClePrive
[string]$arg4 = ' /P ''' + $Passphrase + ''''
[string]$arg5 = ' /F ' + $CheminConfigSecureFX
[string]$arg6 = ' \\' + $Serveur + $CheminFichier + $fichier
[string]$arg7 = ' SFTP://' + $UserCCD + '@' + $HostaddressCCD + ':/' + $RepertoireCCD


Bob 10-06-2015 12:06 PM

I've change the way I call it and it work.

In place of

"& $CMD $arg1 $arg2 $arg3 $arg4 $arg5 $arg6 $arg7"

I proceed like this

"cmd.exe /c "$CMD $argTotal"

where $argTotal is the total of each $arg (1...7).

Not the best but it work for me.

bgagnon 10-06-2015 01:07 PM

Hi Bob,

Great, I am glad to hear you found a workaround. Thanks for posting an update! :)


All times are GMT -6. The time now is 04:26 PM.