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

Bridged Network Support #243

Closed
fkorotkov opened this issue Sep 13, 2022 · 20 comments · Fixed by #245 or #429
Closed

Bridged Network Support #243

fkorotkov opened this issue Sep 13, 2022 · 20 comments · Fixed by #245 or #429
Labels
not possible atm Not possible at the moment

Comments

@fkorotkov
Copy link
Contributor

We got approved for the com.apple.vm.networking entitlement so now we can use VZBridgedNetworkDeviceAttachment.

FYI @naikrovek @magnusviri

@naikrovek
Copy link

oh, wow, nice

@magnusviri
Copy link

This is great! I just switched my workflow to use Tart as well!

@cosmoshepcat
Copy link

now if apple would just support snapshots in their virtual framework :)

@fkorotkov
Copy link
Contributor Author

@cosmoshepcat you mean snapshot like in #147?

@cosmoshepcat
Copy link

@cosmoshepcat you mean snapshot like in #147?

sort of, what i meant is apple does not have any such core vm snapshot feature in the virtualization framework that I know of. this is why other commercial products like parallels etc cannot take vm snapshots like they do on intel versions/previous versions of their software since they now rely on the api framework for silicon m1 support.

i do not know apples roadmap for such features if any

@fkorotkov fkorotkov reopened this Sep 15, 2022
@fkorotkov
Copy link
Contributor Author

We had to revert the entitlements in #247 since they require an embedded provisioning profile and we haven't yet figure out how to do it for a CLI toll and not an *.App.

@fkorotkov
Copy link
Contributor Author

From this doc:

Some macOS products, like daemons and command-line tools, ship as a standalone executable. A standalone executable can’t claim a restricted entitlement because there’s no place to embed the provisioning profile that authorizes that claim. If your standalone executable needs to do this, wrap it in an app-like structure. For an example of this, see Signing a Daemon with a Restricted Entitlement.

If your standalone executable needs to do this, wrap it in an app-like structure. part is very concerning since Tart is a single binary at the moment. Hopefully there is another way...

@fkorotkov
Copy link
Contributor Author

It seems the only way right now to embed a provisioning profile is to distribute Tart as an *.App and install it in /Applications. 😪🤷‍♂️

@cosmoshepcat
Copy link

apple... :(

@edigaryev
Copy link
Collaborator

If your standalone executable needs to do this, wrap it in an app-like structure

What if we would ship an App as an option, though?

Seems like it would be possible to handle this via Homebrew. Here's an example of vlc installed via brew:

% cat /opt/homebrew/Caskroom/vlc/3.0.17.3/vlc.wrapper.sh
#!/bin/sh
exec '/Applications/VLC.app/Contents/MacOS/VLC' "$@"

Also some non-Homebrew apps that are CLIs:

% ls -l /usr/local/bin/prlctl
lrwxr-xr-x@ 1 root  wheel  68 Aug 24 23:09 /usr/local/bin/prlctl -> /Applications/Parallels Desktop.app/Contents/MacOS/parallels_wrapper
% ls -l /usr/local/bin/docker
lrwxr-xr-x  1 root  wheel  54 Aug 16 21:11 /usr/local/bin/docker -> /Applications/Docker.app/Contents/Resources/bin/docker

@fkorotkov
Copy link
Contributor Author

@edigaryev, yeah, I thought about the same. Maybe even start Tart.App and see a list of local VMs to launch in the UI. 🤔 But changing how we release Tart is a task for another day and looks like a hack. I'd prefer to wait a bit and see if it's really the only option. I've created mitchellh/gon#65 to see if maybe someone solved the problem.

@torarnv
Copy link
Contributor

torarnv commented Sep 29, 2022

It's possible to embed Info.plists by adding -sectcreate __TEXT __info_plist Info.plist to the linker flags. Perhaps the provisioning profile can be embedded in a similar way?

@naikrovek
Copy link

@cosmoshepcat you mean snapshot like in #147?

sort of, what i meant is apple does not have any such core vm snapshot feature in the virtualization framework that I know of. this is why other commercial products like parallels etc cannot take vm snapshots like they do on intel versions/previous versions of their software since they now rely on the api framework for silicon m1 support.

i do not know apples roadmap for such features if any

the APFS filesystem may already do what you are expecting by itself.

i create a VM which i never launch once it is set up. call it a template. when i want to launch a VM, i clone the template and launch the clone. only changes on top the template are persisted in the clone VM disk - the entire disk is not copied. the clone disk contains only what differs from the template VM and consumes very little actual disk space.

i REALLY wish Windows had something like this…

does this info help you?

@magnusviri
Copy link

So is --net-bridged supposed to work now? I just tried it and it doesn't work for me.

Error: Invalid virtual machine configuration. Using VZBridgedNetworkDeviceAttachment in a process that lacks the “com.apple.vm.networking” entitlement.

I made sure I used the Tart 0.36.3 pkg from Github and not Homebrew.

@fkorotkov
Copy link
Contributor Author

Unfortunately, it's not working. See #243 (comment). In order to embed a provisioning profile we need to repack Tart as Tart.App which we'll do in #305. We haven't found another way to embed a provisioning profiles. Might need to hide the flag until then 🤔

@magnusviri
Copy link

Sounds good. I'm subscribed to 305 so I'll look forward to its release. If it takes too long to make the app, I seriously wouldn't mind just having an app that did nothing just so I could get the bridged networking. I can't use tart effectively on my laptop until then (I am using it on a Mac Mini).

@fmoc
Copy link

fmoc commented Feb 7, 2023

Will this feature allow bridging to multiple network interfaces? See #384 (comment) for more information.

@edigaryev
Copy link
Collaborator

Will this feature allow bridging to multiple network interfaces? See #384 (comment) for more information.

It's possible to attach multiple network interfaces with Virtualization.Framework, however, we haven't tested how it works with bridged networks yet due to the entitlement limitation.

@larry-brewer
Copy link

I'd love to tackle this issue and set up a blank wrapper mac app.

How would I go about running my PR on Tart's CI so that I can sign it with Tart's profile with the entitlement?
Does Tart's CI have the updated provisioning profile with the entitlement?

fkorotkov added a commit that referenced this issue Feb 22, 2023
Until it's fixed in #243.
fkorotkov added a commit that referenced this issue Feb 24, 2023
@fkorotkov
Copy link
Contributor Author

--net-bridged is finally working in 1.0.0. Please give it a try! There is some hacky things involved. 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not possible atm Not possible at the moment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants