10가지 더 좋은 유닉스 습관
유닉스 명령어 라인을 다루는데 있어, 효율성을 높일 수 있는 10가지 좋은 습관인데, 프로그래밍에서 변수 이름은 어떻게 명명하며, 루프구조에서는 어떤 방식이 유리하며, 가급적 전역변수는 피한다던가 하는 것과 같은 맥락에서 이해하면 되겠다. 그 10가지는 아래에 링크되어 있는데, 1년 반이 지난 지금, 10가지 더 좋은 습관에 대한 Article이 업데이트 되었다. 그 내용은 다음과 같다.
http://www.ibm.com/developerworks/kr/library/au-unixtips/
pushd
와 popd
로 디렉터리를 탐색하자.
curl
명령행 유틸리티를 활용하자.
awk
로 자료를 처리하자.개인적으로 awk를 종종 이용하는데, 대부분 사람들이 어렵다고 생각하여 잘 사용하지 않는다.
awk는 텍스트를 처리하는데 아주 막강하여, 보다 높은 질의 결과물을 얻는데에 이용될 수 있다.
참고자료를 링크한다.
Get started with GAWK: AWK language fundamentals(06.09.19) :
http://www.ibm.com/developerworks/edu/au-dw-au-gawk-i.html
'IBM dW review' 카테고리의 다른 글
자바 코드 벤치마킹에 관련된 여러가지 함정 (2) | 2008.08.01 |
---|---|
Ajax에서 XML 처리하기, Part 3 (0) | 2008.07.30 |
Ajax에서 XML 처리하기, Part 2 (0) | 2008.06.30 |
vi editor 의 모든 것 (0) | 2008.06.30 |
소프트웨어 공학이라는 용어를 묻어버리자 (0) | 2008.06.30 |
don't let me be misunderstood - Santa Esmeralada
놈놈놈, 킬빌, 무한도전("돈 가방을 갖고 튀어라" 편)에 삽입되었던 음악.
애잔한 발라드곡인 'You're My Everything'을 물러 큰 인기를 얻은 산타 에스메랄다라는 그룹이 1978년 리메이크.
2003년 쿠엔틴 타란티노 감독의 '킬 빌 1(Kill Bill: Vol. 1)'에 삽입.
2008년 김지운 감독의 '놈놈놈'에 삽입.
전체적으로 경쾌하고 다이나믹하다.
놈놈놈의 기차 씬에서 이 음악은 정말 절묘하다고 말할 수 밖에 없을 만큼 멋지게 들린다.
처음 부분과 간주 중에 나오는 마치 박수소리와도 비슷한 소리로 만들어 내는 리듬은 그야말로 일품.
'일상다반사' 카테고리의 다른 글
사랑을 놓치다 (1) | 2008.09.17 |
---|---|
영화 '놈놈놈' 감상평 (0) | 2008.08.03 |
직장인 분들, 휴일엔 뭘 하시나요? (3) | 2008.04.10 |
어수선 했던 주말 (0) | 2008.04.07 |
초대장 드립니다.(마감) (62) | 2008.04.04 |
Ajax에서 XML 처리하기, Part 2
(Part 1 링크: http://www.ibm.com/developerworks/kr/library/x-xmlajaxpt1/)
1. DOM 트리 탐색
2. 서버쪽 XSLT
3. 클라이언트쪽 XSLT
4. JSON과 동적 스크립트 태그
Part 2 에서는 2,3번 방법을 살펴본다. 모두 XSLT를 사용한다는 공통점이 있다.
Part 1 : DOM 트리 탐색 방법
Part 2 : 서버쪽 XSLT
Part 2 : 클라이언트쪽 XSLT
3가지 방식은 비슷하나 조금씩 다른 면이 있다.
간단한 예제라면 브라우저에 아무런 부담이 없겠지만 XML 이 커지면 문제는 달라진다.
또한, 사용자가 사용하는 브라우저와 컴퓨터도 고려해야 한다.
어떤 방법을 사용할 것인가는 각기 다른 모델에 대한 충분한 이해와 적용하는 환경에 따라 선택해야 할 것이다.
좀 더 자세한 설명과 튜토리얼은 아래 링크로.
http://www.ibm.com/developerworks/kr/library/x-xmlajaxpt2/
'IBM dW review' 카테고리의 다른 글
Ajax에서 XML 처리하기, Part 3 (0) | 2008.07.30 |
---|---|
10가지 더 좋은 유닉스 습관 (0) | 2008.07.30 |
vi editor 의 모든 것 (0) | 2008.06.30 |
소프트웨어 공학이라는 용어를 묻어버리자 (0) | 2008.06.30 |
Ajax에서 XML 처리하기, Part 1: 네 가지 방법 (0) | 2008.05.30 |
vi editor 의 모든 것
vi editor는 VIsual display editor 를 의미한다. 버클리의 어느 천재가 만들었다고 했던가, vi를 만들던 시절에는 ed와 같은 라인 에디터가 일반적이었다. 도스의 edlin이라는 라인 에디터를 사용 해 본 사람이라면 그것이 얼마나 불편한 것이었는지 잘 알 것이다. 유닉스 처럼 텍스트 에디터와 포매터가 분리된 환경에서는 텍스트 에디터의 비중이 크기 때문에 기능 면에서도 많은 요구가 있게 마련이다. 때문에 텍스트 에디터가 워드 프로세서 기능의 상당 부분을 가지게 되었다. 유닉스에 여러가지 종류가 있듯이 vi도 여러가지 클론이 만들어졌다. 요즘 대부분의 배포판에서는 vim이라는 vi의 클론이 포함되어 있다. vim은 완벽하게 한글을 지원하고 원래의 vi의 기능을 충실하게 갖고 있을 뿐만 아니라 여러가지 좀 더 편리한 툴들을 제공한다.
참조(http://blog.paran.com/comembedded)
실제로 필드에서 유닉스나 리눅스를 다루다 보면, vi의 일부 기능만으로 문서를 다루는 것을 종종 본다. 능력이 좋은 것인지, 그만큼 vi가 강력한 것인지는 모르겠지만, 솔직히 vi는 쓰면 쓸 수록 강력하다는 것을 느끼게 해 준다. 특히, 나 같이 키보드에서 손을 떼고 마우스를 움직여야 하는 일이 무엇보다 귀찮은 사람이라면 더더욱.
vi를 처음으로 접하는 사람은 익숙해질 기회를! 경험이 풍부한 사용자는 생각을 정리할 기회를!
http://www.ibm.com/developerworks/kr/library/tutorial/l-dw-linuxvi-i.html
'IBM dW review' 카테고리의 다른 글
10가지 더 좋은 유닉스 습관 (0) | 2008.07.30 |
---|---|
Ajax에서 XML 처리하기, Part 2 (0) | 2008.06.30 |
소프트웨어 공학이라는 용어를 묻어버리자 (0) | 2008.06.30 |
Ajax에서 XML 처리하기, Part 1: 네 가지 방법 (0) | 2008.05.30 |
유닉스(UNIX) 로그 파일 이해하기 (0) | 2008.05.28 |
소프트웨어 공학이라는 용어를 묻어버리자
소프트웨어 공학이란 과학적인 지식을 컴퓨터 프로그램 설계와 제작에 실제 응용하는 것이며, 이를 개발, 운영하고 유지 보수하는데 필요한 문서화 과정 또는 소프트웨어 위기를 극복하기 위해 제안된 학문으로 소프트웨어 개발, 운용, 유니보수 및 폐기에 대한 체계적인 접근 방법 또는 최소의 경비로 높은 소프트웨어를 생산하기 위한 기법과 도구 등으로 풀이되고 있다.
이제는 학부 과정에서도 소프트웨어 공학이라는 과목을 가르치고 있으며, 기사 자격증 중 가장 많은 응시생을 가지는 정보처리기사의 5과목 중 한 과목이기도 하다. 대학 초/중반에 개발에 필요한 언어를 가르치고, 중/후반에는 소프트웨어 라이프사이클에 대해 논하면서 유지/보수의 중요성을 대두시킨다. 그에 따라 반드시 필요하거나 배워야 할 것은 소프트웨어 공학이며, 대학 3,4학년의 필수과목으로 채택하는 학교도 적지 않다.
애자일 공동체를 위한 전자 잡지인 애자일 저널 11월호에 Daryl Kulak이 쓴 "소프트웨어 공학이라는 용어를 묻어버리자" 라는 기사가 실렸다. Kulak이 독자들에게 전달하고자 했던 메시지는 무엇일까?
http://www.ibm.com/developerworks/kr/library/08/jan08/pollice/
'IBM dW review' 카테고리의 다른 글
Ajax에서 XML 처리하기, Part 2 (0) | 2008.06.30 |
---|---|
vi editor 의 모든 것 (0) | 2008.06.30 |
Ajax에서 XML 처리하기, Part 1: 네 가지 방법 (0) | 2008.05.30 |
유닉스(UNIX) 로그 파일 이해하기 (0) | 2008.05.28 |
시스템 관리 툴킷: UNIX 프로세스 관리 기법 (0) | 2008.05.25 |
Ajax에서 XML 처리하기, Part 1: 네 가지 방법
이제, XML은 선택이 아니라 필수가 되어가고 있다.
Ajax에서 XML데이터를 처리하는 방법은 제각기 다르다. 무식하게 엘리멘트/노드 들을 파싱하는 단순 노가다의 반복부터 DOM, XSLT 등을 이용하는 방법까지.
과연 어떤 방법으로 XML을 다루는 것이 좋을까? 정답은 '없다'다. 모든 것은 상황에 따라 변하니까.
하지만, 최적의 방법을 선택하기 위해서는 많은 방법들을 알고 있어야 하며, 그 방법들의 장/단점에 대해서도 알고 있어야 함은 물론이다.
dW에서 이달 초에 다룬 기사 중에서 이러한 접근을 보다 수월하게 가능케 해 주는 기사가 있어 소개코자 한다.
XML을 처리하는 Ajax 뱃지(위젯)을 간단하게 작성하는 과정을 다루는데, 다음 4가지 방법으로 XML에 접근한다.
링크: http://www.ibm.com/developerworks/kr/library/x-xmlajaxpt1/
1. DOM 트리 탐색
2. 서버쪽 XSLT
3. 클라이언트쪽 XSLT
4. JSON과 동적 스크립트 태그
Part 1에서는 DOM 트리 탐색 방법을 이용하고 있는데, 사실은 2,3,4번 방법이 업데이트 되면 비교해서 리뷰하려 했지만 아직 소식이 없다.(곧 업데이트 될 듯 한데, Part 2에서는 2,3번 방법을 다룬단다.) 접근 방법 1을 위한 데이터 라인을 보면 다음과 같다.
대충 감이 오는지?
세부 내용을 읽고, 기사에서 말하는 장/단점 외에도 추가적인 부분이 있는지 고민해 보는 것도 좋을 듯.
Part 2를 기다려 보자.
링크: http://www.ibm.com/developerworks/kr/library/x-xmlajaxpt1/
'IBM dW review' 카테고리의 다른 글
vi editor 의 모든 것 (0) | 2008.06.30 |
---|---|
소프트웨어 공학이라는 용어를 묻어버리자 (0) | 2008.06.30 |
유닉스(UNIX) 로그 파일 이해하기 (0) | 2008.05.28 |
시스템 관리 툴킷: UNIX 프로세스 관리 기법 (0) | 2008.05.25 |
메모리 프로그래밍을 개선하자 (0) | 2008.04.30 |
유닉스(UNIX) 로그 파일 이해하기
시스템은 언젠가 장애에 직면하게 되며, 그것에 대응하는 방법 중 가장 확실한 방법은 시스템이 남긴 로그 파일을 보는 것이다. 예를 들어, 어느날 시스템이 갑자기 패닉 상태로 떨어졌다고 하자. UNIX의 로그 파일을 살펴보면, 대부분 그 이유와 날짜, 시간이 기록되어 있다. 하지만 NT는 블루스크린이 뜨고, 곧 이어 시스템이 죽어버린다. 물론 덤프를 내리긴 하지만, 이를 분석하는 것이 무척이나 어려우며, 모든 경우에 해당되는 것 또한 아니다.
그 외에도 UNIX는 아주 작은 부분까지도 로그파일에 메시지를 남기는데, 이 로그는 시스템을 운용하는 사람에게 무엇보다 중요하다. 하지만, 로그 파일을 이해하는 것이 그렇게 만만한 것은 아니다.
많은 장애를 대응하다 보면, 무슨 장애의 종류가 그렇게 많은지도 모르겠다. 고객을 만나 장애를 마주하고 앉으면 가장 먼저 로그 파일을 점검하는 것이 우선이다. 그만큼 중요한 것이 로그 파일인데 대부분의 시스템 관리자들은 로그 파일을 올바로 이해하고 있지 않다. 나에게도 로그 파일의 이해를 원하는 많은 UNIX, LINUX 이용자들에게 많은 도움이 될 것 같다. Article의 일부만 발췌하면 다음과 같다.
Listing 5. 시스템 로그 파일 예제(/var/adm/messages)
Feb 3 16:06:58 solaris2 genunix: [ID 936769 kern.info] cmdk2 is
/pci@0,0/pci-ide@1f,1/ide@1/cmdk@0,0
Feb 3 16:06:59 solaris2 asy: [ID 267298 kern.notice] asy0: UART @
3f8 scratch register: expected 0x5a, got 0xff
Feb 3 16:06:59 solaris2 asy: [ID 702181 kern.notice] Cannot identify UART chip at 3f8
Feb 3 16:06:59 solaris2 asy: [ID 267298 kern.notice] asy1: UART @ 2f8 scratch register:
expected 0x5a, got 0xff
Feb 3 16:06:59 solaris2 asy: [ID 702181 kern.notice] Cannot identify UART chip at 2f8
Feb 3 16:07:01 solaris2 genunix: [ID 314293 kern.info] device
pciclass,030000@2(display#0) keeps up device sd@1,0(sd#1), but the latter is
not power managed
Feb 3 16:07:01 solaris2 /usr/lib/power/powerd: [ID 387247 daemon.error]
Able to open /dev/srn
Feb 3 16:07:08 solaris2 /sbin/dhcpagent[164]: [ID 778557 daemon.warning]
configure_v4_lease: no IP broadcast specified for ni0, making best guess
Feb 3 16:07:31 solaris2 sendmail[503]: [ID 702911 mail.crit] My unqualified host name
(solaris2) unknown; sleeping for retry
Feb 3 16:07:32 solaris2 sendmail[507]: [ID 702911 mail.crit] My unqualified host name
(solaris2) unknown; sleeping for retry
Feb 3 16:07:48 solaris2 svc.startd[7]: [ID 652011 daemon.warning]
svc:/system/webconsole:console: Method "/lib/svc/method/svc-webconsole start"
failed with exit status 95.
Feb 3 16:07:48 solaris2 svc.startd[7]: [ID 748625 daemon.error]
system/webconsole:console failed fatally: transitioned to maintenance
(see 'svcs -xv' for details)
Feb 3 16:07:55 solaris2 pseudo: [ID 129642 kern.info] pseudo-device: devinfo0
Feb 3 16:07:55 solaris2 genunix: [ID 936769 kern.info] devinfo0 is /pseudo/devinfo@0
Feb 3 16:08:31 solaris2 sendmail[503]: [ID 702911 mail.alert] unable to qualify
my own domain name (solaris2) -- using short name
Feb 3 16:08:32 solaris2 sendmail[507]: [ID 702911 mail.alert] unable to qualify my
own domain name (solaris2) -- using short name
대표적인 로그 파일인 messages 로그이다. 이 외에도 dmesg, syslog 등에 대해서도 언급하고 있다.
링크 : http://www-128.ibm.com/developerworks/kr/library/au-satlogfilebasics/
'IBM dW review' 카테고리의 다른 글
소프트웨어 공학이라는 용어를 묻어버리자 (0) | 2008.06.30 |
---|---|
Ajax에서 XML 처리하기, Part 1: 네 가지 방법 (0) | 2008.05.30 |
시스템 관리 툴킷: UNIX 프로세스 관리 기법 (0) | 2008.05.25 |
메모리 프로그래밍을 개선하자 (0) | 2008.04.30 |
망할놈의 메모리 오류 그리고 디버깅 (0) | 2008.04.23 |
Solaris10 sd.conf 동적으로 다시 읽기
Solaris 시스템에서 외부 스토리지나 백업장치를 붙여서 사용하는 경우,
sd.conf 파일에 스토리지단에서 해당 서버로 던져준 볼륨에 대한 정의(target, lun)를 하게 되는데,
이것이 변경되거나 새로 추가된 경우 touch로 reconfigure 파일을 생성하고 -i6로 shutdown을 해야 했다.
동적으로 스토리지의 볼륨을 다시 읽어 올 수 있는 방법은 생각보다 간단하다.
#update_drv -f sd
#drvconfig;disks
이렇게 해 주면, 스토리지단의 볼륨을 동적으로 다시 물고 올라온다. 간단하고 쉽고 빠르다.
(주의) Solaris10 에서만 가능
'유닉스' 카테고리의 다른 글
pkgadd 오류: admin 파일 <default>를 열 수 없습니다. (0) | 2008.11.11 |
---|---|
SSH setting for solaris8 (0) | 2008.08.26 |
Fixing read-only file system error (0) | 2008.08.13 |
Dos Attack On UNIX (0) | 2008.05.08 |
디스크 Dump & Restore (0) | 2008.05.04 |
시스템 관리 툴킷: UNIX 프로세스 관리 기법
http://www.ibm.com/developerworks/kr/library/au-unix-sysadmin1.html
유닉스 시스템을 다루다 보면, 관리자 입장에서 프로세스 정보를 얻고, 죽이고 모니터링 해야 하는 경우가 빈번하다. 일반적으로는 시스템에서 제공하는 표준 명령어로 프로세스에 대한 목록 또는 정보를 얻는데, 이렇게 얻는 정보가 원하는 형식이 아니거나 충분하지 못한 경우가 종종 발생한다. 원하는 정보를 원하는 형식으로 추출하게되면 시스템 관리는 좀 더 수월해진다. 프로세스 정보를 가독성 있게 추려내는 것은 명령어와 텍스트 기반의 유닉스 시스템에서는 상당히 중요하다. 그것은 다양한 플랫폼에서 동일한 방식으로 정보를 얻어내는 방법인 표준화 기법 또한 소개하고 있다.
BSD/SVR4 유닉스 계열에서 사용자/전체 프로세스 목록 보기, 열 지정하기, CPU사용량 추적하기, 여러 프로세스에 시그널 보내기, 명령 하나로 여러 프로세스 죽이기, 메모리 사용량 계산하기, 백그라운드에서 프로세스 안전하게 실행하기 등 많은 기법에 대해 소개하고 있다. 실제로 고객을 대하고 시스템을 점검하면, 갖가지 요구사항들이 끝없이 쏟아진다.
Listing 14. ps
와 awk
로 메모리 사용량 계산하기
awk '{rss += $1; vsz += $2 } END { print "Real: ",rss, "Virtual: ",vsz }'
Real: 4004 Virtual: 305624
위는 bash 프로세스가 사용하는 물리적 메모리 양과 가상 메모리 양을 합한 결과로 메모리 사용량 문제와 스왑 공간 사용량 문제를 진단할 때 특히 유용하다. 이 외에도 프로세스에 관련하여 갖가지 기법들을 소개하고 있다.
http://www.ibm.com/developerworks/kr/library/au-unix-sysadmin1.html
'IBM dW review' 카테고리의 다른 글
Ajax에서 XML 처리하기, Part 1: 네 가지 방법 (0) | 2008.05.30 |
---|---|
유닉스(UNIX) 로그 파일 이해하기 (0) | 2008.05.28 |
메모리 프로그래밍을 개선하자 (0) | 2008.04.30 |
망할놈의 메모리 오류 그리고 디버깅 (0) | 2008.04.23 |
실패하지 않는 C코드 (0) | 2008.04.15 |
Dos Attack On UNIX
The purpose of this document is to strengthen the UNIX IP stack against a variety of attack types prevalent on the Internet today. This document details the settings recommended for UNIX servers designed to provide network intensive services such as HTTP or routing (firewall services). You can find the most useful dos attack tutorial here in order to prevent the dos attacks on your servers.
General IP Stack Tuning Recommendations
1. TCP send and receive spaces
The TCP send and receive spaces directly effect the TCP window size parameter. An increased window size will allow for more efficient transfers, particularly bulk transfers such as FTP and HTTP. The default for each is not optimal, and should be increased to 32768 bytes. This value should not be increased above 64K bytes unless the implications of RFC1323 and RFC2018 are fully understood and support for both is enabled.
Do not enable RFC1323 without also enabling support for RFC2018. Remember, pipe drain is a Bad Thing[tm].
A. AIX
/usr/sbin/no -o tcp_sendspace=32768
/usr/sbin/no -o tcp_recvspace=32768
B. Solaris
/usr/sbin/ndd -set /dev/tcp tcp_xmit_hiwat 32768
/usr/sbin/ndd -set /dev/tcp tcp_recv_hiwat 32768
C. Tru64 UNIX
No tuning recommendations.
D. HP-UX
The TCP send and receive spaces are set to 32768 by default
E. Linux kernel 2.2
While Linux automagically assigns the TCP send and receive spaces, support for both RFC1323 (large window support, net.ipv4.tcp_window_scaling) and RFC2018 (SACK support, net.ipv4.tcp_sack) are enabled by default.
F. FreeBSD
sysctl -w net.inet.tcp.sendspace=32768
sysctl -w net.inet.tcp.recvspace=32768
G. IRIX
The default settings for IRIX are 64Kbytes for both the TCP send and receive spaces.
2. Socket queue defense against SYN attacks
While great effort is undertaken to defend any network from those with malicious intent, several ports (largely TCP) must remain open to conduct business. Internet vandals may attempt to exploit these ports to launch a denial of service attack. One of the most popular attacks remains the SYN flood, wherein the socket queue of the attacked host is overwhelmed with bogus connection requests. To defend against such attacks, certain UNIX variants maintain separate queues for inbound socket connection requests. One queue is for half-open sockets (SYN received, SYN|ACK sent), the other queue for fully-open sockets awaiting an accept() call from the application. These two queues should be increased so that an attack of low to moderate intensity will have little to no effect on the stability or availability of the server.
A. AIX
/usr/sbin/no -o clean_partial_conns=1
This setting will instruct the kernel to randomly remove half-open sockets from the q0 queue to make room for new sockets.
B. Solaris
/usr/sbin/ndd -set /dev/tcp tcp_conn_req_max_q 1024
The q queue holds sockets awaiting an accept() call from the application.
/usr/sbin/ndd -set /dev/tcp tcp_conn_req_max_q0 2
048
The q0 queue contains half-open sockets.
C. Tru64 UNIX
/sbin/sysconfig -r socket sominconn=65535
The value of sominconn determines how many simultaneous incoming SYN packets can be handled by the system.
/sbin/sysconfig -r socket somaxconn=65535
The value of somaxconn sets the maximum number of pending TCP connections.
D. HP-UX
/usr/sbin/ndd -set tcp_syn_rcvd_max 1024
/usr/sbin/ndd -set tcp_conn_request_max 200
E. Linux kernel 2.2
/sbin/sysctl -w net.ipv4.tcp_max_syn_backlog=1280
Increases the size of the socket queue (effectively, q0).
/sbin/sysctl -w net.ipv4.tcpsyn_cookies=1
Enables support for TCP SYN cookies, which mitigates the effectiveness of SYN floods. However, this may cause performance problems for large windows (see RFC1323 and RFC2018). To read more about SYN cookies, please review DJ Bernstein's paper here.
F. FreeBSD
sysctl -w kern.ipc.somaxconn=1024
G. IRIX
The listen() queue is hardcoded to 32. However, the system actually enforces the limit of pending connections as ((3 * backlog) / 2) + 1. This yields a maximum backlog of 49 connections.
3. Redirects
A miscreant can use IP redirects to modify the routing table on a remote host. In a well-designed network, redirects to the end stations should not be required. Both the sending and accepting of redirects should be disabled.
A. AIX
/usr/sbin/no -o ipignoreredirects=1
/usr/sbin/no -o ipsendredirects=0
B. Solaris
/usr/sbin/ndd -set /dev/ip ip_ignore_redirect 1
/usr/sbin/ndd -set /dev/ip ip_send_redirects 0
C. Tru64 UNIX
No tuning recommendations.
D. HP-UX
/usr/sbin/ndd -set /dev/ip ip_send_redirects 0
E. Linux kernel 2.2
/sbin/sysctl -w net.ipv4.conf.all.send_redirects=0
/sbin/sysctl -w net.ipv4.conf.all.accept_redirects=0
F. FreeBSD
sysctl -w net.inet.icmp.drop_redirect=1
sysctl -w net.inet.icmp.log_redirect=1
sysctl -w net.inet.ip.redirect=0
sysctl -w net.inet6.ip6.redirect=0
G. IRIX
/usr/sbin/systune icmp_dropredirects to 1
4. ARP cleanup
It is possible for a miscreant to create a resource exhaustion or performance degredation by filling the IP route cache with bogus ARP entries. In Solaris, there are two parameters that govern the cleanup interval for the IP route cache. For unsolicited ARP responses, the parameter to be tuned is arp_cleanup_interval. In AIX, the cleanup interval is governed by the value of arpt_killc. However, this parameter governs both solicited and unsolicited ARP entries. For this reason, it is likely best to leave the parameter at the default setting of 20 minutes.
A. AIX
/usr/sbin/no -o arpt_killc=20
B. Solaris
/usr/sbin/ndd -set /dev/arp arp_cleanup_interval 60000
C. Tru64 UNIX
No tuning recommendations.
D. HP-UX
By default set to five minutes.
E. Linux kernel 2.2
No tuning recommendations.
F. FreeBSD
sysctl -w net.link.ether.inet.max_age=1200
G. IRIX
No tuning recommendations.
5. Source routing
With source routing, an attacker can attempt to reach internal IP addresses - including RFC1918 addresses. It is important to disable the acceptance of source routed packets to prevent subtle probes of your internal networks.
A. AIX
/usr/sbin/no -o ipsrcroutesend=0
Disable the sending of source routed packets.
/usr/sbin/no -o ipsrcrouteforward=0
This is important if the box is routing, e.g. a firewall. Disable this feature to prevent the host from forwarding source routed packets.
B. Solaris
/usr/sbin/ndd -set /dev/ip ip_forward_src_routed 0
This is important if the box is routing, e.g. a firewall. Disable this feature to prevent the host from forwarding source routed packets.
C. Tru64 UNIX
No tuning recommendations.
D. HP-UX
ndd -set /dev/ip ip_forward_src_routed 0
Disable this feature to prevent the host from forwarding source routed packets.
E. Linux kernel 2.2
/sbin/sysctl -w net.ipv4.conf.all.accept_source_route=0
Drop all source route packets.
/sbin/sysctl -w net.ipv4.conf.all.forwarding=0
/sbin/sysctl -w net.ipv4.conf.all.mc_forwarding=0
Do not forward source routed frames.
F. FreeBSD
sysctl -w net.inet.ip.sourceroute=0
sysctl -w net.inet.ip.accept_sourceroute=0
G. IRIX
/usr/sbin/systune ipforward to 2
6. TIME_WAIT setting
On a busy web server, many sockets may linger in the TIME_WAIT state. This is caused by improperly coded client applications that do not properly shut down a socket. This can also be used as a type of DDoS attack.
A. AIX
No tuning recommendations.
B. Solaris
/usr/sbin/ndd -set /dev/tcp tcp_time_wait_interval 60000
This parameter effects the amount of time a TCP socket will remain in the TIME_WAIT state. The default is quite high for a busy web server, so it should be lowered to 60000 milliseconds (60 seconds). The parameter name was corrected in Solaris 7 and higher. Prior to Solaris 7, the parameter was incorrectly labeled as tcp_close_wait_interval.
C. Tru64 UNIX
No tuning recommendations.
D. HP-UX
ndd -set /dev/tcp tcp_time_wait_interval 60000
Sockets will linger in TIME_WAIT state no more than 60 seconds.
E. Linux kernel 2.2
/sbin/sysctl -w net.ipv4.vs.timeout_timewait=60
Sockets will linger in TIME_WAIT state for no more than 60 seconds.
F. FreeBSD
No tuning recommendations.
G. IRIX
/usr/sbin/systune tcp_2msl to 60
7. Broadcast ECHO response
Smurf attacks work by sending ICMP 8 0 (ECHO REQUEST) messages to a broadcast address from a spoofed address. Some IP stacks will respond, by default, to such messages. This should be disabled. Further, if the host is a firewall (router), it should not propogate directed broadcasts.
A. AIX
/usr/sbin/no -o directed_broadcast=0
Do not respond to directed broadcasts.
B. Solaris
/usr/sbin/ndd -set /dev/ip ip_respond_to_echo_broadcast 0
Do not respond to directed broadcasts.
/usr/sbin/ndd -set /dev/ip ip_forward_directed_broadcasts 0
Do not forward directed broadcasts.
C. Tru64 UNIX
No tuning recommendations.
D. HP-UX
ndd -set /dev/ip ip_respond_to_echo_broadcast 0
Do not respond to directed broadcasts.
ndd -set /dev/ip ip_forward_directed_broadcasts 0
Do not forward directed broadcasts.
E. Linux kernel 2.2
/sbin/sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=1
Do not respond to directed broadcasts.
F. FreeBSD
sysctl -w net.inet.icmp.bmcastecho=0
G. IRIX
/usr/sbin/systune allow_brdaddr_srcaddr to 0
8. Other broadcast probes
There are two other broadcast probes that a miscreant could utilize against a network. The address mask query can be used to map out the size of the netblock, and set a range for further probes. The timestamp broadcast is another means of mapping and fingerprinting hosts.
A. AIX
/usr/sbin/no -o icmpaddressmask=0
Prevent address mask queries.
B. Solaris
/usr/sbin/ndd -set /dev/ip ip_respond_to_address_mask_broadcast 0
Prevent address mask queries.
/usr/sbin/ndd -set /dev/ip ip_respond_to_timestamp_broadcast 0
Disable timestamp broadcast query response.
C. Tru64 UNIX
No tuning recomendations.
D. HP-UX
ndd -set /dev/ip ip_respond_to_address_mask_broadcast 0
Prevent the host from revealing the configured netmask.
ndd -set /dev/ip ip_respond_to_timestamp_broadcast 0
Disable timestamp broadcast query response.
E. Linux kernel 2.2
No tuning recommendations.
F. FreeBSD
sysctl -w net.inet.icmp.maskrepl=0
G. IRIX
Use ipfilterd to block unwanted ICMP types.
9. Support for RFC1948
This will utilize RFC1948 sequence number generation techniques to ensure that the initial sequence number for a given TCP socket is very difficult to guess. This tactic makes IP spoofing significantly more difficult to accomplish.
B. Solaris
Set TCP_STRONG_ISS=2 in /etc/default/inetinit.
This will require a reboot to take effect.
G. IRIX
/usr/sbin/systune tcpiss_md5 to 1
'유닉스' 카테고리의 다른 글
pkgadd 오류: admin 파일 <default>를 열 수 없습니다. (0) | 2008.11.11 |
---|---|
SSH setting for solaris8 (0) | 2008.08.26 |
Fixing read-only file system error (0) | 2008.08.13 |
Solaris10 sd.conf 동적으로 다시 읽기 (0) | 2008.05.26 |
디스크 Dump & Restore (0) | 2008.05.04 |