PostgreSQL La base de donnees la plus sophistiquee au monde.

Forums PostgreSQL.fr

Le forum officiel de la communauté francophone de PostgreSQL

Vous n'êtes pas identifié(e).

#1 Re : Sécurité » PgAdmin4 Unable to connect to server:timeout expired » 02/05/2021 11:52:42

Vous avez trouvé la solution.
Je suis admiratif et je vous remercie vraiment.

Bonne journée.

#2 Re : Sécurité » PgAdmin4 Unable to connect to server:timeout expired » 02/05/2021 11:31:04

iptable -L -n

serveur 1

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

serveur 2

serveur 2

root@debian:/home/olivier# /sbin/iptables -L -n


Chain INPUT (policy DROP)
target     prot opt source               destination
ufw-before-logging-input  all  --  0.0.0.0/0            0.0.0.0/0
ufw-before-input  all  --  0.0.0.0/0            0.0.0.0/0
ufw-after-input  all  --  0.0.0.0/0            0.0.0.0/0
ufw-after-logging-input  all  --  0.0.0.0/0            0.0.0.0/0
ufw-reject-input  all  --  0.0.0.0/0            0.0.0.0/0
ufw-track-input  all  --  0.0.0.0/0            0.0.0.0/0

Chain FORWARD (policy DROP)
target     prot opt source               destination
ufw-before-logging-forward  all  --  0.0.0.0/0            0.0.0.0/0
ufw-before-forward  all  --  0.0.0.0/0            0.0.0.0/0
ufw-after-forward  all  --  0.0.0.0/0            0.0.0.0/0
ufw-after-logging-forward  all  --  0.0.0.0/0            0.0.0.0/0
ufw-reject-forward  all  --  0.0.0.0/0            0.0.0.0/0
ufw-track-forward  all  --  0.0.0.0/0            0.0.0.0/0

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ufw-before-logging-output  all  --  0.0.0.0/0            0.0.0.0/0
ufw-before-output  all  --  0.0.0.0/0            0.0.0.0/0
ufw-after-output  all  --  0.0.0.0/0            0.0.0.0/0
ufw-after-logging-output  all  --  0.0.0.0/0            0.0.0.0/0
ufw-reject-output  all  --  0.0.0.0/0            0.0.0.0/0
ufw-track-output  all  --  0.0.0.0/0            0.0.0.0/0

Chain ufw-before-logging-input (1 references)
target     prot opt source               destination

Chain ufw-before-logging-output (1 references)
target     prot opt source               destination

Chain ufw-before-logging-forward (1 references)
target     prot opt source               destination

Chain ufw-before-input (1 references)
target     prot opt source               destination
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
ufw-logging-deny  all  --  0.0.0.0/0            0.0.0.0/0            ctstate INVALID
DROP       all  --  0.0.0.0/0            0.0.0.0/0            ctstate INVALID
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0            icmptype 3
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0            icmptype 11
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0            icmptype 12
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0            icmptype 8
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp spt:67 dpt:68
ufw-not-local  all  --  0.0.0.0/0            0.0.0.0/0
ACCEPT     udp  --  0.0.0.0/0            224.0.0.251          udp dpt:5353
ACCEPT     udp  --  0.0.0.0/0            239.255.255.250      udp dpt:1900
ufw-user-input  all  --  0.0.0.0/0            0.0.0.0/0

Chain ufw-before-output (1 references)
target     prot opt source               destination
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
ufw-user-output  all  --  0.0.0.0/0            0.0.0.0/0

Chain ufw-before-forward (1 references)
target     prot opt source               destination
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0            icmptype 3
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0            icmptype 11
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0            icmptype 12
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0            icmptype 8
ufw-user-forward  all  --  0.0.0.0/0            0.0.0.0/0

Chain ufw-after-input (1 references)
target     prot opt source               destination
ufw-skip-to-policy-input  udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:137
ufw-skip-to-policy-input  udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:138
ufw-skip-to-policy-input  tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:139
ufw-skip-to-policy-input  tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:445
ufw-skip-to-policy-input  udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:67
ufw-skip-to-policy-input  udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:68
ufw-skip-to-policy-input  all  --  0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type BROADCAST

Chain ufw-after-output (1 references)
target     prot opt source               destination

Chain ufw-after-forward (1 references)
target     prot opt source               destination

Chain ufw-after-logging-input (1 references)
target     prot opt source               destination
LOG        all  --  0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "

Chain ufw-after-logging-output (1 references)
target     prot opt source               destination

Chain ufw-after-logging-forward (1 references)
target     prot opt source               destination
LOG        all  --  0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "

Chain ufw-reject-input (1 references)
target     prot opt source               destination

