Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added special char trimming for ssl and updated help texts #3724

Merged
merged 2 commits into from
Mar 3, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"loc.input.label.WebsiteAuthUserName": "Username",
"loc.input.help.WebsiteAuthUserName": "Provide the user name that will be used to access the website's physical path.",
"loc.input.label.WebsiteAuthUserPassword": "Password",
"loc.input.help.WebsiteAuthUserPassword": "Provide the user's password that will be used to access the website's physical path.",
"loc.input.help.WebsiteAuthUserPassword": "Provide the user's password that will be used to access the website's physical path. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. <br> Note: Special characters in password are interpreted as per <a href=\"https://go.microsoft.com/fwlink/?linkid=843470\">command-line arguments</a>",
"loc.input.label.AddBinding": "Add binding",
"loc.input.help.AddBinding": "Select the option to add port binding for the website.",
"loc.input.label.Protocol": "Protocol",
Expand Down Expand Up @@ -57,7 +57,7 @@
"loc.input.label.AppPoolUsernameForWebsite": "Username",
"loc.input.help.AppPoolUsernameForWebsite": "Provide the username of the custom account that you want to use.",
"loc.input.label.AppPoolPasswordForWebsite": "Password",
"loc.input.help.AppPoolPasswordForWebsite": "Provide the password for custom account. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. ",
"loc.input.help.AppPoolPasswordForWebsite": "Provide the password for custom account. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. <br> Note: Special characters in password are interpreted as per <a href=\"https://go.microsoft.com/fwlink/?linkid=843470\">command-line arguments</a>",
"loc.input.label.ParentWebsiteNameForVD": "Parent website name",
"loc.input.help.ParentWebsiteNameForVD": "Provide the name of the parent Website of the virtual directory.",
"loc.input.label.VirtualPathForVD": "Virtual path",
Expand All @@ -69,7 +69,7 @@
"loc.input.label.VDAuthUserName": "Username",
"loc.input.help.VDAuthUserName": "Provide the user name that will be used to access the virtual directory's physical path.",
"loc.input.label.VDAuthUserPassword": "Password",
"loc.input.help.VDAuthUserPassword": "Provide the user's password that will be used to access the virtual directory's physical path.",
"loc.input.help.VDAuthUserPassword": "Provide the user's password that will be used to access the virtual directory's physical path. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. <br> Note: Special characters in password are interpreted as per <a href=\"https://go.microsoft.com/fwlink/?linkid=843470\">command-line arguments</a>",
"loc.input.label.ParentWebsiteNameForApplication": "Parent website name",
"loc.input.help.ParentWebsiteNameForApplication": "Provide the name of the parent Website under which the application will be created or updated.",
"loc.input.label.VirtualPathForApplication": "Virtual path",
Expand All @@ -81,7 +81,7 @@
"loc.input.label.ApplicationAuthUserName": "Username",
"loc.input.help.ApplicationAuthUserName": "Provide the user name that will be used to access the application's physical path.",
"loc.input.label.ApplicationAuthUserPassword": "Password",
"loc.input.help.ApplicationAuthUserPassword": "Provide the user's password that will be used to access the application's physical path.",
"loc.input.help.ApplicationAuthUserPassword": "Provide the user's password that will be used to access the application's physical path. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. <br> Note: Special characters in password are interpreted as per <a href=\"https://go.microsoft.com/fwlink/?linkid=843470\">command-line arguments</a>",
"loc.input.label.CreateOrUpdateAppPoolForApplication": "Create or update app pool",
"loc.input.help.CreateOrUpdateAppPoolForApplication": "Select the option to create or update an application pool. If checked, the application will be created in the specified app pool.",
"loc.input.label.AppPoolNameForApplication": "Name",
Expand All @@ -95,7 +95,7 @@
"loc.input.label.AppPoolUsernameForApplication": "Username",
"loc.input.help.AppPoolUsernameForApplication": "Provide the username of the custom account that you want to use.",
"loc.input.label.AppPoolPasswordForApplication": "Password",
"loc.input.help.AppPoolPasswordForApplication": "Provide the password for custom account. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'.",
"loc.input.help.AppPoolPasswordForApplication": "Provide the password for custom account. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. <br> Note: Special characters in password are interpreted as per <a href=\"https://go.microsoft.com/fwlink/?linkid=843470\">command-line arguments</a>",
"loc.input.label.AppPoolName": "Name",
"loc.input.help.AppPoolName": "Provide the name of the IIS application pool to create or update.",
"loc.input.label.DotNetVersion": ".NET version",
Expand All @@ -107,7 +107,7 @@
"loc.input.label.AppPoolUsername": "Username",
"loc.input.help.AppPoolUsername": "Provide the username of the custom account that you want to use.",
"loc.input.label.AppPoolPassword": "Password",
"loc.input.help.AppPoolPassword": "Provide the password for custom account. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'.",
"loc.input.help.AppPoolPassword": "Provide the password for custom account. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. <br> Note: Special characters in password are interpreted as per <a href=\"https://go.microsoft.com/fwlink/?linkid=843470\">command-line arguments</a>",
"loc.input.label.StartStopRecycleAppPoolName": "Application pool name",
"loc.input.help.StartStopRecycleAppPoolName": "Provide the name of the IIS application pool.",
"loc.input.label.AppCmdCommands": "Additional appcmd.exe commands",
Expand All @@ -116,5 +116,6 @@
"loc.messages.InvalidVirtualPath": "Virtual path should begin with a /",
"loc.messages.InvalidIISDeploymentType": "Invalid IIS Deployment Type : {0}",
"loc.messages.InvalidActionIISWebsite": "Invalid action '{0}' selected for the IIS Website.",
"loc.messages.InvalidActionIISAppPool": "Invalid action '{0}' selected for the IIS Application Pool."
"loc.messages.InvalidActionIISAppPool": "Invalid action '{0}' selected for the IIS Application Pool.",
"loc.messages.SSLCertWarningInvalidCharacters": "SSL Certificate thumbprint contains non-hexadecimal characters. Trimming all non-hexadecimal characters."
}
28 changes: 14 additions & 14 deletions Tasks/IISWebAppManagementOnMachineGroup/Tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ describe('IISWebAppManagementOnMachineGroup Suite', function () {
psr.run(path.join(__dirname, 'L0AppcmdAddUpdateWebsite.ps1'), done);
})

