IAP for TCP forwarding으로 SSH의 소스 IP 주소 제한
6830 단어 gcp
소개
IAP for TCP forwarding에서 SSH의 소스 IP 주소를 제한하는 방법을 설명합니다. 결론적으로 VPC Service Control을 사용하여 제한할 수 있습니다.
GCP에서 연결 소스 IP 주소를 제한하는 방법
GCP에서 연결하는 IP 주소를 제한하는 방법은 Firewall rule과 Access context manager의 두 가지 방법을 사용할 수 있습니다. Access context manager는 다음과 같이 네트워크를 설정할 수 있습니다.

Access context manager는 단독으로 사용하지 않고 다른 서비스와 함께 사용합니다. 다른 서비스는 구체적으로 'VPC Service Controls', 'Context-aware access', 'IAM Conditions'입니다.
위를 IAP for TCP forwarding으로 조합하여 사용할 수 있는지 확인합니다.
1. Firewall의 Ingress 규칙
2.Context-aware access for the Cloud Console and the Google Cloud APIs
htps : // c ぉ d. 오, ぇ. 코 m / 베요 d
3.IAP + VPC Service Controls(VPC-SC)
h tps : // c ぉ d. 오, ぇ. 코 m / 아 p / 도 cs / 세쿠린 gtcp 우우 th-vpc-sc
4. IAP + Context-aware access
h tps : // c ぉ d. 오, ぇ. 코 m / 아 p / 드 cs / c ぉ d d ea p p Xt-Ae-Ass s Ho w
Firewall의 Ingress 규칙
IAP for TCP forwarding을 사용하려면 방화벽 규칙으로 IP 범위 35.235.240.0/20에서 업 링크 (내향) 트래픽을 허용하십시오.
h tps : // c ぉ d. 오, ぇ. 이 m/아 p/도 cs/우신 g-tcp ぉr와 rぢg? hl = 그럼 # c 어서
35.235.240.0/20은 Google이 사용하는 IP 주소 범위이며 사용자가 허용하려는 네트워크를 지정할 수 없습니다. 따라서 Firewall에서 SSH의 소스 IP 주소를 제한할 수 없습니다.
Context-aware access for the Cloud Console and the Google Cloud APIs
GCP는 인증 시 소스 IP 주소 제한으로 Context-aware access for the Cloud Console and the Google Cloud APIs를 사용할 수 있습니다.
h tps : // c ぉ d. 오, ぇ. 코 m / 베요 d
여기에 설명된 대로 Google 콘솔에 로그인하거나 API 런타임에 인증할 때 액세스 제어가 되므로 IAP for TCP forwarding을 사용하여 SSH 연결 시 소스 IP 주소를 제한할 수 없습니다.
IAP + VPC 서비스 제어 (VPC-SC)
IAP for TCP forwarding과 VPC-SC를 결합하면 SSH 연결시 소스 IP 주소를 제한 할 수 있습니다.
실제로 시도해 보겠습니다.
다음을 참고하여 IAP for TCP forwarding을 활성화합니다.
htps : // c ぉ d. 오, ぇ. 코 m / 아 p / 도 cs / 우신 g tcp fu rwa r ぢ g
VPC-SC 경계에 해당 프로젝트를 추가하고 Restricted service에 IAP를 추가합니다. Shared VPC를 사용하는 경우 호스트 프로젝트와 서비스 프로젝트를 모두 서비스 경계에 추가합니다.

Google cloud console에서 ssh를 시도합니다.

SSH 연결이 거부되었습니다.

gcloud 명령으로 ssh를 시도합니다.
여기도 SSH 연결이 거부되었습니다.
$ gcloud compute ssh bastion --zone asia-northeast1-b
External IP address was not found; defaulting to using IAP tunneling.
ERROR: (gcloud.compute.start-iap-tunnel) Error while connecting [4054: "Request is prohibited by organization's policy. ID: 3FdzVQ5u4jIuETm3PpuR58Fz5htLS-971K3VL4fy9geh4_B856aVAg"].
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
ERROR: (gcloud.compute.ssh) [/usr/local/bin/ssh] exited with return code [255].
Access context manager에서 모든 소스 IP로부터의 액세스를 허용합니다.