Chain ufw-reject-output (1 references)
target     prot opt source               destination

Chain ufw-reject-forward (1 references)
target     prot opt source               destination

Chain ufw-track-input (1 references)
target     prot opt source               destination

Chain ufw-track-output (1 references)
target     prot opt source               destination
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            ctstate NEW
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            ctstate NEW

Chain ufw-track-forward (1 references)
target     prot opt source               destination

Chain ufw-logging-deny (2 references)
target     prot opt source               destination
RETURN     all  --  0.0.0.0/0            0.0.0.0/0            ctstate INVALID limit: avg 3/min burst 10
LOG        all  --  0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "

Chain ufw-logging-allow (0 references)
target     prot opt source               destination
LOG        all  --  0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW ALLOW] "

Chain ufw-skip-to-policy-input (7 references)
target     prot opt source               destination
DROP       all  --  0.0.0.0/0            0.0.0.0/0

Chain ufw-skip-to-policy-output (0 references)
target     prot opt source               destination
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0

Chain ufw-skip-to-policy-forward (0 references)
target     prot opt source               destination
DROP       all  --  0.0.0.0/0            0.0.0.0/0

Chain ufw-not-local (1 references)
target     prot opt source               destination
RETURN     all  --  0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type LOCAL
RETURN     all  --  0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type MULTICAST
RETURN     all  --  0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type BROADCAST
ufw-logging-deny  all  --  0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 10
DROP       all  --  0.0.0.0/0            0.0.0.0/0

Chain ufw-user-input (1 references)
target     prot opt source               destination
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:443
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22

Chain ufw-user-output (1 references)
target     prot opt source               destination

Chain ufw-user-forward (1 references)
target     prot opt source               destination

Chain ufw-user-logging-input (0 references)
target     prot opt source               destination

Chain ufw-user-logging-output (0 references)
target     prot opt source               destination

Chain ufw-user-logging-forward (0 references)
target     prot opt source               destination

Chain ufw-user-limit (0 references)
target     prot opt source               destination
LOG        all  --  0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 5 LOG flags 0 level 4 prefix "[UFW LIMIT BLOCK] "
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable

Chain ufw-user-limit-accept (0 references)
target     prot opt source               destination
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0

#3 Re : Sécurité » PgAdmin4 Unable to connect to server:timeout expired » 02/05/2021 09:53:59

netstat serveur 1

netstat -laputen | grep 5432
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      118        23164      701/postgres
tcp        0      0 192.168.0.44:5432       192.168.0.74:57997      ESTABLISHED 118        84428      4227/postgres: 13/m
tcp        0      0 192.168.0.44:5432       192.168.0.74:56739      ESTABLISHED 118        37301      2224/postgres: 13/m
tcp        0      0 192.168.0.44:5432       192.168.0.74:56955      ESTABLISHED 118        52802      3050/postgres: 13/m
tcp6       0      0 :::5432                 :::*                    LISTEN      118        23165      701/postgres

netstat serveur 2

netstat -laputen | grep 5432
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      105        77190      3974/postgres
tcp6       0      0 :::5432                 :::*                    LISTEN      105        77191      3974/postgres

#4 Re : Sécurité » PgAdmin4 Unable to connect to server:timeout expired » 02/05/2021 09:48:39

Oui psql sur le serveur 1 ne se connecte pas au serveur 2.
Vous avez bien résumé le pb.

configuration postgres serveur 1
            name            |             current_setting             |        source        |               sourcefile                | sourceline
----------------------------+-----------------------------------------+----------------------+-----------------------------------------+------------
 application_name           | psql                                    | client               |                                         |
 client_encoding            | UTF8                                    | client               |                                         |
 cluster_name               | 13/main                                 | configuration file   | /etc/postgresql/13/main/postgresql.conf |        569
 data_checksums             | off                                     | override             |                                         |
 DateStyle                  | ISO, MDY                                | configuration file   | /etc/postgresql/13/main/postgresql.conf |        678
 default_text_search_config | pg_catalog.english                      | configuration file   | /etc/postgresql/13/main/postgresql.conf |        701
 dynamic_shared_memory_type | posix                                   | configuration file   | /etc/postgresql/13/main/postgresql.conf |        142
 external_pid_file          | /var/run/postgresql/13-main.pid         | configuration file   | /etc/postgresql/13/main/postgresql.conf |         49
 lc_collate                 | en_US.UTF-8                             | override             |                                         |
 lc_ctype                   | en_US.UTF-8                             | override             |                                         |
 lc_messages                | en_US.UTF-8                             | configuration file   | /etc/postgresql/13/main/postgresql.conf |        694
 lc_monetary                | en_US.UTF-8                             | configuration file   | /etc/postgresql/13/main/postgresql.conf |        696
 lc_numeric                 | en_US.UTF-8                             | configuration file   | /etc/postgresql/13/main/postgresql.conf |        697
 lc_time                    | en_US.UTF-8                             | configuration file   | /etc/postgresql/13/main/postgresql.conf |        698
 listen_addresses           | *                                       | configuration file   | /etc/postgresql/13/main/postgresql.conf |         59
 log_line_prefix            | %m [%p] %q%u@%d                         | configuration file   | /etc/postgresql/13/main/postgresql.conf |        529
 log_timezone               | US/Central                              | configuration file   | /etc/postgresql/13/main/postgresql.conf |        563
 max_connections            | 100                                     | configuration file   | /etc/postgresql/13/main/postgresql.conf |         64
 max_stack_depth            | 2MB                                     | environment variable |                                         |
 max_wal_size               | 1GB                                     | configuration file   | /etc/postgresql/13/main/postgresql.conf |        228
 min_wal_size               | 80MB                                    | configuration file   | /etc/postgresql/13/main/postgresql.conf |        229
 port                       | 5432                                    | configuration file   | /etc/postgresql/13/main/postgresql.conf |         63
 server_encoding            | UTF8                                    | override             |                                         |
 shared_buffers             | 128MB                                   | configuration file   | /etc/postgresql/13/main/postgresql.conf |        121
 ssl                        | on                                      | configuration file   | /etc/postgresql/13/main/postgresql.conf |        100
 ssl_cert_file              | /etc/ssl/certs/ssl-cert-snakeoil.pem    | configuration file   | /etc/postgresql/13/main/postgresql.conf |        102
 ssl_key_file               | /etc/ssl/private/ssl-cert-snakeoil.key  | configuration file   | /etc/postgresql/13/main/postgresql.conf |        104
 stats_temp_directory       | /var/run/postgresql/13-main.pg_stat_tmp | configuration file   | /etc/postgresql/13/main/postgresql.conf |        585
 TimeZone                   | US/Central                              | configuration file   | /etc/postgresql/13/main/postgresql.conf |        680
 transaction_deferrable     | off                                     | override             |                                         |
 transaction_isolation      | read committed                          | override             |                                         |
 transaction_read_only      | off                                     | override             |                                         |
 unix_socket_directories    | /var/run/postgresql                     | configuration file   | /etc/postgresql/13/main/postgresql.conf |         66
 wal_buffers                | 4MB                                     | override             |                                         |
 wal_segment_size           | 16MB                                    | override             |                                         |
(35 rows)
configuration postgres serveur 2
            name            |             current_setting             |        source        |               sourcefile                | sourceline
----------------------------+-----------------------------------------+----------------------+-----------------------------------------+------------
 application_name           | psql                                    | client               |                                         |
 client_encoding            | UTF8                                    | client               |                                         |
 cluster_name               | 13/main                                 | configuration file   | /etc/postgresql/13/main/postgresql.conf |        569
 data_checksums             | off                                     | override             |                                         |
 DateStyle                  | ISO, MDY                                | configuration file   | /etc/postgresql/13/main/postgresql.conf |        678
 default_text_search_config | pg_catalog.english                      | configuration file   | /etc/postgresql/13/main/postgresql.conf |        701
 dynamic_shared_memory_type | posix                                   | configuration file   | /etc/postgresql/13/main/postgresql.conf |        142
 external_pid_file          | /var/run/postgresql/13-main.pid         | configuration file   | /etc/postgresql/13/main/postgresql.conf |         49
 lc_collate                 | en_US.UTF-8                             | override             |                                         |
 lc_ctype                   | en_US.UTF-8                             | override             |                                         |
 lc_messages                | en_US.UTF-8                             | configuration file   | /etc/postgresql/13/main/postgresql.conf |        694
 lc_monetary                | en_US.UTF-8                             | configuration file   | /etc/postgresql/13/main/postgresql.conf |        696
 lc_numeric                 | en_US.UTF-8                             | configuration file   | /etc/postgresql/13/main/postgresql.conf |        697
 lc_time                    | en_US.UTF-8                             | configuration file   | /etc/postgresql/13/main/postgresql.conf |        698
 listen_addresses           | *                                       | configuration file   | /etc/postgresql/13/main/postgresql.conf |         59
 log_line_prefix            | %m [%p] %q%u@%d                         | configuration file   | /etc/postgresql/13/main/postgresql.conf |        529
 log_timezone               | US/Central                              | configuration file   | /etc/postgresql/13/main/postgresql.conf |        563
 max_connections            | 100                                     | configuration file   | /etc/postgresql/13/main/postgresql.conf |         64
 max_stack_depth            | 2MB                                     | environment variable |                                         |
 max_wal_size               | 1GB                                     | configuration file   | /etc/postgresql/13/main/postgresql.conf |        228
 min_wal_size               | 80MB                                    | configuration file   | /etc/postgresql/13/main/postgresql.conf |        229
 port                       | 5432                                    | configuration file   | /etc/postgresql/13/main/postgresql.conf |         63
 server_encoding            | UTF8                                    | override             |                                         |
 shared_buffers             | 128MB                                   | configuration file   | /etc/postgresql/13/main/postgresql.conf |        121
 ssl                        | on                                      | configuration file   | /etc/postgresql/13/main/postgresql.conf |        100
 ssl_cert_file              | /etc/ssl/certs/ssl-cert-snakeoil.pem    | configuration file   | /etc/postgresql/13/main/postgresql.conf |        102
 ssl_key_file               | /etc/ssl/private/ssl-cert-snakeoil.key  | configuration file   | /etc/postgresql/13/main/postgresql.conf |        104
 stats_temp_directory       | /var/run/postgresql/13-main.pg_stat_tmp | configuration file   | /etc/postgresql/13/main/postgresql.conf |        585
 TimeZone                   | US/Central                              | configuration file   | /etc/postgresql/13/main/postgresql.conf |        680
 transaction_deferrable     | off                                     | override             |                                         |
 transaction_isolation      | read committed                          | override             |                                         |
 transaction_read_only      | off                                     | override             |                                         |
 unix_socket_directories    | /var/run/postgresql                     | configuration file   | /etc/postgresql/13/main/postgresql.conf |         66
 wal_buffers                | 4MB                                     | override             |                                         |
 wal_segment_size           | 16MB                                    | override             |                                         |
