이 글은 다음의 내용을 대충 번역한 것입니다. Rate Limiting with NGINX and NGINX Plus 아주 유용한 것중에 하나지만 종종 잘못 이해하고 잘못 설정하게되는 NGINX 기능이 속도 제한(rate limiting) 이다. 이것은 주어진 특정한 시간동안 HTTP 요청양을 제한할 수 있도록 한다. 하나의 요청은 웹사이트의 홈페이지를 위한 GET 요청이나 로그인 폼에 POST 요청이다. 속도 제한은 보안 목적을 위해서 사용되어 질 수 있는데, 에를들어 부르트 포스 패스워드 추정 공격의 속도를 낮출 수 있다. 이것은 실제 사용자에 대해 들어오는 요청 비율을 일반적인 값으로 제한하고 (로깅을 […]
systemd unit 편집기 바꾸기
systemd 는 이제 리눅스 시스템의 뼈대가 되는 기본운영 방법이 되었다. 기존에는 System V Init 이였지만 RHEL 7, Ubuntu 16.04부터 기본 시스템운영 프로그램이 되었다. systemd 는 ‘ctl’ 로 끝나는 명령어들의 집합으로 제어가 가능하다. systemctl, journalctl, timedatectl, hostnamectl, loginctl 이 대표적이다. systemctl 의 경우에는 systemd unit 파일들에 대한 제어와 설정이 가능하다. systemd unit 파일은 기존의 Systemv V init Script 를 대체하는 것으로 일종의 시스템 데몬 프로그램들이라고 보면 된다. 시스템이 시작될때에 자동으로 시작되게 한다거나 종료하게 한다거나 하는것들을 가능하게 한다. unit 파일은 텍스트 파일이기 […]
Yum 패키지 충돌 발생시 쓸 수 있는 명령어
최근에 CentOS 8 에서 Kubernetes 를 테스트하던 중에 패키지 업데이트가 되지 않는 일이 발생 했다. 아직 Kubernetes 는 CentOS 8 배포판을 정식으로 지원하지 않아 CentOS 7 배포판의 패키지를 사용해야 하는 상황이다. 그런데, yum 명령어로 업데이트를 할려고 보니 오류가 발생 했다. 이럴 경우에 다음과 같은 명령어를 사용해서 의존성을 체크해 볼 수 있다.
|
1 2 3 4 5 6 7 8 9 10 11 12 |
# repoquery --requires --resolve kubelet-1.18 ethtool-2:4.8-10.el7.x86_64 iptables-0:1.4.21-34.el7.x86_64 util-linux-0:2.23.2-63.el7.x86_64 iptables-0:1.4.21-34.el7.i686 util-linux-0:2.23.2-63.el7.i686 conntrack-tools-0:1.4.4-7.el7.x86_64 iproute-0:4.11.0-25.el7_7.2.x86_64 ebtables-0:2.0.10-16.el7.x86_64 glibc-0:2.17-307.el7.1.i686 glibc-0:2.17-307.el7.1.x86_64 socat-0:1.7.3.2-2.el7.x86_64 |
위와같은 명령어를 이용하면 패키지 의존성에 대한 내용을 풀어서 볼 수 있다. 참고: kubeadm and kubelet 1.15 fail to install on centos 7 after patches released today#92242
Generic WebHook Trigger 설정
Jenkins 에서 Github 나 GitLab 와 연동하기 위해서 Generic WebHook Trigger 플러그인을 많이 사용한다. 검색을 해보면 사용법이 아주 많이 나오는데, 특정 브랜치(Branch) 에만 작동되게 하기 위해서 Execute Shell 를 활용하는 사례를 볼 수 있다. 하지만 Generic WebHook Trigger 플러그인 설정에서 그냥 특정 브랜치만 반응하도록 할 수 있다. 제일 먼저 Post content parameters 에서 Variable 에 “ref”, Expression 에는 “$.ref” 를 적어주고 JSONPath 를 선택해 준다. 이것은 Github나 GitLab 가 jenkins 를 호출할때에 JSON 포맷으로 관련 데이터를 넘겨주게 된다. JSON 포맷이기 […]
letsencrypt 인증서 발급/갱신
letencrypt 는 무료로 발급 받을 수 있는 도메인 인증서이다. 도메인 인증서는 서버와 클라이언트간에 HTTP 통신을 암호화하는데 필요한 것이다. 원래는 돈을 주고 구매해야 하지만 letsencrypt 는 무료로 사용할 수 있게 해준다. 대부분의 발급 절차를 서버의 CLI 를 통해서 이루어진다. 따라서 서버가 있어야 하며 터미널 접속이 가능해야 한다. 또, Python 을 필요로 한다. 인증서를 발급 받기위해서 프로그램을 사용하는데 이것이 Python 을 필요로 한다. certbot 설치 certbot 은 letsencrypt 인증서를 발급받기 위한 CLI 명령어 세트다. 다음과 같이 다운로드 할 수 있다.
|
1 2 3 |
]$ git clone https://github.com/letsencrypt/letsencrypt ]$ ls letsencrypt |
복제된 […]
VIM, Yaml 문법 적용
이 문서는 VIM, Yaml 문법 적용에 관한 것이다. YAML 은 각종 설정파일에서 자주 쓰인다. Kubernetes 에서는 manifest 파일로 쓰이고 있는데, VIM 을 이용해 Yaml 을 편집할때에 간단하게 사용할 수 있는 방법을 소개한다. 간단하게 .vimrc 파일에 다음과 같이 입력해주면 된다.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
syntax on set nocompatible set hls set scs set visualbell set ignorecase set showmatch set fileencodings=utf-8 set termencoding=utf-8 set encoding=utf-8 " add yaml stuffs " au! BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml foldmethod=indent au! BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab autoindent |
내용을 보면 금방 이해가 될 것이다.
virsh 를 통해 Ubuntu 20.04 에 console 로 접속하는 방법
KVM 가상화 시스템에서 virsh 를 통해 Ubuntu Guest OS에 Console 로 접속하는 방법은 다양한데 대부분 grub 부팅 옵션을 손보는 것이 였다. 하지만 Ubuntu 20.04 로 넘어오면서 이 방법이 훨씬 간단해 졌다. 먼저 Ubuntu 20.04 Guest 에 접속한 후에 다음과 같이 입력 하면 끝난다.
|
1 2 |
$ sudo systemctl enable serial-getty@ttyS0.service $ sudo systemctl start serial-getty@ttyS0.service |
이렇게 한 후에 KVM 시스템에서 console 접속을 하면 접속이 잘된다.
|
1 2 3 4 5 |
$ virsh console ubuntu20.04 Connected to domain ubuntu20.04 Escape character is ^] systemv login: |
이 방법은 18.04 에서도 가능하다.
VSCode 폰트 변경하기
VSCode 폰트(font) 변경하기에 대해서 알아본다. 환경도 윈도우즈가 아닌 리눅스(Linux) 에서 VSCode 폰트 변경이다. 리눅스 환경에서 폰트변경은 뭐든 쉬운 일이 아니다. 폰트(font) 알기 – fc-list 리눅스에서 폰트는 fc-list 명령어를 통해서 알 수 있다.
|
1 2 3 4 5 6 7 8 |
$ fc-list /usr/share/fonts/truetype/tlwg/TlwgTypo-Bold.ttf: Tlwg Typo:style=Bold /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold /usr/share/fonts/truetype/noto/NotoSansThai-Regular.ttf: Noto Sans Thai:style=Regular /usr/share/fonts/truetype/noto/NotoSansModi-Regular.ttf: Noto Sans Modi:style=Regular /usr/share/fonts/opentype/urw-base35/URWBookman-LightItalic.otf: URW Bookman:style=Light Italic /usr/share/fonts/truetype/fonts-kalapi/Kalapi.ttf: Kalapi:style=Regular /usr/share/fonts/truetype/fonts-gujr-extra/Rekha.ttf: Rekha:style=Medium |
결과를 보면 다음과 같은 정보를 보여준다. 설치된 폰트 파일(전체 경로 포함) 폰트 이름. 스타일. 스타일은 Regular, Bold, Italic 등이다. 옵션없이 실행하자 설치된 모든 폰트들을 보여준다. 이 명령어에는 필터 기능을 제공한다.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$ fc-list : lang=ko /usr/share/fonts/truetype/nanum/NanumSquareRoundB.ttf: 나눔스퀘어라운드,NanumSquareRound,NanumSquareRound Bold,나눔스퀘어라운드 Bold:style=Bold,Regular /usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK SC:style=Bold /usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK TC:style=Bold /usr/share/fonts/opentype/noto/NotoSansCJK-Black.ttc: Noto Sans CJK HK,Noto Sans CJK HK Black:style=Black,Regular /usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK JP:style=Bold /usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK KR:style=Bold /usr/share/fonts/truetype/nanum/NanumSquareRoundR.ttf: 나눔스퀘어라운드,NanumSquareRound,NanumSquareRound Regular,나눔스퀘어라운드 Regular:style=Regular /usr/share/fonts/truetype/nanum/NanumSquareB.ttf: 나눔스퀘어,NanumSquare,NanumSquare Bold,나눔스퀘어 Bold:style=Bold /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK JP:style=Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK HK:style=Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK KR:style=Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Black.ttc: Noto Sans CJK TC,Noto Sans CJK TC Black:style=Black,Regular /usr/share/fonts/opentype/noto/NotoSerifCJK-Medium.ttc: Noto Serif CJK KR,Noto Serif CJK KR Medium:style=Medium,Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Black.ttc: Noto Sans CJK KR,Noto Sans CJK KR Black:style=Black,Regular /usr/share/fonts/truetype/wqy/wqy-microhei.ttc: WenQuanYi Micro Hei,文泉驛微米黑,文泉驿微米黑:style=Regular /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK SC:style=Regular |
‘:’ 를 기준으로 필터를 줄 수 있다. 필터는 ‘:’ 를 기준으로 연달아 적어주면 되는데 위의 예제는 […]
Oracle Linux 8 UEK 커널 설치
Oracle Linux 는 UEK(Unbreakable Enterprise Kernel) 라고 해서 커널을 제공 한다. Oracle 은 이를통해 최신의 커널을 제공하고 자신들만의 퍼포먼스 패치를 더해서 고성능을 낼수 있도록 했다. Oracle Linux 8 에서 UEK 커널을 설치해 보자. Yum Repository 확인 Oracle Linux 8 에는 uek 를 위한 yum repository 가 추가되어 있다. 다음과 같이 확인이 가능하다.
|
1 2 3 4 5 6 |
yum repolist Failed to set locale, defaulting to C.UTF-8 repo id repo name ol8_UEKR6 Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64) ol8_appstream Oracle Linux 8 Application Stream (x86_64) ol8_baseos_latest Oracle Linux 8 BaseOS Latest (x86_64) |
‘ol8_UEKR6’ 가 uek 를 위한 저장소(repository) 이다. 이제 다음과 같이 어떤 버전의 uek 커널이 있는지 다음과 같이 체크해보자.
|
1 2 3 4 5 |
yum list kernel-uek Last metadata expiration check: 0:19:13 ago on Thu Jul 23 19:37:48 2020. Available Packages kernel-uek.x86_64 5.4.17-2011.3.2.1.el8uek ol8_UEKR6 kernel-uek.src 5.4.17-2011.4.4.el8uek ol8_baseos_latest |
현재 시점에서 5.4 버전의 uek 커널이 있음을 알 […]
Grafana admin password reset
Grafana 는 Time series 데이터베이스에 내용을 그래프로 그려주는 유명한 웹 프로그램이다. 아주 유용한 프로그램으로 인기가 높다. 그런데, 이것을 사용하다가 admin 패스워드를 잊어버렸다면 어떻게 해야할까? 공식 메뉴얼에는 다음과 같이 하라고 나와 있다.
|
1 |
]$ grafana-cli admin reset-admin-password admin --config "/etc/grafana" |
하지만 이렇게 해도 되지 않는다. 이럴때는 다음과 같이 하면 된다.
|
1 2 3 4 5 6 |
]# sqlite3 /var/lib/grafana/grafana.db SQLite version 3.7.17 2013-05-20 00:56:22 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> update user set password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6', salt = 'F3FAxVm33R' where login = 'admin'; sqlite> .exit |
위 내용은 admin 계정의 패스워드를 ‘admin’ 으로 초기화 시키는 것이다. Grafana 에 접속해 초기화 패스워드를 입력하면 새로운 패스워드를 지정하라는 프로세스를 타게 된다.