VPC-SC에서 위의 Access context manager 정책을 Access Levels로 설정합니다.

Google cloud console에서 ssh를 시도합니다.

연결할 수 있었습니다.

gcloud 명령으로 ssh를 시도합니다.
이쪽도, 접속할 수 있었습니다.
$ gcloud compute ssh bastion --zone asia-northeast1-b
External IP address was not found; defaulting to using IAP tunneling.
Updating project ssh metadata...⠹Updated [https://www.googleapis.com/compute/v1/projects/app-dev-256209].
Updating project ssh metadata...done.
Waiting for SSH key to propagate.
Warning: Permanently added 'compute.3051378218933375262' (ECDSA) to the list of known hosts.
Linux bastion 4.19.0-14-cloud-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
matsushi@bastion:~$
IAP + Context-aware access
htps : // c ぉ d. 오, ぇ. 코 m / 아 p / 드 cs / c ぉ d d ea p p xt 아아 - 어서 s - w
이것도 할 수 있을 것입니다만, 왠지 condtions를 설정하는 곳에서 에러가 되어 실기 확인할 수 없었습니다. . 또 별도 시험해 보겠습니다. .

Reference
이 문제에 관하여(IAP for TCP forwarding으로 SSH의 소스 IP 주소 제한), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/atsumjp/items/202d45914251f707ab4f
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
GCP에서 연결하는 IP 주소를 제한하는 방법은 Firewall rule과 Access context manager의 두 가지 방법을 사용할 수 있습니다. Access context manager는 다음과 같이 네트워크를 설정할 수 있습니다.

Access context manager는 단독으로 사용하지 않고 다른 서비스와 함께 사용합니다. 다른 서비스는 구체적으로 'VPC Service Controls', 'Context-aware access', 'IAM Conditions'입니다.
위를 IAP for TCP forwarding으로 조합하여 사용할 수 있는지 확인합니다.
1. Firewall의 Ingress 규칙
2.Context-aware access for the Cloud Console and the Google Cloud APIs
htps : // c ぉ d. 오, ぇ. 코 m / 베요 d
3.IAP + VPC Service Controls(VPC-SC)
h tps : // c ぉ d. 오, ぇ. 코 m / 아 p / 도 cs / 세쿠린 gtcp 우우 th-vpc-sc
4. IAP + Context-aware access
h tps : // c ぉ d. 오, ぇ. 코 m / 아 p / 드 cs / c ぉ d d ea p p Xt-Ae-Ass s Ho w
Firewall의 Ingress 규칙
IAP for TCP forwarding을 사용하려면 방화벽 규칙으로 IP 범위 35.235.240.0/20에서 업 링크 (내향) 트래픽을 허용하십시오.
h tps : // c ぉ d. 오, ぇ. 이 m/아 p/도 cs/우신 g-tcp ぉr와 rぢg? hl = 그럼 # c 어서
35.235.240.0/20은 Google이 사용하는 IP 주소 범위이며 사용자가 허용하려는 네트워크를 지정할 수 없습니다. 따라서 Firewall에서 SSH의 소스 IP 주소를 제한할 수 없습니다.
Context-aware access for the Cloud Console and the Google Cloud APIs
GCP는 인증 시 소스 IP 주소 제한으로 Context-aware access for the Cloud Console and the Google Cloud APIs를 사용할 수 있습니다.
h tps : // c ぉ d. 오, ぇ. 코 m / 베요 d
여기에 설명된 대로 Google 콘솔에 로그인하거나 API 런타임에 인증할 때 액세스 제어가 되므로 IAP for TCP forwarding을 사용하여 SSH 연결 시 소스 IP 주소를 제한할 수 없습니다.
IAP + VPC 서비스 제어 (VPC-SC)
IAP for TCP forwarding과 VPC-SC를 결합하면 SSH 연결시 소스 IP 주소를 제한 할 수 있습니다.
실제로 시도해 보겠습니다.
다음을 참고하여 IAP for TCP forwarding을 활성화합니다.
htps : // c ぉ d. 오, ぇ. 코 m / 아 p / 도 cs / 우신 g tcp fu rwa r ぢ g
VPC-SC 경계에 해당 프로젝트를 추가하고 Restricted service에 IAP를 추가합니다. Shared VPC를 사용하는 경우 호스트 프로젝트와 서비스 프로젝트를 모두 서비스 경계에 추가합니다.

Google cloud console에서 ssh를 시도합니다.

SSH 연결이 거부되었습니다.

gcloud 명령으로 ssh를 시도합니다.
여기도 SSH 연결이 거부되었습니다.
$ gcloud compute ssh bastion --zone asia-northeast1-b
External IP address was not found; defaulting to using IAP tunneling.
ERROR: (gcloud.compute.start-iap-tunnel) Error while connecting [4054: "Request is prohibited by organization's policy. ID: 3FdzVQ5u4jIuETm3PpuR58Fz5htLS-971K3VL4fy9geh4_B856aVAg"].
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
ERROR: (gcloud.compute.ssh) [/usr/local/bin/ssh] exited with return code [255].
Access context manager에서 모든 소스 IP로부터의 액세스를 허용합니다.

VPC-SC에서 위의 Access context manager 정책을 Access Levels로 설정합니다.

Google cloud console에서 ssh를 시도합니다.

연결할 수 있었습니다.

gcloud 명령으로 ssh를 시도합니다.
이쪽도, 접속할 수 있었습니다.
$ gcloud compute ssh bastion --zone asia-northeast1-b
External IP address was not found; defaulting to using IAP tunneling.
Updating project ssh metadata...⠹Updated [https://www.googleapis.com/compute/v1/projects/app-dev-256209].
Updating project ssh metadata...done.
Waiting for SSH key to propagate.
Warning: Permanently added 'compute.3051378218933375262' (ECDSA) to the list of known hosts.
Linux bastion 4.19.0-14-cloud-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
matsushi@bastion:~$
IAP + Context-aware access
htps : // c ぉ d. 오, ぇ. 코 m / 아 p / 드 cs / c ぉ d d ea p p xt 아아 - 어서 s - w
이것도 할 수 있을 것입니다만, 왠지 condtions를 설정하는 곳에서 에러가 되어 실기 확인할 수 없었습니다. . 또 별도 시험해 보겠습니다. .

Reference
이 문제에 관하여(IAP for TCP forwarding으로 SSH의 소스 IP 주소 제한), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/atsumjp/items/202d45914251f707ab4f
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
GCP는 인증 시 소스 IP 주소 제한으로 Context-aware access for the Cloud Console and the Google Cloud APIs를 사용할 수 있습니다.
h tps : // c ぉ d. 오, ぇ. 코 m / 베요 d
여기에 설명된 대로 Google 콘솔에 로그인하거나 API 런타임에 인증할 때 액세스 제어가 되므로 IAP for TCP forwarding을 사용하여 SSH 연결 시 소스 IP 주소를 제한할 수 없습니다.
IAP + VPC 서비스 제어 (VPC-SC)
IAP for TCP forwarding과 VPC-SC를 결합하면 SSH 연결시 소스 IP 주소를 제한 할 수 있습니다.
실제로 시도해 보겠습니다.
다음을 참고하여 IAP for TCP forwarding을 활성화합니다.
htps : // c ぉ d. 오, ぇ. 코 m / 아 p / 도 cs / 우신 g tcp fu rwa r ぢ g
VPC-SC 경계에 해당 프로젝트를 추가하고 Restricted service에 IAP를 추가합니다. Shared VPC를 사용하는 경우 호스트 프로젝트와 서비스 프로젝트를 모두 서비스 경계에 추가합니다.

Google cloud console에서 ssh를 시도합니다.

SSH 연결이 거부되었습니다.

gcloud 명령으로 ssh를 시도합니다.
여기도 SSH 연결이 거부되었습니다.
$ gcloud compute ssh bastion --zone asia-northeast1-b
External IP address was not found; defaulting to using IAP tunneling.
ERROR: (gcloud.compute.start-iap-tunnel) Error while connecting [4054: "Request is prohibited by organization's policy. ID: 3FdzVQ5u4jIuETm3PpuR58Fz5htLS-971K3VL4fy9geh4_B856aVAg"].
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
ERROR: (gcloud.compute.ssh) [/usr/local/bin/ssh] exited with return code [255].
Access context manager에서 모든 소스 IP로부터의 액세스를 허용합니다.

VPC-SC에서 위의 Access context manager 정책을 Access Levels로 설정합니다.

Google cloud console에서 ssh를 시도합니다.

연결할 수 있었습니다.

gcloud 명령으로 ssh를 시도합니다.
이쪽도, 접속할 수 있었습니다.
$ gcloud compute ssh bastion --zone asia-northeast1-b
External IP address was not found; defaulting to using IAP tunneling.
Updating project ssh metadata...⠹Updated [https://www.googleapis.com/compute/v1/projects/app-dev-256209].
Updating project ssh metadata...done.
Waiting for SSH key to propagate.
Warning: Permanently added 'compute.3051378218933375262' (ECDSA) to the list of known hosts.
Linux bastion 4.19.0-14-cloud-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
matsushi@bastion:~$
IAP + Context-aware access
htps : // c ぉ d. 오, ぇ. 코 m / 아 p / 드 cs / c ぉ d d ea p p xt 아아 - 어서 s - w
이것도 할 수 있을 것입니다만, 왠지 condtions를 설정하는 곳에서 에러가 되어 실기 확인할 수 없었습니다. . 또 별도 시험해 보겠습니다. .

Reference
이 문제에 관하여(IAP for TCP forwarding으로 SSH의 소스 IP 주소 제한), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/atsumjp/items/202d45914251f707ab4f
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
$ gcloud compute ssh bastion --zone asia-northeast1-b
External IP address was not found; defaulting to using IAP tunneling.
ERROR: (gcloud.compute.start-iap-tunnel) Error while connecting [4054: "Request is prohibited by organization's policy. ID: 3FdzVQ5u4jIuETm3PpuR58Fz5htLS-971K3VL4fy9geh4_B856aVAg"].
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
ERROR: (gcloud.compute.ssh) [/usr/local/bin/ssh] exited with return code [255].
$ gcloud compute ssh bastion --zone asia-northeast1-b
External IP address was not found; defaulting to using IAP tunneling.
Updating project ssh metadata...⠹Updated [https://www.googleapis.com/compute/v1/projects/app-dev-256209].
Updating project ssh metadata...done.
Waiting for SSH key to propagate.
Warning: Permanently added 'compute.3051378218933375262' (ECDSA) to the list of known hosts.
Linux bastion 4.19.0-14-cloud-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
matsushi@bastion:~$
htps : // c ぉ d. 오, ぇ. 코 m / 아 p / 드 cs / c ぉ d d ea p p xt 아아 - 어서 s - w
이것도 할 수 있을 것입니다만, 왠지 condtions를 설정하는 곳에서 에러가 되어 실기 확인할 수 없었습니다. . 또 별도 시험해 보겠습니다. .


Reference
이 문제에 관하여(IAP for TCP forwarding으로 SSH의 소스 IP 주소 제한), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/atsumjp/items/202d45914251f707ab4f텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)