(35 rows)

#5 Re : Sécurité » PgAdmin4 Unable to connect to server:timeout expired » 02/05/2021 08:57:58

Je viens de tester la connexion des psql entre les 2 serveurs PG.
J'obtiens la même erreur à savoir, psql sur le 2 se connecte bien au premier serveur.
psql sur le 1 ne se connecte pas au premier serveur.

psql: error: could not connect to server: Connection timed out
        Is the server running on host "@@@@@@@" and accepting
        TCP/IP connections on port 5432?

#6 Re : Sécurité » PgAdmin4 Unable to connect to server:timeout expired » 02/05/2021 08:45:40

Ma machine physique cliente est un Win10
Mon premier serveur postgres tourne sur un debian10 virtuel sous VMWare
Mon second serveur postgres tourne aussi sur un debian10 virtuel sous VMWare

PGAdmin voit parfaitement le premier serveur mais pas le second.
J'ai désactivé le firewall Win10 pour faire le test mais sans succès.

psql est exécuté en local sur chaque serveur, ils se connectent bien.

#7 Sécurité » PgAdmin4 Unable to connect to server:timeout expired » 01/05/2021 19:25:35

yoyo72
Réponses : 12

Bonjour,
j'ai configuré une base Postgres 13 sur Debian10.
Je me connecte en psql sans pb. Tout semble ok côté serveur. J'ai même revérifié avec un autre serveur qui fonctionne.

netstat -laputen | grep 5432
tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      105        70168      3586/postgres
tcp6       0      0 :::5432                 :::*                    LISTEN      105        70169      3586/postgres


# sudo service postgresql status

â postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
   Active: active (exited) since Sat 2021-05-01 17:22:30 UTC; 58s ago
  Process: 3992 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 3992 (code=exited, status=0/SUCCESS)

May 01 17:22:30 debian systemd[1]: Starting PostgreSQL RDBMS...
May 01 17:22:30 debian systemd[1]: Started PostgreSQL RDBMS.

un extrait du fichier de log

2021-05-01 12:22:28.342 CDT [3974] LOG:  starting PostgreSQL 13.2 (Debian 13.2-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6$
2021-05-01 12:22:28.345 CDT [3974] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2021-05-01 12:22:28.345 CDT [3974] LOG:  listening on IPv6 address "::", port 5432
2021-05-01 12:22:28.346 CDT [3974] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-05-01 12:22:28.350 CDT [3975] LOG:  database system was shut down at 2021-05-01 12:22:28 CDT
2021-05-01 12:22:28.355 CDT [3974] LOG:  database system is ready to accept connections



Quand je tente de me connecter avec PGAdmin, j'ai l'erreur "Unable to connect to server:timeout expired"

Merci pour votre aide car je sèche.

Pied de page des forums

Propulsé par FluxBB