mirror of
https://github.com/flynx/proxmox-utils.git
synced 2025-12-26 05:12:06 +00:00
Compare commits
No commits in common. "6e1886acd62163a57a9b7f8e35aee88399f9f7c7" and "747ba1766fe2610c882d5943e3b072e99017aa6d" have entirely different histories.
6e1886acd6
...
747ba1766f
@ -228,13 +228,10 @@ xreadYes(){
|
|||||||
# XXX check DFL_..???
|
# XXX check DFL_..???
|
||||||
if [[ "${!var}" == "SKIP" ]] ; then
|
if [[ "${!var}" == "SKIP" ]] ; then
|
||||||
eval "$var="
|
eval "$var="
|
||||||
return 1
|
return
|
||||||
fi
|
fi
|
||||||
if [ -z ${!var} ] ; then
|
if [ -z ${!var} ] ; then
|
||||||
if [[ "$(eval "echo \$DFL_${var}")" == "SKIP" ]] ; then
|
if [ -z $(eval "echo \$DFL_${var}") ] ; then
|
||||||
eval "$var="
|
|
||||||
return 1
|
|
||||||
elif [ -z $(eval "echo \$DFL_${var}") ] ; then
|
|
||||||
local yes=y
|
local yes=y
|
||||||
local no=N
|
local no=N
|
||||||
local dfl=
|
local dfl=
|
||||||
|
|||||||
8
Makefile
8
Makefile
@ -83,19 +83,19 @@ config.global: config.global.example
|
|||||||
bootstrap: \
|
bootstrap: \
|
||||||
host-bootstrap \
|
host-bootstrap \
|
||||||
gate-bootstrap ns \
|
gate-bootstrap ns \
|
||||||
$(MINIMAL_CTs)
|
$(MINIMAL_CTs) \
|
||||||
make bootstrap-clean
|
bootstrap-clean
|
||||||
|
|
||||||
|
|
||||||
# Bootstrap stage 2: reconnect host through the base infrastructure...
|
# Bootstrap stage 2: reconnect host through the base infrastructure...
|
||||||
.PHONY: bootstrap-clean
|
.PHONY: bootstrap-clean host-bootstrap-clean
|
||||||
bootstrap-clean: host-bootstrap-clean
|
bootstrap-clean: host-bootstrap-clean
|
||||||
|
|
||||||
|
|
||||||
# Finalize: reconect admin port/bridge correctly...
|
# Finalize: reconect admin port/bridge correctly...
|
||||||
.PHONY: finalize
|
.PHONY: finalize
|
||||||
finalize: bootstrap-clean gate-bootstrap-clean
|
finalize: bootstrap-clean gate-bootstrap-clean
|
||||||
make host-bootstrap-clean
|
@ make host-bootstrap-clean
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
127
README.md
127
README.md
@ -41,61 +41,35 @@ Goals:
|
|||||||
and administration of all the related components at the cost of a
|
and administration of all the related components at the cost of a
|
||||||
heavier CT transparently integrating multiple related services
|
heavier CT transparently integrating multiple related services
|
||||||
|
|
||||||
|
XXX service structure
|
||||||
|
|
||||||
### Network
|
XXX network
|
||||||
|
|
||||||
```
|
In general `proxmox-utils` splits the configuration into two levels:
|
||||||
Internet Admin
|
|
||||||
v v
|
|
||||||
+----|----------------------------------------------------|-----+
|
|
||||||
| | | |
|
|
||||||
| (wan) (lan) (admin) |
|
|
||||||
| | | | |
|
|
||||||
| | | pve --+ |
|
|
||||||
| | | | |
|
|
||||||
| | +--------------------------------+ |
|
|
||||||
| | / | | |
|
|
||||||
| +--($WAN_SSH_IP)- ssh ---------------+ | |
|
|
||||||
| | ^ | | |
|
|
||||||
| | (ssh:23) | | |
|
|
||||||
| | . | | |
|
|
||||||
| | . +------------------------(nat)--+ |
|
|
||||||
| | ./ | | |
|
|
||||||
| +------($WAN_IP)- gate ------(nat)---+ | |
|
|
||||||
| . | | |
|
|
||||||
| . +-- ns ---------+ |
|
|
||||||
| . | | |
|
|
||||||
| + - (udp:51820)-> +-- wireguard | |
|
|
||||||
| . | | |
|
|
||||||
| + - (ssh/https)-> +-- gitea | |
|
|
||||||
| . | | |
|
|
||||||
| + - - - (https)-> +-- nextcloud | |
|
|
||||||
| | | |
|
|
||||||
| +-- syncthing --+ |
|
|
||||||
| |
|
|
||||||
+---------------------------------------------------------------+
|
|
||||||
```
|
|
||||||
|
|
||||||
XXX
|
|
||||||
|
|
||||||
|
|
||||||
### Services
|
### CT level
|
||||||
|
|
||||||
XXX
|
This level is handled by the `Makefile` and is almost completely automated
|
||||||
|
|
||||||
|
|
||||||
|
### Host level
|
||||||
|
|
||||||
|
This level depends on the host setup and is currently done manually
|
||||||
|
depending on existing host configuration.
|
||||||
|
|
||||||
|
XXX clean setup scripts...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Setup
|
## Prerequisites
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
|
|
||||||
Install Proxmox and connect it to your network.
|
Install Proxmox and connect it to your network.
|
||||||
|
|
||||||
|
|
||||||
|
## Semi-automated setup
|
||||||
|
|
||||||
### Semi-automated setup
|
This will download the [`bootstrap.sh`](./scripts/bootstrap.sh) script and execute it:
|
||||||
|
|
||||||
Download the [`bootstrap.sh`](./scripts/bootstrap.sh) script and execute it:
|
|
||||||
```shell
|
```shell
|
||||||
curl 'https://raw.githubusercontent.com/flynx/proxmox-utils/refs/heads/master/scripts/bootstrap.sh' | sudo bash
|
curl 'https://raw.githubusercontent.com/flynx/proxmox-utils/refs/heads/master/scripts/bootstrap.sh' | sudo bash
|
||||||
```
|
```
|
||||||
@ -106,79 +80,30 @@ This will:
|
|||||||
- Run `make bootstrap` on the repo
|
- Run `make bootstrap` on the repo
|
||||||
|
|
||||||
After the basic setup is done connect the device to the network via the
|
After the basic setup is done connect the device to the network via the
|
||||||
selcted WAN port and **disconnect** the ADMIN port.
|
selcted WAN port and it is reccomended to disconnect the admin PORT.
|
||||||
|
|
||||||
The WAN interface exposes two IPs:
|
The WAN interface exposes two IPs:
|
||||||
- Main server (config: `$DFL_WAN_IP` / `$WAN_IP`)
|
- Main server (config: `DFL_WAN_IP` / `WAN_IP`)
|
||||||
- ssh:23
|
- ssh:23
|
||||||
- wireguard:51820
|
- wireguard:51820
|
||||||
- Fail-safe ssh (config: `$DFL_WAN_SSH_IP` / `$WAN_SSH_IP`)
|
- Fail-safe ssh (config: `DFL_WAN_SSH_IP` / `WAN_SSH_IP`)
|
||||||
- ssh:22
|
- ssh:22
|
||||||
|
|
||||||
|
|
||||||
The Proxmox administrative interface is available behind the Wireguard
|
The Proxmox administrative interface is available behind the Wireguard
|
||||||
proxy or on the ADMIN port, both on https://10.0.0.254:8006.
|
proxy or on the ADMIN port, both on https://10.0.0.254:8006.
|
||||||
|
|
||||||
To finalize the setup run:
|
|
||||||
```shell
|
|
||||||
make finalize
|
|
||||||
```
|
|
||||||
|
|
||||||
This will
|
XXX setup additional CTs...
|
||||||
- detach the host from any external ports and make it accessible only
|
|
||||||
from the internal network.
|
|
||||||
See: [Architecture](#architecture) and [Bootstrapping](#bootstrapping)
|
|
||||||
- setup firewall rules.
|
|
||||||
Note that the firewall will not be enabled, this should be done manually
|
|
||||||
after rule review.
|
|
||||||
|
|
||||||
|
|
||||||
*Note that the ADMIN port is configured for direct connections only (DHCP),
|
XXX configuration / administration...
|
||||||
connecting it to a configured network can lead to unexpected behavior.*
|
|
||||||
|
|
||||||
|
|
||||||
#### Accessing the host
|
|
||||||
|
|
||||||
XXX
|
|
||||||
|
|
||||||
|
|
||||||
#### Setup additional services
|
|
||||||
|
|
||||||
XXX
|
|
||||||
|
|
||||||
```shell
|
|
||||||
make all
|
|
||||||
```
|
|
||||||
|
|
||||||
```shell
|
|
||||||
make dev
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Or individually:
|
|
||||||
```shell
|
|
||||||
make nextcloud
|
|
||||||
```
|
|
||||||
|
|
||||||
```shell
|
|
||||||
make syncthing
|
|
||||||
```
|
|
||||||
|
|
||||||
```shell
|
|
||||||
make gitea
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### Setup and configure custom services
|
|
||||||
|
|
||||||
XXX traefik rules
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Manual setup
|
## Manual setup
|
||||||
|
|
||||||
|
|
||||||
#### Bootstrapping
|
### Bootstrapping
|
||||||
|
|
||||||
Since all the internal traffic is routed through the `gate` we need both
|
Since all the internal traffic is routed through the `gate` we need both
|
||||||
the bridges and it setup for things to work, thus we first bootstrap the
|
the bridges and it setup for things to work, thus we first bootstrap the
|
||||||
@ -211,7 +136,7 @@ only for administration and recovory cases.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Network Bridges
|
### Network Bridges
|
||||||
|
|
||||||
`proxmox-utils` expects there to be at least three bridges:
|
`proxmox-utils` expects there to be at least three bridges:
|
||||||
- `WAN` (`vmbr_wan`) - connected to the port that faces the external
|
- `WAN` (`vmbr_wan`) - connected to the port that faces the external
|
||||||
@ -241,7 +166,7 @@ first/last ports to wan/admin respectively and clearly mark them as such.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### DNS
|
### DNS
|
||||||
|
|
||||||
Add `10.1.1.1` to the DNS on the Proxmox host node after the `127.0.0.1`
|
Add `10.1.1.1` to the DNS on the Proxmox host node after the `127.0.0.1`
|
||||||
but before whatever external DNS you are using.
|
but before whatever external DNS you are using.
|
||||||
@ -257,7 +182,7 @@ make host-bootstrap
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### Firewall
|
### Firewall
|
||||||
|
|
||||||
Make sure to allow at least `ssh` access to the host node from the `ADMIN`
|
Make sure to allow at least `ssh` access to the host node from the `ADMIN`
|
||||||
interface to allow admin CT's access to the host if needed, this is mostly
|
interface to allow admin CT's access to the host if needed, this is mostly
|
||||||
|
|||||||
75
host/make.sh
75
host/make.sh
@ -53,26 +53,10 @@ if ! [ -z $BOOTSTRAP_CLEAN ] ; then
|
|||||||
# stage 1: bootstrap -> clean
|
# stage 1: bootstrap -> clean
|
||||||
if [ -e "$INTERFACES".clean ] ; then
|
if [ -e "$INTERFACES".clean ] ; then
|
||||||
@ mv "$INTERFACES"{.clean,.new}
|
@ mv "$INTERFACES"{.clean,.new}
|
||||||
DFL_UPDATE=SKIP
|
|
||||||
DFL_APPS=SKIP
|
|
||||||
DFL_BRIDGES=SKIP
|
|
||||||
DFL_HOSTS=SKIP
|
|
||||||
DFL_DNS=1
|
|
||||||
DFL_FIREWALL=SKIP
|
|
||||||
|
|
||||||
# stage 2: clean -> final
|
# stage 2: clean -> final
|
||||||
elif [ -e "$INTERFACES".final ] ; then
|
elif [ -e "$INTERFACES".final ] ; then
|
||||||
@ mv "$INTERFACES"{.final,.new}
|
@ mv "$INTERFACES"{.final,.new}
|
||||||
DFL_UPDATE=SKIP
|
# donw
|
||||||
DFL_APPS=SKIP
|
|
||||||
DFL_BRIDGES=SKIP
|
|
||||||
DFL_HOSTS=1
|
|
||||||
DFL_DNS=SKIP
|
|
||||||
DFL_FIREWALL=1
|
|
||||||
|
|
||||||
REBOOT=1
|
|
||||||
|
|
||||||
# done
|
|
||||||
else
|
else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
@ -85,40 +69,42 @@ if ! [ -z $BOOTSTRAP_CLEAN ] ; then
|
|||||||
@ ifreload -a
|
@ ifreload -a
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Bootstrap...
|
# Bootstrap...
|
||||||
elif ! [ -z $BOOTSTRAP ] ; then
|
|
||||||
|
# XXX
|
||||||
|
if ! [ -z $BOOTSTRAP ] ; then
|
||||||
DFL_BOOTSTRAP_PORT=${DFL_BOOTSTRAP_PORT:-none}
|
DFL_BOOTSTRAP_PORT=${DFL_BOOTSTRAP_PORT:-none}
|
||||||
xread "Bootstrap port: " BOOTSTRAP_PORT
|
xread "Bootstrap port: " BOOTSTRAP_PORT
|
||||||
|
|
||||||
BRIDGES_BOOTSTRAP_TPL=bootstrap-bridges.tpl
|
BRIDGES_BOOTSTRAP_TPL=bootstrap-bridges.tpl
|
||||||
|
|
||||||
DFL_UPDATE=1
|
|
||||||
DFL_APPS=1
|
|
||||||
DFL_BRIDGES=1
|
|
||||||
DFL_HOSTS=SKIP
|
|
||||||
DFL_DNS=SKIP
|
|
||||||
DFL_FIREWALL=SKIP
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
# System...
|
# Tools
|
||||||
if xreadYes "# Update system?" UPDATE ; then
|
if xreadYes "# Update system?" UPDATE ; then
|
||||||
@ apt update
|
@ apt update
|
||||||
@ apt upgrade
|
@ apt upgrade
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Tools...
|
|
||||||
if xreadYes "# Install additional apps?" APPS ; then
|
if xreadYes "# Install additional apps?" APPS ; then
|
||||||
@ apt install ${SOFTWARE[@]}
|
@ apt install ${SOFTWARE[@]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Bridges...
|
# Bridges...
|
||||||
|
# XXX need to:
|
||||||
|
# - bootstrap this
|
||||||
|
# - setup the gate, ssh, and wireguard
|
||||||
|
# - inalize
|
||||||
|
# XXX /etc/hosts
|
||||||
|
# XXX save config???
|
||||||
|
# XXX should we do things in ./staging ???
|
||||||
if xreadYes "# Create bridges?" BRIDGES ; then
|
if xreadYes "# Create bridges?" BRIDGES ; then
|
||||||
xread "WAN port: " WAN_PORT
|
xread "WAN port: " WAN_PORT
|
||||||
xread "ADMIN port: " ADMIN_PORT
|
xread "ADMIN port: " ADMIN_PORT
|
||||||
@ -212,30 +198,26 @@ if xreadYes "# Create bridges?" BRIDGES ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo "# Building config..."
|
||||||
|
# XXX do we need any extra vars here???
|
||||||
|
buildAssets
|
||||||
|
|
||||||
|
|
||||||
|
# XXX /etc/hosts???
|
||||||
|
|
||||||
|
|
||||||
# /etc/hosts
|
# /etc/hosts
|
||||||
if xreadYes "# Update /etc/hosts?" HOSTS ; then
|
if xreadYes "# Update /etc/hosts?" HOSTS ; then
|
||||||
@ cp /etc/hosts{,.bak}
|
@ cp /etc/hosts{,.bak}
|
||||||
@ cp /etc/hosts{,.new}
|
@ cp /etc/hosts{,.new}
|
||||||
@ sed -i \
|
@ sed -i \
|
||||||
-e 's/^[^#].* \(pve.local.*\)$/'${HOST_ADMIN_IP/\/*}' \1/' \
|
-e 's/^[^#].* \(pve.local.*\)$/'${HOST_ADMIN_IP/\/*}'\1/' \
|
||||||
/etc/hosts.new
|
/etc/hosts.new
|
||||||
reviewApplyChanges /etc/hosts
|
reviewApplyChanges /etc/hosts
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# build only if we need to...
|
|
||||||
build(){
|
|
||||||
if [ -z $__ASSETS ] ; then
|
|
||||||
__ASSETS=1
|
|
||||||
echo "# Building config templates..."
|
|
||||||
buildAssets
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# DNS
|
# DNS
|
||||||
if xreadYes "# Update DNS?" DNS ; then
|
if xreadYes "# Update DNS?" DNS ; then
|
||||||
build
|
|
||||||
file=/etc/resolv.conf
|
file=/etc/resolv.conf
|
||||||
@ cp "staging/${file}" "${file}".new
|
@ cp "staging/${file}" "${file}".new
|
||||||
reviewApplyChanges "${file}"
|
reviewApplyChanges "${file}"
|
||||||
@ -244,7 +226,6 @@ fi
|
|||||||
|
|
||||||
# Firewall
|
# Firewall
|
||||||
if xreadYes "# Update firewall rules?" FIREWALL ; then
|
if xreadYes "# Update firewall rules?" FIREWALL ; then
|
||||||
build
|
|
||||||
file=/etc/pve/firewall/cluster.fw
|
file=/etc/pve/firewall/cluster.fw
|
||||||
@ cp "staging/${file}" "${file}".new
|
@ cp "staging/${file}" "${file}".new
|
||||||
reviewApplyChanges "${file}"
|
reviewApplyChanges "${file}"
|
||||||
@ -255,12 +236,6 @@ showNotes
|
|||||||
echo "# Done."
|
echo "# Done."
|
||||||
|
|
||||||
|
|
||||||
if ! [ -z $REBOOT ] ; then
|
|
||||||
echo "# Rebooting..."
|
|
||||||
@ reboot
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# vim:set ts=4 sw=4 :
|
# vim:set ts=4 sw=4 :
|
||||||
|
|||||||
@ -89,7 +89,7 @@ pctCreateAlpine $ID "$PASS"
|
|||||||
|
|
||||||
echo "# Installing dependencies..."
|
echo "# Installing dependencies..."
|
||||||
@ lxc-attach $ID apk add \
|
@ lxc-attach $ID apk add \
|
||||||
iptables wireguard-tools-wg-quick make bind-tools libqrencode-tools logrotate
|
iptables wireguard-tools-wg-quick make bind-tools libqrencode logrotate
|
||||||
|
|
||||||
echo "# Copying assets..."
|
echo "# Copying assets..."
|
||||||
pctPushAssets $ID
|
pctPushAssets $ID
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user