AWS 클라이언트 VPN을 사용해 보십시오.

9087 단어 AWS

개시하다


2018/12/18에 발표된 AWS 클라이언트 VPN을 살펴보겠습니다.
인증은 Active Directory 공동 작업 및 클라이언트 인증서를 통해 인증할 수 있습니다.이번에는 Getting Started가 클라이언트 인증서를 사용하는 것을 모방합니다.

Linux 서버나 Mac에서 easyrsa 도구를 사용하여 루트 인증서나 서버 인증서, 서버 기밀 키, 클라이언트 인증서와 클라이언트 기밀 키를 만듭니다.생성된 Rootca, 서버 인증서, 서버 비밀 키를 ACM에 등록하고 Clinet VPC 노드에 로그인합니다.
네트워크 구성은 다음과 같습니다.

절차.

  • 연결 테스트를 위한 EC2 인스턴스를 생성하여 Nginx
  • 를 시작합니다.
  • easyrsa에서 루트 인증서, 서버 인증서, 서버 기밀 키, 클라이언트 인증서, 클라이언트 기밀 키를 만들고 ACM에 등록
  • AWS 클라이언트 VPN 엔드포인트 작성
  • 접속 확인
  • 루트 인증서, 서버 인증서, 서버 비밀 키, 클라이언트 인증서, 클라이언트 비밀 키 생성, ACM 등록

    git clone https://github.com/OpenVPN/easy-rsa.git
    Cloning into 'easy-rsa'...
    remote: Enumerating objects: 1039, done.
    remote: Total 1039 (delta 0), reused 0 (delta 0), pack-reused 1039
    Receiving objects: 100% (1039/1039), 86
    
    초기화
    cd easy-rsa/easyrsa3
    ./easyrsa init-pki
    init-pki complete; you may now create a CA or requests.
    Your newly created PKI dir is: /easy-rsa/easyrsa3/pki
    
    CA를 만들 때 Common 을 입력합니다.
    ./easyrsa build-ca nopass
    
    Using SSL: openssl OpenSSL 0.9.8zh 14 Jan 2016
    Generating RSA private key, 2048 bit long modulus
    ...........+++
    .............+++
    e is 65537 (0x10001)
    You are about to be asked to enter information that will be incorporated
    into your certificate request.
    What you are about to enter is what is called a Distinguished Name or a DN.
    There are quite a few fields but you can leave some blank
    For some fields there will be a default value,
    If you enter '.', the field will be left blank.
    -----
    Common Name (eg: your user, host, or server name) [Easy-RSA CA]:sample
    
    CA creation complete and you may now import and sign cert requests.
    Your new CA certificate file for publishing is at:
    /easy-rsa/easyrsa3/pki/ca.crt
    
    서버 인증서와 개인 키를 만듭니다.
    ./easyrsa build-server-full server nopass
    Using SSL: openssl OpenSSL 0.9.8zh 14 Jan 2016
    Generating a 2048 bit RSA private key
    .....+++
    ....................................+++
    writing new private key to '/easy-rsa/easyrsa3/pki/private/server.key.To4RdoPhw4'
    -----
    Using configuration from /easy-rsa/easyrsa3/pki/safessl-easyrsa.cnf
    Check that the request matches the signature
    Signature ok
    The Subject's Distinguished Name is as follows
    commonName            :ASN.1 12:'server'
    Certificate is to be certified until Dec 22 05:18:37 2021 GMT (1080 days)
    
    Write out database with 1 new entr
    
    클라이언트 인증서와 개인 키를 만듭니다.
    ./easyrsa build-client-full client1 nopass
    
    Using SSL: openssl OpenSSL 0.9.8zh 14 Jan 2016
    Generating a 2048 bit RSA private key
    .........+++
    ......................................................................................................................+++
    writing new private key to '/easy-rsa/easyrsa3/pki/private/client1.key.daPAVRFGmP'
    -----
    Using configuration from /easy-rsa/easyrsa3/pki/safessl-easyrsa.cnf
    Check that the request matches the signature
    Signature ok
    The Subject's Distinguished Name is as follows
    commonName            :ASN.1 12:'client1'
    Certificate is to be certified until Dec 22 05:19:31 2021 GMT (1080 days)
    
    Write out database with 1 new entries
    Data Base Updated
    
    루트 인증서, 서버 인증서 및 서버 비밀 키를 ACM에 복사합니다.
    mkdir ./custom_folder
    cp pki/ca.crt ./custom_folder
    cp pki/issued/server.crt ./custom_folder
    cp pki/private/server.key ./custom_folder
    
    루트 인증서, 서버 인증서, 서버 비밀 키를 ACM에 등록합니다.
    cd ./custom_folder
    aws acm import-certificate --certificate file://server.crt --private-key file://server.key --certificate-chain file://ca.crt --region us-east-1
    {
        "CertificateArn": "arn:aws:acm:us-east-1:******:certificate/27ec60c0-8937-4224-9c05-d88243239fde"
    }
    

    AWS 클라이언트 VPN 끝점 작성


    VPC Dashboard에서 Clent VPN Endpoint 를 클릭합니다.
    Create Center VPN Endpoint 를 클릭합니다.

    Client IPv4CIDR은/22 이상/16 이하로 지정됩니다.
    Server certificate ARN과 Center certificate ARN은 모두 서버 인증서를 지정합니다.
    서버 인증서와 클라이언트 인증서의 루트 인증서가 같습니다.

    로그 설정 및 기타 매개 변수는 필요한 경우 Create Celient VPN Endpoint 를 클릭합니다.


    State는 Pending Associate입니다.VPC(Subnet)를 연결하여 Available로 변경합니다.

    Associations 탭을 클릭하고 Associate를 클릭하십시오.

    Associate 및 Subnet을 클릭합니다.


    Authorization 탭을 클릭하고 Authorize Ingress를 클릭합니다.

    대상 네트워크의 Cidr 를 입력하고 Add authorization rule 을 클릭합니다.


    보안 그룹 설정
    Clinet VPN 설정이 완료됩니다.

    연결 확인


    안전팀의 설정을 실시하다.
    두 개의 관련 안전팀이 있다.VPN Endpoint와 연관된 보안 그룹 및 테스트 객체 EC2 인스턴스와 연관된 보안 그룹입니다.
    시도이므로 source 0.0.0/0으로 설정합니다.
    VPN Enpoint와 연관된 보안 그룹


    테스트 개체 EC2 인스턴스와 연관된 보안 그룹

    OpenVPN 클라이언트를 설치합니다.아래에서 dmg 파일을 다운로드하여 설치합니다.
    https://tunnelblick.net/downloads.html
    VPN Endipoint에서 Client Configuration을 다운로드합니다.

    다운로드한 디렉토리에서 만든 첫 번째 클라이언트 인증서와 클라이언트 기밀 키를 복사합니다.
    $ pwd
    /easy-rsa/easyrsa
    $ cp pki/private/client1.key /Downloads/
    $ cp pki/issued/client1.crt /Downloads/
    
    다운로드한 Client Configuration에 다음 항목을 추가합니다.
    cert client1.crt
    key client1.key
    
    연결을 확인합니다.브라우저에 EC2 인스턴스의 Private IP 주소를 입력합니다.
    접속할 수 없음을 확인합니다.

    VPN 연결을 수행합니다.


    configuration 파일을 왼쪽 창으로 드래그한 다음 Connect 를 클릭합니다.

    초록색으로 변하면 돼요.

    브라우저에 EC2 인스턴스의 Private IP 주소를 입력합니다.
    Welcome 페이지가 표시되는지 확인합니다.

    언약


    투고 내용은 제 개인적인 의견으로 소속 기업과 부서의 견해를 대표하지 않습니다.

    좋은 웹페이지 즐겨찾기