Skip to content

Commit

Permalink
[Publish] - Bugfix for #161. Remove -GiveUpSecurityAndAcceptAnySshHos…
Browse files Browse the repository at this point in the history
…tKey parameter, convert -GiveUpSecurityAndAcceptAnySshHostKey from type Switch to Type Bool.
  • Loading branch information
tomohulk committed May 30, 2024
1 parent b296426 commit 633da2d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
workflow_dispatch:

env:
ModuleVersion: 6.3.3.0
ModuleVersion: 6.3.3.1
ReleaseNotes: ${{ github.event.head_commit.message }}

# A workflow run is made up of one or more jobs that can run sequentially or in parallel.
Expand Down
33 changes: 7 additions & 26 deletions Help/New-WinSCPSessionOption.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ Defines information to allow an automatic connection and authentication of the s

```
New-WinSCPSessionOption [-Credential <PSCredential>] [-FtpMode <FtpMode>] [-FtpSecure <FtpSecure>]
[-GiveUpSecurityAndAcceptAnySshHostKey] [-GiveUpSecurityAndAcceptAnyTlsHostCertificate] -HostName <String>
[-PortNumber <Int32>] [-Protocol <Protocol>] [-SecurePrivateKeyPassphrase <SecureString>]
[-SshHostKeyFingerprint <String[]>] [-SshHostKeyPolicy <String>] [-SshPrivateKeyPath <String>]
[-TlsClientCertificatePath <String>] [-TlsHostCertificateFingerprint <String>] [-Timeout <TimeSpan>]
[-WebdavSecure] [-RootPath <String>] [-RawSetting <Hashtable>] [-ProgressAction <ActionPreference>] [-WhatIf]
[-Confirm] [<CommonParameters>]
[-GiveUpSecurityAndAcceptAnyTlsHostCertificate <Boolean>] -HostName <String> [-PortNumber <Int32>]
[-Protocol <Protocol>] [-SecurePrivateKeyPassphrase <SecureString>] [-SshHostKeyFingerprint <String[]>]
[-SshHostKeyPolicy <SshHostKeyPolicy>] [-SshPrivateKeyPath <String>] [-TlsClientCertificatePath <String>]
[-TlsHostCertificateFingerprint <String>] [-Timeout <TimeSpan>] [-WebdavSecure] [-RootPath <String>]
[-RawSetting <Hashtable>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -150,32 +149,14 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -GiveUpSecurityAndAcceptAnySshHostKey
Give up security and accept any SSH host key.
To be used in exceptional situations only, when security is not required.
When set, log files will include warning about insecure connection.
To maintain security, use SshHostKeyFingerprint.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### -GiveUpSecurityAndAcceptAnyTlsHostCertificate
Give up security and accept any FTPS/WebDAVS server TLS/SSL certificate.
To be used in exceptional situations only, when security is not required.
When set, log files will include warning about insecure connection.
To maintain security, use TlsHostCertificateFingerprint.
```yaml
Type: SwitchParameter
Type: Boolean
Parameter Sets: (All)
Aliases:

