2017년 10월 24일 화요일

[mysql]웹서버 보안관련 mysql 계정 권한 설정.

웹서버에서 injection 공격에 의해서 의도치 않는 데이터 위변조를 막기위해서

서버측 에서 접속하는 mysql 계정에 select 권한만 주고 데이터 변경 로직은 프로시저로

처리 하기 위한 권한 설정.

use mysql;

-- 계정 확인
select host,user from user;

1.
-- 이미 존재할 경우만 계정 삭제
DROP USER 'client'@'%'; -- client 라는 계정 생성 하고 myschema 스키마 에 모든 테이블에 모든 원격접속을 허용하고 패스워드를 설정.
grant usage on myschema.* to 'client'@'%' identified by 'password'

-- myschema 스키마에 모든 테이블에 모든 권한 부여
grant all privileges on myschema.* to 'client'@'%' identified by 'password' with grant option;

-- myschema 스키마에 모든 테이블에 추가,삭제,변경 권한 삭제.
revoke DELETE,UPDATE,INSERT on myschema.* from 'client'@'%';

-- 적용
flush privileges;


-- 기타
-- 특정 권한주기
grant select on myschema.* to 'client'@'%' identified by 'password';

-- 프로 시저 실행 권한 주기.
grant execute on procedure myschema.* to 'client'@'%' identified by 'password'; -- 프로시저 실행 권한 추가.

댓글 없음:

댓글 쓰기

[lunux]리눅스 폴더별 용량 확인

리눅스 폴더별 용량 확인 조회 하고자 하는 디렉토리 리스트가있는 경로로 이동후 du -h --max-depth=1