InfoGrab Docs

Linux 감사 시스템을 사용한 SSH 구성

요약

Teleport의 SSH Service를 Linux 감사 시스템(auditd)과 통합하도록 구성할 수 있습니다. A running Teleport cluster. The tctl and tsh clients. Determine the version of your Teleport cluster.

Teleport의 SSH Service를 Linux 감사 시스템(auditd)과 통합하도록 구성할 수 있습니다.

사전 요구사항#

  • A running Teleport cluster. If you want to get started with Teleport, sign up for a free trial or set up a demo environment.

  • The tctl and tsh clients.

    Installing `tctl` and `tsh` clients
    1. Determine the version of your Teleport cluster. The tctl and tsh clients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at /v1/webapi/find and use a JSON query tool to obtain your cluster version. Replace with the web address of your Teleport Proxy Service:

      $ TELEPORT_DOMAIN=
      $ TELEPORT_VERSION="$(curl -s https://$TELEPORT_DOMAIN/v1/webapi/find | jq -r '.server_version')"
      
    2. Follow the instructions for your platform to install tctl and tsh clients:

  • 실행 중인 Teleport Agent 인스턴스. Teleport 클러스터에 에이전트를 추가하는 방법은 시작하기 가이드를 참조하세요. 에이전트에서 teleport는 root 권한으로 systemd 서비스로 실행 중이어야 합니다.
  • CONFIG_AUDIT로 컴파일된 Linux 커널 2.6.6 이상. 대부분의 Linux 배포판에서 이 옵션은 기본적으로 활성화되어 있습니다.
  • auditd 상태 확인을 위한 auditctl (선택 사항).

To check that you can connect to your Teleport cluster, sign in with tsh login, then verify that you can run tctl commands using your current credentials.

For example, run the following command, assigning to the domain name of the Teleport Proxy Service in your cluster and to your Teleport username:

$ tsh login --proxy= --user=
$ tctl status
# Cluster  (=teleport.url=)
# Version  (=teleport.version=)
# CA pin   (=presets.ca_pin=)

If you can connect to the cluster and run the tctl status command, you can use your current credentials to run subsequent tctl commands from your workstation. If you host your own Teleport cluster, you can also run tctl commands on the computer that hosts the Teleport Auth Service for full permissions.

1단계/4단계. 시스템 구성 확인#

Teleport는 시스템에서 auditd가 활성화되어 있음을 감지하면 자동으로 auditd 이벤트를 전송합니다. root로 auditctl -s를 호출하여 이를 확인할 수 있습니다.

해당 명령의 출력 예시:

$ sudo auditctl -s
enabled 1
failure 1
pid 879
rate_limit 0
backlog_limit 8192
lost 0
backlog 0
backlog_wait_time 60000
backlog_wait_time_actual 0
loginuid_immutable 0 unlocked

첫 번째 줄 enabled 1은 auditd가 활성화되어 있으며 Teleport가 이벤트를 전송할 것임을 나타냅니다.

모든 이벤트는 Teleport 노드에서 생성됩니다. invalid user 이벤트는 Teleport 사용자가 인증에 실패할 때 Proxy Service에서도 생성됩니다.

2단계/4단계. Teleport 시작#

root 권한으로 시스템 서비스(예: systemd 서비스)로 Teleport를 실행하는 것이 중요합니다. 그렇지 않으면 권한 부족으로 Teleport가 auditd에 이벤트를 전송하지 않습니다.

Warning

Teleport 프로세스의 로그인 UID가 설정되지 않았는지 확인하세요. 그렇지 않으면 세션 ID가 발행된 이벤트에 올바르게 설정되지 않습니다. cat /proc/$(pidof teleport)/loginuid를 호출하여 확인할 수 있습니다. 값은 4294967295로 설정되어야 합니다.

3단계/4단계. PAM 통합 활성화 (선택 사항)#

PAM(플러그 가능 인증 모듈)이 활성화되면 Auditd가 추가 이벤트를 생성할 수 있습니다. Teleport에서 PAM 통합을 활성화하려면 Teleport 노드의 구성 파일(/etc/teleport.yaml 기본값)에 다음 pam 섹션을 추가합니다:

ssh_service:
  # Enabled SSH Service
  enabled: true
  # Enable PAM integration
  pam:
    # "no" by default
    enabled: true
    # use /etc/pam.d/sshd configuration (the default)
    service_name: "sshd"

