From b48f08ea8e1b19e1c05096e6187b4bfb56567e47 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 8 Dec 2021 15:59:59 +0100 Subject: ci: buildbot-classic -> buildbot; cleanup --- krebs/3modules/buildbot/master.nix | 382 ------------------------------------- krebs/3modules/buildbot/slave.nix | 186 ------------------ krebs/3modules/ci.nix | 222 ++++++++++----------- krebs/3modules/default.nix | 2 - 4 files changed, 102 insertions(+), 690 deletions(-) delete mode 100644 krebs/3modules/buildbot/master.nix delete mode 100644 krebs/3modules/buildbot/slave.nix (limited to 'krebs/3modules') diff --git a/krebs/3modules/buildbot/master.nix b/krebs/3modules/buildbot/master.nix deleted file mode 100644 index c30f31e31..000000000 --- a/krebs/3modules/buildbot/master.nix +++ /dev/null @@ -1,382 +0,0 @@ -{ config, pkgs, lib, ... }: - -with import ; -let - buildbot-master-config = pkgs.writeText "buildbot-master.cfg" '' - # -*- python -*- - from buildbot.plugins import * - import re - import json - c = BuildmasterConfig = {} - - c['slaves'] = [] - slaves = json.loads('${builtins.toJSON cfg.slaves}') - slavenames = [ s for s in slaves ] - for k,v in slaves.items(): - c['slaves'].append(buildslave.BuildSlave(k, v)) - - # TODO: configure protocols? - c['protocols'] = {'pb': {'port': 9989}} - - ####### Build Inputs - c['change_source'] = cs = [] - - ${ concatStringsSep "\n" - (mapAttrsToList (n: v: '' - #### Change_Source: Begin of ${n} - ${v} - #### Change_Source: End of ${n} - '') cfg.change_source )} - - ####### Build Scheduler - c['schedulers'] = sched = [] - - ${ concatStringsSep "\n" - (mapAttrsToList (n: v: '' - #### Schedulers: Begin of ${n} - ${v} - #### Schedulers: End of ${n} - '') cfg.scheduler )} - - ###### Builder - c['builders'] = bu = [] - - # Builder Pre: Begin - ${cfg.builder_pre} - # Builder Pre: End - - ${ concatStringsSep "\n" - (mapAttrsToList (n: v: '' - #### Builder: Begin of ${n} - ${v} - #### Builder: End of ${n} - '') cfg.builder )} - - - ####### Status - c['status'] = st = [] - - # If you want to configure this url, override with extraConfig - c['buildbotURL'] = "http://${config.networking.hostName}:${toString cfg.web.port}/" - - ${optionalString (cfg.web.enable) '' - from buildbot.status import html - from buildbot.status.web import authz, auth - authz_cfg=authz.Authz( - auth=auth.BasicAuth([ ("${cfg.web.username}","${cfg.web.password}") ]), - # TODO: configure harder - gracefulShutdown = False, - forceBuild = 'auth', - forceAllBuilds = 'auth', - pingBuilder = False, - stopBuild = 'auth', - stopAllBuilds = 'auth', - cancelPendingBuild = 'auth' - ) - # TODO: configure krebs.nginx - st.append(html.WebStatus(http_port=${toString cfg.web.port}, authz=authz_cfg)) - ''} - - ${optionalString (cfg.irc.enable) '' - from buildbot.status import words - irc = words.IRC("${cfg.irc.server}", "${cfg.irc.nick}", - channels=${builtins.toJSON cfg.irc.channels}, - notify_events={ - 'started': 1, - 'success': 1, - 'failure': 1, - 'exception': 1, - 'successToFailure': 1, - 'failureToSuccess': 1, - }${optionalString cfg.irc.allowForce ",allowForce=True"}) - c['status'].append(irc) - ''} - - ${ concatStringsSep "\n" - (mapAttrsToList (n: v: '' - #### Status: Begin of ${n} - ${v} - #### Status: End of ${n} - '') cfg.status )} - - ####### PROJECT IDENTITY - c['title'] = "${cfg.title}" - c['titleURL'] = "http://krebsco.de" - - - ####### DB URL - # TODO: configure - c['db'] = { - 'db_url' : "sqlite:///state.sqlite", - } - ${cfg.extraConfig} - ''; - - cfg = config.krebs.buildbot.master; - - api = { - enable = mkEnableOption "Buildbot Master"; - title = mkOption { - default = "Buildbot CI"; - type = types.str; - description = '' - Title of the Buildbot Installation - ''; - }; - workDir = mkOption { - default = "/var/lib/buildbot/master"; - type = types.str; - description = '' - Path to build bot master directory. - Will be created on startup. - ''; - }; - - secrets = mkOption { - default = []; - type = types.listOf types.str; - example = [ "cac.json" ]; - description = '' - List of all the secrets in ‹secrets› which should be copied into the - buildbot master directory. - ''; - }; - - slaves = mkOption { - default = {}; - type = types.attrsOf types.str; - description = '' - Attrset of slavenames with their passwords - slavename = slavepassword - ''; - }; - - change_source = mkOption { - default = {}; - type = types.attrsOf types.str; - example = { - stockholm = '' - cs.append(changes.GitPoller( - 'http://cgit.gum/stockholm', - workdir='stockholm-poller', branch='master', - project='stockholm', - pollinterval=120)) - ''; - }; - description = '' - Attrset of all the change_sources which should be configured. - It will be directly included into the master configuration. - - At the end an change object should be appended to cs - ''; - }; - - scheduler = mkOption { - default = {}; - type = types.attrsOf types.str; - example = { - force-scheduler = '' - sched.append(schedulers.ForceScheduler( - name="force", - builderNames=["full-tests"])) - ''; - }; - description = '' - Attrset of all the schedulers which should be configured. - It will be directly included into the master configuration. - - At the end an change object should be appended to sched - ''; - }; - - builder_pre = mkOption { - default = ""; - type = types.lines; - example = '' - grab_repo = steps.Git(repourl=stockholm_repo, mode='incremental') - ''; - description = '' - some code before the builders are being assembled. - can be used to define functions used by multiple builders - ''; - }; - - builder = mkOption { - default = {}; - type = types.attrsOf types.str; - example = { - fast-test = '' - ''; - }; - description = '' - Attrset of all the builder which should be configured. - It will be directly included into the master configuration. - - At the end an change object should be appended to bu - ''; - }; - - status = mkOption { - default = {}; - type = types.attrsOf types.str; - description = '' - Attrset of all the extra status which should be configured. - It will be directly included into the master configuration. - - At the end an change object should be appended to st - - Right now IRC and Web status can be configured by setting - buildbot.master.irc.enable and - buildbot.master.web.enable - ''; - }; - - # Configurable Stati - web = mkOption { - default = {}; - type = types.submodule ({ config2, ... }: { - options = { - enable = mkEnableOption "Buildbot Master Web Status"; - username = mkOption { - default = "krebs"; - type = types.str; - description = '' - username for web authentication - ''; - }; - hostname = mkOption { - default = config.networking.hostName; - type = types.str; - description = '' - web interface Hostname - ''; - }; - password = mkOption { - default = "bob"; - type = types.str; - description = '' - password for web authentication - ''; - }; - port = mkOption { - default = 8010; - type = types.int; - description = '' - port for buildbot web status - ''; - }; - }; - }); - }; - - irc = mkOption { - default = {}; - type = types.submodule ({ config, ... }: { - options = { - enable = mkEnableOption "Buildbot Master IRC Status"; - channels = mkOption { - default = [ "nix-buildbot-meetup" ]; - type = with types; listOf str; - description = '' - irc channels the bot should connect to - ''; - }; - allowForce = mkOption { - default = false; - type = types.bool; - description = '' - Determines if builds can be forced via IRC - ''; - }; - nick = mkOption { - default = "nix-buildbot"; - type = types.str; - description = '' - nickname for IRC - ''; - }; - server = mkOption { - default = "irc.freenode.net"; - type = types.str; - description = '' - Buildbot Status IRC Server to connect to - ''; - }; - }; - }); - }; - - extraConfig = mkOption { - default = ""; - type = types.lines; - description = '' - extra config appended to the generated master.cfg - ''; - }; - }; - - imp = { - - users.extraUsers.buildbotMaster = { - uid = genid "buildbotMaster"; - group = "buildbotMaster"; - description = "Buildbot Master"; - home = cfg.workDir; - createHome = false; - isSystemUser = true; - }; - - users.extraGroups.buildbotMaster = { - gid = 672626386; - }; - - systemd.services.buildbotMaster = { - description = "Buildbot Master"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; - # TODO: add extra dependencies to master like svn and cvs - path = [ pkgs.git ]; - environment = { - SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; - }; - serviceConfig = let - workdir = shell.escape cfg.workDir; - secretsdir = shell.escape (toString ); - in { - PermissionsStartOnly = true; - # TODO: maybe also prepare buildbot.tac? - ExecStartPre = pkgs.writeDash "buildbot-master-init" '' - set -efux - if [ ! -e ${workdir} ];then - mkdir -p ${workdir} - ${pkgs.buildbot-classic}/bin/buildbot create-master -r -l 10 -f ${workdir} - fi - # always override the master.cfg - cp ${buildbot-master-config} ${workdir}/master.cfg - - # copy secrets - ${ concatMapStringsSep "\n" - (f: "cp ${secretsdir}/${f} ${workdir}/${f}" ) cfg.secrets } - # sanity - ${pkgs.buildbot-classic}/bin/buildbot checkconfig ${workdir} - - # TODO: maybe upgrade? not sure about this - # normally we should write buildbot.tac by our own - # ${pkgs.buildbot-classic}/bin/buildbot upgrade-master ${workdir} - - chmod 700 ${workdir} - chown buildbotMaster:buildbotMaster -R ${workdir} - ''; - ExecStart = "${pkgs.buildbot-classic}/bin/buildbot start --nodaemon ${workdir}"; - PrivateTmp = "true"; - User = "buildbotMaster"; - Restart = "always"; - RestartSec = "10"; - }; - }; - }; -in -{ - options.krebs.buildbot.master = api; - config = lib.mkIf cfg.enable imp; -} diff --git a/krebs/3modules/buildbot/slave.nix b/krebs/3modules/buildbot/slave.nix deleted file mode 100644 index f97b50def..000000000 --- a/krebs/3modules/buildbot/slave.nix +++ /dev/null @@ -1,186 +0,0 @@ -{ config, pkgs, lib, ... }: - -with import ; -let - buildbot-slave-init = pkgs.writeText "buildbot-slave.tac" '' - import os - - from buildslave.bot import BuildSlave - from twisted.application import service - - basedir = '${cfg.workDir}' - rotateLength = 10000000 - maxRotatedFiles = 10 - - application = service.Application('buildslave') - - from twisted.python.logfile import LogFile - from twisted.python.log import ILogObserver, FileLogObserver - logfile = LogFile.fromFullPath(os.path.join(basedir, "twistd.log"), rotateLength=rotateLength, - maxRotatedFiles=maxRotatedFiles) - application.setComponent(ILogObserver, FileLogObserver(logfile).emit) - - buildmaster_host = '${cfg.masterhost}' - # TODO: masterport? - port = 9989 - slavename = '${cfg.username}' - passwd = '${cfg.password}' - keepalive = 600 - usepty = 0 - umask = None - maxdelay = 300 - allow_shutdown = None - - ${cfg.extraConfig} - - s = BuildSlave(buildmaster_host, port, slavename, passwd, basedir, - keepalive, usepty, umask=umask, maxdelay=maxdelay, - allow_shutdown=allow_shutdown) - s.setServiceParent(application) - ''; - default-packages = [ pkgs.git pkgs.bash ]; - cfg = config.krebs.buildbot.slave; - - api = { - enable = mkEnableOption "Buildbot Slave"; - - workDir = mkOption { - default = "/var/lib/buildbot/slave"; - type = types.str; - description = '' - Path to build bot slave directory. - Will be created on startup. - ''; - }; - - masterhost = mkOption { - default = "localhost"; - type = types.str; - description = '' - Hostname/IP of the buildbot master - ''; - }; - - username = mkOption { - type = types.str; - description = '' - slavename used to authenticate with master - ''; - }; - - password = mkOption { - type = types.str; - description = '' - slave password used to authenticate with master - ''; - }; - - contact = mkOption { - default = "nix slave "; - type = types.str; - description = '' - contact to be announced by buildslave - ''; - }; - - description = mkOption { - default = "Nix Generated BuildSlave"; - type = types.str; - description = '' - description for hostto be announced by buildslave - ''; - }; - - packages = mkOption { - default = [ pkgs.git ]; - type = with types; listOf package; - description = '' - packages which should be in path for buildslave - ''; - }; - - extraEnviron = mkOption { - default = {}; - example = { - NIX_PATH = "nixpkgs=/path/to/my/nixpkgs"; - }; - type = types.attrsOf types.str; - description = '' - extra environment variables to be provided to the buildslave service - if you need nixpkgs, e.g. for running nix-shell you can set NIX_PATH here. - ''; - }; - - extraConfig = mkOption { - default = ""; - type = types.lines; - example = '' - port = 443 - keepalive = 600 - ''; - description = '' - extra config evaluated before calling BuildSlave init in .tac file - ''; - }; - }; - - imp = { - - users.extraUsers.buildbotSlave = { - uid = genid "buildbotSlave"; - group = "buildbotSlave"; - description = "Buildbot Slave"; - home = cfg.workDir; - createHome = false; - isSystemUser = true; - }; - - users.extraGroups.buildbotSlave = { - gid = 1408105834; - }; - - systemd.services."buildbotSlave-${cfg.username}-${cfg.masterhost}" = { - description = "Buildbot Slave for ${cfg.username}@${cfg.masterhost}"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; - path = default-packages ++ cfg.packages; - - environment = { - SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; - NIX_REMOTE="daemon"; - } // cfg.extraEnviron; - - serviceConfig = let - workdir = shell.escape cfg.workDir; - contact = shell.escape cfg.contact; - description = shell.escape cfg.description; - # TODO:make this - in { - PermissionsStartOnly = true; - Type = "forking"; - PIDFile = "${workdir}/twistd.pid"; - # TODO: maybe also prepare buildbot.tac? - ExecStartPre = pkgs.writeDash "buildbot-master-init" '' - set -efux - mkdir -p ${workdir}/info - cp ${buildbot-slave-init} ${workdir}/buildbot.tac - echo ${contact} > ${workdir}/info/admin - echo ${description} > ${workdir}/info/host - - chown buildbotSlave:buildbotSlave -R ${workdir} - chmod 700 ${workdir} - ''; - ExecStart = "${pkgs.buildbot-classic-slave}/bin/buildslave start ${workdir}"; - ExecStop = "${pkgs.buildbot-classic-slave}/bin/buildslave stop ${workdir}"; - PrivateTmp = "true"; - User = "buildbotSlave"; - Restart = "always"; - RestartSec = "10"; - }; - }; - }; -in -{ - options.krebs.buildbot.slave = api; - config = lib.mkIf cfg.enable imp; -} diff --git a/krebs/3modules/ci.nix b/krebs/3modules/ci.nix index 50db0b971..bb941a1fb 100644 --- a/krebs/3modules/ci.nix +++ b/krebs/3modules/ci.nix @@ -39,148 +39,131 @@ let profileRoot = "/nix/var/nix/profiles/ci"; - imp = { - krebs.buildbot.master = { - slaves = { - testslave = "lasspass"; - }; + bcfg = config.services.buildbot-master; - change_source = mapAttrs' (name: repo: - nameValuePair name (concatMapStrings (url: '' - cs.append( - changes.GitPoller( - "${url}", - workdir='${name}-${elemAt(splitString "." url) 1}', branches=True, - project='${name}', - pollinterval=100 - ) + imp = { + services.buildbot-master = { + workers = [ "worker.Worker('testworker', 'pass')" ]; + + changeSource = mapAttrsToList (name: repo: + concatMapStringsSep "," (url: '' + changes.GitPoller( + "${url}", + workdir='${name}-${elemAt(splitString "." url) 1}', branches=True, + project='${name}', + pollinterval=100 ) - '') repo.urls) + '') repo.urls ) cfg.repos; - scheduler = mapAttrs' (name: repo: - nameValuePair name '' - sched.append( - schedulers.SingleBranchScheduler( - change_filter=util.ChangeFilter( - branch_re=".*", - project='${name}', - ), - treeStableTimer=60, - name="${name}-all-branches", - builderNames=[ - "${name}", - ] - ) - ) - sched.append( - schedulers.ForceScheduler( - name="${name}", - builderNames=[ - "${name}", - ] - ) - ) - '' - ) cfg.repos; - builder_pre = '' - from buildbot import interfaces - from buildbot.steps.shell import ShellCommand + schedulers = mapAttrsToList (name: repo: '' + schedulers.SingleBranchScheduler( + change_filter=util.ChangeFilter( + branch_re=".*", + project='${name}', + ), + treeStableTimer=60, + name="${name}-all-branches", + builderNames=[ + "${name}", + ] + ), + schedulers.ForceScheduler( + name="${name}", + builderNames=[ + "${name}", + ] + ) + '') cfg.repos; + + builders = []; - class StepToStartMoreSteps(ShellCommand): - def __init__(self, **kwargs): - ShellCommand.__init__(self, **kwargs) - - def addBuildSteps(self, steps_factories): - for sf in steps_factories: - step = interfaces.IBuildStepFactory(sf).buildStep() - step.setBuild(self.build) - step.setBuildSlave(self.build.slavebuilder.slave) - step_status = self.build.build_status.addStepWithName(step.name) - step.setStepStatus(step_status) - self.build.steps.append(step) - - def start(self): - props = self.build.getProperties() - new_steps = json.loads(props.getProperty('steps_json')) - for new_step in new_steps: - self.addBuildSteps([steps.ShellCommand( - name=str(new_step), - command=[ - "${pkgs.writeDash "build-stepper.sh" '' - set -xefu - profile=${shell.escape profileRoot}/$build_name - result=$("$build_script") - if [ -n "$result" ]; then - ${pkgs.nix}/bin/nix-env -p "$profile" --set "$result" - fi - ''}" - ], - env={ - "build_name": new_step, - "build_script": new_steps[new_step], - "NIX_REMOTE": "daemon", - "NIX_PATH": "secrets=/var/src/stockholm/null:/var/src", - }, - timeout=90001, - workdir='build', # TODO figure out why we need this? - )]) - - ShellCommand.start(self) - - ''; + extraConfig = '' + # https://docs.buildbot.net/latest/manual/configuration/buildfactories.html + from buildbot.plugins import util, steps + from buildbot.process import buildstep, logobserver + from twisted.internet import defer + import json - builder = mapAttrs' (name: repo: - nameValuePair name '' - f_${name} = util.BuildFactory() - f_${name}.addStep(steps.Git( + class GenerateStagesCommand(buildstep.ShellMixin, steps.BuildStep): + def __init__(self, **kwargs): + kwargs = self.setupShellMixin(kwargs) + super().__init__(**kwargs) + self.observer = logobserver.BufferLogObserver() + self.addLogObserver('stdio', self.observer) + + def extract_stages(self, stdout): + stages = json.loads(stdout) + return stages + + @defer.inlineCallbacks + def run(self): + # run nix-instanstiate to generate the dict of stages + cmd = yield self.makeRemoteShellCommand() + yield self.runCommand(cmd) + + # if the command passes extract the list of stages + result = cmd.results() + if result == util.SUCCESS: + # create a ShellCommand for each stage and add them to the build + stages = self.extract_stages(self.observer.getStdout()) + self.build.addStepsAfterCurrentStep([ + steps.ShellCommand(name=stage, command=[stages[stage]]) + for stage in stages + ]) + + return result + + + ${concatStringsSep "\n" (mapAttrsToList (name: repo: '' + factory_${name} = util.BuildFactory() + factory_${name}.addStep(steps.Git( repourl=util.Property('repository', '${head repo.urls}'), method='clobber', mode='full', submodules=True, )) - f_${name}.addStep(steps.SetPropertyFromCommand( + factory_${name}.addStep(GenerateStagesCommand( env={ - "NIX_REMOTE": "daemon", - "NIX_PATH": "secrets=/var/src/stockholm/null:/var/src", + "NIX_REMOTE": "daemon", + "NIX_PATH": "secrets=/var/src/stockholm/null:/var/src", }, - name="get_steps", - command=["${getJobs}"], - extract_fn=lambda rc, stdout, stderr: { 'steps_json': stdout }, + name="Generate build stages", + command=[ + "${getJobs}" + ], + haltOnFailure=True, )) - f_${name}.addStep(StepToStartMoreSteps(command=["echo"])) # TODO remove dummy command from here - bu.append( + c['builders'].append( util.BuilderConfig( name="${name}", - slavenames=slavenames, - factory=f_${name} + workernames=['testworker'], + factory=factory_${name} ) ) - '' - ) cfg.repos; + '') cfg.repos)} + ''; enable = true; - web.enable = true; - irc = { - enable = true; - nick = "build|${hostname}"; - server = "irc.r"; - channels = [ "xxx" "noise" ]; - allowForce = true; - }; - extraConfig = '' - c['buildbotURL'] = "http://build.${hostname}.r/" - ''; + reporters = ['' + reporters.IRC( + host = "irc.r", + nick = "buildbot|${hostname}", + notify_events = [ 'started', 'finished', 'failure', 'success', 'exception', 'problem' ], + channels = [{"channel": "#xxx"}], + ) + '']; + + buildbotUrl = "http://build.${hostname}.r/"; }; - krebs.buildbot.slave = { + services.buildbot-worker = { enable = true; - masterhost = "localhost"; - username = "testslave"; - password = "lasspass"; - packages = with pkgs; [ gnumake jq nix populate gnutar lzma gzip ]; + workerUser = "testworker"; + workerPass = "pass"; + packages = with pkgs; [ git gnutar gzip jq nix populate ]; }; system.activationScripts.buildbots-nix-profile = '' @@ -192,11 +175,10 @@ let users = { groups.buildbots.gid = genid "buildbots"; users = { - buildbotMaster.extraGroups = [ "buildbots" ]; - buildbotSlave.extraGroups = [ "buildbots" ]; + buildbot.extraGroups = [ "buildbots" ]; + bbworker.extraGroups = [ "buildbots" ]; }; }; }; in out - diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index 7b6639212..0617e15b2 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -13,8 +13,6 @@ let ./bepasty-server.nix ./bindfs.nix ./brockman.nix - ./buildbot/master.nix - ./buildbot/slave.nix ./build.nix ./cachecache.nix ./ci.nix -- cgit v1.2.3 From 3f6219e251aba6a67cbfea14a070e746c9320162 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 8 Dec 2021 08:50:32 +0100 Subject: users: add xkey ssh key, use for logging into puyak --- krebs/3modules/external/default.nix | 4 +++- krebs/3modules/external/ssh/xkey.pub | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 krebs/3modules/external/ssh/xkey.pub (limited to 'krebs/3modules') diff --git a/krebs/3modules/external/default.nix b/krebs/3modules/external/default.nix index fe572f2ae..91ce66742 100644 --- a/krebs/3modules/external/default.nix +++ b/krebs/3modules/external/default.nix @@ -754,7 +754,9 @@ in { mail = "xq@shackspace.de"; pubkey = ssh-for "xq"; }; - xkey = {}; + xkey = { + pubkey = ssh-for "xkey"; + }; miaoski = { }; filly = { diff --git a/krebs/3modules/external/ssh/xkey.pub b/krebs/3modules/external/ssh/xkey.pub new file mode 100644 index 000000000..cd09f06bb --- /dev/null +++ b/krebs/3modules/external/ssh/xkey.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIZFKgFcAEGXcsssJxDeUVvOTKD0U4LlT2Yw85+WmMTj -- cgit v1.2.3 From 759a471f884ccba6b6f28f0209e7e453d32863e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 27 Nov 2021 13:18:27 +0100 Subject: mic92: drop eddie --- krebs/3modules/external/mic92.nix | 34 ---------------------------------- 1 file changed, 34 deletions(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/external/mic92.nix b/krebs/3modules/external/mic92.nix index 0e6812a35..5e8c2232e 100644 --- a/krebs/3modules/external/mic92.nix +++ b/krebs/3modules/external/mic92.nix @@ -178,40 +178,6 @@ in { }; }; }; - eddie = { - owner = config.krebs.users.mic92; - nets = rec { - internet = { - # eddie.thalheim.io - ip4.addr = "129.215.197.11"; - aliases = [ "eddie.i" ]; - }; - retiolum = { - via = internet; - addrs = [ - config.krebs.hosts.eddie.nets.retiolum.ip4.addr - config.krebs.hosts.eddie.nets.retiolum.ip6.addr - ]; - ip4.addr = "10.243.29.170"; - aliases = [ "eddie.r" ]; - tinc.pubkey = '' - -----BEGIN RSA PUBLIC KEY----- - MIICCgKCAgEAuRQphRlSIC/aqRTfvStPdJOJCx1ACeFIDEjRdgoxuu32qoBl7i6d - j7Voh+Msditf2a5+f0fVsNDaPnjPGfk0NkZBjmn+RZQDRXk0krpTNj2Vb6W5quTm - 3yrjJMFJR9CU5khfppc47X+ir8bjn7RusWTFNEuDvUswHmRmnJHLS3Y+utOaRbCF - 2hxpyxCn423gpsaBfORPEK8X90nPbuNpFDugWPnC+R45TpNmIf4qyKvfhd9OKrua - KNanGHG30xhBW/DclUwwWi8D44d94xFnIRVcG1O+Uto93WoUWZn90lI1qywSj5Aq - iWstBK4tc7VwvAj0UzPlaRYYPfFjOEkPQzj8xC6l/leJcgxkup252uo6m1njMx3t - 6QWMgevjqosY22OZReZfIwb14aDWFKLTWs30J+zmWK4TjlRITdsOEKxlpODMbJAD - kfSoPwuwkWIzFhNOrFiD/NtKaRYmV8bTBCT3a9cvvObshJx13BP+IUFzBS1N1n/u - hJWYH5WFsQZn/8rHDwZGkS1zKPEaNoydjqCZNyJpJ5nhggyl6gpuD7wpXM/8tFay - pAjRP40+qRQLUWXmswV0hsZTOX1tvZs4f68y3WJ+GwCWw9HvvwmzYes5ayJrPsbJ - lyK301Jb42wGEsVWxu3Eo/PLtp8OdD+Wdh6o/ELcc0k/YCUGFMujUM8CAwEAAQ== - -----END RSA PUBLIC KEY----- - ''; - }; - }; - }; eve = { owner = config.krebs.users.mic92; nets = rec { -- cgit v1.2.3 From 9900a57f3f0e361a51c680fc72bcb62c59ce0b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 29 Nov 2021 15:54:05 +0100 Subject: mic92: drop eva's ipv4 address --- krebs/3modules/external/mic92.nix | 1 - 1 file changed, 1 deletion(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/external/mic92.nix b/krebs/3modules/external/mic92.nix index 5e8c2232e..f2276fb23 100644 --- a/krebs/3modules/external/mic92.nix +++ b/krebs/3modules/external/mic92.nix @@ -678,7 +678,6 @@ in { }; retiolum = { via = internet; - ip4.addr = "10.243.29.185"; aliases = [ "eva.r" "loki.r" -- cgit v1.2.3 From 2bcac9f89cd3ada1b75f348db3cafc14eb4dd491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 29 Nov 2021 15:56:30 +0100 Subject: mic92: drop redundant addrs blocks --- krebs/3modules/external/mic92.nix | 71 --------------------------------------- 1 file changed, 71 deletions(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/external/mic92.nix b/krebs/3modules/external/mic92.nix index f2276fb23..65ef565c8 100644 --- a/krebs/3modules/external/mic92.nix +++ b/krebs/3modules/external/mic92.nix @@ -19,10 +19,6 @@ in { aliases = [ "amy.i" ]; }; retiolum = { - addrs = [ - config.krebs.hosts.amy.nets.retiolum.ip4.addr - config.krebs.hosts.amy.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.181"; aliases = [ "amy.r" ]; tinc.pubkey = '' @@ -53,10 +49,6 @@ in { aliases = [ "clara.i" ]; }; retiolum = { - addrs = [ - config.krebs.hosts.clara.nets.retiolum.ip4.addr - config.krebs.hosts.clara.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.182"; aliases = [ "clara.r" ]; tinc.pubkey = '' @@ -130,10 +122,6 @@ in { }; retiolum = { via = internet; - addrs = [ - config.krebs.hosts.donna.nets.retiolum.ip4.addr - config.krebs.hosts.donna.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.180"; aliases = [ "donna.r" ]; tinc.pubkey = '' @@ -159,10 +147,6 @@ in { owner = config.krebs.users.mic92; nets = rec { retiolum = { - addrs = [ - config.krebs.hosts.herbert.nets.retiolum.ip4.addr - config.krebs.hosts.herbert.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.177"; aliases = [ "herbert.r" ]; tinc.pubkey = '' @@ -189,9 +173,6 @@ in { }; retiolum = { via = internet; - addrs = [ - config.krebs.hosts.eve.nets.retiolum.ip6.addr - ]; aliases = [ "eve.r" ]; tinc.pubkey = '' -----BEGIN RSA PUBLIC KEY----- @@ -220,10 +201,6 @@ in { okelmann = { owner = config.krebs.users.mic92; nets.retiolum = { - addrs = [ - config.krebs.hosts.okelmann.nets.retiolum.ip4.addr - config.krebs.hosts.okelmann.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.190"; aliases = [ "okelmann.r" @@ -243,10 +220,6 @@ in { aendernix = { owner = config.krebs.users.mic92; nets.retiolum = { - addrs = [ - config.krebs.hosts.aendernix.nets.retiolum.ip4.addr - config.krebs.hosts.aendernix.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.172"; aliases = [ "aendernix.r" @@ -271,10 +244,6 @@ in { aenderpad = { owner = config.krebs.users.mic92; nets.retiolum = { - addrs = [ - config.krebs.hosts.aenderpad.nets.retiolum.ip4.addr - config.krebs.hosts.aenderpad.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.201"; aliases = [ "aendernix.r" @@ -360,10 +329,6 @@ in { }; retiolum = { via = internet; - addrs = [ - config.krebs.hosts.martha.nets.retiolum.ip4.addr - config.krebs.hosts.martha.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.179"; aliases = [ "martha.r" ]; tinc.pubkey = '' @@ -420,10 +385,6 @@ in { }; retiolum = { via = internet; - addrs = [ - config.krebs.hosts.sauron.nets.retiolum.ip4.addr - config.krebs.hosts.sauron.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.194"; aliases = [ "sauron.r" ]; tinc.pubkey = '' @@ -450,10 +411,6 @@ in { }; retiolum = { via = internet; - addrs = [ - config.krebs.hosts.bill.nets.retiolum.ip4.addr - config.krebs.hosts.bill.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.195"; aliases = [ "bill.r" ]; tinc.pubkey = '' @@ -485,10 +442,6 @@ in { }; retiolum = { via = internet; - addrs = [ - config.krebs.hosts.nardole.nets.retiolum.ip4.addr - config.krebs.hosts.nardole.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.173"; aliases = [ "nardole.r" ]; tinc.pubkey = '' @@ -547,10 +500,6 @@ in { }; retiolum = { via = internet; - addrs = [ - config.krebs.hosts.rose.nets.retiolum.ip4.addr - config.krebs.hosts.rose.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.178"; aliases = [ "rose.r" ]; tinc.pubkey = '' @@ -708,10 +657,6 @@ in { owner = config.krebs.users.mic92; nets = rec { retiolum = { - addrs = [ - config.krebs.hosts.doctor.nets.retiolum.ip4.addr - config.krebs.hosts.doctor.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.186"; aliases = [ "doctor.r" ]; tinc.pubkey = '' @@ -732,10 +677,6 @@ in { owner = config.krebs.users.mic92; nets = rec { retiolum = { - addrs = [ - config.krebs.hosts.bernie.nets.retiolum.ip4.addr - config.krebs.hosts.bernie.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.169"; aliases = [ "bernie.r" ]; tinc.pubkey = '' @@ -770,10 +711,6 @@ in { }; retiolum = { via = internet; - addrs = [ - config.krebs.hosts.ryan.nets.retiolum.ip4.addr - config.krebs.hosts.ryan.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.198"; aliases = [ "ryan.r" ]; tinc.pubkey = '' @@ -802,10 +739,6 @@ in { }; retiolum = { via = internet; - addrs = [ - config.krebs.hosts.graham.nets.retiolum.ip4.addr - config.krebs.hosts.graham.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.199"; aliases = [ "graham.r" ]; tinc.pubkey = '' @@ -827,10 +760,6 @@ in { owner = config.krebs.users.mic92; nets = rec { retiolum = { - addrs = [ - config.krebs.hosts.maurice.nets.retiolum.ip4.addr - config.krebs.hosts.maurice.nets.retiolum.ip6.addr - ]; ip4.addr = "10.243.29.200"; aliases = [ "maurice.r" ]; tinc.pubkey = '' -- cgit v1.2.3 From b981c43a97bf254ea15c324d8f82aab368cdf3d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 3 Dec 2021 11:47:40 +0100 Subject: mic92: remove ipv4 from turingmachine --- krebs/3modules/external/mic92.nix | 1 - 1 file changed, 1 deletion(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/external/mic92.nix b/krebs/3modules/external/mic92.nix index 65ef565c8..901379294 100644 --- a/krebs/3modules/external/mic92.nix +++ b/krebs/3modules/external/mic92.nix @@ -525,7 +525,6 @@ in { owner = config.krebs.users.mic92; nets = { retiolum = { - ip4.addr = "10.243.29.168"; aliases = [ "turingmachine.r" ]; -- cgit v1.2.3 From e5fc654f50e2b99bcae186962b29c8754f382f3b Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 9 Dec 2021 11:21:06 +0100 Subject: add ACME ca via ca.r --- krebs/3modules/default.nix | 1 + krebs/3modules/krebs/default.nix | 1 + krebs/3modules/ssl.nix | 80 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 krebs/3modules/ssl.nix (limited to 'krebs/3modules') diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index 0617e15b2..2772d8d37 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -48,6 +48,7 @@ let ./secret.nix ./setuid.nix ./shadow.nix + ./ssl.nix ./sync-containers.nix ./tinc.nix ./tinc_graphs.nix diff --git a/krebs/3modules/krebs/default.nix b/krebs/3modules/krebs/default.nix index f796f0323..35ed67f5f 100644 --- a/krebs/3modules/krebs/default.nix +++ b/krebs/3modules/krebs/default.nix @@ -76,6 +76,7 @@ in { "agenda.r" "build.r" "build.hotdog.r" + "ca.r" "cgit.hotdog.r" "irc.r" "wiki.r" diff --git a/krebs/3modules/ssl.nix b/krebs/3modules/ssl.nix new file mode 100644 index 000000000..5d28ac841 --- /dev/null +++ b/krebs/3modules/ssl.nix @@ -0,0 +1,80 @@ +{ config, lib, pkgs, ... }: let + cfg = config.krebs.ssl; +in { + options.krebs.ssl = { + rootCA = lib.mkOption { + type = lib.types.str; + readOnly = true; + default = '' + -----BEGIN CERTIFICATE----- + MIIC0jCCAjugAwIBAgIJAKeARo6lDD0YMA0GCSqGSIb3DQEBBQUAMIGBMQswCQYD + VQQGEwJaWjESMBAGA1UECAwJc3RhdGVsZXNzMRAwDgYDVQQKDAdLcmVic2NvMQsw + CQYDVQQLDAJLTTEWMBQGA1UEAwwNS3JlYnMgUm9vdCBDQTEnMCUGCSqGSIb3DQEJ + ARYYcm9vdC1jYUBzeW50YXgtZmVobGVyLmRlMB4XDTE0MDYxMTA4NTMwNloXDTM5 + MDIwMTA4NTMwNlowgYExCzAJBgNVBAYTAlpaMRIwEAYDVQQIDAlzdGF0ZWxlc3Mx + EDAOBgNVBAoMB0tyZWJzY28xCzAJBgNVBAsMAktNMRYwFAYDVQQDDA1LcmVicyBS + b290IENBMScwJQYJKoZIhvcNAQkBFhhyb290LWNhQHN5bnRheC1mZWhsZXIuZGUw + gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMs/WNyeQziccllLqom7bfCjlh6/ + /qx9p6UOqpw96YOOT3sh/mNSBLyNxIUJbWsU7dN5hT7HkR7GwzpfKDtudd9qiZeU + QNYQ+OL0HdOnApjdPqdspZfKxKTXyC1T1vJlaODsM1RBrjLK9RUcQZeNhgg3iM9B + HptOCrMI2fjCdZuVAgMBAAGjUDBOMB0GA1UdDgQWBBSKeq01+rAwp7yAXwzlwZBo + 3EGVLzAfBgNVHSMEGDAWgBSKeq01+rAwp7yAXwzlwZBo3EGVLzAMBgNVHRMEBTAD + AQH/MA0GCSqGSIb3DQEBBQUAA4GBAIWIffZuQ43ddY2/ZnjAxPCRpM3AjoKIwEj9 + GZuLJJ1sB9+/PAPmRrpmUniRkPLD4gtmolDVuoLDNAT9os7/v90yg5dOuga33Ese + 725musUbhEoQE1A1oVHrexBs2sQOplxHKsVXoYJp2/trQdqvaNaEKc3EeVnzFC63 + 80WiO952 + -----END CERTIFICATE----- + ''; + }; + intermediateCA = lib.mkOption { + type = lib.types.str; + readOnly = true; + default = '' + -----BEGIN CERTIFICATE----- + MIICWzCCAcSgAwIBAgIQVavHn7XtM7NJ8bnph6hGoTANBgkqhkiG9w0BAQsFADCB + gTELMAkGA1UEBhMCWloxEjAQBgNVBAgMCXN0YXRlbGVzczEQMA4GA1UECgwHS3Jl + YnNjbzELMAkGA1UECwwCS00xFjAUBgNVBAMMDUtyZWJzIFJvb3QgQ0ExJzAlBgkq + hkiG9w0BCQEWGHJvb3QtY2FAc3ludGF4LWZlaGxlci5kZTAeFw0yMTEyMDgxNTU5 + MDRaFw0yMTEyMDkxNTU5MDRaMBoxGDAWBgNVBAMTD0tyZWJzIEFDTUUgQ0EgMTBZ + MBMGByqGSM49AgEGCCqGSM49AwEHA0IABDOK4g3pJPhOErk49zQgpNKE1cAyoeLp + PqWXkHZVLIVg8CBzPyCYiHS8RtaJ1kwWxwo5OTypCDOLxf1isR5HgZOjgYAwfjAO + BgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQUv758 + A4RPewsRtgjdB6AE1tn632swHwYDVR0jBBgwFoAUinqtNfqwMKe8gF8M5cGQaNxB + lS8wGAYDVR0eAQH/BA4wDKAKMAOCAXIwA4IBdzANBgkqhkiG9w0BAQsFAAOBgQAT + ewOSGWGTCWcJFGSxgnt8/WspMERq1hL1PikwwVMp7wzJmbHcbA0Es4fcrE5Xf8vQ + dGenlvyQjkQNahbsyGBoja7bpWpnw9qofLQkns1AZWp7q7GBqyKm30keM/E/stjH + YkgY4QaxlIL+6N0f4nKL3RSf6GQ1hWJOHf+RrboaMw== + -----END CERTIFICATE----- + ''; + }; + acmeURL = lib.mkOption { + type = lib.types.str; + readOnly = true; + default = "https://ca.r/acme/acme/directory"; + }; + trustRoot = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + whether to trust the krebs root CA. + This implies that krebs can forge a certficate for every domain + ''; + }; + trustIntermediate = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + whether to trust the krebs ACME CA. + this only trusts the intermediate cert for .w and .r domains + ''; + }; + }; + config = lib.mkMerge [ + (lib.mkIf cfg.trustRoot { + security.pki.certificates = [ cfg.rootCA ]; + }) + (lib.mkIf cfg.trustIntermediate { + security.pki.certificates = [ cfg.intermediateCA ]; + }) + ]; +} -- cgit v1.2.3 From 155e3e18b0d65c914ffcdc513090060cff26721a Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 9 Dec 2021 11:35:27 +0100 Subject: realwallpaper: use new graph.r endpoint --- krebs/3modules/realwallpaper.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/realwallpaper.nix b/krebs/3modules/realwallpaper.nix index 167afed2c..f2b34e8c4 100644 --- a/krebs/3modules/realwallpaper.nix +++ b/krebs/3modules/realwallpaper.nix @@ -19,7 +19,7 @@ let marker = mkOption { type = types.str; - default = "http://graph.r/marker.json"; + default = "http://graph.r/network.json"; }; timerConfig = mkOption { -- cgit v1.2.3 From fba330ab36ed3f0c5f5b01a1c434ed9e8281846a Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 9 Dec 2021 14:30:25 +0100 Subject: wiki.r: add acme ssl config --- krebs/3modules/krebs/default.nix | 1 - 1 file changed, 1 deletion(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/krebs/default.nix b/krebs/3modules/krebs/default.nix index 35ed67f5f..1b5d903cb 100644 --- a/krebs/3modules/krebs/default.nix +++ b/krebs/3modules/krebs/default.nix @@ -80,7 +80,6 @@ in { "cgit.hotdog.r" "irc.r" "wiki.r" - "wiki.hotdog.r" ]; tinc.port = 0; tinc.pubkey = '' -- cgit v1.2.3 From abd82c4faf8a882c72f4f19125a280d8d14f852f Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 9 Dec 2021 14:52:35 +0100 Subject: ca.r: serve ca.crt via nginx --- krebs/3modules/ssl.nix | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/ssl.nix b/krebs/3modules/ssl.nix index 5d28ac841..3a9b5d329 100644 --- a/krebs/3modules/ssl.nix +++ b/krebs/3modules/ssl.nix @@ -29,23 +29,7 @@ in { intermediateCA = lib.mkOption { type = lib.types.str; readOnly = true; - default = '' - -----BEGIN CERTIFICATE----- - MIICWzCCAcSgAwIBAgIQVavHn7XtM7NJ8bnph6hGoTANBgkqhkiG9w0BAQsFADCB - gTELMAkGA1UEBhMCWloxEjAQBgNVBAgMCXN0YXRlbGVzczEQMA4GA1UECgwHS3Jl - YnNjbzELMAkGA1UECwwCS00xFjAUBgNVBAMMDUtyZWJzIFJvb3QgQ0ExJzAlBgkq - hkiG9w0BCQEWGHJvb3QtY2FAc3ludGF4LWZlaGxlci5kZTAeFw0yMTEyMDgxNTU5 - MDRaFw0yMTEyMDkxNTU5MDRaMBoxGDAWBgNVBAMTD0tyZWJzIEFDTUUgQ0EgMTBZ - MBMGByqGSM49AgEGCCqGSM49AwEHA0IABDOK4g3pJPhOErk49zQgpNKE1cAyoeLp - PqWXkHZVLIVg8CBzPyCYiHS8RtaJ1kwWxwo5OTypCDOLxf1isR5HgZOjgYAwfjAO - BgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQUv758 - A4RPewsRtgjdB6AE1tn632swHwYDVR0jBBgwFoAUinqtNfqwMKe8gF8M5cGQaNxB - lS8wGAYDVR0eAQH/BA4wDKAKMAOCAXIwA4IBdzANBgkqhkiG9w0BAQsFAAOBgQAT - ewOSGWGTCWcJFGSxgnt8/WspMERq1hL1PikwwVMp7wzJmbHcbA0Es4fcrE5Xf8vQ - dGenlvyQjkQNahbsyGBoja7bpWpnw9qofLQkns1AZWp7q7GBqyKm30keM/E/stjH - YkgY4QaxlIL+6N0f4nKL3RSf6GQ1hWJOHf+RrboaMw== - -----END CERTIFICATE----- - ''; + default = builtins.readFile ../6assets/krebsAcmeCA.crt; }; acmeURL = lib.mkOption { type = lib.types.str; -- cgit v1.2.3 From f2533d88924feb48834a07c4dc1e82cd21acd025 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 11 Dec 2021 12:00:36 +0100 Subject: ci: add gcroots for successful builds --- krebs/3modules/ci.nix | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/ci.nix b/krebs/3modules/ci.nix index bb941a1fb..822dbab61 100644 --- a/krebs/3modules/ci.nix +++ b/krebs/3modules/ci.nix @@ -108,8 +108,21 @@ let # create a ShellCommand for each stage and add them to the build stages = self.extract_stages(self.observer.getStdout()) self.build.addStepsAfterCurrentStep([ - steps.ShellCommand(name=stage, command=[stages[stage]]) - for stage in stages + steps.ShellCommand( + name=stage, + env=dict( + build_name = stage, + build_script = stages[stage], + ), + command="${pkgs.writeDash "build.sh" '' + set -xefu + profile=${shell.escape profileRoot}/$build_name + result=$("$build_script") + if [ -n "$result" ]; then + ${pkgs.nix}/bin/nix-env -p "$profile" --set "$result" + fi + ''}", + ) for stage in stages ]) return result -- cgit v1.2.3 From a7f26ef99b5d514b44590285b8f74a1df94a6e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 20 Dec 2021 19:00:41 +0100 Subject: mic92: add mickey.r --- krebs/3modules/external/mic92.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'krebs/3modules') diff --git a/krebs/3modules/external/mic92.nix b/krebs/3modules/external/mic92.nix index 901379294..3c76a372c 100644 --- a/krebs/3modules/external/mic92.nix +++ b/krebs/3modules/external/mic92.nix @@ -775,5 +775,30 @@ in { }; }; }; + + mickey = { + owner = config.krebs.users.mic92; + nets = rec { + retiolum = { + aliases = [ "mickey.r" ]; + tinc.pubkey = '' + Ed25519PublicKey = cE450gYxzp9kAzV5ytU9N7aV+WdnD7wQMjkPWV7r/bC + -----BEGIN RSA PUBLIC KEY----- + MIICCgKCAgEA7TwI3/tyl3z46Enr6p/0bpl5CpG6DZLxjAhsMcWBM+4xTL9s18IZ + 2FGbyS3EyOBprMBQULrik1u0rfZ0AL8XdO6h+r1BD6XmlZtUu3FJaVeXrLBPGtC0 + qqC0mZOj1ezTl3kC9/O7slU1/vuIRWiiRuvmvLnc6uWo+ShTl8fs0a3rY7/FsFVY + ZClf2M/5cJmeZpwy+PvgGmhSvjflO5+v+C+LvvhfVzoLw2zf8Gbi23ifS0uhhJt2 + 9ztGnmQg+n4+EWEN3XFS1XXHO2P2jyy1ss5NrN0JrO/1J519owHXxbo096MV12xr + azD6of8k0xHbfW4PW0/U1qzs9Ra1T54D+xtnyemLOyeCApwUy+bSg+XuqMz1Wy55 + dci7cBguTIn+pnJqcf8lGSfWDSxlBiwrbXSPszlRQ6vO8MA2uciSmOKodKtNj4bQ + 5IfdHHOHGAuuE+ZNt6owc/8QzQ3dVT+fVmTeN1PB4FmPmF5E2kOpe4NebZ0DhD+g + +g/bNO5FFlIy2M+LKauIXugAHlrVrxl4blfjVkb9xrfsSJHQl8/G/F9zMUAzUBv3 + W8cVFn9mAw0FFaQljs9iha92we6Vs93v+ZvsmSG2MVOYBVwka4FJ7kjaABLFXcjN + RA8gQM/P3j1EmDvemlskWOoCLVELR40BtKdM9MFiGqxGMoNh3DvGWTECAwEAAQ== + -----END RSA PUBLIC KEY----- + ''; + }; + }; + }; }; } -- cgit v1.2.3 From d6f79283bf4aa411ef3a45a767dd0ee67be861bd Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 21 Dec 2021 12:08:47 +0100 Subject: tinc module: use tinc_pre as default package --- krebs/3modules/tinc.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/tinc.nix b/krebs/3modules/tinc.nix index 898b5e8c3..b12fe6050 100644 --- a/krebs/3modules/tinc.nix +++ b/krebs/3modules/tinc.nix @@ -102,7 +102,7 @@ let tincPackage = mkOption { type = types.package; - default = pkgs.tinc; + default = pkgs.tinc_pre; description = "Tincd package to use."; }; -- cgit v1.2.3 From 0a7d779cc1823ea0f62813211ac792016cbed81c Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 21 Dec 2021 12:38:07 +0100 Subject: iptables module: add compat layer to networking.firewall --- krebs/3modules/iptables.nix | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/iptables.nix b/krebs/3modules/iptables.nix index 6298a05a5..3bab13b0e 100644 --- a/krebs/3modules/iptables.nix +++ b/krebs/3modules/iptables.nix @@ -73,7 +73,7 @@ let }; }; - imp = { + imp = mkMerge ([{ networking.firewall.enable = false; systemd.services.krebs-iptables = { @@ -97,7 +97,41 @@ let unitConfig.DefaultDependencies = false; }; - }; + }] ++ compat); + + compat = [ + ({ + krebs.iptables.tables.filter.INPUT.rules = map + (port: { predicate = "-p tcp --dport ${toString port}"; target = "ACCEPT"; }) + config.networking.firewall.allowedTCPPorts; + }) + ({ + krebs.iptables.tables.filter.INPUT.rules = map + (port: { predicate = "-p udp --dport ${toString port}"; target = "ACCEPT"; }) + config.networking.firewall.allowedUDPPorts; + }) + ({ + krebs.iptables.tables.filter.INPUT.rules = map + (portRange: { predicate = "-p tcp --dport ${toString port.from}:${toString port.to}"; target = "ACCEPT"; }) + config.networking.firewall.allowedTCPPortRanges; + }) + ({ + krebs.iptables.tables.filter.INPUT.rules = map + (portRange: { predicate = "-p udp --dport ${toString port.from}:${toString port.to}"; target = "ACCEPT"; }) + config.networking.firewall.allowedUDPPortRanges; + }) + ({ + krebs.iptables.tables.filter.INPUT.rules = flatten (mapAttrsToList + (interface: interfaceConfig: [ + (map (port: { predicate = "-i ${interface} -p tcp --dport ${toString port}"; target = "ACCEPT"; }) interfaceConfig.allowedTCPPorts) + (map (port: { predicate = "-i ${interface} -p udp --dport ${toString port}"; target = "ACCEPT"; }) interfaceConfig.allowedUDPPorts) + (map (portRange: { predicate = "-i ${interface} -p tcp --dport ${toString port.from}:${toString port.to}"; target = "ACCEPT"; }) interfaceConfig.allowedTCPPortRanges) + (map (portRange: { predicate = "-i ${interface} -p udp --dport ${toString port.from}:${toString port.to}"; target = "ACCEPT"; }) interfaceConfig.allowedUDPPortRanges) + ]) + config.networking.firewall.interfaces + ); + }) + ]; #buildTable :: iptablesVersion -> iptablesAttrSet` -> str #todo: differentiate by iptables-version -- cgit v1.2.3 From c9f0c17660a23faaa9fff1331b9c303f52b7c995 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 21 Dec 2021 21:57:21 +0100 Subject: tinc module: reload instead of restart remove enableLegacy option since reloading is dependant on /etc/tinc/ existing --- krebs/3modules/tinc.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/tinc.nix b/krebs/3modules/tinc.nix index b12fe6050..3d0cc8fb4 100644 --- a/krebs/3modules/tinc.nix +++ b/krebs/3modules/tinc.nix @@ -17,7 +17,6 @@ let in { enable = mkEnableOption "krebs.tinc.${netname}" // { default = true; }; - enableLegacy = mkEnableOption "/etc/tinc/${netname}"; confDir = mkOption { type = types.package; @@ -263,9 +262,9 @@ let ) config.krebs.tinc; environment.etc = mapAttrs' (netname: cfg: - nameValuePair "tinc/${netname}" (mkIf cfg.enableLegacy { + nameValuePair "tinc/${netname}" { source = cfg.confDir; - }) + } ) config.krebs.tinc; systemd.services = mapAttrs (netname: cfg: @@ -287,9 +286,12 @@ let ]; wantedBy = [ "multi-user.target" ]; path = [ tinc iproute ]; + reloadIfChanged = true; + restartTriggers = [ cfg.confDir ]; serviceConfig = rec { Restart = "always"; - ExecStart = "${tinc}/sbin/tincd -c ${cfg.confDir} -d 0 -U ${cfg.user.name} -D --pidfile=/var/run/tinc.${SyslogIdentifier}.pid"; + ExecStart = "${tinc}/sbin/tincd -c /etc/tinc/${netname} -d 0 -U ${cfg.user.name} -D --pidfile=/var/run/tinc.${SyslogIdentifier}.pid"; + ExecReload = "${tinc}/sbin/tinc -n ${netname} reload"; SyslogIdentifier = netname; }; } -- cgit v1.2.3