2023-01-25 11:48:44 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
Name: https://en.wikipedia.org/wiki/Optimus_Prime
|
|
|
|
Why: Created to sell toys so this vm is for games
|
|
|
|
Type: VM
|
|
|
|
Hardware: -
|
|
|
|
From: 2023
|
|
|
|
Role: Game host
|
|
|
|
Notes:
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
{ pkgs, lib, nodes, arion, ... }:
|
|
|
|
let
|
|
|
|
# name of the server, sets teh hostname and record for it
|
|
|
|
name = "optimus";
|
|
|
|
ip_pub = "193.1.99.112";
|
|
|
|
ip_priv = "172.20.20.7";
|
2023-04-20 13:07:26 +00:00
|
|
|
hostname = "${name}.skynet.ie";
|
2023-01-25 11:48:44 +00:00
|
|
|
|
|
|
|
in {
|
|
|
|
imports = [
|
|
|
|
# applications for this particular server
|
|
|
|
../applications/firewall.nix
|
|
|
|
../applications/dns.nix
|
|
|
|
../applications/games.nix
|
2023-05-18 20:59:23 +00:00
|
|
|
|
|
|
|
# for testing
|
|
|
|
../applications/ldap.nix
|
2023-01-25 11:48:44 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
deployment = {
|
|
|
|
targetHost = hostname;
|
|
|
|
targetPort = 22;
|
|
|
|
targetUser = "root";
|
|
|
|
};
|
|
|
|
|
|
|
|
# these two are to be able to add the rules for firewall and dns
|
|
|
|
# open the firewall for this
|
|
|
|
skynet_firewall.forward = [
|
2023-01-28 15:31:16 +00:00
|
|
|
"ip daddr ${ip_pub} tcp dport 80 counter packets 0 bytes 0 accept"
|
|
|
|
"ip daddr ${ip_pub} tcp dport 443 counter packets 0 bytes 0 accept"
|
|
|
|
"ip daddr ${ip_pub} tcp dport 25565 counter packets 0 bytes 0 accept"
|
2023-01-25 11:48:44 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
skynet_dns.records = {
|
|
|
|
external = [
|
|
|
|
"${name} A ${ip_pub}"
|
|
|
|
];
|
|
|
|
cname = [
|
|
|
|
# the games are each going to have a subdomain on this
|
|
|
|
"games CNAME ${name}"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-05-18 20:59:23 +00:00
|
|
|
# we use this to pass in teh relevent infomation to the
|
|
|
|
services.skynet_ldap = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
host = {
|
|
|
|
# pass in teh ip (used for firewall)
|
|
|
|
ip = ip_pub;
|
|
|
|
|
|
|
|
# the name is used for dns
|
|
|
|
name = name;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
security.sudo.extraRules = [
|
|
|
|
{ groups = [ "admin-skynet" ]; commands = [ { command = "ALL"; options = [ "NOPASSWD" ]; } ]; }
|
|
|
|
];
|
|
|
|
|
|
|
|
services.sssd = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
# just for testing purposes, don't put this into the Nix store in production!
|
|
|
|
environmentFile = "${pkgs.writeText "ldap-root" "LDAP_BIND_PW=westwood"}";
|
|
|
|
|
|
|
|
sshAuthorizedKeysIntegration = true;
|
|
|
|
|
|
|
|
config = ''
|
|
|
|
[domain/skynet.ie]
|
|
|
|
id_provider = ldap
|
|
|
|
auth_provider = ldap
|
|
|
|
sudo_provider = ldap
|
|
|
|
ldap_uri = ldap://sso.skynet.ie
|
|
|
|
ldap_search_base = ou=users,dc=skynet,dc=ie
|
|
|
|
ldap_group_search_base = ou=posix-groups,dc=skynet,dc=ie
|
|
|
|
ldap_sudo_search_base = ou=admin-skynet,ou=posix-groups,dc=skynet,dc=ie
|
|
|
|
ldap_default_bind_dn = uid=portunus_service,ou=users,dc=skynet,dc=ie
|
|
|
|
ldap_default_authtok_type = password
|
|
|
|
ldap_default_authtok = $LDAP_BIND_PW
|
|
|
|
cache_credentials = false
|
|
|
|
simple_allow_groups = admin-skynet
|
|
|
|
|
|
|
|
[sssd]
|
|
|
|
config_file_version = 2
|
|
|
|
services = nss, pam, sudo, ssh
|
|
|
|
domains = skynet.ie
|
|
|
|
|
|
|
|
[nss]
|
|
|
|
|
|
|
|
[pam]
|
|
|
|
|
|
|
|
[sudo]
|
|
|
|
|
|
|
|
[autofs]
|
|
|
|
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-01-25 11:48:44 +00:00
|
|
|
}
|