PAM에서 생성되는 이벤트는 통합이 활성화된 경우 sshd 구성에 따라 달라집니다. 대부분의 시스템은 USER_ACCT 또는 USER_START와 같은 이벤트를 생성합니다. 또한 pam_tty_audit.so 모듈을 활성화하면 TTY 입력을 로깅할 수 있습니다.

자세한 내용은 PAM 또는 운영 체제 설명서를 참조하세요.

PAM 통합이 활성화되면 auditd 이벤트는 OpenSSH에서 생성된 이벤트와 거의 일치합니다.

4단계/4단계. auditd로 SSH 세션 추적#

Teleport에서 SSH 세션을 추적하는 몇 가지 방법이 있습니다. auditd 이벤트와 상호 작용하기 위해 ausearch를 사용합니다. 시스템에 이 도구가 없다면 배포판 문서를 참조하여 설치 방법을 확인하세요.

시스템 사용자로 검색#

-ua 스위치를 사용하여 시스템 사용자로 로그인할 때 이벤트를 검색할 수 있습니다. id 명령으로 사용자의 UID를 확인할 수 있습니다:

$ id bob
uid=1000(bob) gid=1000(bob) groups=1000(bob)

그런 다음 uid를 사용하여 auditd 로그를 검색할 수 있습니다:

ausearch -ua 1000 -m USER_LOGIN

Teleport 사용자로 검색#

Teleport가 auditd에 전송하는 이벤트는 Teleport 사용자 이름이 포함된 teleportUser 필드로 보강됩니다. ausearch는 사용자 정의 필드로 검색을 허용하지 않지만, grep을 사용할 수 있습니다:

ausearch -m USER_LOGIN | grep teleportUser=bob

세션 ID로 검색#

특정 세션에서 생성된 모든 이벤트를 찾으려면 먼저 세션 ID를 찾아야 합니다. 다음 명령으로 찾을 수 있습니다:

ausearch  -m USER_LOGIN -x teleport --just-one

그런 다음 해당 세션에만 관련된 이벤트를 검색합니다:

ausearch --session 42

Linux 감사 시스템을 사용한 SSH 구성

원문 보기
요약

Teleport의 SSH Service를 Linux 감사 시스템(auditd)과 통합하도록 구성할 수 있습니다. A running Teleport cluster. The tctl and tsh clients. Determine the version of your Teleport cluster.

Teleport의 SSH Service를 Linux 감사 시스템(auditd)과 통합하도록 구성할 수 있습니다.

사전 요구사항#

  • A running Teleport cluster. If you want to get started with Teleport, sign up for a free trial or set up a demo environment.

  • The tctl and tsh clients.

    Installing `tctl` and `tsh` clients
    1. Determine the version of your Teleport cluster. The tctl and tsh clients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at /v1/webapi/find and use a JSON query tool to obtain your cluster version. Replace with the web address of your Teleport Proxy Service:

      $ TELEPORT_DOMAIN=
      $ TELEPORT_VERSION="$(curl -s https://$TELEPORT_DOMAIN/v1/webapi/find | jq -r '.server_version')"
      
    2. Follow the instructions for your platform to install tctl and tsh clients:

  • 실행 중인 Teleport Agent 인스턴스. Teleport 클러스터에 에이전트를 추가하는 방법은 시작하기 가이드를 참조하세요. 에이전트에서 teleport는 root 권한으로 systemd 서비스로 실행 중이어야 합니다.
  • CONFIG_AUDIT로 컴파일된 Linux 커널 2.6.6 이상. 대부분의 Linux 배포판에서 이 옵션은 기본적으로 활성화되어 있습니다.
  • auditd 상태 확인을 위한 auditctl (선택 사항).

To check that you can connect to your Teleport cluster, sign in with tsh login, then verify that you can run tctl commands using your current credentials.

For example, run the following command, assigning to the domain name of the Teleport Proxy Service in your cluster and to your Teleport username:

$ tsh login --proxy= --user=
$ tctl status
# Cluster  (=teleport.url=)
# Version  (=teleport.version=)
# CA pin   (=presets.ca_pin=)

If you can connect to the cluster and run the tctl status command, you can use your current credentials to run subsequent tctl commands from your workstation. If you host your own Teleport cluster, you can also run tctl commands on the computer that hosts the Teleport Auth Service for full permissions.

