- Notifications
You must be signed in to change notification settings - Fork3
chore: enable tunnel binary verification#36
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
34793f0
37d463e
ee33e47
81e645c
bc09aa2
ecf8260
c0904fb
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -30,7 +30,7 @@ | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Content Include="coder.ico" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<AssemblyName>Coder.Desktop.Installer</AssemblyName> | ||
<RootNamespace>Coder.Desktop.Installer</RootNamespace> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net481</TargetFramework> | ||
<LangVersion>13.0</LangVersion> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<None Remove="*.msi" /> | ||
<None Remove="*.exe" /> | ||
<None Remove="*.wxs" /> | ||
<None Remove="*.wixpdb" /> | ||
<None Remove="*.wixobj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="WixSharp_wix4" Version="2.6.0" /> | ||
<PackageReference Include="WixSharp_wix4.bin" Version="2.6.0" /> | ||
<PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
</ItemGroup> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -250,13 +250,17 @@ private static int BuildMsiPackage(MsiOptions opts) | ||
programFiles64Folder.AddDir(installDir); | ||
project.AddDir(programFiles64Folder); | ||
// Add registry values that are consumed by the manager. Note that these | ||
// should not be changed. See Vpn.Service/Program.cs and | ||
// Vpn.Service/ManagerConfig.cs for more details. | ||
project.AddRegValues( | ||
new RegValue(RegistryHive, RegistryKey, "Manager:ServiceRpcPipeName", "Coder.Desktop.Vpn"), | ||
new RegValue(RegistryHive, RegistryKey, "Manager:TunnelBinaryPath", | ||
$"[INSTALLFOLDER]{opts.VpnDir}\\coder-vpn.exe"), | ||
new RegValue(RegistryHive, RegistryKey, "Manager:LogFileLocation", | ||
@"[INSTALLFOLDER]coder-desktop-service.log"), | ||
new RegValue(RegistryHive, RegistryKey, "Manager:TunnelBinarySignatureSigner", "Coder Technologies Inc."), | ||
new RegValue(RegistryHive, RegistryKey, "Manager:TunnelBinaryAllowVersionMismatch", "false")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. If I'm understanding this correctly, the
But that means we've got this string key coupling between these two sections of the code, which feels fragile if we were to change the name. Is there a way they could be based on the same constant? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I don't think we can without creating a new library package or adding this value to a package where it doesn't really belong like These values should never be changed anyways without some consideration for backwards compatibility. I can add comments to both of these places saying that it's not to be changed. | ||
// Note: most of this control panel info will not be visible as this | ||
// package is usually hidden in favor of the bootstrapper showing | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Coder Desktop for Windows | ||
This repo contains the C# source code for Coder Desktop for Windows. You can | ||
download the latest version from the GitHub releases. | ||
### Contributing | ||
You will need: | ||
- Visual Studio 2022 | ||
- .NET desktop development | ||
- WinUI application development | ||
- Windows 10 SDK (10.0.19041.0) | ||
- Wix Toolset 5.0.2 (if building the installer) | ||
It's also recommended to use JetBrains Rider (or VS + ReSharper) for a better | ||
experience. | ||
### License | ||
The Coder Desktop for Windows source is licensed under the GNU Affero General | ||
Public License v3.0 (AGPL-3.0). | ||
Some vendored files in this repo are licensed separately. The license for these | ||
files can be found in the same directory as the files. | ||
The binary distributions of Coder Desktop for Windows have some additional | ||
license disclaimers that can be found in | ||
[scripts/files/License.txt](scripts/files/License.txt) or during installation. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.go | ||
*.pfx |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
$errorActionPreference = "Stop" | ||
Set-Location $PSScriptRoot | ||
# If hello.go does not exist, write it. We don't check it into the repo to avoid | ||
# GitHub showing that the repo contains Go code. | ||
if (-not (Test-Path "hello.go")) { | ||
deansheather marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
$helloGo = @" | ||
package main | ||
func main() { | ||
println("Hello, World!") | ||
} | ||
"@ | ||
Set-Content -Path "hello.go" -Value $helloGo | ||
} | ||
& go.exe build -ldflags '-w -s' -o hello.exe hello.go | ||
if ($LASTEXITCODE -ne 0) { throw "Failed to build hello.exe" } | ||
# hello-invalid-version.exe is used for testing versioned binaries with an | ||
# invalid version. | ||
Copy-Item hello.exe hello-invalid-version.exe | ||
& go-winres.exe patch --in winres.json --delete --no-backup --product-version 1-2-3-4 --file-version 1-2-3-4 hello-invalid-version.exe | ||
if ($LASTEXITCODE -ne 0) { throw "Failed to patch hello-invalid-version.exe with go-winres" } | ||
# hello-self-signed.exe is used for testing untrusted binaries. | ||
Copy-Item hello.exe hello-self-signed.exe | ||
$helloSelfSignedPath = (Get-Item hello-self-signed.exe).FullName | ||
# Create a self signed certificate for signing and then delete it. | ||
$certStoreLocation = "Cert:\CurrentUser\My" | ||
$password = "password" | ||
$cert = New-SelfSignedCertificate ` | ||
-CertStoreLocation $certStoreLocation ` | ||
-DnsName coder.com ` | ||
-Subject "CN=coder-desktop-windows-self-signed-cert" ` | ||
-Type CodeSigningCert ` | ||
-KeyUsage DigitalSignature ` | ||
-NotAfter (Get-Date).AddDays(3650) | ||
$pfxPath = Join-Path $PSScriptRoot "cert.pfx" | ||
try { | ||
$securePassword = ConvertTo-SecureString -String $password -Force -AsPlainText | ||
Export-PfxCertificate -Cert $cert -FilePath $pfxPath -Password $securePassword | ||
# Sign hello-self-signed.exe with the self signed certificate | ||
& "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.19041.0\x64\signtool.exe" sign /debug /f $pfxPath /p $password /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 $helloSelfSignedPath | ||
if ($LASTEXITCODE -ne 0) { throw "Failed to sign hello-self-signed.exe with signtool" } | ||
} finally { | ||
if ($cert.Thumbprint) { | ||
Remove-Item -Path (Join-Path $certStoreLocation $cert.Thumbprint) -Force | ||
} | ||
if (Test-Path $pfxPath) { | ||
Remove-Item -Path $pfxPath -Force | ||
} | ||
} | ||
# hello-versioned-signed.exe is used for testing versioned binaries and | ||
# binaries signed by a real EV certificate. | ||
Copy-Item hello.exe hello-versioned-signed.exe | ||
& go-winres.exe patch --in winres.json --delete --no-backup --product-version 1.2.3.4 --file-version 1.2.3.4 hello-versioned-signed.exe | ||
if ($LASTEXITCODE -ne 0) { throw "Failed to patch hello-versioned-signed.exe with go-winres" } | ||
# Then sign hello-versioned-signed.exe with the same EV cert as our real | ||
# binaries. Since this is a bit more complicated and requires some extra | ||
# permissions, we don't do this in the build script. | ||
Write-Host "Don't forget to sign hello-versioned-signed.exe with the EV cert!" |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.