it('test website add binding', (done) => {
it('test add binding for website', (done) => {
psr.run(path.join(__dirname, 'L0AppcmdTestBinding.ps1'), done);
})

it('test sni and sslcert addition', (done) => {
it('test sni and sslcert addition for https binding', (done) => {
psr.run(path.join(__dirname, 'L0AppcmdTestSSLandSNI.ps1'), done);
})

Expand All @@ -56,40 +56,40 @@ describe('IISWebAppManagementOnMachineGroup Suite', function () {
psr.run(path.join(__dirname, 'L0AppcmdTestApplicationExists.ps1'), done);
})

it('test add and update application function', (done) => {
it('test add and update application', (done) => {
psr.run(path.join(__dirname, 'L0AppcmdAddUpdateApplication.ps1'), done);
})

it('test virtual directory exists function', (done) => {
it('test virtual directory exists', (done) => {
psr.run(path.join(__dirname, 'L0AppcmdTestVirtualDirExists.ps1'), done);
})

it('test add and update virtual directory function', (done) => {
it('test add and update virtual directory', (done) => {
psr.run(path.join(__dirname, 'L0AppcmdAddUpdateVDir.ps1'), done);
})

it('test additional actions', (done) => {
it('test additional actions for website and application pool', (done) => {
psr.run(path.join(__dirname, 'L0AppcmdAdditionalActions.ps1'), done);
})

it('test execute-main function', (done) => {
it('test execute main for appcmd', (done) => {
psr.run(path.join(__dirname, 'L0AppcmdExecuteMain.ps1'), done);
})

it('test iis manage utility - manage virtual directory', (done) => {
psr.run(path.join(__dirname, 'L0UtilityManageVDir.ps1'), done);
it('test iis manage utility - manage website', (done) => {
psr.run(path.join(__dirname, 'L0UtilityManageWebsite.ps1'), done);
})

it('test iis manage utility - manage application', (done) => {
psr.run(path.join(__dirname, 'L0UtilityManageApp.ps1'), done);
})

it('test iis manage utility - manage virtual directory', (done) => {
psr.run(path.join(__dirname, 'L0UtilityManageVDir.ps1'), done);
})

it('test iis manage utility - manage application pool', (done) => {
psr.run(path.join(__dirname, 'L0UtilityManageAppPool.ps1'), done);
})

it('test iis manage utility - manage website', (done) => {
psr.run(path.join(__dirname, 'L0UtilityManageWebsite.ps1'), done);
})
}
});
6 changes: 5 additions & 1 deletion Tasks/IISWebAppManagementOnMachineGroup/Utility.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ function Trim-Inputs([ref]$siteName, [ref]$physicalPath, [ref]$poolName, [ref]$v
}
if ($sslCertThumbPrint -ne $null)
{
$sslCertThumbPrint.Value = $sslCertThumbPrint.Value.Trim()
# Trim all non-hexadecimal characters from the ssl cetificate thumbprint
Write-Warning (Get-VstsLocString -Key "SSLCertWarningInvalidCharacters")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write warning only when there are non-hexadecimal characters

$sslCertThumbprint.Value = [Regex]::Replace($sslCertThumbprint.Value, "[^a-fA-F0-9]+" , "")
$sslCertThumbprintValue = $sslCertThumbprint.Value
Write-Host "##vso[task.setvariable variable=sslCertThumbprint;isSecret=true]$sslCertThumbprintValue"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the variable name may collide. How about using a GUID?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a comment to convey the intent

}
}

Expand Down
17 changes: 9 additions & 8 deletions Tasks/IISWebAppManagementOnMachineGroup/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"version": {
"Major": 0,
"Minor": 2,
"Patch": 0
"Patch": 1
},
"minimumAgentVersion": "2.111.0",
"instanceNameFormat": "Manage $(IISDeploymentType)",
Expand Down Expand Up @@ -153,7 +153,7 @@
"groupName": "Website",
"defaultValue": "",
"visibleRule": "WebsitePhysicalPathAuth = WebsiteWindowsAuth",
"helpMarkDown": "Provide the user's password that will be used to access the website's physical path."
"helpMarkDown": "Provide the user's password that will be used to access the website's physical path. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. <br> Note: Special characters in password are interpreted as per <a href=\"https://go.microsoft.com/fwlink/?linkid=843470\">command-line arguments</a>"
},
{
"name": "AddBinding",
Expand Down Expand Up @@ -326,7 +326,7 @@
"defaultValue": "",
"required": false,
"groupName": "ApplicationPoolForWebsite",
"helpMarkDown": "Provide the password for custom account. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. ",
"helpMarkDown": "Provide the password for custom account. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. <br> Note: Special characters in password are interpreted as per <a href=\"https://go.microsoft.com/fwlink/?linkid=843470\">command-line arguments</a>",
"visibleRule": "AppPoolIdentityForWebsite = SpecificUser"
},
{
Expand Down Expand Up @@ -385,7 +385,7 @@
"required": false,
"defaultValue": "",
"visibleRule": "VDPhysicalPathAuth = VDWindowsAuth",
"helpMarkDown": "Provide the user's password that will be used to access the virtual directory's physical path."
"helpMarkDown": "Provide the user's password that will be used to access the virtual directory's physical path. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. <br> Note: Special characters in password are interpreted as per <a href=\"https://go.microsoft.com/fwlink/?linkid=843470\">command-line arguments</a>"
},
{
"name": "ParentWebsiteNameForApplication",
Expand Down Expand Up @@ -443,7 +443,7 @@
"required": false,
"defaultValue": "",
"visibleRule": "ApplicationPhysicalPathAuth = ApplicationWindowsAuth",
"helpMarkDown": "Provide the user's password that will be used to access the application's physical path."
"helpMarkDown": "Provide the user's password that will be used to access the application's physical path. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. <br> Note: Special characters in password are interpreted as per <a href=\"https://go.microsoft.com/fwlink/?linkid=843470\">command-line arguments</a>"
},
{
"name": "CreateOrUpdateAppPoolForApplication",
Expand Down Expand Up @@ -524,7 +524,7 @@
"required": false,
"groupName": "ApplicationPoolForApplication",
"visibleRule": "AppPoolIdentityForApplication = SpecificUser",
"helpMarkDown": "Provide the password for custom account. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'."
"helpMarkDown": "Provide the password for custom account. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. <br> Note: Special characters in password are interpreted as per <a href=\"https://go.microsoft.com/fwlink/?linkid=843470\">command-line arguments</a>"
},
{
"name": "AppPoolName",
Expand Down Expand Up @@ -596,7 +596,7 @@
"required": false,
"groupName": "ApplicationPool",
"visibleRule": "AppPoolIdentity = SpecificUser",
"helpMarkDown": "Provide the password for custom account. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'."
"helpMarkDown": "Provide the password for custom account. <br/>The best practice is to create a variable in the Build or Release definition, and mark it as 'Secret' to secure it, and then use it here, like '$(userCredentials)'. <br> Note: Special characters in password are interpreted as per <a href=\"https://go.microsoft.com/fwlink/?linkid=843470\">command-line arguments</a>"
},
{
"name": "StartStopRecycleAppPoolName",
Expand Down Expand Up @@ -627,7 +627,8 @@
"InvalidVirtualPath": "Virtual path should begin with a /",
"InvalidIISDeploymentType": "Invalid IIS Deployment Type : {0}",
"InvalidActionIISWebsite": "Invalid action '{0}' selected for the IIS Website.",
"InvalidActionIISAppPool": "Invalid action '{0}' selected for the IIS Application Pool."
"InvalidActionIISAppPool": "Invalid action '{0}' selected for the IIS Application Pool.",
"SSLCertWarningInvalidCharacters": "SSL Certificate thumbprint contains non-hexadecimal characters. Trimming all non-hexadecimal characters."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be good to add a forward link to documentation here and help-markdown https://msdn.microsoft.com/en-us/library/windows/desktop/cc307220(v=vs.85).aspx

}

}
5 changes: 3 additions & 2 deletions Tasks/IISWebAppManagementOnMachineGroup/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"version": {
"Major": 0,
"Minor": 2,
"Patch": 0
"Patch": 1
},
"minimumAgentVersion": "2.111.0",
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
Expand Down Expand Up @@ -627,6 +627,7 @@
"InvalidVirtualPath": "ms-resource:loc.messages.InvalidVirtualPath",
"InvalidIISDeploymentType": "ms-resource:loc.messages.InvalidIISDeploymentType",
"InvalidActionIISWebsite": "ms-resource:loc.messages.InvalidActionIISWebsite",
"InvalidActionIISAppPool": "ms-resource:loc.messages.InvalidActionIISAppPool"
"InvalidActionIISAppPool": "ms-resource:loc.messages.InvalidActionIISAppPool",
"SSLCertWarningInvalidCharacters": "ms-resource:loc.messages.SSLCertWarningInvalidCharacters"
}
}