Files
minimal-setups/content/snippets/0050-email-childprot.md
Wolfgang Hottgenroth b2249c06e9
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
mdwiki test starts
2025-04-14 22:22:45 +02:00

1.6 KiB

This small tool implements a whitelist on a Postfix mail-server. It prevents certain recipient addresses (your kids ones) from receiving mail from any not whitelisted address. Any mail from not whitelisted senders is redirected to a delegate (a parent).

The code for this tool can is here: https://gitea.hottis.de/wn/childprot.

Configure the tool by adding this line into the master.cf of the Postfix installation:

childprot unix -   n    n    -    25    spawn user=mail argv=/opt/sbin/ChildProt

and this one to the main.cf:

check_policy_service unix:private/childprot

The restricted recipients and the whitelists are stored in an SQLite3 database:

CREATE TABLE child_address_t (
  child INTEGER REFERENCES child_t(id),
  address TEXT
);

CREATE TABLE child_t (
  id INTEGER PRIMARY KEY,
  name TEXT,
  delegate TEXT
);

CREATE TABLE whitelist_t (
  child INTEGER REFERENCES child_t(id),
  address TEXT
);

CREATE VIEW child_v AS
  SELECT c.id as id,
         c.delegate as delegate,
         ca.address as address
  FROM child_t c,
       child_address_t ca
  WHERE c.id = ca.child;

Restricted persons together with their delegates are added to the table child_t, multiple addresses can be assigned to those persons in child_address_t. Whitelists per person are maintained in whitelist_t.

The tool is querying the view child_v.

Note: The code is unmaintained and here only for documentary reasons. It is not meant to be used any longer.