Synology-Forum.nl

Firmware => Synology DSM 5.1 en eerder => Topic gestart door: Piet Puk op 03 november 2014, 17:04:10

Titel: PostgreSQL database account activeren
Bericht door: Piet Puk op 03 november 2014, 17:04:10
Hallo,

Sinds zeer recent ben ik in bezit van een Synology NAS DS209+II. Ik wil deze inzetten specifiek voor 1 applicatie, mAirList genaamd. Ik ben fanatiek gebruiker van de applicatie en een leek op het gebied van NAS, Linux en PostgreSQL. Het is belangrijk dat ik deze database actief krijg om de verdere migratie te kunnen voltooien.

De DS209 dient als filestation en database server te gaan fungeren. Ik zit nu midden in een migratietraject van de lokale PC database naar de database op de NAS. Hiervoor dien ik een tutorial te doorlopen die de ontwikkelaar van de software opgesteld heeft: https://www.mairlist.com/en/blog/using-a-synology-nas-as-postgresql-server-for-mairlistdb/ (https://www.mairlist.com/en/blog/using-a-synology-nas-as-postgresql-server-for-mairlistdb/)

Ik heb stap 1 tot en met 3 kunnen doorlopen (Enable SSH acces, create database en create user). Succesvol, denk ik. Ik loop nu echter vast bij “set up network acces”. Ik dien de file /usr/syno/pgsql/etc/pg_hba.conf te bewerken. Ik heb al van alles geprobeerd, het lukt me – door kennisgebrek – gewoon niet. Ik heb geen idee wat ik aan het doen ben.

Vraag: is er iemand met voldoende kennis van Linux, DSM 4.2 en PostgreSQL die mij hierbij kan assisteren? In ieder geval met tips, maar liever door in te loggen via Teamviewer en de benodigde handelingen uit te voeren.
Titel: Re: PostgreSQL database account activeren
Bericht door: Birdy op 03 november 2014, 17:13:25
Citaat
Ik dien de file /usr/syno/pgsql/etc/pg_hba.conf te bewerken. Ik heb al van alles geprobeerd, het lukt me – door kennisgebrek – gewoon niet. Ik heb geen idee wat ik aan het doen ben.
Dat komt waarschijnlijk omdat je "vi" niet eigen bent.  ;)

Gebruik WinSCP (GUI) en je kunt aanpassen wat je wilt (op eigen risico natuurlijk).

Voor de volledigheid toch even alle stappen:

WinSCP:
1 - Zorg ervoor dat SSH-Service aan staat: Configuratiescherm > Terminal.
2 - Download: http://winscp.net/eng/download.php
3 - Installeer WinSCP
4 - Start WinSCP klik op nieuw
5 - Bestandsprotocol: SCP
6 - Adres doelcomputer: <NAS-IP>
7 - Poortnummer: 22
8 - Gebruikersnaam: root
9 - Opslaan
10 - Inloggen (Password van je admin)

Gewoon, aan de rechterkant browsen naar  /usr/syno/pgsql/etc/ en dubbelklik de file pg_hba.conf.
Deze wordt dan geopend op je PC, die regel toevoegen en saven (wordt weer om admin password gevraagd).

Titel: Re: PostgreSQL database account activeren
Bericht door: Piet Puk op 03 november 2014, 17:32:40
Birdy,

Hartelijk dank voor je heldere respons.

Ik kan vlekkeloos inloggen en de file /usr/syno/pgsql/etc/pg_hba.conf benaderen. Als ik op "bewerken" klik is de file echter leeg, de omvang is ook inderdaad 0 kb  :oops: ?
Titel: Re: PostgreSQL database account activeren
Bericht door: Birdy op 03 november 2014, 21:31:00
IK heb niet zoveel verstand van PostgreSQL maar, als ik kijk op m'n DS411+ii met DSM4.2 dan heb ik een wel data in /usr/syno/pgsql/etc/pg_hba.conf, vraag me alleen niet waardoor die file is ontstaan (standaard ?).

[attachimg=1]

# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the
# PostgreSQL documentation for a complete description
# of this file.  A short synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access.  Records take one of these forms:
#
# local      DATABASE  USER  METHOD  [OPTION]
# host       DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTION]
# hostssl    DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTION]
# hostnossl  DATABASE  USER  CIDR-ADDRESS  METHOD  [OPTION]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type: "local" is a Unix-domain socket,
# "host" is either a plain or SSL-encrypted TCP/IP socket, "hostssl" is an
# SSL-encrypted TCP/IP socket, and "hostnossl" is a plain TCP/IP socket.
#
# DATABASE can be "all", "sameuser", "samerole", a database name, or
# a comma-separated list thereof.
#
# USER can be "all", a user name, a group name prefixed with "+", or
# a comma-separated list thereof.  In both the DATABASE and USER fields
# you can also write a file name prefixed with "@" to include names from
# a separate file.
#
# CIDR-ADDRESS specifies the set of hosts the record matches.
# It is made up of an IP address and a CIDR mask that is an integer
# (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that specifies
# the number of significant bits in the mask.  Alternatively, you can write
# an IP address and netmask in separate columns to specify the set of hosts.
#
# METHOD can be "trust", "reject", "md5", "crypt", "password", "gss", "sspi",
# "krb5", "ident", "pam" or "ldap".  Note that "password" sends passwords
# in clear text; "md5" is preferred since it sends encrypted passwords.
#
# OPTION is the ident map or the name of the PAM service, depending on METHOD.
#
# Database and user names containing spaces, commas, quotes and other special
# characters must be quoted. Quoting one of the keywords "all", "sameuser" or
# "samerole" makes the name lose its special character, and just match a
# database or username with that name.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal.  If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect.  You can use
# "pg_ctl reload" to do that.

# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL listen
# on a non-local interface via the listen_addresses configuration parameter,
# or via the -i or -h command line switches.
#



# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
# IPv6 local connections:
##host    all         all         ::1/128               md5

Titel: Re: PostgreSQL database account activeren
Bericht door: kuba op 03 november 2014, 21:58:27
Kijk eens in /volume1/@database/pgsql
Daar staat een postgresql.conf die gesymlinked is naar /etc/postgresql/postgresql.conf.
In deze .conf file worden pg_hba.conf en pg_ident.conf aangeroepen in /etc/postgresql/
Dus niet de pg_hba.conf gebruiken die in /volume1/@database/pgsql staat.

Waarom makkelijk maken als het ook moeilijk kan? :-)

Nu met vi of een andere editor de acces voor je host regelen.

Veel succes
Titel: Re: PostgreSQL database account activeren
Bericht door: Birdy op 03 november 2014, 22:48:13
Ja....in DSM5 maar niet in DSM4.2, Piet Puk draait n.l. 4.2  ;)
Titel: Re: PostgreSQL database account activeren
Bericht door: kuba op 03 november 2014, 23:17:59
Ja....in DSM5 maar niet in DSM4.2, Piet Puk draait n.l. 4.2  ;)

O sorry, dat is waar ook.
Als je in welke Syno, of welke DSM dan ook wilt weten hoe het zit met de postgres config files, doe dan even een process listing met
# ps | grep postgres

Kijk dan wat er achter de -D staat: dat is de datadirectory waar meestal ook verwijzingen in staan naar de config files.
Titel: Re: PostgreSQL database account activeren
Bericht door: Piet Puk op 11 november 2014, 13:17:46
Alles gelukt! Hartelijk dank voor jullie hulp.
Titel: Re: PostgreSQL database account activeren
Bericht door: cyrus1977 op 11 november 2014, 22:03:39
top ! Ziet er trouwens handig uit dat mAirList !  :twisted: