Skip to content

About

BitlBee IRC gateway in one container: Discord, Google Chat, Teams, WhatsApp and Mastodon plugins, plus a private Matrix homeserver with mautrix bridges for Messenger, Instagram, Signal, Slack and Telegram. TLS only, amd64/arm64, each service under its own user.

Topics

Resources

Stars

50 stars

Watchers

0 watching

Forks

Repository files navigation

BitlBee Docker Container

Docker Pulls GitHub Workflow Status Docker Image Size License

BitlBee with libpurple plugins, plus a private Matrix homeserver and mautrix bridges, in one image for linux/amd64 and linux/arm64. It listens on two ports, both IRC over TLS:

  • 6697: BitlBee, for the protocols it reaches through plugins.
  • 6698: matrix2051, a second IRC network for Matrix and the bridged networks.

stunnel terminates TLS; BitlBee and matrix2051 listen on loopback only. Each service runs as its own user and keeps its data in a directory only that user can open, so a compromised plugin or bridge can't read the others' sessions, keys or databases. s6-overlay supervises them from PID 1, as root with only the SETUID, SETGID, KILL, CHOWN and DAC_READ_SEARCH capabilities. The root filesystem can be read-only, leaving only the volume, /run and /tmp writable. No file in the image is setuid or setgid, and downloaded binaries are checked against their published checksums at build time.

Protocols

Network Port Through
BitlBee's built-in protocols (XMPP, IRC, …) 6697 BitlBee
Discord 6697 purple-discord
Google Chat 6697 purple-googlechat
Mastodon 6697 bitlbee-mastodon
Microsoft Teams 6697 purple-teams
WhatsApp 6697 purple-whatsmeow
Matrix, any homeserver 6698 matrix2051
Facebook Messenger, Instagram DMs 6698 mautrix-meta
Signal 6698 mautrix-signal
Slack 6698 mautrix-slack
Telegram (needs your own API keys) 6698 mautrix-telegram

The mautrix bridges run on the built-in homeserver, tuwunel, which listens on loopback and doesn't federate. BitlBee's built-in Twitter/X support needs a paid API key.

Run

Docker:

docker volume create bitlbee-data
docker run -d --name bitlbee \
  --cap-drop=ALL --cap-add=SETUID --cap-add=SETGID --cap-add=KILL \
  --cap-add=CHOWN --cap-add=DAC_READ_SEARCH \
  --security-opt no-new-privileges:true \
  --read-only --tmpfs /run:exec --tmpfs /tmp \
  -p 6697:6697 -p 6698:6698 \
  -v bitlbee-data:/var/lib/bitlbee \
  mbologna/bitlbee:latest

Docker Compose: copy .env.example to .env, adjust it, and run docker compose up -d. docker-compose.yml uses the same capabilities and read-only root filesystem.

On a platform that refuses root containers (OpenShift, a runAsNonRoot policy), start it as uid 1000 (--user 1000:1000) with no capabilities: every service then runs as that user, without the isolation. With a read-only root filesystem, give it a /run that uid 1000 owns (--tmpfs /run:exec,uid=1000,gid=1000). A volume belongs to the mode it was created in.

Kubernetes: kubectl apply -k k8s/ creates the bitlbee namespace, a 1Gi PersistentVolumeClaim, the Deployment and a ClusterIP Service. Settings live in k8s/configmap.yaml, storage size in k8s/pvc.yaml and resource limits in k8s/deployment.yaml. IRC is raw TCP, which HTTP Ingress controllers don't carry: k8s/ingress.yaml has NodePort and LoadBalancer Services to uncomment, or use kubectl port-forward -n bitlbee svc/bitlbee 6697 6698.

Configuration

Environment variables, all optional:

Variable Default Effect
MATRIX_REGISTRATION_TOKEN random, printed in the first log Token for creating accounts on the built-in homeserver
TELEGRAM_API_ID, TELEGRAM_API_HASH unset Turn the Telegram bridge on; it stays off without both
TZ UTC Time zone
BITLBEE_PORT, MATRIX_PORT 6697, 6698 Compose only: host ports

All state lives in /var/lib/bitlbee, one directory per service. On first start the container writes a self-signed certificate to /var/lib/bitlbee/ssl/bitlbee.pem; replace it with your own (certificate and key in one PEM file, owned by the stunnel user, uid 1003, mode 0600) and restart.

Using BitlBee (port 6697)

Connect with TLS, accept the certificate, then in the &bitlbee channel:

register <password>
account add eionrobb-discord you@example.com <password>
account eionrobb-discord on
save

account add <protocol> <username> <password> works the same way for the other protocols. plugins lists their names under "Enabled Protocols": plugin protocols carry their author's prefix, as in eionrobb-discord, eionrobb-msteams, googlechat, hehoe-whatsmeow and mastodon.

Matrix and the bridges (port 6698)

matrix2051 is a Matrix client that acts as an IRC server, so Matrix is a second IRC network in your client, not a BitlBee account. It logs in with SASL PLAIN: the username is your Matrix ID without the @ (me:matrix.org), the password your Matrix password. In WeeChat:

/server add matrix example.org/6698 -tls
/set irc.server.matrix.sasl_mechanism plain
/set irc.server.matrix.sasl_username me:matrix.org
/set irc.server.matrix.sasl_password <password>
/connect matrix

For an account on another homeserver, that is all: the homeserver is found through .well-known, and /join #room:matrix.org joins a room. A matrix.org account needs a password; one created with "Sign in with Google/GitHub" has none (check at account.matrix.org).

Bridges

The bridges need an account on the built-in homeserver:

docker exec bitlbee matrix-register me 'my-password'

This creates @me:localhost and opens a chat with each bridge's bot, which matrix2051 shows as #<network>-me:localhost. Connect as above with sasl_username me:localhost, and set the real name to the homeserver's address: /set irc.server.matrix.realname homeserver-url=http://127.0.0.1:6167. Then say login (or one of the flows below) in the bot's channel:

Bridge Login
Facebook login facebook: paste the browser's cookies (below)
Instagram login instagram with the cookies of an instagram.com session, or login android with username and password
Signal login: the bot sends a QR code, which reaches IRC as sgnl://linkdevice?… text. Render it with qrencode -t ansiutf8 '<text>' and scan it in Signal under Settings → Linked devices
Slack login email with the code Slack sends, or login token with a token (and the d cookie, for a browser token)
Telegram login phone: phone number, the code Telegram sends, then your 2FA password if set

To get Facebook's cookies, log into facebook.com in a private window, open the browser's devtools on the Network tab, filter for graphql, right-click a request and choose Copy as cURL. Join the command into one line before pasting it: most IRC clients send each pasted line as a separate message. Meta may ask for a captcha or a password reset on the first login; enabling 2FA beforehand helps. The mautrix documentation covers every login option.

Telegram requires each client to bring its own API keys: create an application at my.telegram.org/apps, set TELEGRAM_API_ID and TELEGRAM_API_HASH, and restart. An account registered before that gets its Telegram chat by inviting @telegrambot:localhost to a direct chat.

Once a bridge is linked, it invites you to a room per chat; accept with /join <channel>.

Limitations

  • No end-to-end encryption: encrypted rooms are unreadable, which on most public homeservers includes direct messages.
  • Rooms without an alias, such as direct chats and every bridged chat, appear as channels named after the room ID (!AbCdEf:localhost), and only once a message arrives.
  • Anyone who reaches port 6698 can log into any Matrix homeserver with valid credentials. Expose it only where you would expose BitlBee.

Versioning

The image has its own SemVer version, with BitlBee's as build metadata: tag v6.0.0+up3.6 publishes mbologna/bitlbee:6.0.0, 6.0 and latest. Releases follow the Conventional Commits: feat a minor, fix a patch, a breaking change a major. Dependency and CVE rebuilds ship as patches, and a new BitlBee version as a minor or major. See the versioning standard.

Component versions are image labels:

docker inspect -f '{{json .Config.Labels}}' mbologna/bitlbee:<tag>

Components without release tags (matrix2051 and the EionRobb plugins) are built from a commit pinned in the Dockerfile; Renovate proposes each new upstream commit as a pull request.

Why not an existing tool

  • BitlBee upstream publishes no container image, and there is no official BitlBee image on Docker Hub.
  • Community images are minimal builds or no longer updated: ezkrg/bitlbee-libpurple, for example, was last pushed in 2023.
  • None of them bundles TLS through stunnel, a Matrix homeserver and its bridges, supervised by s6.

Checked 2026-11-23.

Star History

Star History Chart

About

BitlBee IRC gateway in one container: Discord, Google Chat, Teams, WhatsApp and Mastodon plugins, plus a private Matrix homeserver with mautrix bridges for Messenger, Instagram, Signal, Slack and Telegram. TLS only, amd64/arm64, each service under its own user.

Topics

Resources

Stars

50 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages