🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #84987

Re: Nocem question

#84987
From: Tim Skirvin
Date: Tue, 26 Jun 2012 19:45
141 lines
5614 bytes
Alexander Bartolich <alexander.bartolich@gmx.at> writes:

> Last time I looked the documentation was bad and the source code
> incomprehensible. After a bit of experimenting I found a working
> setup, though.

        I wrote up some puppet configuration that seems to get NoCeM
working properly a while ago.  I'm not sure if this will help anybody out,
but here's what it generally looks like (and it's missing a lot, but it
might get the idea across):

# Configuration to support NoCeM filtering from a server.  Consists of three
# parts: a managing /etc/news/nocem.ctl, managing a GPG file for valid 
# keys, and actually adding entries to listen to.

class usenet_inn2::nocem (
) inherits usenet_inn2::params {
  include usenet_inn2::nocem::gpg
  include usenet_inn2::nocem::newsfeeds
  include usenet_inn2::nocem::ctl

  usenet_inn2::nocem::fragment { 
    'vlad-pgpmoose':
      ensure => present,
      issuer => 'pgpmoose@killfile.org',
      type   => 'pgpmoose-forged-moderation';
    'bleachbot':
      ensure => present,
      issuer => 'bleachbot@httrack.com',
      type   => 'mmf,spam';
  }
}

class usenet_inn2::nocem::gpg (
) inherits usenet_inn2::params {

  $gpg_opts = "--no-default-keyring --no-options --allow-non-selfsigned-uid --no-permission-warning"
  $keyring = "${path_conf}/pgp/ncmring.gpg"

  exec { "nocem-gpg import":
    command     => "/bin/rm -f ${keyring} && gpg ${gpg_opts} --primary-keyring ${keyring} --import ${path_conf}/pgp/nocem/*",
    creates     => $keyring,
    notify      => File[$keyring]
  }

  file { 
    $keyring: 
      require => Exec['nocem-gpg import'],
      mode    => 644;
    "${path_conf}/pgp/nocem":
      source  => 'puppet:///modules/usenet_inn2/etc/news/pgp/nocem',
      recurse => true,
      notify  => Exec['nocem-gpg import'],
  }
}

# Create and manage /etc/news/nocem.ctl (or similar).  This file is used to 
# decide which nocem messages to honor.
#
# The underlying file is managed with the 'concat' module.  Stanzas are created
# using the usenet_inn2::nocem::fragment definition.
# 
# Usage (defaults come from usenet_inn2::params):
#
#   class { 'usenet_inn2::nocem::ctl':
#     $news_group => [ '<unix-group>' ],
#     $news_user  => [ '<unix-user>' ],
#     $path_conf  => [ '<path-to-files>' ]
#   }

class usenet_inn2::nocem::ctl (
  $news_group = $usenet_inn2::params::news_group,
  $news_user  = $usenet_inn2::params::news_user,
  $path_conf  = $usenet_inn2::params::path_conf
) inherits usenet_inn2::params {
  include concat::setup

  $config = "${path_conf}/nocem.ctl"

  concat { $config:
    owner => $news_user,
    group => $news_group,
    mode  => 0644;
  }

  concat::fragment { 'nocem.ctl.local_header':
    target  => $config,
    content => "## $config - managed with puppet\n\n",
    order   => 01
  }
}

# Generate an entry in /etc/news/nocem.ctl (or equivalent).  Uses 
# concat::fragment to do the merging.
#
# Usage: 
#
#   usenet_inn2::nocem::fragment { '<name>':
#     ensure     => present | absent,
#     issuer     => '<address>',
#     type       => '<nocem-type>'
#   }
#
# Please see the perl-nocem man page for details on the proper values for 
# issuer/type.

define usenet_inn2::nocem::fragment (
  $ensure     = 'present',
  $issuer,
  $type
) {
  include usenet_inn2::nocem::ctl

  $config = $usenet_inn2::nocem::ctl::config

  concat::fragment { $name:
    ensure  => $ensure,
    target  => $config,
    content => "# ${name}\n${issuer}:${type}\n\n";
  }
}

class usenet_inn2::nocem::newsfeeds (
  $config   = $usenet_inn2::params::path_conf,
  $path_bin = $usenet_inn2::params::path_bin
) inherits usenet_inn2::params {

  $groups = '!*,alt.nocem.misc,news.lists.filters'
  $binary = "${path_bin}/perl-nocem"

  concat::fragment { 'newsfeeds-nocem':
    ensure  => present,
    target  => "${config}/newsfeeds",
    content => "\n# nocem feed\nnocem!:${groups}:Tc,Wf,Ap:${binary}\n"
  }
}

                           - Tim Skirvin (tskirvin@killfile.org)
-- 
http://wiki.killfile.org/           Skirv's Homepage <FISH>< <*>
http://wiki.killfile.org/archives/              Skirv's Archives
Technical Details
Message-ID: <tskirvin.20120626194558$5005@vulture.killfile.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news0.firedrake.org!usenet-its.stanford.edu!usenet.stanford.edu!news.killfile.org!.POSTED!not-for-mail
References: <jscpog$dnh$1@cs6.cmpublishers.com> <jscurp$8ff$1@news.albasani.net>

Show Full Headers
Complete Article Headers
Message-ID: <tskirvin.20120626194558$5005@vulture.killfile.org>
Subject: Re: Nocem question
Date: Tue, 26 Jun 2012 12:45:58 -0700
From: tskirvin@killfile.org (Tim Skirvin)
References: <jscpog$dnh$1@cs6.cmpublishers.com> <jscurp$8ff$1@news.albasani.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news0.firedrake.org!usenet-its.stanford.edu!usenet.stanford.edu!news.killfile.org!.POSTED!not-for-mail
Newsgroups: news.software.nntp
Organization: Killfiles, Unlimited
Lines: 141
Reply-To: tskirvin@killfile.org
X-Trace: vulture.killfile.org 1340740105 4292 173.228.89.212 (26 Jun 2012
X-Complaints-To: usenet@news.killfile.org
NNTP-Posting-Date: Tue, 26 Jun 2012 19:48:25 +0000 (UTC)
User-Agent: nn/6.7.3
X-Note: Unless otherwise noted, I speak only for myself.
X-Signature: PGPMoose V1.1 PGP tskirvin@killfile.org
 iD8DBQFP6hIIkw7FUwwu4h0RAtx5AJ4jjrkJDQkrP4Hzn+c1QWcoZcy5EQCeJCJD
 LGZarOyh/0SI8I+LPflGbi4= =Fu2f
X-Original-Bytes: 5309