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

Broken create Jail with net address already available on host #742

Open
urosgruber opened this issue Aug 12, 2019 · 3 comments
Open

Broken create Jail with net address already available on host #742

urosgruber opened this issue Aug 12, 2019 · 3 comments
Labels

Comments

@urosgruber
Copy link
Contributor

I was trying to create a jail with IP address already used on host. I have this set up on machine with older ioc and it worked fine. Latest version add IP alias and that is why network is broken after process completes.

ioc create ioc/foo ip4_addr="igb1|8.8.8.8"

I tried a few other options but digging through source code I can see alias is added in all use cases except DHCP option

Is this intentional? Or broken feature?

@gronke
Copy link
Member

gronke commented Aug 12, 2019

Adding and removing IP addresses to the non-VNET interfaces is done deliberately by libioc as seen here in Jail.py

libioc/libioc/Jail.py

Lines 1928 to 1931 in ddded09

if teardown is True:
command.append("remove")
else:
command.append("alias")

Before adding a new alias to an interface, we could verify that no other interface has claimed it, so that a jail does not steal the hosts default address. If that is the case, the jail should refuse to start, so that the IP is not removed on jail shutdown.

Actions to mitigate this issue:

  • Verify the absence of non-VNET IPs before starting the jail

@gronke gronke added the bug label Aug 12, 2019
@urosgruber
Copy link
Contributor Author

@gronke what if I need to just run a process inside jail but use the host IP?

@gronke
Copy link
Member

gronke commented Sep 4, 2019

@urosgruber sorry for the late response. You are right, in this case you would need to supply the jail with the ip4.addr parameter, while not removing the IP from the interface on teardown. I can't imagine a scenario where I would want to borrow an IP address of the host, but if you say that's a thing, we should find a solution for this.

I suggest that we allow users to override final jail parameters. ip4_addr is an ioc(age) config parameter. params.ip4.addr could be a user defined override for whatever ioc would start the jail with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants