apiVersion: v1
kind: ConfigMap
metadata:
  name: unrealircd
  labels:
    app: unrealircd
data:
  ircd.motd: |-
    Welcome to the FAForever IRC Server

  unrealircd.conf: |-
    include "modules.default.conf";
    include "help/help.conf";
    include "badwords.conf";
    include "spamfilter.conf";
    include "operclass.default.conf";

    me {
    	name "irc.##FAF_BASE_DOMAIN##";
    	info "FAForever";
    	sid "001";
    };

    admin {
    	"Admin";
    	"admin";
    	"admin@##FAF_BASE_DOMAIN##";
    };
    class clients
    {
    	pingfreq 90;
    	maxclients 3000;
    	sendq 200k;
    	recvq 8000;
    };

    class opers
    {
    	pingfreq 90;
    	maxclients 50;
    	sendq 1M;
    	recvq 8000;
    };

    class servers
    {
    	pingfreq 60;
    	connfreq 15; /* try to connect every 15 seconds */
    	maxclients 10; /* max servers */
    	sendq 5M;
    };

    allow {
    	ip *@*;
    	class clients;
    	maxperip 10;
    };

    /* FAF IMPORTANT FAF
            we are blocking ip v6 on purpose using `ip 0.0.0.0`
            docker-compose can't handle ipv4 and ipv6 in parallel currently
            using ipv4 only we delegate the ipv6->ipv4 routing to docker

            if you want to use ipv6 replace `ip 0.0.0.0` with `ip *`
    */

    listen {
    	ip 0.0.0.0;
    	port 6667;
    };

    listen {
    	ip 0.0.0.0;
    	port 6697;
    	options { ssl; };
    };

    listen {
    	ip 0.0.0.0;
    	port 7000;
    	options { serversonly; };
    };

    listen {
    	ip 0.0.0.0;
    	port 8167;
    	options { ssl; };
    };

    drpass {
    	restart "restart";
    	die "die";
    };

    log "ircd.log" {
    	flags {
    		oper;
    		connects;
    		server-connects;
    		kills;
    		errors;
    		sadmin-commands;
    		chg-commands;
    		oper-override;
    		tkl;
    		spamfilter;
    	};
    };

    include "aliases/anope.conf";

    oper sheeo__ {
    	class opers;
    	mask *@*;
    	password "B4n4nA";
    	operclass netadmin;
    	swhois "is a Network Administrator";
    	vhost netadmin.mynet.org;
    };

    ban nick {
    	mask "*C*h*a*n*S*e*r*v*";
    	reason "Reserved for Services";
    };

    except ban {
    	mask *@192.0.2.1;
    	type all;
    };

    deny dcc {
    	filename "*sub7*";
    	reason "Possible Sub7 Virus";
    };

    deny channel {
    	channel "*warez*";
    	reason "Warez is illegal";
    	class "clients";
    };

    set {
    	network-name 		"FAForever";
    	default-server 		"faf-irc";
    	services-server 	"faf-irc-services";
    	stats-server 		"faf-irc-stats";
    	help-channel 		"#help";
    	hiddenhost-prefix	"Clk";
    	prefix-quit 		"Quit";
    	plaintext-policy {
    		 /* must be one of: allow, warn, deny */
    		 /* server users access via internal network */
    		user allow;
    		oper deny;
    		server allow;
      };
    	cloak-keys {
    		"B4n4n1";
    		"B4n4n2";
    		"B4n4n3";
    	};
    };

    link services.##FAF_BASE_DOMAIN##
    {
     incoming {
       mask *.*.*.*;
     };
     outgoing {
        hostname services.##FAF_BASE_DOMAIN##;
        port 7000;
     };
     password "banana";
     class	servers;
    };

    ulines {
    	faf-irc-services;
    };

    set {
    	kline-address "admin@##FAF_BASE_DOMAIN##";
    	modes-on-connect "+ixw";
    	modes-on-oper	 "+xwgs";
    	oper-auto-join "#opers";
    	options {
    		hide-ulines;
    		show-connect-info;
    	};

    	maxchannelsperuser 20;

    	anti-spam-quit-message-time 10s;

    	anti-flood {
    		nick-flood 3:60;
    		connect-flood 3:60;
    		away-flood 4:120;
    	};

    	spamfilter {
    		ban-time 1d;
    		ban-reason "Spam/Advertising";
    		virus-help-channel "#help";
    	};
    };
