Forum teuk.org

Configuration Cleanup, Libera NickServ, and Safer Partyline Eval

in Mediabot · started by TeuK · 1w ago

TeuK · 1w ago

Mediabot v3 — Configuration Cleanup, Libera NickServ, and Safer Partyline Eval

Suggested forum title

Mediabot v3: cleaner generated configs, Libera NickServ, and safer partyline eval

Article

This update is another maintenance-focused step for Mediabot v3. It is not about adding flashy commands, but about making the project cleaner, safer, and easier to install without hidden assumptions.

A lot of the work was about aligning the runtime code, the sample configuration, and the generated configuration files.

Configuration consistency

The root sample configuration is now the single official sample file:

mediabot.sample.conf

The project no longer keeps or references a duplicate sample configuration elsewhere. Tests now make sure the working tree only relies on the root sample.

Several runtime keys that were already used by the bot are now explicitly documented in the sample configuration and, where relevant, generated by the installer:

CHARSET_MODE=utf8mb4
CONN_PASS=
CHANNEL_LOG_RETENTION_DAYS=90
USER_SEEN_RETENTION_DAYS=180
DCC_DEBUG_HINTS=0
PARTYLINE_EVAL_ENABLED=0
PARTYLINE_EVAL_TIMEOUT_SECONDS=5

The generated configuration flow was also updated so new installs do not start with an older, incomplete config layout. ./configure and install/db_install.sh now generate more of the keys that the runtime actually expects.

Prometheus metrics configuration

The Prometheus exporter settings are now documented in the sample config:

[metrics]
METRICS_ENABLED=0
METRICS_BIND=127.0.0.1
METRICS_PORT=9108

This makes the metrics feature easier to discover without enabling it by default.

Libera NickServ cleanup

The old historical freenode naming has been removed from the important configuration path.

Network type 2 is now treated as Libera NickServ authentication, with:

[libera]
LIBERA_NICKSERV_PASSWORD=

The runtime, installer, sample config, and regression tests now use the Libera naming consistently.

DCC and Partyline cleanup

The DCC sample configuration was cleaned up so deployment-specific values remain commented, while runtime booleans are explicit.

For example:

DCC_DEBUG_HINTS=0

is now an explicit default, while deployment-specific values such as public IP and port range remain commented.

The Partyline eval command also received an important safety fix. .eval now requires more than Owner level: it must also be explicitly enabled in configuration.

By default:

PARTYLINE_EVAL_ENABLED=0

So .eval is blocked unless the admin deliberately enables it:

PARTYLINE_EVAL_ENABLED=1
PARTYLINE_EVAL_TIMEOUT_SECONDS=5

This makes the dangerous command opt-in instead of merely permission-protected.

Public defaults cleanup

A few private or deployment-specific values were removed from public code defaults.

For example, the weather User-Agent no longer hard-codes a private deployment URL. It now uses:

MAIN_PROG_URL=

when available, with a neutral project fallback.

The Icecast/radio sample config was also cleaned up so public examples use neutral values such as example.com, not a private deployment domain.

Installer and documentation fixes

Some smaller but useful cleanup was also done:

  • clean_and_exit() now reads the quit message from the documented main.MAIN_PROG_QUIT_MSG key.
  • install/configure.pl now logs the real IRC server hostname passed to addIrcServer(), instead of accidentally using the global interactive $line.
  • Mediabot::Conf POD examples now use the real key main.MAIN_PROG_NAME instead of a stale placeholder.
  • Generated configuration files and sample config are now better aligned.

New regression coverage

More regression tests were added around these cleanup areas, including:

  • single official sample config behavior;
  • radio/Icecast sample keys;
  • private public-URL fallback prevention;
  • runtime config keys in the sample;
  • metrics sample config;
  • DCC sample config shape;
  • Libera NickServ naming;
  • generated config defaults;
  • Partyline eval safety guard;
  • installer logging correctness;
  • documentation examples using real config keys.

The important point is that these are not just manual cleanups. They are now protected by tests so future refactors should not silently reintroduce stale keys, private defaults, or unsafe behavior.

Why this matters

Mediabot v3 has grown a lot over time. That is good, but it also means older names, old defaults, and historical assumptions can linger in corners of the project.

This update removes some of that dust.

The result is a bot that is a bit cleaner to install, safer by default, and easier to maintain. The runtime, sample config, generated config, and tests now agree more closely with each other.

Suggested commit message

Finite Incantatem: banish stale config ghosts and seal the partyline eval chamber

Full local test command

cd /home/mediabot/mediabot_v3 || exit 1

find Mediabot -name '*.pm' -print0 | xargs -0 -n1 runuser -u mediabot -- perl -I. -c

runuser -u mediabot -- perl -c mediabot.pl

runuser -u mediabot -- perl t/test_commands.pl

Suggested smoke tests

m help internal
m help weather
m listeners
m song

For partyline:

.eval 1+1

should be refused unless PARTYLINE_EVAL_ENABLED=1 is explicitly set in [main].

You must be logged in to reply.