Expand Down Expand Up @@ -393,7 +374,7 @@ Accept wildcard characters: False
SSH host key policy. Use the default SshHostKeyPolicy.Check to verify the host key against SshHostKeyFingerprint. Use SshHostKeyPolicy.GiveUpSecurityAndAcceptAny to give up a security and accept any SSH host key. To be used in exceptional situations only, when security is not required. When set, log files will include warning about insecure connection. Use SshHostKeyPolicy.AcceptNew to automatically accept host key of new hosts. The known keys are cached in registry.
```yaml
Type: String
Type: SshHostKeyPolicy
Parameter Sets: (All)
Aliases:

Expand Down
Binary file not shown.
Binary file not shown.
17 changes: 5 additions & 12 deletions WinSCP/Public/New-WinSCPSessionOption.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ function New-WinSCPSessionOption {
$FtpSecure = (New-Object -TypeName WinSCP.FtpSecure),

[Parameter()]
[Switch]
$GiveUpSecurityAndAcceptAnySshHostKey,

[Parameter()]
[Switch]
$GiveUpSecurityAndAcceptAnyTlsHostCertificate,
[Bool]
$GiveUpSecurityAndAcceptAnyTlsHostCertificate = $false,

[Parameter(
Mandatory = $true
Expand All @@ -49,7 +45,7 @@ function New-WinSCPSessionOption {

[Parameter()]
[WinSCP.Protocol]
$Protocol = ( New-Object -TypeName WinSCP.Protocol ),
$Protocol = (New-Object -TypeName WinSCP.Protocol),

[Parameter()]
[SecureString]
Expand All @@ -62,11 +58,8 @@ function New-WinSCPSessionOption {
$SshHostKeyFingerprint,

[Parameter()]
[ValidateSet(
"Check", "AcceptNew"
)]
[String]
$SshHostKeyPolicy = "Check",
[WinSCP.SshHostKeyPolicy]
$SshHostKeyPolicy = (New-Object -TypeName WinSCP.SshHostKeyPolicy),

[Parameter()]
[ValidateScript({
Expand Down
38 changes: 8 additions & 30 deletions WinSCP/en-US/WinSCP-Help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3116,24 +3116,14 @@ True 00:01:00 ftp.tomohulk.github.io</dev:code>
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>GiveUpSecurityAndAcceptAnySshHostKey</maml:name>
<maml:description>
<maml:para>Give up security and accept any SSH host key. To be used in exceptional situations only, when security is not required. When set, log files will include warning about insecure connection. To maintain security, use SshHostKeyFingerprint.</maml:para>
</maml:description>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>GiveUpSecurityAndAcceptAnyTlsHostCertificate</maml:name>
<maml:description>
<maml:para>Give up security and accept any FTPS/WebDAVS server TLS/SSL certificate. To be used in exceptional situations only, when security is not required. When set, log files will include warning about insecure connection. To maintain security, use TlsHostCertificateFingerprint.</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:name>Boolean</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>False</dev:defaultValue>
Expand Down Expand Up @@ -3304,9 +3294,9 @@ True 00:01:00 ftp.tomohulk.github.io</dev:code>
<maml:description>
<maml:para>SSH host key policy. Use the default SshHostKeyPolicy.Check to verify the host key against SshHostKeyFingerprint. Use SshHostKeyPolicy.GiveUpSecurityAndAcceptAny to give up a security and accept any SSH host key. To be used in exceptional situations only, when security is not required. When set, log files will include warning about insecure connection. Use SshHostKeyPolicy.AcceptNew to automatically accept host key of new hosts. The known keys are cached in registry.</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<command:parameterValue required="true" variableLength="false">SshHostKeyPolicy</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:name>SshHostKeyPolicy</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
Expand Down Expand Up @@ -3374,26 +3364,14 @@ True 00:01:00 ftp.tomohulk.github.io</dev:code>
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>GiveUpSecurityAndAcceptAnySshHostKey</maml:name>
<maml:description>
<maml:para>Give up security and accept any SSH host key. To be used in exceptional situations only, when security is not required. When set, log files will include warning about insecure connection. To maintain security, use SshHostKeyFingerprint.</maml:para>
</maml:description>
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>False</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>GiveUpSecurityAndAcceptAnyTlsHostCertificate</maml:name>
<maml:description>
<maml:para>Give up security and accept any FTPS/WebDAVS server TLS/SSL certificate. To be used in exceptional situations only, when security is not required. When set, log files will include warning about insecure connection. To maintain security, use TlsHostCertificateFingerprint.</maml:para>
</maml:description>
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
<command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue>
<dev:type>
<maml:name>SwitchParameter</maml:name>
<maml:name>Boolean</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>False</dev:defaultValue>
Expand Down Expand Up @@ -3559,9 +3537,9 @@ True 00:01:00 ftp.tomohulk.github.io</dev:code>
<maml:description>
<maml:para>SSH host key policy. Use the default SshHostKeyPolicy.Check to verify the host key against SshHostKeyFingerprint. Use SshHostKeyPolicy.GiveUpSecurityAndAcceptAny to give up a security and accept any SSH host key. To be used in exceptional situations only, when security is not required. When set, log files will include warning about insecure connection. Use SshHostKeyPolicy.AcceptNew to automatically accept host key of new hosts. The known keys are cached in registry.</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<command:parameterValue required="true" variableLength="false">SshHostKeyPolicy</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:name>SshHostKeyPolicy</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
Expand Down

0 comments on commit 633da2d

Please sign in to comment.