본문 바로가기

Programming137

[Spring Cloud] config에서 대칭키 암호화 설정하기 설정 값 암호화/복호화 하기 암호화를 처리하는 두 가지 방식 대칭키 vs 비대칭키 Symmetric Encrption (shared : 대칭키) - 같은 키 Asymmetric Encryption (RSA keypair : 비대칭키) - privater and public key - using java keytool (JDK에 포함) spring cloud config를 이용해 공개키 암호화를 할 수 있다. config server에 encrypt용 yml 파일 생성 encrypt: key: abcdefghijklmnopqrstuvwxyz0123456789 이 키값으로 암호화를 한다는 의미이다. post 요청시 변경된 암호를 리턴 받는 것을 볼 수 있다. decrypt 시에도 작동한다. 이처럼 Sprin.. 2023. 6. 1.
[Spring Cloud] bus, rabbitmq를 이용해 서버 연결하고 actuator를 이용한 갱신 집합화하기 설정 정보를 변경하는 방식으로 Spring cloud bus를 사용한다. Atuator의 refresh 방법은 서버가 늘어나면 하나하나를 전부 해줘야 해서 번거롭다. Spring cloud bus 는 - 분산 시스템의 노드(마이크로 서비스)를 경량 메시지 브로커와 연결한다 - 상태 및 구성에 대한 변경 사항을 연결된 노드에게 전달한다 (broadcast) 다이렉트로 메시지를 전달하는 것이 아니라 중간에 middleware를 두고 전달하는 방식이다. AMQP (Advanced Message Queing Protocol) 을 이용해서 변경점을 알려준다. => push update AMQP : 메시지 지향 미들웨어를 위한 개방형 표준 응용 계층 프로토콜 - 메시지 지향, 큐잉 라우팅, 신뢰성, 보안 - Erl.. 2023. 6. 1.
Mac brew Rabbitmq 설치 후 실행 문제 brew 로 설치하고 rabbitmq-server 실행 명령시 다음과 같은 에러가 발생했다. 2023-06-01 18:55:42.589155+09:00 [warning] Failed to create PID file "/opt/homebrew/var/lib/rabbitmq/mnesia/rabbit@localhost.pid" directory: no such file or directory 2023-06-01 18:55:42.714424+09:00 [error] Failed to create feature flags file "/opt/homebrew/var/lib/rabbitmq/mnesia/rabbit@localhost-feature_flags" directory: no such file or dire.. 2023. 6. 1.
[Spring Cloud] Config yml 설정, actuator를 이용한 자동 반영 Spring Cloud Config - 분산 시스템에서 서버, 클라이언트 구성에 필요한 설정정보 (application.yml)를 외부 시스템에서 관리 - 하나의 중앙화된 저장소에서 구성 요소 관리 가능 - 각 서비스를 다시 빌드하지 않고 바로 적용 가능 - 애플리케이션 배포 파이프라인을 통해 DEV - UAT - PROD 환경에 맞는 구성 정보 사용 기존에 각 프로젝트마다 존재하던 yml 파일을 외부에서 관리하도록 하여 동적으로 서버 구성 정보를 적용할 수 있도록 한다. - private git repository -> - secure vault ->. Spring cloud config server - secure file storage -> local repository를 만들어 confi yml .. 2023. 6. 1.
[Spring Cloud] JWT 토큰 생성과 API Gateway에서 검증 필터 구현 스프링 부트 프로젝트에서 JWT 토큰을 생성하기 dependencies dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'io.jsonwebtoken:jjwt-api:0.11.2' implementation 'io.jsonwebtoken:jjwt-impl:0.11.2' implementation 'io.jsonwebtoken:jjwt-jackson:0.11.2' // 다른 종속성들... } yml token: expiration_time: 86400000 s.. 2023. 6. 1.