Pre-Requesitites - Setup LXC on your Linux System
- Underprivileged LXC has been setup, with user mappings, network mappings
Templates for LXC can be found here:
- https://us.images.linuxcontainers.org/images/
How To Steps include:
- Download Template (Debian unstable in this example)
- Configure Freedombox on LXC container
- Setup static ip to portforward easy
- Enable port forwarding
Steps:
> lxc-create --name debunstable-freedombox -t download
Interactive added these options when prompted:
Distribution:
debian
Release:
sid
Architecture:
amd64
(should download image)
> systemd-run --unit=myshell --user --scope -p "Delegate=yes" lxc-start debunstable-freedombox --logfile $HOME/lxc_freedombox.log --logpriority DEBUG
> lxc-ls --fancy
confirm running ->
NAME STATE AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED
debunstable-freedombox RUNNING 0 - 10.0.3.53 - true
attach to instance:
lxc-attach --name debunstable-freedombox
root@debunstable-freedombox:/# apt update
root@debunstable-freedombox:/# DEBIAN_FRONTEND=noninteractive apt install snapd freedombox systemd syslog-ng mariadb-server -y
root@debunstable-freedombox:/# vi /etc/network/interfaces
You can use the following commands to help you find gateway and ip address:
# ip addr
# ip route
example:
Replace auto eth0 dhcp to this:
yours will be specific to your network
auto eth0
iface eth0 inet static
address 10.0.3.53
netmask 255.255.255.0
gateway 10.0.3.1
root@debunstable-freedombox:/# systemctl restart networking.service
root@debunstable-freedombox:/# echo nameserver 1.1.1.1 > /etc/resolv.conf
replace 8.8.8.8 with your favorite name server
root@debunstable-freedombox:/# exit
root@host> iptables -t nat -A POSTROUTING -s 10.0.3.0/24 -o $WAN -j MASQUERADE
# Dont' forget to forward your ports
root@host> echo 1 > /proc/sys/net/ipv4/ip_foward
root@host> iptables -t nat -A PREROUTING -i $WAN -p tcp --dport 6677 -j DNAT --to 10.0.3.53:443
Log in and follow the instructions including getting the secret key