728x90
11. 보안과 권한 관리
01 보안
- 물리적 환경에 대한 보안
- 자연재해 등으로부터 보호
- 권한 관리를 통한 보안
- 접근이 허락된 사용자만 부여된 권한 내에서 데이터베이스 사용
- 운영 관리를 통한 보안
- 데이터 무결성을 유지하기 위한 올바른 제약 조건 정의
- 사용자들이 제약조건을 위반하지 않도록 통제
02 권한 관리
1. 권한 관리의 개념
접근 제어 기능: 데이터베이스 관리 시스템에 계정이 발급된 사용자가 로그인이 성공했을 경우에만 데이터베이스에 접근이 가능
보안을 위한 데이터 단위: 데이터베이스 전체 ~ 특정 테이블의 특정 행과 열에 있는 특정 데이터 값
2. 권한의 부여
객체 권한
해당 객체의 소유자가 부여
GRANT
:객체의 소유자가 다른 사용자에게 객체에 대한 사용 권한을 부여
GRANT 권한 ON 객체 TO 사용자 [WITH GRANT OPTION];
부여할 수 있는 권한: INSERT, DELETE, UPDATE, SELECT, REFERENCES
- REFERENCES: 권한 부여 대상인 테이블의 기본키를 참조하는 외래키를 포함할 수 있다
모든 사용자에게 권한을 똑같이 부여: TO PUBLIC 키워드 사용
GRANT UPDATE(등급, 적립금) ON 고객 TO Park;
# Park에게 등급, 적립금 속성의 데이터를 수정할 수 있는 권한 부여
WITH GRANT OPTION
: 부여받은 검색 권한을 GRANT 문을 통해 다른 사용자에게 부여 가능
시스템 권한
데이터베이스 관리자가 부여
데이터베이스 관리와 관련된 작업에 대한 권한
- DDL(데이터 정의어) 관련 작업
GRANT CREATE TABLE TO Song;
3. 권한의 취소
다른 사용자에게 권한을 부여한 사용자가 자신이 부여한 권한을 취소할 수 있음
REVOKE 권한 ON 객체 FROM 사용자 CASCADE | RESTRICT;
- CASCADE 옵션: a가 b에게 권한 취소, b가 c에게 권한을 부여했을때 c에게 부여한 권한도 취소
- RESTRICT 옵션: c에게 부여한 권한은 취소x
4. 역할의 부여와 취소
여러 사용자에게 동일한 권한을 부여하거나 취소할 때 번거로움
→ 역할: 여러 사용자에게 동일한 권한들을 부여하고 취소하는 번거로운 작업을 편리하게 수행할 수 있도록 도와줌
역할: 여러 권한을 그룹으로 묶어놓은 것
CREATE ROLE 롤이름;
GRANT 권한 ON 객체 TO 롤이름;
GRANT 롤이름 TO 사용자
GRANT문 하나만으로도 여러 권한을 한 번에 부여할 수 있음
새로운 권한을 추가하고 싶으면 GRANT문을 통해 롤이름에 새로운 권한을 추가 → 해당 롤을 부여받은 사용자에게 자동으로 부여됨
역할 취소
REVOKE 롤이름 FROM 사용자;
역할 제거
DROP ROLE 롤이름;
728x90
'CS > DataBase' 카테고리의 다른 글
[데이터베이스 개론] 13. 데이터 과학과 빅데이터 (0) | 2022.12.11 |
---|---|
[데이터베이스 개론] 12. 데이터베이스 응용 기술 (0) | 2022.12.11 |
[데이터베이스 개론] 10. 회복과 병행제어 (0) | 2022.12.02 |
[데이터베이스 개론] 9. 정규화 (0) | 2022.12.01 |
[데이터베이스 개론] 6. 관계 데이터 연산 (0) | 2022.10.02 |