Skip to content

add config with no exists config #671

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
47 changes: 38 additions & 9 deletions libioc/Config/Jail/Globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"boot": False,
"priority": 0,
"legacy": False,
"priority": 0,
"depends": [],
"basejail": False,
"basejail_type": "nullfs",
Expand All @@ -41,6 +40,7 @@
"mac_prefix": "02ff60",
"vnet": False,
"interfaces": [],
"vnet_default_interface": [],
"vnet_interfaces": [],
"ip4": "new",
"ip4_saddrsel": 1,
Expand All @@ -52,6 +52,7 @@
"host_hostuuid": None,
"host_hostname": None,
"host_domainname": None,
"host_time": True,
"hostid": None,
"hostid_strict_check": False,
"devfs_ruleset": 4,
Expand All @@ -61,16 +62,28 @@
"allow_sysvipc": 0,
"allow_raw_sockets": 0,
"allow_chflags": 0,
"allow_mount": 0,
"allow_mount_devfs": 0,
"allow_mount_nullfs": 0,
"allow_mount_procfs": 0,
"allow_mount_fdescfs": 0,
"allow_mount_zfs": 0,
"allow_mount_tmpfs": 0,
"allow_mlock": None,
"allow_mount": False,
"allow_mount_devfs": False,
"allow_mount_fusefs": False,
Copy link
Member

Choose a reason for hiding this comment

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

Interesting idea to actually turn the allow_mount_* properties into booleans. The sysctl value is an integer type, but there is a translation of boolean values happening. We should just be consistent and change similar properties among this one.

Copy link
Author

Choose a reason for hiding this comment

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

OK. I think should keep a consistency for code(For example, 0 or 1 integer only used, or boolean type only used).
If possible, To refactoring for future, I think should only use boolean type.

Copy link
Author

Choose a reason for hiding this comment

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

Anyway, I do fix such allow_mount.* parameters from 0,1 to True, False.

"allow_mount_nullfs": False,
"allow_mount_procfs": False,
"allow_mount_fdescfs": False,
"allow_mount_zfs": False,
"allow_mount_tmpfs": False,
"allow_quotas": 0,
"allow_socket_af": 0,
"allow_tun": 0,
"allow_vmm": False,
"available": 0,
"bpf": None,
"comment": None,
"compression": None,
"compressratio": None,
Copy link
Member

Choose a reason for hiding this comment

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

This is not a property that can be set. It should not be in the jail configuration at all. Is that the case in python-iocage?

Copy link
Author

@himrock922 himrock922 Feb 26, 2019

Choose a reason for hiding this comment

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

Yes, such parameters using with python-iocage.
https://www.freebsd.org/cgi/man.cgi?query=iocage&sektion=8

     available	   Available space in the jail's dataset.  The amount of space
		   available to	the dataset and	all its	children, assuming
		   that	there is no other activity in the pool.	 Because space
		   is shared within a pool, availability can be	limited	by any
		   number of factors, including	physical pool size, quotas,
		   reservations, or other datasets within the pool.

		   Source: zfs(8)
  • bpf

https://github.com/iocage/iocage/blob/528f007e92f6e081614d8a09186c4831fc9f3e32/iocage.8#L1019

Toggle starting the jail with Berkely Packet Filter devices enabled.
  • compression

https://github.com/iocage/iocage/blob/528f007e92f6e081614d8a09186c4831fc9f3e32/iocage.8#L1724

Controls the compression algorithm used for this dataset.
The lzjb compression algorithm is optimized for performance while
providing decent data compression.
Setting compression to on uses the lzjb compression algorithm.
The gzip algorithm uses the same compression as the
  • compressratio

https://github.com/iocage/iocage/blob/528f007e92f6e081614d8a09186c4831fc9f3e32/iocage.8#L1789

Compression ratio.
Read-only.
For non-snapshots, the compression ratio achieved for the used space
of this dataset, expressed as a multiplier.
The used property includes descendant datasets, and, for clones, does
not include the space shared with the origin snapshot.

Also, Also, comment property setting a lower layer for user property.

ref #630 (comment)

For example

user {
  comment: None,
  notes: None
}

"count": None,
"cpuset": False,
Copy link
Member

Choose a reason for hiding this comment

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

There is a new feature suggested in #636 - this change should be handled in a separate PR that addresses the GitHub Issue.

"dedup": False,
"dhcp": False,
"rlimits": None,
"sysvmsg": "new",
"sysvsem": "new",
Expand All @@ -84,20 +97,36 @@
"exec_prestop": None,
"exec_stop": "/bin/sh /etc/rc.shutdown",
"exec_poststop": None,
"exec_system_user": "root",
"exec_system_jail_user": "root",
"exec_jail_user": "root",
"exec_timeout": "600",
"stop_timeout": "30",
"mount_procfs": "0",
"mount_devfs": "1",
"mount_fdescfs": "0",
"mount_linprocfs": "0",
"securelevel": 2,
"mountpoint": "0",
"notes": None,
"origin": None,
"owner": None,
"quota": None,
"reservation": None,
"rtsold": None,
"sync_state": None,
"sync_target": None,
"sync_tgt_zpool": None,
"tags": [],
"template": False,
"used": False,
"jail_zfs": False,
"jail_zfs_dataset": None,
"jail_zfs_mountpoint": None,
"provision": {
"method": None,
"source": None,
"rev": "master"
}
},
"last_started": None
Copy link
Member

Choose a reason for hiding this comment

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

Missing feature tracked in #632 - this change belongs in a separate PR.

})