automated config changes to OPNsense box
Hi all, i'm working on automating some stuff within my home lab, primarily through automated nix deployments.
one small roadblock i currently have towards my goal of being able to take a nix config fully from a configuration on my workstation to a running set of services on a VM on my proxmox cluster is that my homelab is actually closer to 6 homelabs, experimenting with various things (i actually use my homelab as a lab to learn new skills, not just to make storing my "linux iso's" or w/e easier).
sadly, im stuck with my main residential router, which doesn't support basic features like using a larger subnet, using multiple subnets or using VLANs.
so currently, i am running a double-NAT setup with an opnsense box behind my main router, my "home net" is on the main network, and the opnsense box effectively condenses my entire home lab down to one ip.
this *fully* works, i have it set up to work completely fine, though it took some doing. learnt a *lot* about NAT and firewalls trying to get everything working correctly especially since my proxy is on the main net with multiple newt vpns on various subnets to reach the different servers that need public internet publishing, which all has to work "locally" but through NAT.
i've already gotten my deployment pipeline to the point where the server is created with the desired configuration and subsequently moved on proxmox to the correct network/vlan (all servers are prepped by booting an ISO that has a predetermined IP on the local net, since deployment of the config happens over ssh).
problem is: once this happens, i no longer have access to the server over ssh because now it's on a different subnet behind NAT.
this is easily resolved by opening a port on the opnsense router, i already took this into accounts so all my configs have a port noted in case they need to go through the opnsense router.
the actual thing i cannot seem to figure out is: how do i set up a NAT destination rule and its accompanying firewall rule automatically as part of a deployment pipeline?
it's totally fine for this router to have a bunch of ssh ports open btw, since well... its behind *another* firewall that basically only has http, https, email and VPN ports available, all bound to specific servers. there's no way to reach any of these ports from the internet.
basically: what's the best approach to having an automated workflow of some kind make changes to the NAT configuration/firewall configuration? preferably something that doesn't need its own server to run on, but if i must, i will.
if this is not possible at all and someone knows of another way to automatically gain ssh access from my main workstation to all deployed servers on the various opnsense subnets (assuming those servers are already set up with proper keys, sshd configs etc), do also let me know about those.