데스크탑 PC 의 microcode update

kernel-5.4.13 빌드를 한뒤 부팅하고 dmesg 와 sysfs 를 확인해보니 역시나 새로운 intel cpu 취약점을 알려주고 있었다. # dmesg | grep -i micro [ 0.172428] TAA: Vulnerable: Clear CPU buffers attempted, no microcode [ 0.172429] MDS: Vulnerable: Clear CPU buffers attempted, no microcode [ 6.553483] microcode: sig=0x506e3, pf=0x2, revision=0xc6 [ 6.553702] microcode: Microcode Update Driver: v2.2. # grep . /sys/devices/system/cpu/vulnerabilities/* /sys/devices/system/cpu/vulnerabilities/itlb_multihit:KVM: Mitigation: Split huge pages /sys/devices/system/cpu/vulnerabilities/l1tf:Mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable /sys/devices/system/cpu/vulnerabilities/mds:Vulnerable: Clear CPU buffers attempted, no microcode; SMT vulnerable /sys/devices/system/cpu/vulnerabilities/meltdown:Mitigation: PTI /sys/devices/system/cpu/vulnerabilities/spec_store_bypass:Mitigation: Speculative Store Bypass disabled via prctl and seccomp /sys/devices/system/cpu/vulnerabilities/spectre_v1:Mitigation: usercopy/swapgs barriers and __user pointer sanitization /sys/devices/system/cpu/vulnerabilities/spectre_v2:Mitigation: Full generic retpoline, IBPB: conditional, IBRS_FW, STIBP: conditional, RSB filling /sys/devices/system/cpu/vulnerabilities/tsx_async_abort:Vulnerable: Clear CPU buffers attempted, no microcode; SMT vulnerable microcode 를 업데이트 하면 일부는 완화될것으로 생각이 되어 업데이트를 시도!...

January 23, 2020 · foobargem

Windows 에서 ssh remote command 결과를 file 로 저장하기

오늘 회사에서 Linux 서버에 있는 어떤 file 의 내용을 Windows 의 notepad 에 복사를 하고 싶은데 좋은 방법이 있냐는 문의를 받았다. 당장 떠오른 방법은 Linux 서버에서 netcat 으로 해당 file 을 전송하게 하고 클라이언트 환경에서 netcat 이나 telnet 으로 내용을 받도록 하는 것이었다. 그러나 windows 환경에서는 제약적인듯 하여 검색을 해보니 putty 의 plink 를 사용해서 SSH remote command 실행을 하고 그 결과를 powershell 의 Out-File 함수에 stdin 으로 재전송하면 깔끔하게 file 로 결과를 얻을수 있었다....

January 22, 2020 · foobargem

RHEL kernel 의 CPU model 검사

회사에서 RHEL7 을 사용하는 일부 시스템이 있다. 오늘 openvswitch 관련하여 kernel crash 가 일어나 재부팅이 발생을 했다. 관련해서 시스템을 진단하다가 생소한 메시지를 발견했고 RedHat 은 linux kernel 에 CPU model 검사를 한다는 것을 확인하게 되었다. dmesg 의 일부 내용은 다음과 같다. [ 0.000000] Warning: Intel CPU model - this hardware has not undergone testing by Red Hat and might not be certified. Please consult https://hardware.redhat.com for certified hardware. 메시지만 보아도 RedHat 이 커널에 무슨짓을 했을것 같은 느낌이다....

October 17, 2019 · foobargem

nfs 를 사용한 cinder-volume 구성시 secure 설정

퇴근을 10여분 앞둔 금요일 오후.. 갑자기 모니터링 시스템으로 부터 알람이 쏟아지기 시작했다. 진단을 해보니 VM 에 Disk IO 가 정지되어 read-only 상태로 mount 된것을 확인했다. 관련된 log 를 확인하던중 qemu log 에서 permission denied (13) 오류가 발생한 것을 확인했다. block I/O error in device 'drive-virtio-disk0': Permission denied (13) block I/O error in device 'drive-virtio-disk0': Permission denied (13) block I/O error in device 'drive-virtio-disk0': Permission denied (13) block I/O error in device 'drive-virtio-disk0': Permission denied (13) cinder 의 backend 가 mount 된 directory 와 disk files 의 상태를 조회해보니 일부 disk files 의 소유권이 모두 nova:nova 로 변경 되어 있었다....

October 8, 2019 · foobargem

Anaconda 디버깅 - anaconda 가 거짓말을 했어

