1 (edited by Pavel Zhe 2024-07-24 15:46:17)

Topic: 1.7.0 - incorrect table owner for fail2ban.jails ?

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.7.0
- Deployed with iRedMail Easy or the downloadable installer? Installer
- Linux/BSD distribution name and version: Ubuntu 20.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? YES
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

During upgrade, add 'fail2ban.jails' accordingly to manual. After restart server, on startup got an error in postgresql log:

2024-07-24 09:51:44.664 MSK [1359] fail2ban@fail2ban ERROR:  permission denied for table jails
2024-07-24 09:51:44.664 MSK [1359] fail2ban@fail2ban STATEMENT:  SELECT id FROM jails WHERE name='sshd' LIMIT 1;
2024-07-24 09:51:44.723 MSK [1447] fail2ban@fail2ban ERROR:  permission denied for table jails
2024-07-24 09:51:44.723 MSK [1447] fail2ban@fail2ban STATEMENT:  INSERT INTO jails (name, enabled) VALUES ('sshd', 1);
2024-07-24 09:51:44.809 MSK [1538] fail2ban@fail2ban ERROR:  permission denied for table jails
2024-07-24 09:51:44.809 MSK [1538] fail2ban@fail2ban STATEMENT:  SELECT id FROM jails WHERE name='nginx' LIMIT 1;
2024-07-24 09:51:44.873 MSK [1584] fail2ban@fail2ban ERROR:  permission denied for table jails
2024-07-24 09:51:44.873 MSK [1584] fail2ban@fail2ban STATEMENT:  INSERT INTO jails (name, enabled) VALUES ('nginx', 1);
2024-07-24 09:51:44.946 MSK [1634] fail2ban@fail2ban ERROR:  permission denied for table jails
2024-07-24 09:51:44.946 MSK [1634] fail2ban@fail2ban STATEMENT:  SELECT id FROM jails WHERE name='postfix' LIMIT 1;
2024-07-24 09:51:45.006 MSK [1657] fail2ban@fail2ban ERROR:  permission denied for table jails
2024-07-24 09:51:45.006 MSK [1657] fail2ban@fail2ban STATEMENT:  INSERT INTO jails (name, enabled) VALUES ('postfix', 1);
2024-07-24 09:51:45.079 MSK [1694] fail2ban@fail2ban ERROR:  permission denied for table jails
2024-07-24 09:51:45.079 MSK [1694] fail2ban@fail2ban STATEMENT:  SELECT id FROM jails WHERE name='dovecot' LIMIT 1;
2024-07-24 09:51:45.137 MSK [1721] fail2ban@fail2ban ERROR:  permission denied for table jails
2024-07-24 09:51:45.137 MSK [1721] fail2ban@fail2ban STATEMENT:  INSERT INTO jails (name, enabled) VALUES ('dovecot', 1);
2024-07-24 09:51:45.214 MSK [1772] fail2ban@fail2ban ERROR:  permission denied for table jails
2024-07-24 09:51:45.214 MSK [1772] fail2ban@fail2ban STATEMENT:  SELECT id FROM jails WHERE name='pregreet' LIMIT 1;
2024-07-24 09:51:45.272 MSK [1797] fail2ban@fail2ban ERROR:  permission denied for table jails
2024-07-24 09:51:45.272 MSK [1797] fail2ban@fail2ban STATEMENT:  INSERT INTO jails (name, enabled) VALUES ('pregreet', 1);
2024-07-24 09:51:45.343 MSK [1834] fail2ban@fail2ban ERROR:  permission denied for table jails
2024-07-24 09:51:45.343 MSK [1834] fail2ban@fail2ban STATEMENT:  SELECT id FROM jails WHERE name='sogo' LIMIT 1;
2024-07-24 09:51:45.402 MSK [1859] fail2ban@fail2ban ERROR:  permission denied for table jails
2024-07-24 09:51:45.402 MSK [1859] fail2ban@fail2ban STATEMENT:  INSERT INTO jails (name, enabled) VALUES ('sogo', 1);

Log into psql

postgres@MX-TEST:~$ psql -U fail2ban -d fail2ban
psql (12.18 (Ubuntu 12.18-0ubuntu0.20.04.1))
Type "help" for help.

fail2ban=> \dt
         List of relations
 Schema |  Name  | Type  |  Owner
--------+--------+-------+----------
 public | banned | table | fail2ban
 public | jails  | table | postgres
(2 rows)

fail2ban=> select * from jails;
ERROR:  permission denied for table jails
fail2ban=> quit;

Well,

root@MX-TEST:~# su - postgres
postgres@MX-TEST:~$ psql -U postgres -d fail2ban
psql (12.18 (Ubuntu 12.18-0ubuntu0.20.04.1))
Type "help" for help.

fail2ban=# ALTER TABLE jails OWNER TO fail2ban;
ALTER TABLE
fail2ban=# \dt
         List of relations
 Schema |  Name  | Type  |  Owner
--------+--------+-------+----------
 public | banned | table | fail2ban
 public | jails  | table | fail2ban
(2 rows)

fail2ban=#

and no error on startup

Incorrect owner set for 'jails' table during upgrade due ALTER TABLE statement in f2b.sql missing, i think. Correct me, if I wrong

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: 1.7.0 - incorrect table owner for fail2ban.jails ?

Fixed. https://github.com/iredmail/iRedMail/co … 2e41071R12