Today I came across a problem with Majorcool (a tool to manage Majordomo mailing lists) where the following message showed up for any mailing list:
/usr/local/majordomo/3725/majo
Where 3725 was the ID of the mailing list. So depending on the list, the ID of the error message varied.
Naturally, I was thinking of a permissions problem so I checked all file and folder permissions on /usr/local/majordomo. But they all looked good, most files were owned correctly by user and group 'majordomo', the ones for majorcool were owned by 'bin'. I compared the permissions with another majordomo/majorcool installation on another server and they were the same.
Then I came across a hint which suggested to use the majordomo wrapper script for a config-check. This is the output:
/usr/local/majordomo # ./wrapper config-test
------------------------------------------------------------
---------------- Config-test for Majordomo ----------------
------------------------------------------------------------
--------------------- Obvious things: ---------------------
------------------ environment variables ------------------
HOME=/usr/local/majordomo
LOGNAME=root
MAJORDOMO_CF=/usr/local/majordomo/majordomo.cf
PATH=/bin:/usr/bin:/usr/ucb
SHELL=/bin/sh
USER=root
--------------------- euid/egid checks ---------------------
effective user = ckremote (uid 1002)
effective group = cmadm root (gid 1001 0 )
---------------------- uid/gid checks ----------------------
real user = ckremote (uid 1002)
real group = cmadm root (gid 1001 0 )
------------------------------------------------------------
Non obvious things that cause headaches:
------------------------------------------------------------
Good: 'require'd /usr/local/majordomo/majordomo.cf okay.
Good: found ctime.pl okay.
Good: found majordomo_version.pl okay.
Good: found majordomo.pl okay.
Good: found shlock.pl okay.
Good: found config_parse.pl okay.
You're running Majordomo Version 1.94.5.
--==> Majordomo home directory is /usr/local/majordomo.
------------------- Include directories -------------------
/usr/local/majordomo
/etc/perl
/usr/local/lib/perl/5.10.1
/usr/local/share/perl/5.10.1
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.10
/usr/share/perl/5.10
/usr/local/lib/site_perl
--------------------------- Home ---------------------------
Good: changedir to /usr/local/majordomo succeeded.
BAD: Couldn't create a mock lock file.
$homedir (/usr/local/majordomo) needs to be writable.
---------------------- temp directory ----------------------
Good: Created a temp file in $TMPDIR (/tmp).
---------------------- list directory ----------------------
BAD: list directory /usr/local/majordomo/lists has bad permissions
--------------------------- log ---------------------------
BAD: logfile /usr/local/majordomo/Log exists, but is not writeable or isn't a file.
------------------------- Mailers -------------------------
You have defined a mailer for delivery.
Attempting to verify that this is a valid mailer...looks okay.
You have defined a mailer for delivering administrative messages.
Attempting to verify that this is a valid mailer...looks okay.
------------------ Checking majordomo.cf ------------------
Checking to see if there are new variables that should be in your majordomo.cf file...Nope, none that I see.
Have you configured where Majordomo is?
$whereami is example.com
Good: yup!
----------------------- end of tests -----------------------
3 bad things were found.
Please fix before attempting to run Majordomo.
So the 3 bad things mentioned show problems with permissions (Couldn't create a mock lock file for example). But actually the problem doesn't come from file permissions, but rather from the wrapper script. If you take a look at the first few lines (euid/egid checks and uid/gid checks) it is strange, that the mentioned user and group is not majordomo.
Let's compare that to the output on the server with the working installation:
--------------------- Obvious things: ---------------------
------------------ environment variables ------------------
HOME=/usr/local/majordomo
LOGNAME=root
MAJORDOMO_CF=/usr/local/majordomo/majordomo.cf
PATH=/bin:/usr/bin:/usr/ucb
SHELL=/bin/sh
USER=root
--------------------- euid/egid checks ---------------------
effective user = majordomo (uid 2136)
effective group = majordomo root (gid 2116 0 )
---------------------- uid/gid checks ----------------------
real user = majordomo (uid 2136)
real group = majordomo root (gid 2116 0 )
------------------------------------------------------------
And indeed - the wrapper uses majordomo as user and group on the working installation.
So to fix the "bug" on the wrapper script you can't just change the file permissions of /usr/local/majordomo/wrapper, no, you need to recompile it. The information of the majordomo user and group is hard-coded into the wrapper script. Go once again into your majordomo source (re-download it if necessary) and first clean the previous compilation:
# make clean
rm -f wrapper *~
Then check on your system the current User ID (UID) and Group ID (GID) of majordomo and note them down:
# grep majordomo /etc/passwd
majordomo:x:1007:1007::/home/majordomo:/bin/sh
# grep majordomo /etc/group
majordomo:x:1007:
Now open the file Makefile with vi oder another editor and edit the following lines (enter the previously noted UID and GID):
# You need to have or create a user and group which majordomo will run as.
# Enter the numeric UID and GID (not their names!) here:
W_USER = 1007
W_GROUP = 1007
If you've already installed majordomo, this is the only change you have to do on Makefile.
Then it's time to re-compile and re-install the wrapper script:
# make wrapper
# make install-wrapper
To see the difference I re-launched the wrapper config-test and now the following output was shown:
/usr/local/majordomo # ./wrapper config-test
------------------------------------------------------------
---------------- Config-test for Majordomo ----------------
------------------------------------------------------------
--------------------- Obvious things: ---------------------
------------------ environment variables ------------------
HOME=/usr/local/majordomo
LOGNAME=root
MAJORDOMO_CF=/usr/local/majordomo/majordomo.cf
PATH=/bin:/usr/bin:/usr/ucb
SHELL=/bin/sh
USER=root
--------------------- euid/egid checks ---------------------
effective user = majordomo (uid 1007)
effective group = majordomo root (gid 1007 0 )
---------------------- uid/gid checks ----------------------
real user = majordomo (uid 1007)
real group = majordomo root (gid 1007 0 )
-----------------------------------------------------------
This looks better, doesn't it?
After another try with majorcool, the lists were now able to being managed again.
No comments yet.
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Containers CouchDB DB DNS Database Databases Docker ELK Elasticsearch Filebeat FreeBSD Galera Git GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Influx Internet Java KVM Kibana Kodi Kubernetes LVM LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS Office OpenSearch PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Python Rancher Rant Redis Roundcube SSL Samba Seafile Security Shell SmartOS Solaris Surveillance Systemd TLS Tomcat Ubuntu Unix VMWare VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder