Page MenuHomeDevCentral

D3570.id.diff
No OneTemporary

D3570.id.diff

diff --git a/PORTS b/PORTS
--- a/PORTS
+++ b/PORTS
@@ -1,5 +1,9 @@
devserver
2337 API api-exec HTTP
+ 6660 bitlbee
+
+shellserver
+ 6660 bitlbee
webserver-alkane
9253 php-fpm metrics
diff --git a/pillar/core/backup.sls b/pillar/core/backup.sls
new file mode 100644
--- /dev/null
+++ b/pillar/core/backup.sls
@@ -0,0 +1,18 @@
+# -------------------------------------------------------------
+# Salt — Backup
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+# -------------------------------------------------------------
+# Directories to backup
+#
+# Directories storing application data should be added here.
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+backup_directories_by_role:
+ devserver:
+ - /var/db/bitlbee
+ shellserver:
+ - /var/db/bitlbee
diff --git a/pillar/top.sls b/pillar/top.sls
--- a/pillar/top.sls
+++ b/pillar/top.sls
@@ -8,6 +8,7 @@
base:
'*':
+ - core.backup
- core.users
- core.groups
- core.network
diff --git a/roles/shellserver/bitlbee/files/bitlbee.conf b/roles/shellserver/bitlbee/files/bitlbee.conf
new file mode 100644
--- /dev/null
+++ b/roles/shellserver/bitlbee/files/bitlbee.conf
@@ -0,0 +1,42 @@
+# -------------------------------------------------------------
+# BitlBee
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/shellserver/bitlbee/files/bitlbee.conf
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+# -------------------------------------------------------------
+# General settings
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+[settings]
+
+DaemonInterface = {{ ip }}
+DaemonPort = 6660
+
+ClientInterface = 0.0.0.0
+
+MotdFile = {{ motd_path }}
+ConfigDir = {{ db_path }}
+
+# -------------------------------------------------------------
+# Administration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+#!SetOperPassword
+
+# -------------------------------------------------------------
+# Default values for per-user settings
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+[defaults]
+
+private = 1
diff --git a/roles/shellserver/bitlbee/files/motd.txt b/roles/shellserver/bitlbee/files/motd.txt
new file mode 100644
--- /dev/null
+++ b/roles/shellserver/bitlbee/files/motd.txt
@@ -0,0 +1,8 @@
+Welcome to the BitlBee server at %h.
+
+This server is running BitlBee version %v,
+it's hosted on the Nasqueron infrastructure.
+
+To report any issue, please use https://devcentral.nasqueron.org/
+
+Documentation: https://www.bitlbee.org/user-guide.html
diff --git a/roles/shellserver/bitlbee/files/rc/bitlbee.conf b/roles/shellserver/bitlbee/files/rc/bitlbee.conf
new file mode 100644
--- /dev/null
+++ b/roles/shellserver/bitlbee/files/rc/bitlbee.conf
@@ -0,0 +1,16 @@
+# -------------------------------------------------------------
+# bitlbee — rc configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/shellserver/bitlbee/files/rc/bitlbee.conf
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+bitlbee_enable="YES"
diff --git a/roles/shellserver/bitlbee/files/set-oper-password.sh b/roles/shellserver/bitlbee/files/set-oper-password.sh
new file mode 100755
--- /dev/null
+++ b/roles/shellserver/bitlbee/files/set-oper-password.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# -------------------------------------------------------------
+# BitlBee
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# If eligible, BSD-2-Clause
+# -------------------------------------------------------------
+
+set -e
+
+# -------------------------------------------------------------
+# Determine etc directory path and sed command
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+. /etc/os-release
+
+if [ "$ID" = "freebsd" ]; then
+ ETC=/usr/local/etc
+ SED=gsed
+else
+ ETC=/etc
+ SED=sed
+fi
+
+# -------------------------------------------------------------
+# Set password
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+PASSWORD=$(openssl rand -base64 12)
+$SED -i 's@#!SetOperPassword@OperPassword = '"$PASSWORD"'@' "$ETC/bitlbee/bitlbee.conf"
+
+touch "$ETC/bitlbee/.oper_password_set"
diff --git a/roles/shellserver/bitlbee/init.sls b/roles/shellserver/bitlbee/init.sls
new file mode 100644
--- /dev/null
+++ b/roles/shellserver/bitlbee/init.sls
@@ -0,0 +1,67 @@
+# -------------------------------------------------------------
+# Salt — Provision Bitlbee
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import dirs, services with context %}
+
+{% set network = salt["node.resolve_network"]() %}
+
+# -------------------------------------------------------------
+# Software
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+bitlbee:
+ pkg.installed
+
+# -------------------------------------------------------------
+# Config
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/var/db/bitlbee:
+ file.directory:
+ - user: bitlbee
+ - mode: 755
+
+{{ dirs.etc }}/bitlbee:
+ file.directory
+
+{{ dirs.etc }}/bitlbee/motd.txt:
+ file.managed:
+ - source: salt://roles/shellserver/bitlbee/files/motd.txt
+ - mode: 644
+
+{{ dirs.etc }}/bitlbee/bitlbee.conf:
+ file.managed:
+ - source: salt://roles/shellserver/bitlbee/files/bitlbee.conf
+ - mode: 400
+ - user: bitlbee
+ - template: jinja
+ - replace: False
+ - context:
+ ip: {{ network.private_ipv4_address | default("localhost") }}
+ motd_path: {{ dirs.etc }}/bitlbee/motd.txt
+ db_path: /var/db/bitlbee
+
+bitlbee_oper_password:
+ cmd.script:
+ - source: salt://roles/shellserver/bitlbee/files/set-oper-password.sh
+ - creates: {{ dirs.etc }}/bitlbee/.oper_password_set
+
+# -------------------------------------------------------------
+# Service
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{% if services.manager == "rc" %}
+
+/etc/rc.conf.d/bitlbee:
+ file.managed:
+ - source: salt://roles/shellserver/bitlbee/files/rc/bitlbee.conf
+
+bitlbee_running:
+ service.running:
+ - name: bitlbee
+
+{% endif %}
diff --git a/roles/shellserver/init.sls b/roles/shellserver/init.sls
--- a/roles/shellserver/init.sls
+++ b/roles/shellserver/init.sls
@@ -11,6 +11,7 @@
- .vhosts
- .web-hosting
- .database
+ - .bitlbee
- .quassel-core
- .vault
diff --git a/roles/shellserver/userland-software/irc.sls b/roles/shellserver/userland-software/irc.sls
--- a/roles/shellserver/userland-software/irc.sls
+++ b/roles/shellserver/userland-software/irc.sls
@@ -49,7 +49,6 @@
irc_misc:
pkg.installed:
- pkgs:
- - bitlbee
- oidentd
- pisg

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 04:55 (17 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2311693
Default Alt Text
D3570.id.diff (7 KB)

Event Timeline