|
@@ -15,11 +15,25 @@ installs needed. Requires `pvesh` (from `pve-manager`) and `dig`
|
|
|
## Installation
|
|
## Installation
|
|
|
|
|
|
|
|
Copy the script and the config to a Proxmox host (or any host with
|
|
Copy the script and the config to a Proxmox host (or any host with
|
|
|
-`pvesh` access to the cluster), e.g. to `/etc/pve`:
|
|
|
|
|
|
|
+`pvesh` access to the cluster).
|
|
|
|
|
+
|
|
|
|
|
+Note: `/etc/pve` is Proxmox's cluster filesystem (pmxcfs). It syncs
|
|
|
|
|
+its files to every node, but does not support `chmod` — scripts
|
|
|
|
|
+there cannot be made executable. Two options:
|
|
|
|
|
+
|
|
|
|
|
+**a) In `/etc/pve`** — cluster-wide, run via `python3`:
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
cp manage_ipset.py manage_ipset.conf /etc/pve/
|
|
cp manage_ipset.py manage_ipset.conf /etc/pve/
|
|
|
-chmod +x /etc/pve/manage_ipset.py
|
|
|
|
|
|
|
+python3 /etc/pve/manage_ipset.py
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+**b) Local and executable** — e.g. `/usr/local/sbin`, per node:
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+install -m 755 manage_ipset.py /usr/local/sbin/
|
|
|
|
|
+install -m 644 manage_ipset.conf /etc/
|
|
|
|
|
+/usr/local/sbin/manage_ipset.py -c /etc/manage_ipset.conf
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
`manage_ipset.conf` is looked up next to the script unless `-c` is
|
|
`manage_ipset.conf` is looked up next to the script unless `-c` is
|
|
@@ -29,21 +43,24 @@ given.
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
# sync every IPSet from the config
|
|
# sync every IPSet from the config
|
|
|
-./manage_ipset.py
|
|
|
|
|
|
|
+python3 manage_ipset.py
|
|
|
|
|
|
|
|
# use a different config file
|
|
# use a different config file
|
|
|
-./manage_ipset.py -c /path/to/manage_ipset.conf
|
|
|
|
|
|
|
+python3 manage_ipset.py -c /path/to/manage_ipset.conf
|
|
|
|
|
|
|
|
# sync a single IPSet directly
|
|
# sync a single IPSet directly
|
|
|
-./manage_ipset.py github github.com github.io
|
|
|
|
|
-./manage_ipset.py docker-io registry-1.docker.io --round 30
|
|
|
|
|
|
|
+python3 manage_ipset.py github github.com github.io
|
|
|
|
|
+python3 manage_ipset.py docker-io registry-1.docker.io --round 30
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
### Cron
|
|
### Cron
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
-# every hour
|
|
|
|
|
-0 * * * * /etc/pve/manage_ipset.py
|
|
|
|
|
|
|
+# every hour, /etc/pve install
|
|
|
|
|
+0 * * * * python3 /etc/pve/manage_ipset.py
|
|
|
|
|
+
|
|
|
|
|
+# local install
|
|
|
|
|
+0 * * * * /usr/local/sbin/manage_ipset.py -c /etc/manage_ipset.conf
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
## Config (`manage_ipset.conf`)
|
|
## Config (`manage_ipset.conf`)
|