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

Docs: More failsafe on WSLENV having colon [skip ci][ci skip] #2408

Merged
merged 1 commit into from
Jul 22, 2020

Conversation

rfay
Copy link
Member

@rfay rfay commented Jul 21, 2020

The Problem/Issue/Bug:

People have had trouble with ";" in the WSLENV environment variable. The result is not being able to get a trusted connection in chrome.

How this PR Solves The Problem:

Make sure that the WSLENV variable gets set to a usable value, even if it was previously set wrong.

Manual Testing Instructions:

Automated Testing Overview:

Related Issue Link(s):

Release/Deployment notes:

@rfay rfay requested a review from gilbertsoft July 21, 2020 23:25
@@ -63,7 +63,7 @@ We'll walk through these in more detail. You may prefer other techniques of inst
2. **Chocolatey:** We recommend using Chocolatey for [Chocolatey](https://chocolatey.org/install) installing required Windows apps like mkcert. In an administrative PowerShell, `Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))`
3. In an administrative PowerShell: `choco install -y mkcert`
4. In administrative PowerShell, run `mkcert -install` and answer the prompt allowing the installation of the Certificate Authority.
5. In administrative PowerShell, run the command `setx CAROOT "$(mkcert -CAROOT)"; If ($Env:WSLENV -notlike "*CAROOT*") { setx WSLENV "CAROOT/up:$Env:WSLENV" }`. This will set WSL2 to use the Certificate Authority installed on the Windows side.
5. In administrative PowerShell, run the command `setx CAROOT "$(mkcert -CAROOT)"; If ($Env:WSLENV -notlike "*CAROOT/up:*") { setx WSLENV "CAROOT/up:$Env:WSLENV" }`. This will set WSL2 to use the Certificate Authority installed on the Windows side.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
5. In administrative PowerShell, run the command `setx CAROOT "$(mkcert -CAROOT)"; If ($Env:WSLENV -notlike "*CAROOT/up:*") { setx WSLENV "CAROOT/up:$Env:WSLENV" }`. This will set WSL2 to use the Certificate Authority installed on the Windows side.
5. In administrative PowerShell, run the command `setx CAROOT "$(mkcert -CAROOT)"; If ($Env:WSLENV -notlike "*CAROOT/up:*") { setx WSLENV ("CAROOT/up:" + ($Env:WSLENV -replace '(.*)CAROOT[^:;]*[:;](.*)', '$1$2').Trim(':')) }`. This will set WSL2 to use the Certificate Authority installed on the Windows side.

Copy link
Member

Choose a reason for hiding this comment

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

Here we go, this new PS script should now also fix the errors from the first version with using ; instead of : as separator. It also fixes wrong options if a user has set it before.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't object to the trim, but WSENV works fine without it. Also doubled CAROOT/up:CAROOT/up: works fine.

I really appreciate you adding this, but I think it's simpler as is. I think well-tested version of this will be OK in your script, but I'm going to pass on it here.

Copy link
Member

Choose a reason for hiding this comment

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

The trim is to ensure we don't have a separator at the begin and end which could lead then to two separators, it's not really important but produces a cleaner variable value.

@rfay rfay merged commit 0be1896 into ddev:master Jul 22, 2020
@rfay rfay deleted the 20200721_wslenv branch July 22, 2020 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants