<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forum PostgreSQL - konfiguracja pg_hba.conf linux]]></title>
	<link rel="self" href="http://forum.postgresql.org.pl/extern.php?action=feed&amp;tid=1952&amp;type=atom"/>
	<updated>2016-12-02T10:04:42Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.postgresql.org.pl/viewtopic.php?id=1952</id>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=17885#p17885"/>
			<content type="html"><![CDATA[No to chyba pozostaje się pogodzić z takim dziwnym zachowaniem md5 w pg_hba.conf

Odnośnie md5 znalazłem podobny wątek, ale rozwiązania nie znalazłem.

[url]https://www.postgresql.org/message-id/496F4627.9040408%40netzmeister-st-pauli.de[/url]



Dzięki
Pozdrawiam]]></content>
			<author>
				<name><![CDATA[adamleon]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=873</uri>
			</author>
			<updated>2016-12-02T10:04:42Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=17885#p17885</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=17884#p17884"/>
			<content type="html"><![CDATA[Wszystko jest skonfigurowane OK masz nawet dodane certyfikaty SSL.

Jedyne co mi przychodzi do głowy to to, że Wireshark ma jakieś opcje które śledząc protokół PG-Client od razu dekoduje ciągi MD5]]></content>
			<author>
				<name><![CDATA[c_michal]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=627</uri>
			</author>
			<updated>2016-12-02T09:50:32Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=17884#p17884</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=17883#p17883"/>
			<content type="html"><![CDATA[Logi mam w 
/var/log/postgresql  - Ostatnie wpisy z 10 listopada.
/var/lib/postgresql/9.3/main/pg_log
Nie wiem dlaczego w dwóch miejscach i co konkretnie logują te pliki. Nic ciekawego nie znalazłem w logach, ale logami się nigdy nie zajmowałem może coś przeoczyłem. Może wykonać jakieś działania i wrzucić plik z logami?

Poniżej fragment pliku postgresql.conf, może coś zmienić?

# - Security and Authentication -

#authentication_timeout = 1min		# 1s-600s
ssl = true				# (change requires restart)
#ssl_ciphers = 'DEFAULT:!LOW:!EXP:!MD5:@STRENGTH'	# allowed SSL ciphers
					# (change requires restart)
#ssl_renegotiation_limit = 0		# amount of data between renegotiations
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem'		# (change requires restart)
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key'		# (change requires restart)
#ssl_ca_file = ''			# (change requires restart)
#ssl_crl_file = ''			# (change requires restart)
password_encryption = on
#db_user_namespace = off

#------------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------

# - Where to Log -

log_destination = 'stderr'		# Valid values are combinations of
					# stderr, csvlog, syslog, and eventlog,
					# depending on platform.  csvlog
					# requires logging_collector to be on.

# This is used when logging to stderr:
logging_collector = on		# Enable capturing of stderr and csvlog
					# into log files. Required to be on for
					# csvlogs.
					# (change requires restart)

# These are only used if logging_collector is on:
log_directory = 'pg_log'		# directory where log files are written,
					# can be absolute or relative to PGDATA
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'	# log file name pattern,
					# can include strftime() escapes
#log_file_mode = 0600			# creation mode for log files,
					# begin with 0 to use octal notation
#zmieniam to ponizej na on
log_truncate_on_rotation = on		# If on, an existing log file with the
					# same name as the new log file will be
					# truncated rather than appended to.
					# But such truncation only occurs on
					# time-driven rotation, not on restarts
					# or size-driven rotation.  Default is
					# off, meaning append to existing files
					# in all cases.
#log_rotation_age = 1d			# Automatic rotation of logfiles will
					# happen after that time.  0 disables.
log_rotation_size = 10MB		# Automatic rotation of logfiles will
					# happen after that much log output.
					# 0 disables.

# These are relevant when logging to syslog:
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres'

# This is only relevant when logging to eventlog (win32):
#event_source = 'PostgreSQL'

# - When to Log -

client_min_messages = notice		# values in order of decreasing detail:
					#   debug5
					#   debug4
					#   debug3
					#   debug2
					#   debug1
					#   log
					#   notice
					#   warning
					#   error

log_min_messages = warning		# values in order of decreasing detail:
					#   debug5
					#   debug4
					#   debug3
					#   debug2
					#   debug1
					#   info
					#   notice
					#   warning
					#   error
					#   log
					#   fatal
					#   panic

log_min_error_statement = error	# values in order of decreasing detail:
					#   debug5
					#   debug4
					#   debug3
					#   debug2
					#   debug1
					#   info
					#   notice
					#   warning
					#   error
					#   log
					#   fatal
					#   panic (effectively off)

#zmieniam to ponizej na 0
log_min_duration_statement = 0		# -1 is disabled, 0 logs all statements
					# and their durations, > 0 logs only
					# statements running at least this number
					# of milliseconds


# - What to Log -

#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
#debug_pretty_print = on
#log_checkpoints = off
#log_connections = off
#log_disconnections = off
#log_duration = off
#log_error_verbosity = default		# terse, default, or verbose messages
#log_hostname = off
log_line_prefix = '%t '			# special values:
					#   %a = application name
					#   %u = user name
					#   %d = database name
					#   %r = remote host and port
					#   %h = remote host
					#   %p = process ID
					#   %t = timestamp without milliseconds
					#   %m = timestamp with milliseconds
					#   %i = command tag
					#   %e = SQL state
					#   %c = session ID
					#   %l = session line number
					#   %s = session start timestamp
					#   %v = virtual transaction ID
					#   %x = transaction ID (0 if none)
					#   %q = stop here in non-session
					#        processes
					#   %% = '%'
					# e.g. '<%u%%%d> '
#log_lock_waits = off			# log lock waits >= deadlock_timeout
#log_statement = 'none'			# none, ddl, mod, all
#log_temp_files = -1			# log temporary files equal or larger
					# than the specified size in kilobytes;
					# -1 disables, 0 logs all temp files
log_timezone = 'Poland']]></content>
			<author>
				<name><![CDATA[adamleon]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=873</uri>
			</author>
			<updated>2016-12-02T07:24:12Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=17883#p17883</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=17882#p17882"/>
			<content type="html"><![CDATA[restartuje zawsze serwer po zmianach, to jest taka testowa maszyna do "zabawy"
/etc/init.d/postgresql stop
/etc/init.d/postgresql start]]></content>
			<author>
				<name><![CDATA[adamleon]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=873</uri>
			</author>
			<updated>2016-12-01T16:10:31Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=17882#p17882</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=17881#p17881"/>
			<content type="html"><![CDATA[tutaj wszystko jest OK, a może tylko nie zrestartowałeś serwera po tym jak dokonałeś zmian w pliku pg_hba.conf

Zrestartuj serwer - i zerknij na logi czy nie ma tam jakiegoś wpisu świadczącego, że coś się z tych ustawień nie załadowało]]></content>
			<author>
				<name><![CDATA[c_michal]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=627</uri>
			</author>
			<updated>2016-12-01T14:22:40Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=17881#p17881</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=17880#p17880"/>
			<content type="html"><![CDATA[Wszytko wcześniej w pliku to opis wyremowany
łączę się z 192.168.71.157
serwer jest na 192.168.71.133

# Database administrative login by Unix domain socket
local   all             postgres                                peer
local	all		zabbix					peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
#local   all             all                                     password
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
##host    all             all             ::1/128                 md5
host	all		all		192.168.71.0/24		md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            md5
#host    replication     postgres        ::1/128                 md5]]></content>
			<author>
				<name><![CDATA[adamleon]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=873</uri>
			</author>
			<updated>2016-12-01T13:44:06Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=17880#p17880</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=17879#p17879"/>
			<content type="html"><![CDATA[podeślij swój plik pg_hba.conf]]></content>
			<author>
				<name><![CDATA[c_michal]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=627</uri>
			</author>
			<updated>2016-12-01T13:16:53Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=17879#p17879</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=17878#p17878"/>
			<content type="html"><![CDATA[Witam
Podejrzałem połączenie na kliencie windows (Wireshark). ODBC  w opcjach (w ustawieniach połączenia w panelu sterowania) ma zablokowane SSL (SSLMode disable).

Połączenie nawiązałem z:
1 - bezposrednio z konfiguracji połączenia ODBC - hasło i użytkownik idą zwykłym tekstem w protokole PGSQL
2 - połącznie z MSACCESS - ADODB.Connection - hasło i użytkownik idą zwykłym tekstem w protokole PGSQL
3 - PGADMIN i EMS SQL MANAGER - połączenia są szyfrowane w protokole TLSv1.2 

Na serwerze żadnego protokołu TLSv1.2   nie instalowałem, musi być gdzieś w standardzie.

Nadal nie wiem dlaczego opcja md5 w pg_hba.conf przyjmuje zwykły tekst.

Ustawiłem tryb SSLMode na require w ustawieniach ODBC i teraz ruch jest szyfrowany.

Chciałem wrzuciuć szyfrowanie do kodu VBA tak, aby ustawienie w ODBC nie miało znaczenia. Ale niestety nie działa to.
Dodanie do kodu opcji SslMode=Require lub Trusted_Connection=yes nie szyfruje połączenia. Wręcz przeciwnie jeżeli w kodzie są takie zapisy to szyfrowanie nie działa nawet jeżeli w konfiguracji ODBC jest ustawiony tryb SSLMode na require.
Pozostaje na tę chwilę tylko opcja SSL w ustwieniach ODBC. Zawsze coś, ale wolałbym w kodzie, wtedy mam pewność, że nikt tego nie zmieni.

Z protokołem SSL w ADDODB.Connection muszę pokombinować.

Pozdrawiam]]></content>
			<author>
				<name><![CDATA[adamleon]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=873</uri>
			</author>
			<updated>2016-12-01T09:10:29Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=17878#p17878</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=17877#p17877"/>
			<content type="html"><![CDATA[Ad "ale dlaczego md5 przyjmuje hasło zwykłem tekstem?"
Tym nie musisz się martwić na stacji roboczej hasło jest oczywiście przyjmowane jako zwykły tekst ale sterownik ODBC je szyfruje i w takiej formie dalej przesyła. Możesz to sprawdzić jeśli użyjesz tracer do śledzenia połączenia sieciowego

Co do SSL to musisz najpierw wygenerować na serwerze certyfikat i go skonfigurować ale ja tego nigdy nie robiłem.
W accesie wykorzystujesz w metodzie open z ADDODB.Connection ciagu opisanego na stronie [url]https://www.connectionstrings.com/postgresql/[/url] patrz punkt SSL]]></content>
			<author>
				<name><![CDATA[c_michal]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=627</uri>
			</author>
			<updated>2016-11-30T20:29:39Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=17877#p17877</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=17876#p17876"/>
			<content type="html"><![CDATA[Ok, ale dlaczego md5 przyjmuje hasło zwykłem tekstem?

Tak password_encryption = on odpowiada za formę przechowywanych haseł w bazie. Sprawdziłem to wyłączając tę opcję i zmieniłem użytkownikowi hasło, do tabeli trafiło hasło jako zwykły tekst nie szyfrowany md5xxx..

Korzystam z interfejsu w MsAccess, wszystkie operacje wykonuje kodem bez żadnych tabel połączonych itp, ale nie wiem jak połączyć MsAccess z Postgresql po ssl.]]></content>
			<author>
				<name><![CDATA[adamleon]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=873</uri>
			</author>
			<updated>2016-11-30T12:21:19Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=17876#p17876</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=17875#p17875"/>
			<content type="html"><![CDATA[metoda:
- MD5 oznacza, że hasło jest przesyłane przez siec w formie zakodowanej
- password oznacza że hasło przesyłane jest przez sieć bez jakiegokolwiek szyfrowania (otwartym tekstem)
Metoda password nie jest zalecana ale może być wykorzystana jak będziesz miał skonfigurowany SSL i nie będziesz dopuszczał innego rodzaju połączeń.

O ile dobrze pamiętam to opcja "password_encryption = on" odpowiada za to w jakiej formie mają być przechowywane hasła w bazie

PS pamiętaj, że metoda MD5 jest już mocno przestarzała i takie hasła można spokojnie złamać lepiej stosować SSL]]></content>
			<author>
				<name><![CDATA[c_michal]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=627</uri>
			</author>
			<updated>2016-11-30T11:07:25Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=17875#p17875</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=17874#p17874"/>
			<content type="html"><![CDATA[Witam
Żeby nie tworzyć nowego wątku napiszę tutaj
Mam serwer 9.3 na Debianie w pg_hba.conf mam ustawioną metode autoryzacji na password, ale zauważyłem, że czy podam password czy md5 to nadal bez problemu loguję się do bazy. Zakładam, że loguję się zwykłym tekstem z np PgAdmina lub ODBC z windows. W postgresql.conf mam opcje password_encryption = on. Podejrzałem hasła w pg_catalog.pg_shadow hasła są zaszyfrowane md5xxx. Jak można to rozumieć, myślałem, że opcja md5 w pg_hba.conf nie przyjmuje "zwykłego" hasła.

Pozdrawiam
AdamP.]]></content>
			<author>
				<name><![CDATA[adamleon]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=873</uri>
			</author>
			<updated>2016-11-30T06:25:09Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=17874#p17874</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=5042#p5042"/>
			<content type="html"><![CDATA[a co stoi na przeszkodzie dodać
[code] host          all          all      10.0.0.0/24    MD5 [/code]
lub
[code]host          all          all      10.0.0.0/16    MD5[/code]
W zależności ile oktetów używasz w sieci

raz widziałem takie cudo
[code] host          all          all      0.0.0.0/24    MD5 [/code]

Nigdy bym się nie dowarzył na taki krok, ale podobno działa.]]></content>
			<author>
				<name><![CDATA[magicmen]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1143</uri>
			</author>
			<updated>2014-04-18T07:57:57Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=5042#p5042</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=5025#p5025"/>
			<content type="html"><![CDATA[To miałoby sens jeśli w sieci działałby DHCP sztywny.]]></content>
			<author>
				<name><![CDATA[goransol]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1796</uri>
			</author>
			<updated>2014-04-03T06:51:08Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=5025#p5025</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: konfiguracja pg_hba.conf linux]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=5022#p5022"/>
			<content type="html"><![CDATA[a może możesz dodać całą podgrupę np
host          all          +grupa        10.0.0.1/24    password]]></content>
			<author>
				<name><![CDATA[c_michal]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=627</uri>
			</author>
			<updated>2014-04-02T13:30:26Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=5022#p5022</id>
		</entry>
</feed>