1단계/4단계. 시스템 구성 확인#

Teleport는 시스템에서 auditd가 활성화되어 있음을 감지하면 자동으로 auditd 이벤트를 전송합니다. root로 auditctl -s를 호출하여 이를 확인할 수 있습니다.

해당 명령의 출력 예시:

$ sudo auditctl -s
enabled 1
failure 1
pid 879
rate_limit 0
backlog_limit 8192
lost 0
backlog 0
backlog_wait_time 60000
backlog_wait_time_actual 0
loginuid_immutable 0 unlocked

첫 번째 줄 enabled 1은 auditd가 활성화되어 있으며 Teleport가 이벤트를 전송할 것임을 나타냅니다.

모든 이벤트는 Teleport 노드에서 생성됩니다. invalid user 이벤트는 Teleport 사용자가 인증에 실패할 때 Proxy Service에서도 생성됩니다.

2단계/4단계. Teleport 시작#

root 권한으로 시스템 서비스(예: systemd 서비스)로 Teleport를 실행하는 것이 중요합니다. 그렇지 않으면 권한 부족으로 Teleport가 auditd에 이벤트를 전송하지 않습니다.

Warning

Teleport 프로세스의 로그인 UID가 설정되지 않았는지 확인하세요. 그렇지 않으면 세션 ID가 발행된 이벤트에 올바르게 설정되지 않습니다. cat /proc/$(pidof teleport)/loginuid를 호출하여 확인할 수 있습니다. 값은 4294967295로 설정되어야 합니다.

3단계/4단계. PAM 통합 활성화 (선택 사항)#

PAM(플러그 가능 인증 모듈)이 활성화되면 Auditd가 추가 이벤트를 생성할 수 있습니다. Teleport에서 PAM 통합을 활성화하려면 Teleport 노드의 구성 파일(/etc/teleport.yaml 기본값)에 다음 pam 섹션을 추가합니다:

ssh_service:
  # Enabled SSH Service
  enabled: true
  # Enable PAM integration
  pam:
    # "no" by default
    enabled: true
    # use /etc/pam.d/sshd configuration (the default)
    service_name: "sshd"

PAM에서 생성되는 이벤트는 통합이 활성화된 경우 sshd 구성에 따라 달라집니다. 대부분의 시스템은 USER_ACCT 또는 USER_START와 같은 이벤트를 생성합니다. 또한 pam_tty_audit.so 모듈을 활성화하면 TTY 입력을 로깅할 수 있습니다.

자세한 내용은 PAM 또는 운영 체제 설명서를 참조하세요.

PAM 통합이 활성화되면 auditd 이벤트는 OpenSSH에서 생성된 이벤트와 거의 일치합니다.

4단계/4단계. auditd로 SSH 세션 추적#

Teleport에서 SSH 세션을 추적하는 몇 가지 방법이 있습니다. auditd 이벤트와 상호 작용하기 위해 ausearch를 사용합니다. 시스템에 이 도구가 없다면 배포판 문서를 참조하여 설치 방법을 확인하세요.

시스템 사용자로 검색#

-ua 스위치를 사용하여 시스템 사용자로 로그인할 때 이벤트를 검색할 수 있습니다. id 명령으로 사용자의 UID를 확인할 수 있습니다:

$ id bob
uid=1000(bob) gid=1000(bob) groups=1000(bob)

그런 다음 uid를 사용하여 auditd 로그를 검색할 수 있습니다:

ausearch -ua 1000 -m USER_LOGIN

Teleport 사용자로 검색#

Teleport가 auditd에 전송하는 이벤트는 Teleport 사용자 이름이 포함된 teleportUser 필드로 보강됩니다. ausearch는 사용자 정의 필드로 검색을 허용하지 않지만, grep을 사용할 수 있습니다:

ausearch -m USER_LOGIN | grep teleportUser=bob

세션 ID로 검색#

특정 세션에서 생성된 모든 이벤트를 찾으려면 먼저 세션 ID를 찾아야 합니다. 다음 명령으로 찾을 수 있습니다:

ausearch  -m USER_LOGIN -x teleport --just-one

그런 다음 해당 세션에만 관련된 이벤트를 검색합니다:

ausearch --session 42