How to correctly set SSL in pg_hba.conf of postgreSQL-11?Cannot connect to postgresql on port 5432PostgreSQL 9.4 hangs during installation at “Removing obsolete dictionary files:”Can't apply Postgres configuration update after setting up custom data directoryPostgresql server is not listeningApache2 HTTP Ubuntu Won't Restart

A bob hanging in an accelerating train moves backward. What is the force moving it backward?

Why don't electrical receptacles have more than one ground?

How can you weaponize a thermos?

Conveying computationally (talking about algorithms; e.g. computationally ineficient/expensive) avec computationnellement

Only return recordset(s) from Stored Procedure if it has rows

While I have six eyes, I don't need an optician

What world is this where 6 + 6 = 10?

Can the US Senate's Hong Kong bill be treated as foreign interference?

A Ukrainian idiom meaning "on one's last legs"

How to deal with an employee who is requesting a demotion?

If password expiration is applied, should door-lock expiration be applied too?

Why do some planes have flashing lights within the plane cabin?

Why should I invest so much in 401(k)?

Algorithmic thinking problems

My advisor wants me to make my PhD thesis weaker

Exactly what color was the text on monochrome terminals with green-on-black and amber-on-black screens?

Contacted by head of school regarding an issue - should I be worried?

Why is it ethical for Ambassador Sondland to have been given an ambassadorship for campaign contributions?

What is the difference between "cat < filename" and "cat filename"?

What are the units of the product of two signals?

Bought a book that is in the public domain ... but the T&A of company says I can't redistribute it

Dollar cost averaging vs buy low/sell high

Low pass filter giving sine wave ( triangular wave as input )

Employer wants me to do something explicitly illegal



How to correctly set SSL in pg_hba.conf of postgreSQL-11?


Cannot connect to postgresql on port 5432PostgreSQL 9.4 hangs during installation at “Removing obsolete dictionary files:”Can't apply Postgres configuration update after setting up custom data directoryPostgresql server is not listeningApache2 HTTP Ubuntu Won't Restart






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









0


















In my Ubuntu 18.04.02 Server Edition with postgreSQL-11 I want to add the possibility of SSL communication between the postgreSQL server and a client.



I turned the ssl on in postgresql.conf :



sudo nano /etc/postgresql/11/main/postgresql.conf



ssl = on


and in pg_hba.conf I added a line for ssl :



sudo nano /etc/postgresql/11/main/pg_hba.conf



local all postgres peer

# TYPE DATABASE USER ADDRESS
METHOD

# "local" is for Unix domain socket connections only
local all all peer

# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all peer
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5

host all all 192.168.1.1/24 md5

# Only for SSL connections :
hostssl all all cert


But when reloading the new configuration, and restarting postgreSQL :



(base) marco@pc:~$ sudo /etc/init.d/postgresql reload
[ ok ] Reloading postgresql configuration (via systemctl):
postgresql.service.
(base) marco@pc:~$ sudo service postgresql restart
(base) marco@pc:~$ sudo service postgresql status
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled;
vendor preset: enabled)
Active: active (exited) since Mon 2019-09-16 18:48:13 CEST; 6s
ago
Process: 3349 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
Process: 3399 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 3399 (code=exited, status=0/SUCCESS)

Sep 16 18:48:13 pc systemd[1]: Starting PostgreSQL RDBMS...
Sep 16 18:48:13 pc systemd[1]: Started PostgreSQL RDBMS.


I get this error:



(base) marco@pc:~$ sudo su -l postgres
postgres@pc:~$ 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"?



I already tried the suggestions found here: Cannot connect to postgresql on port 5432
withour any success



When commenting the hostssl line in pg_hba.conf:



# Only for SSL connections :
#hostssl all all cert


The error disappears:



(base) marco@pc:~$ sudo /etc/init.d/postgresql reload
[ ok ] Reloading postgresql configuration (via systemctl):
postgresql.service.
(base) marco@pc:~$ sudo service postgresql restart
(base) marco@pc:~$ sudo service postgresql status
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled;
vendor preset: enabled)
Active: active (exited) since Mon 2019-09-16 18:52:37 CEST; 3s
ago
Process: 3455 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
Process: 3511 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 3511 (code=exited, status=0/SUCCESS)

Sep 16 18:52:37 pc systemd[1]: Starting PostgreSQL RDBMS...
Sep 16 18:52:37 pc systemd[1]: Started PostgreSQL RDBMS.
(base) marco@pc:~$ sudo su -l postgres
postgres@pc:~$ psql
psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1))
Type "help" for help.

postgres=# help
You are using psql, the command-line interface to PostgreSQL.
Type: copyright for distribution terms
h for help with SQL commands
? for help with psql commands
g or terminate with semicolon to execute query
q to quit
postgres=#


So, my question is : how to correctly set ssl in /etc/postgresql/11/main/pg_hba.conf ?



SOLVED: adding the IP addresses range in pg_hba.conf:



hostssl all all 192.168.1.0/24 cert









share|improve this question

































    0


















    In my Ubuntu 18.04.02 Server Edition with postgreSQL-11 I want to add the possibility of SSL communication between the postgreSQL server and a client.



    I turned the ssl on in postgresql.conf :



    sudo nano /etc/postgresql/11/main/postgresql.conf



    ssl = on


    and in pg_hba.conf I added a line for ssl :



    sudo nano /etc/postgresql/11/main/pg_hba.conf



    local all postgres peer

    # TYPE DATABASE USER ADDRESS
    METHOD

    # "local" is for Unix domain socket connections only
    local all all peer

    # IPv4 local connections:
    host all all 127.0.0.1/32 md5
    # IPv6 local connections:
    host all all ::1/128 md5
    # Allow replication connections from localhost, by a user with the
    # replication privilege.
    local replication all peer
    host replication all 127.0.0.1/32 md5
    host replication all ::1/128 md5

    host all all 192.168.1.1/24 md5

    # Only for SSL connections :
    hostssl all all cert


    But when reloading the new configuration, and restarting postgreSQL :



    (base) marco@pc:~$ sudo /etc/init.d/postgresql reload
    [ ok ] Reloading postgresql configuration (via systemctl):
    postgresql.service.
    (base) marco@pc:~$ sudo service postgresql restart
    (base) marco@pc:~$ sudo service postgresql status
    ● postgresql.service - PostgreSQL RDBMS
    Loaded: loaded (/lib/systemd/system/postgresql.service; enabled;
    vendor preset: enabled)
    Active: active (exited) since Mon 2019-09-16 18:48:13 CEST; 6s
    ago
    Process: 3349 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
    Process: 3399 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
    Main PID: 3399 (code=exited, status=0/SUCCESS)

    Sep 16 18:48:13 pc systemd[1]: Starting PostgreSQL RDBMS...
    Sep 16 18:48:13 pc systemd[1]: Started PostgreSQL RDBMS.


    I get this error:



    (base) marco@pc:~$ sudo su -l postgres
    postgres@pc:~$ 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"?



    I already tried the suggestions found here: Cannot connect to postgresql on port 5432
    withour any success



    When commenting the hostssl line in pg_hba.conf:



    # Only for SSL connections :
    #hostssl all all cert


    The error disappears:



    (base) marco@pc:~$ sudo /etc/init.d/postgresql reload
    [ ok ] Reloading postgresql configuration (via systemctl):
    postgresql.service.
    (base) marco@pc:~$ sudo service postgresql restart
    (base) marco@pc:~$ sudo service postgresql status
    ● postgresql.service - PostgreSQL RDBMS
    Loaded: loaded (/lib/systemd/system/postgresql.service; enabled;
    vendor preset: enabled)
    Active: active (exited) since Mon 2019-09-16 18:52:37 CEST; 3s
    ago
    Process: 3455 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
    Process: 3511 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
    Main PID: 3511 (code=exited, status=0/SUCCESS)

    Sep 16 18:52:37 pc systemd[1]: Starting PostgreSQL RDBMS...
    Sep 16 18:52:37 pc systemd[1]: Started PostgreSQL RDBMS.
    (base) marco@pc:~$ sudo su -l postgres
    postgres@pc:~$ psql
    psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1))
    Type "help" for help.

    postgres=# help
    You are using psql, the command-line interface to PostgreSQL.
    Type: copyright for distribution terms
    h for help with SQL commands
    ? for help with psql commands
    g or terminate with semicolon to execute query
    q to quit
    postgres=#


    So, my question is : how to correctly set ssl in /etc/postgresql/11/main/pg_hba.conf ?



    SOLVED: adding the IP addresses range in pg_hba.conf:



    hostssl all all 192.168.1.0/24 cert









    share|improve this question





























      0













      0









      0








      In my Ubuntu 18.04.02 Server Edition with postgreSQL-11 I want to add the possibility of SSL communication between the postgreSQL server and a client.



      I turned the ssl on in postgresql.conf :



      sudo nano /etc/postgresql/11/main/postgresql.conf



      ssl = on


      and in pg_hba.conf I added a line for ssl :



      sudo nano /etc/postgresql/11/main/pg_hba.conf



      local all postgres peer

      # TYPE DATABASE USER ADDRESS
      METHOD

      # "local" is for Unix domain socket connections only
      local all all peer

      # IPv4 local connections:
      host all all 127.0.0.1/32 md5
      # IPv6 local connections:
      host all all ::1/128 md5
      # Allow replication connections from localhost, by a user with the
      # replication privilege.
      local replication all peer
      host replication all 127.0.0.1/32 md5
      host replication all ::1/128 md5

      host all all 192.168.1.1/24 md5

      # Only for SSL connections :
      hostssl all all cert


      But when reloading the new configuration, and restarting postgreSQL :



      (base) marco@pc:~$ sudo /etc/init.d/postgresql reload
      [ ok ] Reloading postgresql configuration (via systemctl):
      postgresql.service.
      (base) marco@pc:~$ sudo service postgresql restart
      (base) marco@pc:~$ sudo service postgresql status
      ● postgresql.service - PostgreSQL RDBMS
      Loaded: loaded (/lib/systemd/system/postgresql.service; enabled;
      vendor preset: enabled)
      Active: active (exited) since Mon 2019-09-16 18:48:13 CEST; 6s
      ago
      Process: 3349 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
      Process: 3399 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
      Main PID: 3399 (code=exited, status=0/SUCCESS)

      Sep 16 18:48:13 pc systemd[1]: Starting PostgreSQL RDBMS...
      Sep 16 18:48:13 pc systemd[1]: Started PostgreSQL RDBMS.


      I get this error:



      (base) marco@pc:~$ sudo su -l postgres
      postgres@pc:~$ 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"?



      I already tried the suggestions found here: Cannot connect to postgresql on port 5432
      withour any success



      When commenting the hostssl line in pg_hba.conf:



      # Only for SSL connections :
      #hostssl all all cert


      The error disappears:



      (base) marco@pc:~$ sudo /etc/init.d/postgresql reload
      [ ok ] Reloading postgresql configuration (via systemctl):
      postgresql.service.
      (base) marco@pc:~$ sudo service postgresql restart
      (base) marco@pc:~$ sudo service postgresql status
      ● postgresql.service - PostgreSQL RDBMS
      Loaded: loaded (/lib/systemd/system/postgresql.service; enabled;
      vendor preset: enabled)
      Active: active (exited) since Mon 2019-09-16 18:52:37 CEST; 3s
      ago
      Process: 3455 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
      Process: 3511 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
      Main PID: 3511 (code=exited, status=0/SUCCESS)

      Sep 16 18:52:37 pc systemd[1]: Starting PostgreSQL RDBMS...
      Sep 16 18:52:37 pc systemd[1]: Started PostgreSQL RDBMS.
      (base) marco@pc:~$ sudo su -l postgres
      postgres@pc:~$ psql
      psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1))
      Type "help" for help.

      postgres=# help
      You are using psql, the command-line interface to PostgreSQL.
      Type: copyright for distribution terms
      h for help with SQL commands
      ? for help with psql commands
      g or terminate with semicolon to execute query
      q to quit
      postgres=#


      So, my question is : how to correctly set ssl in /etc/postgresql/11/main/pg_hba.conf ?



      SOLVED: adding the IP addresses range in pg_hba.conf:



      hostssl all all 192.168.1.0/24 cert









      share|improve this question
















      In my Ubuntu 18.04.02 Server Edition with postgreSQL-11 I want to add the possibility of SSL communication between the postgreSQL server and a client.



      I turned the ssl on in postgresql.conf :



      sudo nano /etc/postgresql/11/main/postgresql.conf



      ssl = on


      and in pg_hba.conf I added a line for ssl :



      sudo nano /etc/postgresql/11/main/pg_hba.conf



      local all postgres peer

      # TYPE DATABASE USER ADDRESS
      METHOD

      # "local" is for Unix domain socket connections only
      local all all peer

      # IPv4 local connections:
      host all all 127.0.0.1/32 md5
      # IPv6 local connections:
      host all all ::1/128 md5
      # Allow replication connections from localhost, by a user with the
      # replication privilege.
      local replication all peer
      host replication all 127.0.0.1/32 md5
      host replication all ::1/128 md5

      host all all 192.168.1.1/24 md5

      # Only for SSL connections :
      hostssl all all cert


      But when reloading the new configuration, and restarting postgreSQL :



      (base) marco@pc:~$ sudo /etc/init.d/postgresql reload
      [ ok ] Reloading postgresql configuration (via systemctl):
      postgresql.service.
      (base) marco@pc:~$ sudo service postgresql restart
      (base) marco@pc:~$ sudo service postgresql status
      ● postgresql.service - PostgreSQL RDBMS
      Loaded: loaded (/lib/systemd/system/postgresql.service; enabled;
      vendor preset: enabled)
      Active: active (exited) since Mon 2019-09-16 18:48:13 CEST; 6s
      ago
      Process: 3349 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
      Process: 3399 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
      Main PID: 3399 (code=exited, status=0/SUCCESS)

      Sep 16 18:48:13 pc systemd[1]: Starting PostgreSQL RDBMS...
      Sep 16 18:48:13 pc systemd[1]: Started PostgreSQL RDBMS.


      I get this error:



      (base) marco@pc:~$ sudo su -l postgres
      postgres@pc:~$ 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"?



      I already tried the suggestions found here: Cannot connect to postgresql on port 5432
      withour any success



      When commenting the hostssl line in pg_hba.conf:



      # Only for SSL connections :
      #hostssl all all cert


      The error disappears:



      (base) marco@pc:~$ sudo /etc/init.d/postgresql reload
      [ ok ] Reloading postgresql configuration (via systemctl):
      postgresql.service.
      (base) marco@pc:~$ sudo service postgresql restart
      (base) marco@pc:~$ sudo service postgresql status
      ● postgresql.service - PostgreSQL RDBMS
      Loaded: loaded (/lib/systemd/system/postgresql.service; enabled;
      vendor preset: enabled)
      Active: active (exited) since Mon 2019-09-16 18:52:37 CEST; 3s
      ago
      Process: 3455 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
      Process: 3511 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
      Main PID: 3511 (code=exited, status=0/SUCCESS)

      Sep 16 18:52:37 pc systemd[1]: Starting PostgreSQL RDBMS...
      Sep 16 18:52:37 pc systemd[1]: Started PostgreSQL RDBMS.
      (base) marco@pc:~$ sudo su -l postgres
      postgres@pc:~$ psql
      psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1))
      Type "help" for help.

      postgres=# help
      You are using psql, the command-line interface to PostgreSQL.
      Type: copyright for distribution terms
      h for help with SQL commands
      ? for help with psql commands
      g or terminate with semicolon to execute query
      q to quit
      postgres=#


      So, my question is : how to correctly set ssl in /etc/postgresql/11/main/pg_hba.conf ?



      SOLVED: adding the IP addresses range in pg_hba.conf:



      hostssl all all 192.168.1.0/24 cert






      18.04 postgresql ssl






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 16 at 18:58







      user2315094

















      asked Sep 16 at 17:44









      user2315094user2315094

      771 gold badge1 silver badge8 bronze badges




      771 gold badge1 silver badge8 bronze badges























          0






          active

          oldest

          votes













          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );














          draft saved

          draft discarded
















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1174579%2fhow-to-correctly-set-ssl-in-pg-hba-conf-of-postgresql-11%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown


























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1174579%2fhow-to-correctly-set-ssl-in-pg-hba-conf-of-postgresql-11%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown









          Popular posts from this blog

          Tamil (spriik) Luke uk diar | Nawigatjuun

          Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

          Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?