IT SeedBox: Linux/Gentoo 카테고리 글 목록https://seedbox.ip.or.kr/IT 주제, 특히 리눅스를 다룹니다.2024-03-27T13:25:25+09:00Textcube 1.10.10 : Tempo primoGentoo - Predictable network interface와 udevBlakehttps://seedbox.ip.or.kr/entry/Gentoo-Predictable-network-interface%EC%99%80-udev2016-06-07T16:46:05+09:002016-06-07T16:46:01+09:00<p>udev >= 197 부터는 기본적으로 predictable network interface 가 사용된다.
즉 sit0, eth0 등이 아니라 udev rule에 따라 interface name이 결정되어 인식된다.</p>
<p>확정된 interface는 /etc/conf.d/net 의 dhcp 설정 및 /etc/init.d/network.* script 로 사용할텐데,
만약 메인보드를 다른 모델로 교체했다면 이름이 바뀌어 재부팅 시 network 인식 못하는 경우가 생긴다.</p>
<p>predictable network interface 를 알아보는 커맨드는 다음과 같다.</p>
<p>> # udevadm test=builtin net_id /sys/class/net/ 2> /dev/null</p>
<p>아래 방법으로 아예 predictable network interface 를 사용 중단할 수도 있다.</p>
<ol>
<li>커널 파라미터 "net.ifnames=0" 을 주고, /etc/systemd/network/99-default.link 파일을 생성</li>
<li>또는 위 파일을 /dev/null 로 symlink</li>
</ol>
<p><strong><a href="https://seedbox.ip.or.kr/entry/Gentoo-Predictable-network-interface%EC%99%80-udev?commentInput=true#entry33WriteComment">댓글 쓰기</a></strong></p>Samba로 NFS mount를 share하는 경우 심각한 문제 발생 가능Blakehttps://seedbox.ip.or.kr/entry/data-corruption-when-samba-shares-nfs-mount2015-05-04T20:41:38+09:002015-04-29T16:36:54+09:00Gentoo에 Samba 3.6.25 설치 후 문제가 발견되었다.<br />Samba를 통해 서버의 NFS mount를 share 하는 경우, 디렉토리/파일을 브라우징하는 것은 문제가 없으나, 파일을 read, write 할 때 file corruption이 발생한다.(checksum 맞지 않음) 꽤 심각한 문제다.<br /><br />Samba log 를 들여다 본 결과 아래와 같은 메시지가 발견되었다.<br />
<blockquote>[2015/04/27 12:37:53.782287, 0] smbd/dfree.c:156(sys_disk_free)<br /> WARNING: dfree is broken on this system</blockquote>
Redhat Customer Portal에서 정보를 찾을 수 있었다.<br /><a href="https://access.redhat.com/solutions/1983">Can an NFS mount be shared out via Samba under Red Hat Enterprise Linux?</a><br /><br />이는 NFS 클라이언트가 필수적인 file-locking mechanism 없이 파일을 액세스 하기 때문이다. 따라서 해당 클라언트들은 서버로부터 해당 파일을 캐시한 다른 SMB 클라이언트로의 oplock break 요청을 초기화하지 못한다.<br />그러므로 NFS 파일 접근은 Samba 클라이언트에 의해 캐시된 파일로 write 할 수 있고, 이는 data corruption을 일으킨다.<br />해당 이슈는 2009년 samba.org 메일링 리스트에서 논의 되었다: <a href="https://lists.samba.org/archive/samba/2009-May/148415.html">[Samba] NFS mounted samba share</a><br /><br />근본 해결책은 이러한 방법을 쓰지 않는 것이지만, 필요한 경우 workaround가 존재한다. (Redhat에서는 권고하지 않는다.)<br />
<ul>
<li>/etc/samba/smb.conf 파일에 다음 내용을 추가한다:</li>
</ul>
<blockquote>posix locking = no</blockquote>
<ul>
<li>또는, NFS mount 옵션에 nolock을 추가한다.</li>
</ul><p><strong><a href="https://seedbox.ip.or.kr/entry/data-corruption-when-samba-shares-nfs-mount?commentInput=true#entry22WriteComment">댓글 쓰기</a></strong></p>SLiM 에서 TCP listen 허용하기Blakehttps://seedbox.ip.or.kr/entry/allow-tcp-on-gentoo-slim2015-05-05T09:33:38+09:002015-04-29T09:15:27+09:00보안 상 TCP listen 허용되지 않는 것이 기본값이다.<br /><br />/etc/slim.conf 파일의 xserver_arguments 항목의 -nolisten tcp 를 지워주면 된다.<br /><br /><p><strong><a href="https://seedbox.ip.or.kr/entry/allow-tcp-on-gentoo-slim?commentInput=true#entry21WriteComment">댓글 쓰기</a></strong></p>Gentoo에 Xfce, SLiM, ibus, TigerVNC 종합 설치Blakehttps://seedbox.ip.or.kr/entry/xfce-slim-ibus-tigervnc-on-gentoo2015-04-23T13:57:22+09:002015-04-19T21:30:00+09:00Xfce는 리눅스 시스템에서 사용할 수 있는 아주 가벼운 윈도우 환경이다. 다른 윈도우 매니저보다 리소스 사용률이 적고, 빠르다. Xfce에 적당한 가벼운 디스플레이 매니저로 SLiM(Simple Login Manager)가 있다.<br /><br />우선, 불필요한 패키지 빌드는 제외하기 위해, gnome, kde, qt4 USE flag를 사용하지 않도록 한다.<br />USE="-gnome -kde -qt4 ..."<br /><br />Xfce를 원격으로 제어하기 위해 TigerVNC를 설치하되, Xorg 서버 모듈을 함께 빌드하기 위한 USE 설정한다.<br /># echo "net-misc/tigervnc server xorgmodule" >> /etc/portage/package.use<br /><br />일반 desktop 프로파일을 설정한다.<br /># eselect profile set <number><br />
<div><br />gvfs의 http USE flag의 경우 많은 gnome 의존성 패키지를 빌드하기 때문에 제외한다.</div>
# echo 'gnome-base/gvfs -http' >> /etc/portage/package.use<br /><br />어떤 Xfce 플러그인을 설치할 것인지 /etc/portage/make.conf 에 정의한다.<br />XFCE_PLUGINS="brightness clock trash"<br /><br />비디오카드를 정의한다. <span style="color: #ff0000;">(Intel HD Graphics를 위해 i965 추가)</span><br />VIDEO_CARDS="intel i965"<br /><br />Xfce, SLiM, ibus, tigervnc 설치를 시작한다.<br /># emerge -av xfce4-meta xfce4-notifyd xorg-server xfce4-terminal xfce4-volumed-pulse gtk-engines-xfce slim ibus ibus-hangul<br /># emerge --deselect y xfce4-notifyd<br /><br />필요한 서비스를 시작한다.<br /># rc-update add dbus default<br /># rc-update add consolekit default<br /># /etc/init.d/dbus start<br /># /etc/init.d/consolekit start<br /><br />xdm의 기본 디스플레이 관리자를 SLiM으로 설정한다.<br /># vi /etc/conf.d/xdm<br />...<br />DISPLAYMANAGER="slim"<br /><br /><span style="color: #ff0000;">System default Xsession을 Xfce로 설정한다.</span><br /># vi /etc/env.d/90xsession<br />XSESSION="Xfce"<br /><br />필요 시 SLiM 환경을 사용자 정의한다. (세션 종류, 자동로그인 등)<br /># vi /etc/slim.conf<br /><br />ibus 데몬을 자동 실행하기 위한 환경을 설정한다.<br />(사용자 홈디렉토리에서)<br /># vi .xprofile<br />
<div>export GTK_IM_MODULE=ibus</div>
<div>export XMODIFIERS=@im=ibus</div>
<div>export QT_IM_MODULE=ibus</div>
<div>ibus-daemon -drx<br /><br />로그인 시 한글 locale을 설정하려면 아래 내용을 추가한다.<br /># vi /etc/X11/xinit/xinitrc.d/99-local<br />
<div>export LANG=ko_KR.UTF-8</div>
<div>export LC_ALL=ko_KR.UTF-8<br /><span style="color: #ff0000;"># chmod +x <span style="line-height: 16.7999992370605px;">/etc/X11/xinit/xinitrc.d/99-local</span></span><br /><br />Xorg 서버 환경을 설정한다.<br /># vi /etc/X11/xorg.conf<br />
<div>Section "Device"</div>
<div> Identifier "Device0"</div>
<div> Driver "intel"</div>
<div> VendorName "INTEL Corporation"</div>
<div>EndSection</div>
<div></div>
<div>Section "Extensions"</div>
<div> # fixes tearing</div>
<div> Option "Composite" "Disable"</div>
<div>EndSection</div>
<div></div>
<div>Section "Module"</div>
<div> Load "vnc"</div>
<div>EndSection</div>
<div></div>
<div>Section "Screen"</div>
<div> Identifier "Screen0"</div>
<div> Device "Device0"</div>
<div> Option "SecurityTypes" "VncAuth"</div>
<div> Option "UserPasswdVerifier" "VncAuth"</div>
<div> Option "PasswordFile" "/root/.vnc/passwd"</div>
<div>EndSection</div>
<br />VNC 패스워드를 설정한다.<br /># vncpasswd<br /><br />Xfce 로그인을 테스트한다.<br /># service xdm start<br /><br />문제가 없다면 부트 스크립트로 추가한다.<br /># rc-update add xdm default</div>
</div><p><strong><a href="https://seedbox.ip.or.kr/entry/xfce-slim-ibus-tigervnc-on-gentoo?commentInput=true#entry19WriteComment">댓글 쓰기</a></strong></p>Kodi (구 XBMC) Media Center + vaapi 주의사항Blakehttps://seedbox.ip.or.kr/entry/do-not-use-both-vaapi-and-gles-when-compiling-kodi2015-04-19T09:46:18+09:002015-04-19T09:46:18+09:00Gentoo에 무분별한 ~amd64 flag 사용으로 시스템이 너무 더러워졌다.<br />필요한 기능만 설치할 겸 /etc 만 백업하고 전체 재설치 중이다.<br /><br />몰랐는데, XBMC 이름이 v14 들어서며 Kodi로 바뀐 듯 하다.<br /><br />Kodi 컴파일 시 vaapi를 사용하기 위해서 USE flag "gles" 를 제외해야 한다.<br />4년 전 버그인데 아직도 dependancy check가 ebuild에 반영되지 않는듯...<br /><br />이건 내 실수지만, OpenGL ES는 Embedded system 타겟이기 때문에 보통 필요 없다.<br /><br />참조: http://trac.kodi.tv/ticket/10552<p><strong><a href="https://seedbox.ip.or.kr/entry/do-not-use-both-vaapi-and-gles-when-compiling-kodi?commentInput=true#entry18WriteComment">댓글 쓰기</a></strong></p>해킹을 방지하기 위한 fail2ban 설치Blakehttps://seedbox.ip.or.kr/entry/block-hacking-with-fail2ban2015-04-18T18:42:48+09:002015-04-18T18:42:48+09:00fail2ban은 iptables을 이용하여 지정된 조건에 맞는 접속 시도를 효과적으로 차단한다.<br />가장 많은 해킹 시도는 ssh를 통해 이루어진다.<br />ssh 필터링을 위해 system logger는 /var/log/auth.log 를 생성해야 한다.<br /><br />emerge -av fail2ban<br /><br />(syslog-ng 수정)<br />destination auth { file("/var/log/auth.log"); };<br />filter f_auth { facility(auth); };<br />log { source(src); filter(f_auth); destination(auth); flags(final); };<br /><br />(/etc/fail2ban/jail.d/ssh-iptables.conf)<br />
<div>[ssh-iptables]</div>
<div>enabled = true</div>
<div>filter = sshd</div>
<div>action = iptables[name=SSH, port=ssh, protocol=tcp]</div>
<div>logpath = /var/log/auth.log</div>
<div>maxretry = 5</div>
<br />service fail2ban start<p><strong><a href="https://seedbox.ip.or.kr/entry/block-hacking-with-fail2ban?commentInput=true#entry17WriteComment">댓글 쓰기</a></strong></p>Windows 7, Gentoo Samba 간 연결 이슈Blakehttps://seedbox.ip.or.kr/entry/windows-7-gentoo-samba-error2015-04-18T13:17:47+09:002015-04-16T15:18:30+09:00<div>Gentoo Samba 3.6.25 설정 후 Windows 7에서 연결 시도하면 아래와 같은 메시지가 출력된다.</div>
<div></div>
<div>[2015/04/16 13:55:07.368135, 0] smbd/process.c:525(init_smb_request)</div>
<div> init_smb_request: invalid wct number 255 (size 108)</div>
<div></div>
<div>/etc/samba/smb.conf 파일에 아래 항목을 추가한다.</div>
<div></div>
<div>max protocol = smb2</div><p><strong><a href="https://seedbox.ip.or.kr/entry/windows-7-gentoo-samba-error?commentInput=true#entry16WriteComment">댓글 쓰기</a></strong></p>