The secret ingredient is the audit2why command, which interprets the reason for the denial and suggests the solution, which can then be applied with full knowledge of the ramifications of and side effects of the change.
[root@swordfish ~]# cat /var/log/audit/audit.log | audit2why | less
This revealed this:
type=AVC msg=audit(1685362712.138:110): avc: denied { connectto } for pid=1804 comm="httpd" path="/run/tomcat-xxx2-yyy/so
cket" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:tomcat_t:s0 tclass=unix_stream_socket permissive=0
Was caused by:
The boolean daemons_enable_cluster_mode was set incorrectly.
Description:
Allow daemons to enable cluster mode
Allow access by executing:
# setsebool -P daemons_enable_cluster_mode 1
Which in turn recommended the answer to this particular question, which is to do this:
setsebool -P daemons_enable_cluster_mode 1
The above mode takes effect immediately.
Do I set the context on the socket? It is not enough to do so. For a unix domain socket, the context of the process (in this case tomcat) is also taken into account as well as the context of the socket file.
The boolean "daemons_enable_cluster_mode" enables a built in SELinux policy that allows daemons to talk to each other.