git: port forward ssh
This commit is contained in:
parent
861d4d112f
commit
b1a8e17b7b
3 changed files with 35 additions and 2 deletions
|
@ -19,7 +19,9 @@
|
||||||
networkConfig = {
|
networkConfig = {
|
||||||
Address = [
|
Address = [
|
||||||
"188.245.196.27/32"
|
"188.245.196.27/32"
|
||||||
|
"116.202.5.66/32"
|
||||||
"2a01:4f8:c17:7f8a::1/64"
|
"2a01:4f8:c17:7f8a::1/64"
|
||||||
|
"2a01:4f8:c17:7f8a::617/64"
|
||||||
];
|
];
|
||||||
DNS = [
|
DNS = [
|
||||||
"2a01:4ff:ff00::add:1"
|
"2a01:4ff:ff00::add:1"
|
||||||
|
|
|
@ -52,7 +52,6 @@ in
|
||||||
# Prevent injection of code in other mime types (XSS Attacks)
|
# Prevent injection of code in other mime types (XSS Attacks)
|
||||||
add_header X-Content-Type-Options nosniff;
|
add_header X-Content-Type-Options nosniff;
|
||||||
'';
|
'';
|
||||||
# default vhost
|
|
||||||
|
|
||||||
virtualHosts."oxapentane.com" = {
|
virtualHosts."oxapentane.com" = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
|
|
|
@ -1,5 +1,37 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
|
# ssh config for forgejo
|
||||||
|
# need ip forward for nat
|
||||||
|
boot.kernel.sysctl = { "net.ipv4.ip_forward" = 1; };
|
||||||
|
|
||||||
|
networking.firewall = {
|
||||||
|
# open port explicitly
|
||||||
|
allowedTCPPorts = [ 22 ];
|
||||||
|
# git.oxapentane.com: port forward 22 to forgejo
|
||||||
|
# TODO do a proper thing with ipv6
|
||||||
|
extraCommands = ''
|
||||||
|
iptables -t nat -I PREROUTING -p tcp --dport 22 -d 116.202.5.66 -j DNAT --to-destination 10.89.88.15:2222
|
||||||
|
iptables ! -o lo -t nat -A POSTROUTING -j MASQUERADE
|
||||||
|
'';
|
||||||
|
extraStopCommands = ''
|
||||||
|
iptables -t nat -D PREROUTING -p tcp --dport 22 -d 116.202.5.66 -j DNAT --to-destination 10.89.88.15:2222 || true
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
# host sshd: only listen on oxapentane.com and mgmt vpn
|
||||||
|
services.openssh.listenAddresses = map (a :
|
||||||
|
{
|
||||||
|
addr = a;
|
||||||
|
port = 22;
|
||||||
|
}) [
|
||||||
|
# enp1s0
|
||||||
|
"188.245.196.27"
|
||||||
|
"2a01:4f8:c17:7f8a::1"
|
||||||
|
# wg-0xa-mgmt
|
||||||
|
"10.89.87.1"
|
||||||
|
"fd31:185d:722e::1"
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
services.nginx.upstreams.forgejo = {
|
services.nginx.upstreams.forgejo = {
|
||||||
servers = {
|
servers = {
|
||||||
"10.89.88.15:3000" = { };
|
"10.89.88.15:3000" = { };
|
||||||
|
|
Loading…
Add table
Reference in a new issue