Perl exit code 17920 on sendmail - perl

i have the problem with my software on my server with plesk.
I send one email from perl script but system return the following error:
error closing /usr/lib/sendmail: (exit 17920)
why recive this error?
In the maillog i recive this error:
Jun 29 11:23:57 ip-xxx-xx-xx-xxx journal: plesk sendmail[7708]: handlers_stderr: PASS
Jun 29 11:23:57 ip-xxx-xx-xx-xxx journal: plesk sendmail[7708]: PASS during call 'limit-out' handler
Jun 29 11:23:57 ip-xxx-xx-xx-xxx journal: plesk sendmail[7708]: Unable to rename '/usr/local/psa/handlers/spool/messageEFbeQO' file: Permission denied
Jun 29 11:23:57 ip-xxx-xx-xx-xxx journal: plesk sendmail[7708]: System error (/usr/local/psa/handlers/spool/messageEFbeQO): No such file or directory
Jun 29 11:23:57 ip-xxx-xx-xx-xxx journal: plesk sendmail[7710]: Unable to open temporary file `/usr/local/psa/handlers/spool/messageEFbeQO' (2): No such file or directory
and i not have idea where the problem.
i hope have said all information.

This might be caused by selinux (if it's enabled on your server). You can check that by issuing the command bellow:
sestatus
If the output says permissive or disabled then selinux is not the issue.
Also this link might help you in fixing your mail problem on your plesk server:
https://support.plesk.com/hc/en-us/articles/213947085-Mail-server-does-not-work-How-to-repair-the-mail-server-configuration

Related

postgresql archive permission denied

We have installed postgres v12 on ubuntu 20.04 (with apt install -y postgresql postgresql-contrib) and wish to enable archiving to /data/db/postgres/archive by setting the following in postgresql.conf:
max_wal_senders=2
wal_keep_segments=256
wal_sender_timeout=60s
archive_mode=on
archive_command=cp %p /data/db/postgres/archive/%f
However the postgres service fails to write there:
2022-11-15 15:02:26.212 CET [392860] FATAL: archive command failed with exit code 126
2022-11-15 15:02:26.212 CET [392860] DETAIL: The failed archive command was: archive_command=cp pg_wal/000000010000000000000002 /data/db/postgres/archive/000000010000000000000002
2022-11-15 15:02:26.213 CET [392605] LOG: archiver process (PID 392860) exited with exit code 1
sh: 1: pg_wal/000000010000000000000002: Permission denied
This directory /data/db/postgres/archive/ is owned by the postgres user and when we su postgres we are able to create and delete files without a problem.
Why can the postgresql service (running as postgres) not write to a directory it owns?
Here are the permissions on all the parents of the archive directory:
drwxr-xr-x 2 postgres root 6 Nov 15 14:59 /data/db/postgres/archive
drwxr-xr-x 3 root root 21 Nov 15 14:29 /data/db/postgres
drwxr-xr-x 3 root root 22 Nov 15 14:29 /data/db
drwxr-xr-x 5 root root 44 Nov 15 14:29 /data
2022-11-15 15:02:26.212 CET [392860] DETAIL: The failed archive command was: archive_command=cp pg_wal/000000010000000000000002 /data/db/postgres/archive/000000010000000000000002
So, your archive_command is apparently set to the peculiar string archive_command=cp %p /data/db/postgres/archive/%f.
After the %variables are substituted, the result is passed to the shell. The shell does what it was told, which is to set the (unused) environment variable 'archive_command' to be 'cp', and then tries to execute the file pg_wal/000000010000000000000002, which is not allowed to because it doesn't have the execute bit set.
I don't know how you managed to get such a deformed archive_command, but it didn't come from anything you showed us.

Cannot run psql in PostgreSQL 9.5

I am using PostgreSQL 9.5 on Ubuntu 16.04 LTS.
I receive the below error when I type psql:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
On checking the logs in /var/log/postgresql/postgresql-9.5-main.log, I see the error as:
2018-11-26 13:17:41 IST [3508-1] FATAL: could not access private key file "/etc/ssl/private/ssl-cert-snakeoil.key": Permission denied
Below are the permissions of the /etc/ssl/private and ssl-cert-snakeoil.key files:
vivek#vivek-ThinkPad-E480:~$ ls -l /etc/ssl
total 36
drwxr-xr-x 2 root root 20480 Nov 22 13:06 certs
-rwxr-xr-x 1 root root 10835 Dec 8 2017 openssl.cnf
drwxr--r-- 2 root ssl-cert 4096 Nov 22 13:06 private
vivek#vivek-ThinkPad-E480:~$ sudo ls -l /etc/ssl/private
total 4
-rw-r----- 1 root ssl-cert 1704 Nov 22 13:06 ssl-cert-snakeoil.key
The postgres user is also added to the group ssl-cert.
vivek#vivek-ThinkPad-E480:~$ getent group ssl-cert
ssl-cert:x:112:postgres
NOTE: I found that there is no server.key present in /var/lib/postgresql/9.5/main.
I also posted this on DBA Stackexchange, but no response as yet.
Can anyone guide me in the right direction in setting permissions?
That can never work, and your server will not be able to start, because the OS user postgres has no permissions to access files in etc/ssl/private.
To allow users in the group ssl-cert to access files in the directory, run
chmod g+x /etc/ssl/private
While you're at it, make sure that /etc/ssl has the required permissions.
To test if everything works, become user postgres and try to read the file.

Mac OS Sierra log show missing SSH source IP

Before, we can track all the SSH logins either success/failure in OS X El Capitan. When moved to OS Sierra, It seems that all the logs were moved which can be viewed by log show, log stream, and syslog.
We can't track the source IP of an SSH process by looking those logs. e.g. :
Jun 27 15:38:47 MAC sshd: administrator [priv][240] <Notice>: USER_PROCESS: 243 ttys000
Jun 27 15:39:34 MAC sshd: administrator [priv][249] <Notice>: USER_PROCESS: 257 ttys001
Jun 27 15:42:50 MAC sshd: administrator [priv][249] <Notice>: DEAD_PROCESS: 257 ttys001
Screen sharing logs works perfectly just like before:
screensharingd: Authentication: SUCCEEDED :: User Name: administrator :: Viewer Address: 10.X.X.X :: Type: DH
Though we can see the logs of sshd if the attempt failed:
sshd: error: PAM: authentication error for administrator from 10.10.5.73
Any help will be greatly appreciated.
Thank you very much.
Try with this command:
log stream --info --predicate 'processImagePath contains[c] "sshd"'
It will log the successful and failed attempts.
I've found out that SSH logs can be shown using this command:
log show --style JSON | grep "ssh"

PG::ConnectionBad Postgres Cluster down

Digitalocean disabled my droplet's internet access. After fixing the error (rollback to older backup) they restored the internet access. But afterwards I constantly get an error when deploying, I can't seem to get my Postgres database up and running.
I'm getting an error each time I try to deploy my application.
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
So I used SSH to login to my server and check if my Postgres was actually running with:
pg_lsclusters
Results into:
Ver Cluster Port Status Owner Data directory Log file
9.5 main 5432 down postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log
Postgres server status
So my Postgres server seems to be down. I tried putting it 'up' again with:
pg_ctlcluster 9.5 main start After doing so I got the error: Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 403.
And /usr/bin/pg_ctlcluster on line 403 says:
system 'systemctl', 'is-active', '-q', "postgresql\#$version-$cluster";
But I'm not to sure what the problem could be here and how I could fix this.
Update
I also tried updating the permissions on /bin to 755 as mentioned here. Sadly that did not fix my problem.
Update 2
I changed the /usr/bin to 755. Now when I try pg_ctlcluster 9.5 main start, I get this:
Job for postgresql#9.5-main.service failed because the control process exited with error code. See "systemctl status postgresql#9.5-main.service" and "journalctl -xe" for details.
And inside the systemctl status postgresql#9.5-main.service:
postgresql#9.5-main.service - PostgreSQL Cluster 9.5-main
Loaded: loaded (/lib/systemd/system/postgresql#.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2018-01-28 17:32:38 EST; 45s ago
Process: 22473 ExecStart=postgresql#%i --skip-systemctl-redirect %i start (code=exited, status=1/FAILURE)
Jan 28 17:32:08 *url* systemd[1]: Starting PostgreSQL Cluster 9.5-main...
Jan 28 17:32:38 *url* postgresql#9.5-main[22473]: The PostgreSQL server failed to start.
Jan 28 17:32:38 *url* systemd[1]: postgresql#9.5-main.service: Control process exited, code=exited status=1
Jan 28 17:32:38 *url* systemd[1]: Failed to start PostgreSQL Cluster 9.5-main.
Jan 28 17:32:38 *url* systemd[1]: postgresql#9.5-main.service: Unit entered failed state.
Jan 28 17:32:38 *url* systemd[1]: postgresql#9.5-main.service: Failed with result 'exit-code'.
Thanks!
You better not mix systemctl and pg_ctlcluster. Let systemctl makes the calls to pg_ctlcluster with the right user and permissions. You should start your postgresql instance with
sudo systemctl start postgresql#9.5-main.service
Also, check the errors in the startup log. You can post them too, to help you figure out what's going on.
Your systemctl status also outputs that the service is disable, so, when the server reboots, you will have to start the service manually. To enable it run:
sudo systemctl enable postgresql#9.5-main.service
I hope it helps
It is mainly because /etc/hosts file is somehow changed.I have removed extra space inside /etc/hosts file.Use cat /etc/hosts
Add these lines into the file
127.0.0.1 localhost
127.0.1.1 your-host-name
::1 ip6-localhost ip6-loopback
And I have given permission 644 to /etc/hosts file.It is working for me even after the reboot of the system.

Fatal error frontend otrs 4 while loading index.pl

I already installed OTRS 4.0.5 in rhel6 after restart apache, mysql and otrs, while loading http://localhost/otrs/index.pl
The page is not loading and it gives:
Fatal error- Frontend -OTRS 4
The index page is not opening and I need some help figuring out why.
My error log is
[Tue Apr 28 15:23:56 2015] -e: DBI connect('database=otrs;host=127.0.0.1','otrs',...) failed: Can't connect to MySQL server on '127.0.0.1' (13) at /opt/otrs//Kernel/System/DB.pm line 184
ERROR: OTRS-CGI-72 Perl: 5.10.1 OS: linux Time: Tue Apr 28 15:23:56 2015
Message: Can't connect to MySQL server on '127.0.0.1' (13)
Can't write '/opt/otrs/var/tmp/CacheFileStorable/TemplateProvider/4/f/4fd2983f3605888b9d72424fb64ba2a1': Permission denied
Can't write '/opt/otrs/var/tmp/CacheFileStorable/TemplateProvider/3/9/39285138ef78930f9c3f9d967fbdd6bb': Permission denied
Can't write '/opt/otrs/var/tmp/CacheFileStorable/TemplateProvider/e/7/e73a715153f074752e829500e76f765b': Permission denied
mkdir /opt/otrs/var/tmp/CacheFileStorable/TemplateProvider/3/d: Permission denied at /opt/otrs//Kernel/System/Cache/FileStorable.pm line 88
Can't write '/opt/otrs/var/tmp/CacheFileStorable/TemplateProvider/e/6/e6f4f8c1130924d59deb478d08f08e5e': Permission denied
Thanks in advance!
You should disable SELinux or add the policy.
To disable SELinux edit /etc/selinux/config and replace and set SELINUX=disabled
Example policy for OTRS is described here:
http://forums.otterhub.org/viewtopic.php?t=20669#p86818
This is SELinux restricting access to the filesystem. You'll need to set an exception or disable SELinux entirely.