Skip to content

Commit 7362c82

Browse files
committed
add more docs
1 parent 8c75a9f commit 7362c82

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

CONFIGURATION.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
PULXC Configuration
2+
===
3+
4+
## file structure
5+
```
6+
/var/lib/pulxc/: storage of the users' lxc
7+
/etc/pulxc/: config for pulxc
8+
/usr/lib/pulxc/: the shell scripts, helpers
9+
/usr/bin/: pulxc-attach, pulxc-create, pulxc-destroy
10+
/usr/lib/systemd/system/: unit files
11+
```
12+
In `/var/lib/pulxc` there are `lxc/` `log/`
13+
14+
All pulxc will be stored inside `lxc/` as the way `--lxcpath=/var/lib/pulxc/lxc` in the argument calling lxc
15+
16+
If you start the `pulxc-dblg@username` service the log will be saved at `log/username.log`
17+
18+
19+
## config
20+
21+
### pulxc.conf
22+
23+
`/etc/pulxc/pulxc` is the main config file
24+
25+
The format is `KEY=VALUE` the `VALUE` should only consist alphanumeric and `_-/`
26+
27+
Key | Description
28+
--- | ---
29+
BASE_PATH| the place where users' lxc should save at
30+
BASE_SUBUID| subuid start of pulxc
31+
BASE_SUBGID| subgid start of pulxc
32+
CGROUP_CPUSET_CPUS| the cgroup cpuset.cpus settings for all pulxc (in total)
33+
CGROUP_CPUSET_MEMS| the cgroup cpuset.mems settings for all pulxc (in total)
34+
BRIDGE_INTERFACE| the bridge the pulxc will connect to
35+
IP_PREFIX| the first 3 part of the ipv4 address of pulxc
36+
GATEWAY| the gateway address
37+
38+
because it is hard coded to run as /24 subnet
39+
40+
you can modify the pulxc-create if you want other subnet size
41+
42+
### pulxc-lxc.conf
43+
44+
This file will be included by lxc itself, you can set configs to every pulxc, for example , cap drops.

INSTALL.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
PULXC installation
2+
===
3+
## Installation
4+
5+
If you are using archlinux, you can install from pulxc-git in AUR
6+
7+
But you still need to configure sysctl and lxc-usernet
8+
9+
### Add conf to sysctl.d
10+
`kernel.uprivileged_userns_clone=1`
11+
### setup lxc-usernet
12+
```
13+
#/etc/lxc/lxc-usernet
14+
pulxc veth pulxcbr0 99 255
15+
```
16+
### add user pulxc:pulxc
17+
`useradd -b /var/lib -m -r pulxc`
18+
### configure subuid subgid
19+
```
20+
touch /etc/subuid
21+
touch /etc/subgid
22+
usermod -v 100000-165535 -w 100000-165535 pulxc
23+
```
24+
### configure bridge
25+
26+
use the tool you want
27+
```
28+
#/etc/systemd/network/pulxcbr0.netdev
29+
[NetDev]
30+
Name=pulxcbr0
31+
Kind=bridge
32+
```
33+
```
34+
#/etc/systemd/network/pulxcbr0.network
35+
[Match]
36+
Name=pulxcbr0
37+
38+
[Network]
39+
Address=192.168.100.254/24
40+
```
41+
configure ip forwarding and NAT if you need it.
42+
43+
### install the files
44+
you can modify the uid/gid/subuid/subgid in Makefile to meet your pulxc's uid/gid/subuid/subgid
45+
```
46+
make
47+
make install
48+
```

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ make
2121
sudo make install
2222
```
2323

24+
read INSTALL.md for more info
25+
2426
## Usage
2527

2628
`pulxc-create username` to create a lxc for the user
@@ -34,3 +36,5 @@ sudo make install
3436
`systemctl enable pulxc@username` to make it start at boot
3537

3638
`systemctl start pulxc-dblg@username` to log the startup, the log file will be saved at /var/lib/pulxc/log/
39+
40+
for more info, read CONFIGURATION.md

0 commit comments

Comments
 (0)