Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F6595827
D1532.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D1532.diff
View Options
diff --git a/roles/shellserver/quassel-core/init.sls b/pillar/shellserver/quassel.sls
copy from roles/shellserver/quassel-core/init.sls
copy to pillar/shellserver/quassel.sls
--- a/roles/shellserver/quassel-core/init.sls
+++ b/pillar/shellserver/quassel.sls
@@ -1,11 +1,10 @@
# -------------------------------------------------------------
-# Salt — Provision Quassel core
+# Salt — Quassel managed installation
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Eglide
# Created: 2018-03-28
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
-include:
- - .certificate
- - .software
+quassel_users:
+ - balaji
diff --git a/pillar/top.sls b/pillar/top.sls
--- a/pillar/top.sls
+++ b/pillar/top.sls
@@ -17,6 +17,8 @@
- webserver.sites
dwellers:
- paas.docker
+ eglide:
+ - shellserver.quassel
equatower:
- paas.docker
- saas.phpbb
diff --git a/roles/shellserver/quassel-core/changepassword.sls b/roles/shellserver/quassel-core/changepassword.sls
new file mode 100644
--- /dev/null
+++ b/roles/shellserver/quassel-core/changepassword.sls
@@ -0,0 +1,38 @@
+# -------------------------------------------------------------
+# Salt — Provision Quassel core
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Eglide
+# Created: 2018-03-28
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import dirs with context %}
+{% from "roles/shellserver/quassel-core/map.jinja" import quassel with context %}
+
+# -------------------------------------------------------------
+# Wrapper for quasselcore --change-userpass
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{{ dirs.bin }}/chquasselpasswd:
+ file.managed:
+ - source: salt://roles/shellserver/quassel-core/files/chquasselpasswd.sh.jinja
+ - mode: 755
+ - template: jinja
+ - context:
+ quassel: {{ quassel }}
+
+# -------------------------------------------------------------
+# Sudo capabilities
+#
+# Quassel users can change their password
+# -------------------------------------------------------------
+
+chquasselpasswd_sudo_capabilities_file:
+ file.managed:
+ - name: {{ dirs.etc }}/sudoers.d/chquasselpasswd
+ - source: salt://roles/shellserver/quassel-core/files/chquasselpasswd.suoders
+ - template: jinja
+ - context:
+ dirs: {{ dirs }}
+ quassel: {{ quassel }}
+ users: {{ pillar['quassel_users'] }}
diff --git a/roles/shellserver/quassel-core/files/chquasselpasswd.sh.jinja b/roles/shellserver/quassel-core/files/chquasselpasswd.sh.jinja
new file mode 100755
--- /dev/null
+++ b/roles/shellserver/quassel-core/files/chquasselpasswd.sh.jinja
@@ -0,0 +1,59 @@
+#!/bin/sh
+# -------------------------------------------------------------
+# Quassel change password wrapper
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Eglide
+# Created: 2018-03-28
+# License: Trivial work, not eligible to copyright
+# Source file: roles/shellserver/quassel-core/files/chquasselpasswd.sh
+# -------------------------------------------------------------
+#
+# <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>
+
+# -------------------------------------------------------------
+# Configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+QUASSEL_CONFIG_DIR=/var/lib/quassel
+QUASSEL_USER="{{ quassel.user }}"
+
+# -------------------------------------------------------------
+# Helper methods
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+error() {
+ echo "$@" 1>&2;
+}
+
+getcommandname() {
+ basename "$0"
+}
+
+usage() {
+ echo "Usage: $(getcommandname)"
+ echo " Change the Quassel user password"
+ exit 64
+}
+
+# -------------------------------------------------------------
+# Check arguments
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
+ usage
+elif [ $# -gt 0 ]; then
+ error "$(getcommandname): illegal option -- $*"
+ usage
+fi
+
+# -------------------------------------------------------------
+# Call quassel core
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+sudo -u "$QUASSEL_USER" \
+ quasselcore --configdir="$QUASSEL_CONFIG_DIR" --change-userpass="$USER"
diff --git a/roles/shellserver/quassel-core/files/chquasselpasswd.suoders b/roles/shellserver/quassel-core/files/chquasselpasswd.suoders
new file mode 100644
--- /dev/null
+++ b/roles/shellserver/quassel-core/files/chquasselpasswd.suoders
@@ -0,0 +1,20 @@
+#!/bin/sh
+# -------------------------------------------------------------
+# Quassel change password wrapper - sudo capabilities
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Eglide
+# Created: 2018-03-28
+# License: Trivial work, not eligible to copyright
+# Source file: roles/shellserver/quassel-core/files/chquasselpasswd.suoders
+# -------------------------------------------------------------
+#
+# <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>
+
+{% for user in users -%}
+{{ user }} ALL=({{ quassel.user }}) NOPASSWD: {{ dirs.bin }}/quasselcore --configdir=/var/lib/quassel --change-userpass={{ user }}
+{% endfor -%}
diff --git a/roles/shellserver/quassel-core/init.sls b/roles/shellserver/quassel-core/init.sls
--- a/roles/shellserver/quassel-core/init.sls
+++ b/roles/shellserver/quassel-core/init.sls
@@ -9,3 +9,4 @@
include:
- .certificate
- .software
+ - .changepassword
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 5, 19:03 (18 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2545162
Default Alt Text
D1532.diff (6 KB)
Attached To
Mode
D1532: Allow user to change its own Quassel password
Attached
Detach File
Event Timeline
Log In to Comment