KatharaFramework / Kathara

A lightweight container-based network emulation system.
https://www.kathara.org/
GNU General Public License v3.0
452 stars 63 forks source link

kathara-lstart manpage states that hosthome is active by default but it's not #200

Closed charles2910 closed 1 year ago

charles2910 commented 1 year ago

Hi,

First, thanks for developing kathará!

The error

Now, I was looking in the manpage of kathara-lstart and it states the following about the -H flag:

       -H, --no-hosthome
              /hosthome dir will not be mounted inside the devices.

              By  default, the home directory of the current user is made available for reading/writing inside the device under the spe‐
              cial directory /hosthome. This option disables this behaviour, thus not making the host filesystem accessible from  inside
              the device. Override the default setting specified in kathara.conf(5) file.

But the kathara.conf manpage states the default behaviour as disabled. And looking at the settings in DockerSettingsAddon.py we get a confirmation:

from typing import Optional, Dict, Any

from ...foundation.setting.SettingsAddon import SettingsAddon

DEFAULTS = {
    "hosthome_mount": False,
    "shared_mount": True,
    "image_update_policy": "Prompt",
    "shared_cd": False,
    "remote_url": None,
    "cert_path": None
}

To Reproduce Look at the manpages of kathara.conf and kathara-lstart.

Expected behavior A match between the manpages and the kathará behaviour.

Also, it would be really nice to have an option in kathara-lstart to enable the hosthome mapping. Maybe we could use the -H flag to actually enable the mapping since it's disabled by default in kathara.

tcaiazzi commented 1 year ago

Hi @charles2910,

First of all, we are very happy that you choose to use Kathará.

Second, thanks for pointing out this inconsistency. We will surely fix it in the next release.

Also, it would be really nice to have an option in kathara-lstart to enable the hosthome mapping. Maybe we could use the -H flag to actually enable the mapping since it's disabled by default in kathara.

I think we definitely go for this solution!

Thanks for the support, Tommaso

tcaiazzi commented 1 year ago

Hi @charles2910,

finally we decided to add to the lstart command the --hosthome option to mount the /hoshome directory. We took this choice to avoid breaking retro-compatibility changing the behaviour of a command with the opposite one.

I also fixed the documentation and added the new option. Now it looks like this:

* `--no-hosthome`, `-H`:
    Do not mount `/hosthome` directory inside devices.

    Do not mount the home directory of the current user inside devices. This is the default specified in `kathara.conf`(5) file.

* `--hosthome`:
    Mount the `/hosthome` directory inside devices.

    Mount the home directory of the current user inside devices on the special directory `/hosthome`. This option makes the host filesystem accessible from inside devices, overriding the default setting specified in `kathara.conf`(5) file.

For consistency, we also added the --shared option to mount the shared directory. Even this is is the default behaviour, this option can be useful if someone changes the default value of shared_mount to False.

* `--no-shared`, `-S`:
    Do not mount the `/shared` directory inside devices.

    By default, the "shared" directory inside the network scenario folder is mounted inside all devices on the special directory `/shared`. This option disables this behaviour, making the shared directory not accessible from inside devices. Override the default setting specified in `kathara.conf`(5) file.

* `--shared`:
    Mount the `/shared` directory inside devices.

    Mount the "shared" directory inside the network scenario folder inside all devices on the special directory `/shared`. This is the default specified in `kathara.conf`(5) file.

We added the options also to lrestart and vstart (only --hosthome) commands.

The changes will be merged on the next release.

Many thanks, Tommaso

charles2910 commented 1 year ago

Awesome!

I agree that adding a --hosthome is better for retro-compatibility.

Thanks for replying and fixing it so quickly!

Also, I'll look into getting kathará into Debian officially. Let's see how it goes, I'll keep you posted.