Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 19 additions & 2 deletions cmd/crc/cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"
"os/signal"
"regexp"
"runtime"
"syscall"
"time"

Expand All @@ -24,6 +25,7 @@ import (
"github.com/crc-org/crc/v2/pkg/crc/constants"
"github.com/crc-org/crc/v2/pkg/crc/daemonclient"
"github.com/crc-org/crc/v2/pkg/crc/logging"
"github.com/crc-org/crc/v2/pkg/fileserver/fs9p"
"github.com/crc-org/machine/libmachine/drivers"
"github.com/docker/go-units"
"github.com/gorilla/handlers"
Expand Down Expand Up @@ -177,7 +179,7 @@ func run(configuration *types.Configuration) error {
}
}()

ln, err := vn.Listen("tcp", fmt.Sprintf("%s:80", configuration.GatewayIP))
ln, err := vn.Listen("tcp", net.JoinHostPort(configuration.GatewayIP, "80"))
if err != nil {
return err
}
Expand All @@ -193,7 +195,7 @@ func run(configuration *types.Configuration) error {
}
}()

networkListener, err := vn.Listen("tcp", fmt.Sprintf("%s:80", hostVirtualIP))
networkListener, err := vn.Listen("tcp", net.JoinHostPort(hostVirtualIP, "80"))
if err != nil {
return err
}
Expand Down Expand Up @@ -248,6 +250,21 @@ func run(configuration *types.Configuration) error {
}
}()

// 9p home directory sharing
if runtime.GOOS == "windows" {
if _, err := fs9p.StartHvsockShares([]fs9p.HvsockMount9p{{Path: constants.GetHomeDir(), HvsockGUID: constants.Plan9HvsockGUID}}); err != nil {
logging.Warnf("Failed to start 9p file server on hvsock: %v", err)
logging.Warnf("Falling back to 9p over TCP")
listener9p, err := vn.Listen("tcp", net.JoinHostPort(configuration.GatewayIP, fmt.Sprintf("%d", constants.Plan9TcpPort)))
if err != nil {
return err
}
if _, err := fs9p.StartShares([]fs9p.Mount9p{{Listener: listener9p, Path: constants.GetHomeDir()}}); err != nil {
return err
}
}
}

startupDone()

if logging.IsDebug() {
Expand Down
11 changes: 0 additions & 11 deletions cmd/crc/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,6 @@ func runStart(ctx context.Context) (*types.StartResult, error) {
}
}

if runtime.GOOS == "windows" {
username, err := crcos.GetCurrentUsername()
if err != nil {
return nil, err
}

// config SharedDirPassword ('shared-dir-password') only exists in windows
startConfig.SharedDirPassword = config.Get(crcConfig.SharedDirPassword).AsString()
startConfig.SharedDirUsername = username
}

return client.Start(ctx, startConfig)
}

Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.24.0

require (
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/DeedleFake/p9 v0.6.12
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Add p9 dependency: OK. Please double-check any lingering SMB/CIFS references.

The module addition aligns with the move to 9P. As a precaution for this PR’s objective (remove SMB on Windows), scan the tree for any remaining SMB/CIFS usage or password plumbing.

Run this script to verify no SMB/CIFS remnants remain and that 9p is wired on Windows:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Expect: no matches (outside vendor)
rg -n --hidden --glob '!vendor/**' -e '\bSMB\b' -e '\bsmb\b' -e '\bcifs\b' -e 'mount\.cifs' -e 'SharedDirPassword' -e 'SharedDirUsername' -e 'net use' -e 'MSI.*custom.*action'

# Expect: matches in Windows driver code
rg -n --glob '!vendor/**' -e 'Type:\s*"9p"' pkg/crc/machine

Length of output: 820


Add p9 dependency: OK — remove leftover SMB/CIFS credential plumbing

9p is wired on Windows, but the repo still contains SharedDir credential fields/uses; these need to be removed or refactored.

Files to fix:

  • pkg/crc/machine/start.go:317-318 — SharedDirPassword / SharedDirUsername passed through
  • pkg/crc/machine/types/types.go:37-38 — SharedDirPassword / SharedDirUsername fields
  • pkg/crc/machine/config/config.go:24-25 — SharedDirPassword / SharedDirUsername config fields
  • pkg/crc/config/settings.go:34 — SharedDirPassword setting (sensitive)
  • pkg/crc/machine/libhvee/driver_windows.go:44 — Type: "9p" (expected; confirms 9p is in use)

Action: remove or replace SMB/CIFS credential plumbing (structs, config, callers, and settings) or explicitly document why they must remain. Re-run the search after changes to confirm no SMB/CIFS remnants remain.

🤖 Prompt for AI Agents
In go.mod line 7 and across the codebase (specifically pkg/crc/machine/start.go
lines ~317-318, pkg/crc/machine/types/types.go lines ~37-38,
pkg/crc/machine/config/config.go lines ~24-25, pkg/crc/config/settings.go line
~34, and pkg/crc/machine/libhvee/driver_windows.go line ~44) there are leftover
SharedDirUsername/SharedDirPassword SMB/CIFS credential fields and plumbing that
are no longer needed because 9p is used; remove the SharedDirUsername and
SharedDirPassword fields from structs and config, delete or refactor any callers
that pass these credentials (e.g., remove arguments, calls, and validation
related to them), remove the sensitive setting from settings.go (or mark
deprecated with migration if you must preserve data), and update
driver_windows.go to rely on 9p-only configuration; after making these
removals/refactors, run a repository-wide search to ensure no remaining SMB/CIFS
credential references exist and update any comments/docs to reflect the removal
or provide a short note documenting why SMB fields were removed.

github.com/Masterminds/semver/v3 v3.4.0
github.com/Microsoft/go-winio v0.6.2
github.com/ProtonMail/go-crypto v1.3.0
Expand All @@ -30,6 +31,7 @@ require (
github.com/klauspost/compress v1.18.0
github.com/klauspost/cpuid/v2 v2.3.0
github.com/kofalt/go-memoize v0.0.0-20220914132407-0b5d6a304579
github.com/linuxkit/virtsock v0.0.0-20220523201153-1a23e78aa7a2
github.com/mattn/go-colorable v0.1.14
github.com/mdlayher/vsock v1.2.1
github.com/onsi/ginkgo/v2 v2.25.3
Expand Down Expand Up @@ -130,7 +132,6 @@ require (
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/pgzip v1.2.6 // indirect
github.com/letsencrypt/boulder v0.0.0-20240620165639-de9c06129bec // indirect
github.com/linuxkit/virtsock v0.0.0-20220523201153-1a23e78aa7a2 // indirect
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
Expand Down
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
al.essio.dev/pkg/shellescape v1.5.1 h1:86HrALUujYS/h+GtqoB26SBEdkWfmMI6FubjXlsXyho=
al.essio.dev/pkg/shellescape v1.5.1/go.mod h1:6sIqp7X2P6mThCQ7twERpZTuigpr6KbZWtls1U8I890=
bazil.org/fuse v0.0.0-20200524192727-fb710f7dfd05/go.mod h1:h0h5FBYpXThbvSfTqthw+0I4nmHnhTHkO5BoOHsBWqg=
dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8=
dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA=
github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ=
github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo=
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/DeedleFake/p9 v0.6.12 h1:U5Qe5t2T3LKeHkDT6gDJO8pA2Gi55dXiQlrw298SzQg=
github.com/DeedleFake/p9 v0.6.12/go.mod h1:LcYdvTijmdXNKjxjAY1mwRaAZSLI8EiYtYCS8iLZnNc=
github.com/Julusian/godocdown v0.0.0-20170816220326-6d19f8ff2df8/go.mod h1:INZr5t32rG59/5xeltqoCJoNY7e5x/3xoY9WSWVWg74=
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
Expand Down Expand Up @@ -106,8 +110,10 @@ github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQ
github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw=
github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw=
github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
github.com/elazarl/goproxy v1.7.2 h1:Y2o6urb7Eule09PjlhQRGNsqRfPmYI3KKQLFpCAV3+o=
github.com/elazarl/goproxy v1.7.2/go.mod h1:82vkLNir0ALaW14Rc399OTTjyNREgmdL2cVoIbS6XaE=
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
Expand Down Expand Up @@ -333,6 +339,7 @@ github.com/r3labs/sse/v2 v2.10.0/go.mod h1:Igau6Whc+F17QUgML1fYe1VPZzTV6EMCnYktE
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481/go.mod h1:C9WhFzY47SzYBIvzFqSvHIR6ROgDo4TtdTuRaOMjF/s=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
Expand Down Expand Up @@ -381,6 +388,7 @@ github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY=
github.com/stefanberger/go-pkcs11uri v0.0.0-20230803200340-78284954bff6 h1:pnnLyeX7o/5aX8qUQ69P/mLojDqwda8hFOCBTmP/6hw=
github.com/stefanberger/go-pkcs11uri v0.0.0-20230803200340-78284954bff6/go.mod h1:39R/xuhNgVhi+K0/zst4TLrJrVmbm6LVgl4A0+ZFS5M=
github.com/stephens2424/writerset v1.0.2/go.mod h1:aS2JhsMn6eA7e82oNmW4rfsgAOp9COBTTl8mzkwADnc=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand All @@ -404,6 +412,7 @@ github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8O
github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=
github.com/tklauser/numcpus v0.10.0/go.mod h1:BiTKazU708GQTYF4mB+cmlpT2Is1gLk7XVuEeem8LsQ=
github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM=
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 h1:pyC9PaHYZFgEKFdlp3G8RaCKgVpHZnecvArXvPXcFkM=
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701/go.mod h1:P3a5rG4X7tI17Nn3aOIAYr5HbIMukwXG0urG0WuL8OA=
github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY=
Expand Down Expand Up @@ -496,9 +505,11 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190529164535-6a60838ec259/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down Expand Up @@ -542,6 +553,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200423201157-2723c5de0d66/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
Expand Down
36 changes: 6 additions & 30 deletions packaging/windows/product.wxs.template
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@
Name="Path" />
</Property>

<Property Id="USERFOLDER">
<DirectorySearch Id="userProfileSearch" Depth="0" Path="[%USERPROFILE]" />
</Property>

<Property Id="SHAREDDIRNAME" Secure="yes">crc-dir0</Property>

<util:Group Id="CrcUsersGroup" Name="crc-users" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
Expand Down Expand Up @@ -72,6 +66,11 @@
<RegistryValue Type="string" Name="ElementName" Value="gvisor-tap-vsock" KeyPath="yes"/>
</RegistryKey>
</Component>
<Component Id="Hvsock9pRegistryEntry" Guid="*">
<RegistryKey Root="HKLM" Key="Software\Microsoft\Windows NT\CurrentVersion\Virtualization\GuestCommunicationServices\00009000-FACB-11E6-BD58-64006A7986D3">
<RegistryValue Type="string" Name="ElementName" Value="fs9p-hvsock" KeyPath="yes"/>
</RegistryKey>
</Component>
Comment on lines +69 to +73
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Write 9P HVSOCK registry to 64‑bit hive (avoid WOW6432 redirection).

Without marking the component as 64‑bit, the key may land under Wow6432Node and not be honored by Guest Communication Services.

Apply this diff:

-                    <Component Id="Hvsock9pRegistryEntry" Guid="*">
+                    <Component Id="Hvsock9pRegistryEntry" Guid="*" Win64="yes">
                         <RegistryKey Root="HKLM" Key="Software\Microsoft\Windows NT\CurrentVersion\Virtualization\GuestCommunicationServices\00009000-FACB-11E6-BD58-64006A7986D3">
                             <RegistryValue Type="string" Name="ElementName" Value="fs9p-hvsock" KeyPath="yes"/>
                         </RegistryKey>
                     </Component>

Optional (recommended): also mark VsockRegistryEntry as Win64 for consistency:

-                    <Component Id="VsockRegistryEntry" Guid="*">
+                    <Component Id="VsockRegistryEntry" Guid="*" Win64="yes">
🤖 Prompt for AI Agents
In packaging/windows/product.wxs.template around lines 69 to 73, the
Hvsock9pRegistryEntry component currently writes to the registry without
specifying 64-bit, which can cause the key to be redirected under Wow6432Node;
update the Component element to include Win64="yes" so the registry key is
written to the 64-bit hive, and for consistency also set Win64="yes" on the
VsockRegistryEntry component.

</Directory>
</Directory>
</Directory>
Expand All @@ -92,24 +91,6 @@
Before="AddUserToHypervAdminGroup"
Sequence="execute"/>
<CustomAction Id="AddUserToHypervAdminGroup" BinaryKey="WixCA" DllEntry="WixQuietExec64" Execute="deferred" Impersonate="no" Return="ignore" />
<SetProperty Action="CACreateSMBShare"
Id="CreateSMBShare"
Value="&quot;[POWERSHELLEXE]&quot; -NonInteractive -ExecutionPolicy Bypass -NoProfile -Command &quot;New-SmbShare -Name '[SHAREDDIRNAME]' -Path '[USERFOLDER]' -FullAccess '[LogonUser]'&quot;"
Before="CreateSMBShare"
Sequence="execute"/>
<CustomAction Id="CreateSMBShare" BinaryKey="WixCA" DllEntry="WixQuietExec64" Execute="deferred" Impersonate="no" Return="ignore" />
<SetProperty Action="CAEnableFileAndPrinterSharing"
Id="EnableFileAndPrinterSharing"
Value="&quot;[POWERSHELLEXE]&quot; -NonInteractive -ExecutionPolicy Bypass -NoProfile -Command &quot;Set-NetFirewallRule -Group '@FirewallAPI.dll,-28502' -Enabled True -Profile 'Private,Public'&quot;"
Before="EnableFileAndPrinterSharing"
Sequence="execute"/>
<CustomAction Id="EnableFileAndPrinterSharing" BinaryKey="WixCA" DllEntry="WixQuietExec64" Execute="deferred" Impersonate="no" Return="ignore" />
<SetProperty Action="CARemoveSMBShare"
Id="RemoveSMBShare"
Value="&quot;[POWERSHELLEXE]&quot; -NonInteractive -ExecutionPolicy Bypass -NoProfile -Command &quot;Remove-SmbShare -Name '[SHAREDDIRNAME]' -Force&quot;"
Before="RemoveSMBShare"
Sequence="execute"/>
<CustomAction Id="RemoveSMBShare" BinaryKey="WixCA" DllEntry="WixQuietExec64" Execute="deferred" Impersonate="no" Return="ignore" />

<InstallExecuteSequence>
<Custom Action="CreateCrcGroup" Before="ConfigureUsers"> NOT Installed AND NOT REMOVE~="ALL" AND NOT WIX_UPGRADE_DETECTED</Custom>
Expand All @@ -118,9 +99,6 @@
<Custom Action="InstallHyperv" Before="CreateCrcGroup"> NOT Installed AND NOT REMOVE~="ALL" AND NOT WIX_UPGRADE_DETECTED</Custom>
<Custom Action="RemoveCrcGroupRollback" After="CreateCrcGroup"> NOT Installed AND NOT REMOVE~="ALL" AND NOT WIX_UPGRADE_DETECTED</Custom>
<Custom Action="RemoveCrcDaemonTask" Before='RemoveFiles'>Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
<Custom Action="EnableFileAndPrinterSharing" After="AddUserToHypervAdminGroup"> NOT Installed AND NOT REMOVE~="ALL" AND NOT WIX_UPGRADE_DETECTED</Custom>
<Custom Action="CreateSMBShare" After="EnableFileAndPrinterSharing"> NOT Installed AND NOT REMOVE~="ALL"</Custom>
<Custom Action="RemoveSMBShare" After='RemoveCrcDaemonTask'>Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
<ScheduleReboot After="InstallFinalize"> NOT Installed AND NOT REMOVE~="ALL" AND NOT WIX_UPGRADE_DETECTED</ScheduleReboot>
</InstallExecuteSequence>
<Feature Id="DefaultFeature" Title="Install core features" Absent="disallow" Level="1">
Expand All @@ -130,6 +108,7 @@
<ComponentRef Id="AddToPath"/>
<ComponentRef Id="AddUserToCrcUsers" />
<ComponentRef Id="VsockRegistryEntry" />
<ComponentRef Id="Hvsock9pRegistryEntry" />
</Feature>
<UI>
<UIRef Id="WixUI_ErrorProgressText"/>
Expand All @@ -140,9 +119,6 @@
<ProgressText Action="InstallHyperv">Installing Hyper-V</ProgressText>
<ProgressText Action="AddUserToHypervAdminGroup">Adding user: [LogonUser] to Hyper-V Administrators group</ProgressText>
<ProgressText Action="RemoveCrcDaemonTask">Removing crcDaemon task</ProgressText>
<ProgressText Action="CreateSMBShare">Creating share named: [SHAREDDIRNAME] for folder: [USERFOLDER]</ProgressText>
<ProgressText Action="RemoveSMBShare">Removing share named: [SHAREDDIRNAME] for folder: [USERFOLDER]</ProgressText>
<ProgressText Action="EnableFileAndPrinterSharing">Enabling file and printer Sharing</ProgressText>
</UI>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<!-- this should help to propagate env var changes -->
Expand Down
26 changes: 2 additions & 24 deletions pkg/crc/config/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package config

import (
"fmt"
"runtime"

"github.com/crc-org/crc/v2/pkg/crc/constants"
"github.com/crc-org/crc/v2/pkg/crc/logging"
Expand Down Expand Up @@ -62,17 +61,6 @@ func RegisterSettings(cfg *Config) {
return validateBundlePath(value, GetPreset(cfg))
}

validateSmbSharedDirs := func(value interface{}) (bool, string) {
if !cfg.Get(HostNetworkAccess).AsBool() {
return false, fmt.Sprintf("%s can only be used with %s set to 'true'",
EnableSharedDirs, HostNetworkAccess)
}
if cfg.Get(SharedDirPassword).IsDefault {
return false, fmt.Sprintf("Please set '%s' first to enable shared directories", SharedDirPassword)
}
return ValidateBool(value)
}

// Preset setting should be on top because CPUs/Memory config depend on it.
cfg.AddSetting(Preset, version.GetDefaultPreset().String(), validatePreset, RequiresDeleteAndSetupMsg,
fmt.Sprintf("Virtual machine preset (valid values are: %s)", preset.AllPresets()))
Expand All @@ -96,18 +84,8 @@ func RegisterSettings(cfg *Config) {
"Enable emergency login for 'core' user. Password is randomly generated. (true/false, default: false)")
cfg.AddSetting(PersistentVolumeSize, constants.DefaultPersistentVolumeSize, validatePersistentVolumeSize, SuccessfullyApplied,
fmt.Sprintf("Total size in GiB of the persistent volume used by the CSI driver for %s preset (must be greater than or equal to '%d')", preset.Microshift, constants.DefaultPersistentVolumeSize))

// Shared directories configs
if runtime.GOOS == "windows" {
cfg.AddSetting(SharedDirPassword, Secret(""), validateString, SuccessfullyApplied,
"Password used while using CIFS/SMB file sharing (It is the password for the current logged in user)")

cfg.AddSetting(EnableSharedDirs, false, validateSmbSharedDirs, SuccessfullyApplied,
"Mounts host's user profile folder at '/' in the CRC VM (true/false, default: false)")
} else {
cfg.AddSetting(EnableSharedDirs, true, ValidateBool, SuccessfullyApplied,
"Mounts host's home directory at '/' in the CRC VM (true/false, default: true)")
}
cfg.AddSetting(EnableSharedDirs, true, ValidateBool, SuccessfullyApplied,
"Mounts host's home directory at '/' in the CRC VM (true/false, default: true)")

if !version.IsInstaller() {
cfg.AddSetting(NetworkMode, string(defaultNetworkMode()), network.ValidateMode, network.SuccessfullyAppliedMode,
Expand Down
5 changes: 5 additions & 0 deletions pkg/crc/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ const (
OpenShiftIngressHTTPSPort = 443

BackgroundLauncherExecutable = "crc-background-launcher.exe"

Plan9Msize = 1024 * 1024
Plan9TcpPort = 564
Plan9HvsockGUID = "00009000-FACB-11E6-BD58-64006A7986D3"
Plan9HvsockPort = 36864
)

var adminHelperExecutableForOs = map[string]string{
Expand Down
16 changes: 0 additions & 16 deletions pkg/crc/machine/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,3 @@ func setDiskSize(host *host.Host, diskSize strongunits.GiB) error {

return updateDriverValue(host, diskSizeSetter)
}

func setSharedDirPassword(host *host.Host, password string) error {
driver, err := loadDriverConfig(host)
if err != nil {
return err
}

if len(driver.SharedDirs) == 0 {
return nil
}

for i := range driver.SharedDirs {
driver.SharedDirs[i].Password = password
}
return updateDriverStruct(host, driver)
}
5 changes: 0 additions & 5 deletions pkg/crc/machine/driver_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
machineVf "github.com/crc-org/crc/v2/pkg/drivers/vfkit"
"github.com/crc-org/crc/v2/pkg/libmachine"
"github.com/crc-org/crc/v2/pkg/libmachine/host"
"github.com/crc-org/machine/libmachine/drivers"
)

func newHost(api libmachine.API, machineConfig config.MachineConfig) (*host.Host, error) {
Expand All @@ -35,7 +34,3 @@ func updateDriverConfig(host *host.Host, driver *machineVf.Driver) error {

return host.UpdateConfig(driverData)
}

func updateDriverStruct(_ *host.Host, _ *machineVf.Driver) error {
return drivers.ErrNotImplemented
}
5 changes: 0 additions & 5 deletions pkg/crc/machine/driver_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/crc-org/crc/v2/pkg/libmachine"
"github.com/crc-org/crc/v2/pkg/libmachine/host"
machineLibvirt "github.com/crc-org/machine/drivers/libvirt"
"github.com/crc-org/machine/libmachine/drivers"
)

func newHost(api libmachine.API, machineConfig config.MachineConfig) (*host.Host, error) {
Expand Down Expand Up @@ -44,7 +43,3 @@ func (r *RPCServerDriver) SetConfigRaw(data []byte, _ *struct{}) error {
return json.Unmarshal(data, &r.ActualDriver)
}
*/

func updateDriverStruct(_ *host.Host, _ *machineLibvirt.Driver) error {
return drivers.ErrNotImplemented
}
5 changes: 0 additions & 5 deletions pkg/crc/machine/driver_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,3 @@ func updateDriverConfig(host *host.Host, driver *machineLibhvee.Driver) error {
}
return host.UpdateConfig(driverData)
}

func updateDriverStruct(host *host.Host, driver *machineLibhvee.Driver) error {
host.Driver = driver
return nil
}
Loading
Loading