public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/ejabberd] f45: Use -set-cookie in ejabberdctl so root can attach to the node (#1163812).
@ 2026-09-23 19:07 Randy Barlow
  0 siblings, 0 replies; only message in thread
From: Randy Barlow @ 2026-09-23 19:07 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/ejabberd
            Branch : f45
            Commit : 4c04c7f3dd9516be42c060f4c250aa15687712f3
            Author : Randy Barlow <randy@electronsweatshop.com>
            Date   : 2016-11-27T19:23:22-05:00
            Stats  : +57/-3 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/ejabberd/c/4c04c7f3dd9516be42c060f4c250aa15687712f3?branch=f45

            Log:
            Use -set-cookie in ejabberdctl so root can attach to the node (#1163812).

Also:
- Mark ejabberdctl as executable.
- Dropped unnecessary gcc-g++ BuildRequires.

---
diff --git a/ejabberd-0005-Use-set-cookie-when-running-erl-in-ejabberdctl.templ.patch b/ejabberd-0005-Use-set-cookie-when-running-erl-in-ejabberdctl.templ.patch
new file mode 100644
index 0000000..e6ef8e9
--- /dev/null
+++ b/ejabberd-0005-Use-set-cookie-when-running-erl-in-ejabberdctl.templ.patch
@@ -0,0 +1,46 @@
+From 42ed5993d433a2aa12239d9ea8004016ca3df6c5 Mon Sep 17 00:00:00 2001
+From: Randy Barlow <randy@electronsweatshop.com>
+Date: Sun, 27 Nov 2016 11:49:19 -0500
+Subject: [PATCH] Use -set-cookie when running erl in ejabberdctl.template.
+
+This patch converts the ejabberdctl.template to use erl's
+-set-cookie option when an .erlang.cookie file is found in
+$SPOOL_DIR. This will help for installations where ejabberd might
+be started by one user, but ejabberdctl might be used by a
+different user to manage it. For example, in Fedora ejabberd is
+launched by systemd as the ejabberd user, but users might want to
+use "sudo ejabberdctl" to manage the node.
+---
+ ejabberdctl.template | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/ejabberdctl.template b/ejabberdctl.template
+index 5b34ebe..7d1ab00 100755
+--- a/ejabberdctl.template
++++ b/ejabberdctl.template
+@@ -96,6 +96,13 @@ ERL_INETRC=$ETC_DIR/inetrc
+ MNESIA_OPTS="-mnesia dir \"\\\"$SPOOL_DIR\\\"\" $MNESIA_OPTIONS"
+ # define erl parameters
+ ERLANG_OPTS="+K $POLL -smp $SMP +P $ERL_PROCESSES $ERL_OPTIONS"
++
++# Determine if the .erlang.cookie file is present or not, and use -setcookie if it is
++if [ -f "$SPOOL_DIR/.erlang.cookie" ] ; then
++    ERLANG_COOKIE=$(cat "$SPOOL_DIR/.erlang.cookie")
++    ERLANG_OPTS+=" -setcookie $ERLANG_COOKIE"
++fi
++
+ KERNEL_OPTS=""
+ if [ "$FIREWALL_WINDOW" != "" ] ; then
+     KERNEL_OPTS="${KERNEL_OPTS} -kernel inet_dist_listen_min ${FIREWALL_WINDOW%-*} inet_dist_listen_max ${FIREWALL_WINDOW#*-}"
+@@ -360,7 +367,7 @@ ctl()
+ {
+     NID=$(uid ctl)
+     CMD="`shell_escape \"$ERL\" \"$NAME\" \"$NID\"` \
+-         -noinput -hidden $KERNEL_OPTS -s ejabberd_ctl \
++         -noinput -hidden $KERNEL_OPTS $ERLANG_OPTS -s ejabberd_ctl \
+          -extra `shell_escape \"$ERLANG_NODE\"` $EJABBERD_NO_TIMEOUT \
+          `shell_escape \"$@\"`"
+     $EXEC_CMD "$CMD"
+-- 
+2.10.2
+

diff --git a/ejabberd.spec b/ejabberd.spec
index 8795528..2d30c57 100644
--- a/ejabberd.spec
+++ b/ejabberd.spec
@@ -5,7 +5,7 @@
 
 Name:           ejabberd
 Version:        16.09
-Release:        2%{?dist}
+Release:        3%{?dist}
 
 Summary:        A distributed, fault-tolerant Jabber/XMPP server
 License:        GPLv2+
@@ -35,6 +35,9 @@ Patch2: ejabberd-0002-Enable-polkit-support.patch
 Patch3: ejabberd-0003-Install-into-BINDIR-instead-of-SBINDIR.patch
 # Fedora-specific
 Patch4: ejabberd-0004-Enable-systemd-notification-if-available.patch
+# Use -set-cookie to allow non-ejabberd users (such as root) to also run ejabberdctl.
+# This patch was submitted upstream at https://github.com/processone/ejabberd/pull/1395
+Patch5: ejabberd-0005-Use-set-cookie-when-running-erl-in-ejabberdctl.templ.patch
 
 BuildRequires:  elixir >= 1.2.6
 BuildRequires:  erlang-cache_tab >= 1.0.4
@@ -69,7 +72,6 @@ BuildRequires:  hevea
 BuildRequires:  texlive-comment
 BuildRequires:  autoconf
 BuildRequires:  automake
-BuildRequires:  gcc-c++
 
 # For creating user and group
 Requires(pre):  shadow-utils
@@ -104,6 +106,7 @@ Windows NT/2000/XP).
 %patch2 -p1 -b .use_polkit
 %patch3 -p1 -b .use_bindir
 %patch4 -p1 -b .enable_sd_notify
+%patch5 -p1 -b .set_cookie
 
 
 %build
@@ -135,7 +138,7 @@ install -D -p -m 0644 ejabberd.yml.example %{buildroot}%{_sysconfdir}/%{name}/ej
 install -D -p -m 0644 ejabberdctl.cfg.example %{buildroot}%{_sysconfdir}/%{name}/ejabberdctl.cfg
 install -D -p -m 0644 inetrc %{buildroot}%{_sysconfdir}/%{name}/inetrc
 
-install -D -p -m 0644 ejabberdctl.example %{buildroot}%{_bindir}/ejabberdctl
+install -D -p -m 0755 ejabberdctl.example %{buildroot}%{_bindir}/ejabberdctl
 
 install -d -m 0750 %{buildroot}/var/lib/ejabberd
 install -d -m 0750 %{buildroot}/var/lock/ejabberdctl
@@ -283,6 +286,11 @@ fi)
 
 
 %changelog
+* Sun Nov 27 2016 Randy Barlow <bowlofeggs@fedoraproject.org> - 16.09-3
+- Use -set-cookie in ejabberdctl so root can attach to the node (#1163812).
+- Mark ejabberdctl as executable.
+- Dropped unnecessary gcc-g++ BuildRequires.
+
 * Thu Nov 10 2016 Randy Barlow <bowlofeggs@fedoraproject.org> - 16.09-2
 - Use the correct path for erl in ejabberdctl (#1393652).
 - Drop NoNewPrivileges=true from the unit file (#1393587).

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-23 19:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23 19:07 [rpms/ejabberd] f45: Use -set-cookie in ejabberdctl so root can attach to the node (#1163812) Randy Barlow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox