프린트 하기

OS환경 : Oracle Linux 7.6 (64bit)


DB 환경 : PostgreSQL 10


방법 : PostgreSQL 10 유저 Password_encryption 을 sha-256 으로 변경

방법이 3가지가 존재하지만 실제론 방법 1만 적용이 되었음


방법 1. alter system 명령 사용(재기동 불필요)

기존 password_encryption 설정 확인

1
2
3
4
5
6
7
8
9
$ psql
psql (10.10)
Type "help" for help.
 
postgres=show password_encryption;
 password_encryption 
---------------------
 md5
(1 row)



alter system 명령 사용

1
2
postgres=alter system set password_encryption = 'scram-sha-256';
ALTER SYSTEM



pg_reload_conf 함수로 적용

1
2
3
4
5
postgres=select pg_reload_conf();
 pg_reload_conf 
----------------
 t
(1 row)



확인 : 쿼리로도 확인 가능하고 show 명령으로도 확인가능함

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
postgres=
select context,name,setting from pg_settings
where name = 'password_encryption';
 
 context |        name         |    setting    
---------+---------------------+---------------
 user    | password_encryption | scram-sha-256
(1 row)
 
postgres=show password_encryption;
 
 password_encryption 
---------------------
 scram-sha-256
(1 row)



아래 방법2, 방법3은 password_encryption 변경이 되지 않았음

다른 파라미터 변경에 사용하기를 권장함

방법 2. $PGDATA/postgresql.conf 파일 수정 사용(재기동 필요)

기존 password_encryption 설정 확인

1
2
3
4
5
6
7
8
9
$ psql
psql (10.10)
Type "help" for help.
 
postgres=show password_encryption;
 password_encryption 
---------------------
 md5
(1 row)



vi로 $PGDATA/postgresql.conf 파일 열어서 password_encryption 찾기

1
2
3
$ vi $PGDATA/postgresql.conf
기존 : #password_encryption = md5              # md5 or scram-sha-256
변경 : password_encryption = scram-sha-256     # md5 or scram-sha-256

scram-sha-256로 변경



postgresql 재기동

1
2
3
4
5
6
$ $PGHOME/bin/pg_ctl -D $PGDATA -l logfile stop
waiting for server to shut down.... done
server stopped
$ $PGHOME/bin/pg_ctl -D $PGDATA -l logfile start
waiting for server to start.... done
server started



확인 : 쿼리로도 확인 가능하고 show 명령으로도 확인가능함(적용안됨)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
postgres=
select context,name,setting from pg_settings
where name = 'password_encryption';
 
 context |        name         |    setting    
---------+---------------------+---------------
 user    | password_encryption | md5
(1 row)
 
postgres=show password_encryption;
 
 password_encryption 
---------------------
 md5
(1 row)



아래 방법2, 방법3은 password_encryption 변경이 되지 않았음

다른 파라미터 변경에 사용하기를 권장함

방법 3. $PGDATA/postgresql.conf 파일 수정 사용(재기동 불필요)

기존 password_encryption 설정 확인

1
2
3
4
5
6
7
8
9
$ psql
psql (10.10)
Type "help" for help.
 
postgres=show password_encryption;
 password_encryption 
---------------------
 md5
(1 row)



vi로 $PGDATA/postgresql.conf 파일 열어서 password_encryption 찾기

1
2
3
$ vi $PGDATA/postgresql.conf
기존 : #password_encryption = md5              # md5 or scram-sha-256
변경 : password_encryption = scram-sha-256     # md5 or scram-sha-256

scram-sha-256로 변경



pg_reload_conf 함수로 적용

1
2
3
4
5
postgres=select pg_reload_conf();
 pg_reload_conf 
----------------
 t
(1 row)


확인 : 쿼리로도 확인 가능하고 show 명령으로도 확인가능함(적용안됨)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
postgres=
select context,name,setting from pg_settings
where name = 'password_encryption';
 
 context |        name         |    setting    
---------+---------------------+---------------
 user    | password_encryption | md5
(1 row)
 
postgres=show password_encryption;
 
 password_encryption 
---------------------
 md5
(1 row)















참조 : 

https://corekms.tistory.com/entry/94-betaALTER-SYSTEM-%EA%B5%AC%EB%AC%B8%EC%9D%84-%EC%9D%B4%EC%9A%A9%ED%95%9C-%ED%8C%8C%EB%9D%BC%EB%A9%94%ED%84%B0-%EB%B3%80%EA%B2%BD