회사에서 PM 은 PXE 로 anaconda 를 구동하여 kickstart 기반으로 OS(CentOS7) 설치를 하고 있다. kickstart 의 pre script, post script 의 조합으로 OS 구성을 하게 되는데, 잘 동작하면 괜찮지만 script 실행중에 실패가 발생하면 디버깅을 하기가 매우 어렵게 되어있다. 오늘도 동료가 진행하는 서버 구성중 OS 설치가 지속적으로 실패를 했고 디버깅을 하는 과정에서 anaconda(CentOS installer) 의 황당한 버그(?)를 발견하여 간략히 정리를 해둔다. kickstart 의 post script 선언부에서 logging 설정을 넣으면 post script 실행 과정에 대한 log 를 남기게 된다....

September 20, 2019 · foobargem

Intel x86 CPU 취약점에 대한 Linux kernel 의 기능들

몇년 전부터 x86 CPU 의 취약점들이 - Meltdown and Spectre 등 - 지속적으로 발견 및 보고되고 있다. 최근 MaaS - Metal as a Service 를 검토하던중 우연히 /proc/cpuinfo 의 항목중 bugs 라는게 생긴것과 sysfs 에 cpu 에 대한 취약점 디렉토리 /sys/devices/system/cpu/vulnerabilities/ 가 추가 된 것을 알게 되었다. /proc/cpuinfo 의 bugs flag CPU 버그에 대한 workarounds 를 감지 또는 적용했음을 표시해준다. 무려 5년전(2014년 6월)에 commit 된 기능이다. 회사에서는 주로 CentOS7 을 다루다 보니 발견할 수 없었다....

September 13, 2019 · foobargem

Build a kernel module on CentOS

발단 bcache (Linux kernel block layer cache) 를 적용하려고 알아보니 CentOS 7 의 커널은 bcache module 이 disabled 였다. 그래서 kernel source 를 받아서 bcache module 을 build 시도했다. 경험하면 할 수록 CentOS 는 서버환경에서 별로이다. - Debian 추천!! :) Build 환경 구축 required packages 설치 # yum install rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed pesign xmlto \ audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel \ ncurses-devel newt-devel numactl-devel pciutils-devel python-devel zlib-devel kernel source 다운로드 http://vault....

June 11, 2016 · foobargem

RPM packaging

배경 VMware VM 중 1대의 Disk 공간이 부족해서 resize 를 하려고 했는데 parted-3.1 (CentOS 7) 에는 resize command 가 없어졌다. 구글링을 해보니 parted-3.2 에 resizepart 가 추가되었다고 한다. http://savannah.gnu.org/forum/forum.php?forum_id=8042 그래서 소스코드를 직접 빌드하고서 내친김에 rpm packaging 까지 하게 되었다. rpm 패키징 Build directory 생성 $ mkdir rpmbuild $ cd rpmbuild $ mkdir SOURCES SPECS BUILD BUILDROOT RPMS SRPMS $ ls BUILD BUILDROOT RPMS SOURCES SPECS SRPMS Spec file 작성 $ cd SPECS $ vim parted-3....

June 11, 2016 · foobargem

stunnel with ulimit

배경 그림과 같이 L4 에 2대의 Swift proxy server 를 바인딩 한 환경에서 https 서비스를 제공하기 위해 L4 에서 SSL Offloading 설정을 했다. 이슈 L4의 SSL Offloading 성능이 떨어짐. 1Gbps 환경에서 download 시 20MB/s 속도 문제를 해결하기 위해서 swift proxy server 에서 SSL 처리를 시도해 보았다. SSL termination 을 위해서 nginx 와 stunnel 을 시험해 보았다. 시험방법 100 sessions 로 동시 다운로드 시도시 시스템 리소스 사용율 측정(Load avg.) 시험결과 nginx: 5 (1 min) stunnel: 0....

April 13, 2016 · foobargem

Raspberry Pi 에서 온습도 센서(DHT-11)로 온/습도 측정하기

DHT11 온습도 센서 http://eleparts.co.kr/EPXF43N9 manual: http://www.micropik.com/PDF/dht11.pdf Python library: https://github.com/adafruit/Adafruit_Python_DHT 시험환경 Raspberry PI B GPIO layout: 시험 센서연결 pin #1 - 3V pin #6 - Ground pin #16 - GPIO23 (data) 설치 $ sudo python setup.py install 예제코드 수정 및 실행 예제코드: https://github.com/adafruit/Adafruit_Python_DHT/blob/master/examples/simpletest.py #!/usr/bin/python import Adafruit_DHT sensor = Adafruit_DHT.DHT11 # GPIO23 (pin no: #16) pin = 23 humidity, temperature = Adafruit_DHT.read_retry(sensor, pin) if humidity is not None and temperature is not None: print "Temp={0:0....

March 27, 2016 · foobargem