On Sun, 26 Jul 2020 at 00:17, Mark Sapiro <mark@msapiro.net> wrote:
On 7/25/20 12:54 PM, Odhiambo Washington wrote:
Finally, I have adapted your init script to get some rudimentary one
that I
could use on FreeBSD. I have to change /opt/mailman to be owned by mailman3:mailman3 (because I have "live" MLs on this server, using mailman-2.1.34. I am not sure if they can co-exist. I suppose they could, but what might be the security implication, if any??
I manage more than one server that supports both Mailman 2.1 and Mailman 3 running as user
mailman
. I'm not aware of any security issues.This is what the init script looks like (rudimentary!!): (venv) [root@gw /usr/local/etc/rc.d]# less mailman3 ### BEGIN INIT INFO # Provides: GNU Mailman # Short-Description: Mailman3 Service # Description: service control for Mailman3 ### END INIT INFO
PATH=/opt/mailman/mm/bin:/opt/mailman/mm/venv/bin:/usr/sbin:/usr/bin:/bin:/sbin:
DESC="GNU Mailman service" DAEMON=/opt/mailman/mm/bin/mailman NAME=mailman USER=mailman3 GROUP=mailman3
# Needed by click export LANG=en_US.UTF-8
# Exit if the package is not installed [ -x "$DAEMON" ] || exit 0
# Load the VERBOSE setting and other rcS variables #. /lib/init/vars.sh
# Define LSB log_* functions. # Depend on lsb-base (>= 3.2-14) to ensure that this file is present # and status_of_proc is working. #. /lib/lsb/init-functions
case "$1" in start) [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME" # use --force to remove a stale lock. /usr/local/bin/sudo -u $USER $DAEMON start --force
T don't recommend using --force in init scripts. It *shouldn't* matter because even with --force the master shouldn't break the lock if the pip that set it still exists, but I prefer not to use it.
;;
stop) [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME" /usr/local/bin/sudo -u $USER $DAEMON stop ;; status) /usr/local/bin/sudo -u $USER $DAEMON status ;; reopen) /usr/local/bin/sudo -u $USER $DAEMON reopen ;; restart) log_daemon_msg "Restarting $DESC" "$NAME" /usr/local/bin/sudo -u $USER $DAEMON restart ;; *) echo "Usage: $SCRIPTNAME {start|stop|status|reopen|restart}" >&2 exit 3 ;; esac
It does start mailman3 for sure, but also complains after a few seconds with the message:
(venv) [root@gw /usr/local/etc/rc.d]#
*/opt/mailman/mm/venv/lib/python3.7/site-packages/mailman-3.3.2b1-py3.7.egg/mailman/rest/wsgiapp.py:180:
DeprecatedWarning: Call to deprecated function __init__(...). API class may be removed in a future release, use falcon.App instead.*
- **kws)*
Hmm... strange, My various MM 3 installs are running falcon 1.4.0, 2.0.0 and 3.0.0a1 and I don't see this warning, but it is only a deprecation warning. It doesn't mean it won't work.
But:
(venv) [root@gw /usr/local/etc/rc.d]# ps ax | grep mailman ...
It seems Mailman core and the rest runner and its workers are all running.
Assuming that I am using mod_wsgi with Apache, and that I have configured apache right using
.. should I be able to access the MM3 web UI??
Yes, I think so.
At that point, I am feeling somewhat confused as to what to try next.
(venv) [root@gw /opt/mailman/mm/var/logs]# less mailman.log Jul 25 22:53:16 2020 (40670) Master started Jul 25 22:53:18 2020 (42036) bounces runner started. Jul 25 22:53:18 2020 (45205) out runner started. Jul 25 22:53:19 2020 (41191) archive runner started. Jul 25 22:53:19 2020 (46670) retry runner started. Jul 25 22:53:19 2020 (44567) nntp runner started. Jul 25 22:53:19 2020 (43069) in runner started. Jul 25 22:53:19 2020 (46960) virgin runner started. Jul 25 22:53:20 2020 (45720) pipeline runner started. Jul 25 22:53:20 2020 (47326) digest runner started. Jul 25 22:53:20 2020 (43755) lmtp runner started. Jul 25 22:53:20 2020 (45922) rest runner started. [2020-07-25 22:53:20 +0300] [45922] [INFO] Starting gunicorn 20.0.4 [2020-07-25 22:53:20 +0300] [45922] [INFO] Listening at: http://127.0.0.1:8001 (45922) [2020-07-25 22:53:20 +0300] [45922] [INFO] Using worker: sync [2020-07-25 22:53:20 +0300] [54732] [INFO] Booting worker with pid: 54732 [2020-07-25 22:53:20 +0300] [55467] [INFO] Booting worker with pid: 55467 Jul 25 22:53:21 2020 (42743) command runner started.
The above is all fine, but it is just Mailman core.
How do I access the web UI for MM3 now?
The Apache config points to /opt/mailman/mm/wsgi.py, a sampole of which is at < https://wiki.list.org/DOC/Mailman%203%20installation%20experience?action=AttachFile&do=view&target=wsgi.py
. Do you have that?
Yes, I have that file.
If you installed the Apache config literally, the location for Mailman 3 is defined by < https://wiki.list.org/DOC/Mailman%203%20installation%20experience?action=AttachFile&do=view&target=mpo_wsgi.txt#CA-29567efd6c2bbc2b7bb6c84828f419edb0e127f8_19
and the URL would be http(s)://your.server/mm3 - have you tried that?
There is still some confusion on my part about the directives in the file so allow me to seek some clarifications.
The following are the contents of a file I have created and placed in my Apache Includes/ directory. I was hoping that with it, I can now access http://lists.my.server/mm3 and get the UI.
<CUT>
# Global section
WSGIDaemonProcess mailman-web display-name=mailman-web
maximum-requests=1000 umask=0002 user=mailman3
group=mailman3
python-path=/opt/mailman/mm/venv/lib/python3.7/site-packages:/opt/mailman/mm/venv/lib/python3.7
python-home=/opt/mailman/mm/venv home=/opt/mailman/mm/var
WSGIRestrictSignal Off
<VirtualHost *:80> ServerName lists.my.server ServerAdmin odhiambo@gmail.com
# (I'm not sure that WSGIRestrictSignal Off is required, but it was in the # provided example so I kept it. I also made changes to WSGIDaemonProcess # based on my own mod_wsgi experience elsewhere.)
ErrorLog /var/log/myserver-error.log LogLevel debug
# This goes in the VirtualHost block for the domain.
# Mailman 3 stuff Alias /static "/var/spool/mailman-web/static" *<----- Where is this directory supposed to be and what/who creates it and with what permissions?* <Directory "/var/spool/mailman-web/static"> Require all granted </Directory> WSGIScriptAlias /mm3 /opt/mailman/mm/wsgi.py <Directory "/opt/mailman/mm/"> <Files wsgi.py> Order deny,allow Allow from all Require all granted </Files> WSGIProcessGroup mailman-web </Directory> </VirtualHost>
</CUT-HERE>
I end up with an "Internal server error" and from the error log I see:
[Sun Jul 26 12:04:43.444127 2020] [wsgi:info] [pid 6444] [remote 197.232.81.246:53383] mod_wsgi (pid=6444, process='mailman-web', application='lists.my.server|/mm3'): Loading Python script file '/opt/mailman/mm/wsgi.py'. [Sun Jul 26 12:04:44.091922 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] mod_wsgi (pid=6444): Failed to exec Python script file '/opt/mailman/mm/wsgi.py'. [Sun Jul 26 12:04:44.092006 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] mod_wsgi (pid=6444): Exception occurred processing WSGI script '/opt/mailman/mm/wsgi.py'. [Sun Jul 26 12:04:44.092940 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] Traceback (most recent call last): [Sun Jul 26 12:04:44.093019 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] File "/opt/mailman/mm/wsgi.py", line 38, in <module> [Sun Jul 26 12:04:44.093029 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] application = get_wsgi_application() [Sun Jul 26 12:04:44.093048 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/core/wsgi.py", line 12, in get_wsgi_application [Sun Jul 26 12:04:44.093057 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] django.setup(set_prefix=False) [Sun Jul 26 12:04:44.093071 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/__init__.py", line 19, in setup [Sun Jul 26 12:04:44.093090 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) [Sun Jul 26 12:04:44.093108 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/conf/__init__.py", line 76, in __getattr__ [Sun Jul 26 12:04:44.093117 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] self._setup(name) [Sun Jul 26 12:04:44.093130 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/conf/__init__.py", line 63, in _setup [Sun Jul 26 12:04:44.093138 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] self._wrapped = Settings(settings_module) [Sun Jul 26 12:04:44.093158 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] File "/opt/mailman/mm/venv/lib/python3.7/site-packages/Django-3.0.8-py3.7.egg/django/conf/__init__.py", line 142, in __init__ [Sun Jul 26 12:04:44.093166 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] mod = importlib.import_module(self.SETTINGS_MODULE) [Sun Jul 26 12:04:44.093179 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module [Sun Jul 26 12:04:44.093187 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] return _bootstrap._gcd_import(name[level:], package, level) [Sun Jul 26 12:04:44.093210 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] File "<frozen importlib._bootstrap>", line 994, in _gcd_import [Sun Jul 26 12:04:44.093224 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] File "<frozen importlib._bootstrap>", line 971, in _find_and_load [Sun Jul 26 12:04:44.093239 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked [Sun Jul 26 12:04:44.093265 2020] [wsgi:error] [pid 6444] [remote 197.232.81.246:53383] ModuleNotFoundError: No module named 'settings'
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)