93
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. アマゾン ウェブ サービス ジャパン株式会社 2018 / 01 / 23 Amazon WorkSpaces 多要素認証による Amazon WorkSpaces の利用

多要素認証による Amazon WorkSpaces の利用

Embed Size (px)

Citation preview

Page 1: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

アマゾン ウェブ サービス ジャパン株式会社

2018 / 01 / 23

Amazon WorkSpaces

多要素認証による Amazon WorkSpaces の利用

Page 2: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Agenda

1. 多要素認証について

2. FreeRADIUS と Google Authenticator

3. Duo Security

Page 3: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

多要素認証

Page 4: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

多要素認証とは

本人しか知りえないこと

本人しか持ちえないもの

本人しか備ええないもの

これらのうちの2つ以上を組み合わせた認証方式が多要素認証(Multi-Factor Authentication)

パスワードやPINトークンスマートカードなど

指紋、虹彩などの生体的要素

Page 5: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Amazon WorkSpaces における多要素認証の仕組み (概略)

RADIUS

Directory Services

Amazon WorkSpaces

クライアント端末

Page 6: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

MFA ソリューションの使い分け

- Username- Password- One Time Password

DUO を利用

- Username- Password- One Time Password

FreeRADIUS + Google Authenticator を利用

- 外部サービスのため、ユーザー数と利用月数に応じて別途課金される

- RADIUS は DUO を利用するため可用性の高い構成を組むことが比較的容易

- RADIUSやMFAサーバーをオンプレミスまたはEC2上に構成するため、認証基盤をAWS内に閉じることが可能

- RADIUSのアカウントは Linux のローカルアカウントとして登録が必要なため、ユーザー管理が冗長になる

RADIUS+ MFA Server

AuthenticationProxy

RADIUS + MFA Service

Directory ServicesDirectory Services

Page 7: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

FreeRADIUS と Google Authenticator を用いたMFAの実装

Page 8: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

本資料での構成

10.0.2.0/24(Corp1-NAT1)

10.0.3.0/24(Corp1-NAT2)

10.0.0.0/24(Corp1-Public1)

10.0.1.0/24(Corp1-Public2)

Availability Z

one A

Availability Z

one C

Remote Desktop

踏み台兼WorkSpaces クライアント

RADIUS 兼 MFA Server10.0.2.170

Private SubnetPublic Subnet

example.local

Destination Target

10.0.0.0/16 local

0.0.0.0/0 NATGW

Destination Target

10.0.0.0/16 local

0.0.0.0/0 IGW

Public Subnet Private Subnet

Page 9: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

本資料での前提条件

• 東京リージョンを利用• Amazon VPC

• CIDR : 10.0.0.0/16

• サブネット• Public : 10.0.0.0/24, 10.0.1.0/24• Private : 10.0.2.0/24, 10.0.3.0/24• 10.0.0.0/24 と 10.0.2.0/24 は “ap-northeast-1a” に作成• 10.0.1.0/24 と 10.0.3.0/24 は “ap-northeast-1c” に作成

• ルートテーブル• Public Subnet はインターネット ゲートウェイを介してインターネット接続可能なように構成• Private Subnet は NAT ゲートウェイを介してインターネット接続可能なように構成

• NAT Gateway• Public Subnet に配置

• Microsoft AD• ドメイン名 : “example.local”• Private サブネットに作成

• 踏み台用 EC2 インスタンス• Windows Server 2016• WORKGROUP で構成• Public Subnet に作成

• “example.local” に参加済みの WorkSpaces x 1• ユーザー名 : “testuser01”※自動的に Microsoft AD が配置されている 2 つのサブネットが任意に選定されて配置されます

• RADIUS サーバー兼 MFA サーバー用途の Amazon Linux x 1• Private サブネットに作成

Page 10: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

利用する EC2 インスタンスの構成 (1)

設定項目 踏み台兼 WorkSpaces クライアント

OS Windows Server 2016

所属先サブネット Public Subnet

ドメイン参加 なし

ソフトウェア WorkSpaces クライアント、SSHクライアント

セキュリティグループ アウトバウンドルール インバウンドルール

プロトコル ポート範囲 送信先 備考 プロトコル ポート範囲 送信元 説明

TCP 443 10.0.0.0/16 WorkSpaces クライアント要件 TCP 3389 0.0.0.0/0 リモートデスクトップ接続

UDP 4172 10.0.0.0/16

TCP 4172 10.0.0.0/16

TCP 22 10.0.0.0/16 RADIUSサーバーへのSSH接続

Page 11: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

利用する EC2 インスタンスの構成 (2)

設定項目 RADIUS 兼 MFA サーバー

OS Amazon Linux

所属先サブネット Private Subnet

ドメイン参加 なし

ソフトウェア ※後述のため省略

セキュリティグループ アウトバウンドルール インバウンドルール

プロトコル ポート範囲 送信先 備考 プロトコル ポート範囲 送信元 説明

TCP 443 0.0.0.0/0 ソフトウェアインストール UDP 1812 10.0.0.0/16 RADIUS認証

TCP 22 10.0.0.0/16 踏み台からの通信

Page 12: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Microsoft AD の IP アドレスの確認

1. [Directories] をクリック

2. [DNS address] に記載されている IP アドレスを控えます

Page 13: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Step1. RADIUS および MFA サービスの設定

Page 14: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

FreeRADIUS と Google Authenticator のインストール

(1) RADIUS兼MFAサーバーに ssh でログインします

(2) 下記のコマンドを実行して、 FreeRADIUS と Google Authenticator をインストールします

$ ssh [email protected]

$ sudo yum -y install freeradius freeradius-utils google-authenticator

Page 15: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

RAIDUS 経由の認証を許可するグループの作成

$ sudo groupadd radius-enabled

下記のコマンドを実行してグループを作成します

Page 16: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

ネットワークの設定 (1)

$ sudo vi /etc/sysconfig/network

NETWORKING=yesHOSTNAME=localhost.localdomainNOZEROCONF=yes

NETWORKING=yesHOSTNAME=radius.example.localNOZEROCONF=yes

下記の様に変更し、保存します

/etc/sysconfig/network の編集

Page 17: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

ネットワークの設定 (2)

$ sudo vi /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost6 localhost6.localdomain6

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost6 localhost6.localdomain610.0.2.170 radius.example.local

下記の様に変更し、保存します

/etc/hosts の編集

Page 18: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

FreeRADIUS の設定 (1)

$ sudo vi /etc/raddb/radiusd.conf

user = radiusdgroup = radiusd

user = rootgroup = root

下記の様に変更し、保存します

/etc/raddb/radiusd.conf の編集

PAM を使って認証を行うため、 root ユーザーで動作させる必要があります。設定を変更して、 root ユーザーで起動するようにします。

該当箇所

Page 19: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

FreeRADIUS の設定 (2)

$ sudo vi /etc/raddb/users

#DEFAULT Group == "disabled", Auth-Type := Reject# Reply-Message = "Your account has been disabled."#

DEFAULT Group != "radius-enabled", Auth-Type := RejectReply-Message = "Your account has been disabled."

DEFAULT Auth-Type := PAM

/etc/raddb/users の編集

“radius-enabled” グループに所属するユーザーのみ RADIUS 認証可能、かつ認証の際は PAM を使うように設定します。

下記を追記して保存します

Page 20: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

FreeRADIUS の設定 (3)

$ sudo vi /etc/raddb/sites-available/default

## Pluggable Authentication Modules.

# pam

/etc/raddb/sites-available/default の編集

default ファイルの編集

既定の設定

## Pluggable Authentication Modules.pam

コメントアウトを外して下記の様に編集し、保存します

Page 21: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

FreeRADIUS の設定 (4)

$ sudo vi /etc/pam.d/radiusd

#%PAM-1.0auth include password-authaccount required pam_nologin.soaccount include password-authpassword include password-authsession include password-auth

/etc/pam.d/radiusd の編集

FreeRADIUS が PAM で認証する際に、Google Authenticator の PAM モジュールを使うように設定します。

既定の設定

#%PAM-1.0#auth include password-auth#account required pam_nologin.so#account include password-auth#password include password-auth#session include password-authauth requisite pam_google_authenticator.soaccount required pam_permit.sosession required pam_permit.so

既存設定をコメントアウトし、下記の様に編集します

Page 22: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

FreeRADIUS の設定 (5)

$ sudo vi /etc/raddb/clients.conf

client 10.0.0.0/16 {secret = P@ssw0rd!shortname = from-vpc

}

/etc/raddb/clients.conf の編集

FreeRADIUS が RADIUS プロトコルで接続を受け付ける RADIUS クライアントとの接続情報を設定します。ここでは RADIUS クライアントは Microsoft AD です。

10.0.0.0/16 のセグメントに存在するRADIUS クライアントからの接続を受け付けるように下記を追記します。 “secret” に記載したパスワードは後で利用するので控えておきます。

Page 23: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

FreeRADIUS の起動

sudo chkconfig --level 345 radiusd onsudo /etc/init.d/radiusd startStarting radiusd: [ OK ]

下記のコマンドを実行して RADIUS を起動します

Page 24: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

ユーザー登録 (1)

useradd -g radius-enabled testuser01sudo -u testuser01 /usr/bin/google-authenticator

Do you want authentication tokens to be time-based (y/n) y(時刻ベースの認証トークンを使用しますか?)https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/testuser01@ip-10-0-2-170%3Fsecret%3DTN7QSETJOB7SHSUMYour new secret key is: TN7QSETJOB7SHSUMYour verification code is 284535Your emergency scratch codes are:

5916861039306435397104433864190931118666

Google Authenticator の PAM モジュールを使う場合は、Active Directory と同名のユーザを作成した上で、Google Authenticatorのユーザ設定を行う必要があります。 下記では “testuser01” というユーザーで登録しています

2. この URL にアクセスすると QR コードが表示されます

1. “y” と入力して Enter を押下します

Page 25: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

ユーザー登録 (2)

Do you want me to update your "/home/testuser01/.google_authenticator" file (y/n) y("/home/XXXXXX/.google_authenticator" ファイルを更新しますか? ※更新しなければ表示されているQRコードでログインできません。)

Do you want to disallow multiple uses of the same authenticationtoken? This restricts you to one login about every 30s, but it increasesyour chances to notice or even prevent man-in-the-middle attacks (y/n) y(同じ認証トークンを複数回利用するのを禁止しますか?この制限により、30秒に1回しかログインできなくなりますが、中間者攻撃に気づいたり禁止できる可能性が高まります。)

By default, tokens are good for 30 seconds and in order to compensate forpossible time-skew between the client and the server, we allow an extratoken before and after the current time. If you experience problems with poortimesynchronization, you can increase the window from its defaultsize of 1:30min to about 4min. Do you want to do so (y/n) y(デフォルトでは、トークンは30秒ごとになっており、クライアントとサーバの時刻がずれていても対応できるように、現在時刻より1つ前や後のトークンでも許可します。もし、時刻同期の状況が悪く問題があれば、デフォルトの1分半のウィンドウを約4分まで広げることができます。行いますか?)

If the computer that you are logging into isn't hardened against brute-forcelogin attempts, you can enable rate-limiting for the authentication module.By default, this limits attackers to no more than 3 login attempts every 30s.Do you want to enable rate-limiting (y/n) y(ログインするコンピュータが総当たり攻撃に対して保護されていなければ、認証モジュールで回数制限を行うことができます。この制限ではデフォルトで30秒に3回より多くログインを試すことができないよう制限します。回数制限を実施しますか?)

Page 26: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Google Authenticator で取り込み

スマートフォンの Google Authenticator アプリケーションで QR コードを取り込みます。

Page 27: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

補足事項

$ sudo vi /home/testuser01/.google_authenticator

TN7QSETJOB7SHSUM" RATE_LIMIT 3 30" WINDOW_SIZE 17" DISALLOW_REUSE" TOTP_AUTH5916861039306435397104433864190931118666

複数台のスマートフォンに同じユーザーの情報を登録する場合は、各ユーザーのディレクトリ直下にある“.google_authenticator” ファイルの先頭行を Google Authenticator に登録します。

万一スマートフォンを紛失した場合は、“.google_authenticator” ファイルをリネームまたは削除することでワンタイムパスワードが使えないようにすることができます。

Page 28: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

RADIUS サーバーのテスト

$ radtest testuser01 737345 10.0.2.170:1812 10 P@ssw0rd!Sending Access-Request of id 149 to 10.0.2.170 port 1812

User-Name = "testuser01"User-Password = "737345"NAS-IP-Address = 10.0.2.170NAS-Port = 10Message-Authenticator = 0x00000000000000000000000000000000

rad_recv: Access-Accept packet from host 10.0.2.170 port 1812, id=149, length=20

下記のコマンドを実行して RADIUS を起動します

$ radtest (1) (2) (3):1812 10 (4)

(1) ユーザー名(2) ワンタイムパスワード(3) RADIUSサーバーの IP アドレス(4) “/etc/raddb/clients.conf” に設定した “secret” の値

実行例

Page 29: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Step2. Directory Services への設定

Page 30: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services のセキュリティ グループ変更 (1)

Microsoft AD に割り当てられているセキュリティ グループは既定では Directory Services からアウトバウンド向けに RADIUS で使われる “UDP 1812” が解放されていません。

そのため、この状態で RADIUS サーバーを登録しようとしても失敗します。

Page 31: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services のセキュリティ グループ変更 (2)

[WorkSpaces] をクリック

Page 32: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services のセキュリティ グループ変更 (3)

1. [ディレクトリ] をクリック

2. 対象のディレクトリの [セキュリティグループ] に記載されている ID を控えます

Page 33: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services のセキュリティ グループ変更 (4)

1. [セキュリティグループ] をクリック

2. 控えたセキュリティ グループの ID を入力してフィルタリング

3. [アウトバウンド] を選択

4. [編集] をクリック

Page 34: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services のセキュリティ グループ変更 (5)

1. [ルールの追加] をクリック

2. 各項目を下記の様に指定タイプ: カスタム UDPポート範囲: 1812送信先: カスタム、10.0.0.0/16

3. [保存] をクリック

Page 35: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services のセキュリティ グループ変更 (6)

新しく追加されたことを確認

Page 36: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services を開く

[Directory Service] をクリック

Page 37: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

対象の Directory ID の詳細表示

1. [ディレクトリ] をクリック

2. ディレクトリ ID のリンクをクリック

Page 38: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

RADIUS サーバーの情報を設定

1. [多要素認証] タブをクリック

2. [多要素認証の有効化] にチェックを入れる

3. 各項目に入力- RADIUS サーバーの IP アドレス- ポート : 1812- 共有シークレットコード : P@ssw0rd!- 共有シークレットコードの確認 : P@ssw0rd!- プロトコル : PAP- サーバータイムアウト (秒単位) : 30 (例)- 最大再試行回数 : 5 (例)

4. [ディレクトリの更新] をクリック

Page 39: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

完了済みになることを確認

“完了済み” になる事を確認

※処理完了までに1分ほどかかります

Page 40: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Step3. WorkSpaces クライアントからの接続

Page 41: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

接続先ディレクトリ サービスの登録コードの確認

1. [WorkSpaces] をクリック

2. [登録コード] を控えます

Page 42: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

登録コードの登録

1. WorkSpaces クライアントを起動して控えた登録コードを入力し、[登録] をクリックします

2. ログイン画面が表示されるので、“MFAコード” と書かれた枠が表示されていることを確認します

Page 43: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

ログイン

1. “ユーザー登録 (1)” のスライド内で登録したユーザーとパスワード、およびスマートフォンの Google Authenticator のアプリケーションに表示されているワンタイムパスワードを入力し、 [サインイン] をクリック

2. 必要に応じてクリックします

Page 44: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

WorkSpaces の表示

Page 45: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

DUO を利用した MFA 構成

Page 46: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

“DUO” とは

• SaaS 型の認証サービス

• 多要素認証や SSO などのサービスを提供

• AWS の認証にも利用可能

• ユーザー数と利用するサービスの組み合わせにより課金される仕組み

https://duo.com

Page 47: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

DUO による MFA の仕組み

Page 48: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

本資料での前提条件

• 本項に記載の内容は、下記にも記載されていますので、必要に応じてご参照くださいhttps://duo.com/docs/awsworkspaces

• Duo のアカウントは作成済みであることとします• 下記のリソースは作成済みであるものとします

• 東京リージョンを利用• Amazon VPC

• CIDR : 10.0.0.0/16

• サブネット• Public : 10.0.0.0/24, 10.0.1.0/24• Private : 10.0.2.0/24, 10.0.3.0/24• 10.0.0.0/24 と 10.0.2.0/24 は “ap-northeast-1a” に作成• 10.0.1.0/24 と 10.0.3.0/24 は “ap-northeast-1c” に作成

• ルートテーブル• Public Subnet はインターネット ゲートウェイを介してインターネット接続可能であるように構成• Private Subnet は NAT ゲートウェイを介してインターネット接続可能であるように構成

• NAT Gateway• Public Subnet に配置

• Microsoft AD• ドメイン名 : “sandbox.local”• Private サブネットに作成

• 踏み台用 EC2 インスタンス• Windows Server 2016• WORKGROUP で構成

• “sandbox.local” に参加済みの WorkSpaces x 1• ユーザー名 : “testuser01”

• Authentication Proxy 用途の Amazon Linux x 1• Private サブネットに作成

Page 49: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

本資料での構成

10.0.2.0/24

10.0.3.0/24

10.0.0.0/24

10.0.1.0/24

Availability Z

one A

Availability Z

one C

RDP

踏み台兼WorkSpaces クライアント

AuthenticationProxy

Private SubnetPublic Subnet

sandbox.local

Destination Target

10.0.0.0/16 local

0.0.0.0/0 NATGW

Destination Target

10.0.0.0/16 local

0.0.0.0/0 IGW

Public Subnet Private Subnet

NAT GW

IGW

トークン生成

MFA認証

Page 50: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

利用する EC2 インスタンスの構成 (1)

設定項目 踏み台兼 WorkSpaces クライアント

OS Windows Server 2016

所属先サブネット パブリックサブネット

ドメイン参加 なし

ソフトウェア WorkSpaces クライアント、SSHクライアント

セキュリティグループ アウトバウンドルール インバウンドルール

プロトコル ポート範囲 送信先 備考 プロトコル ポート範囲 送信元 説明

TCP 443 10.0.0.0/16 WorkSpaces クライアント要件 TCP 3389 0.0.0.0/0 リモートデスクトップ接続

UDP 4172 10.0.0.0/16

TCP 4172 10.0.0.0/16

TCP 22 10.0.0.0/16 RADIUSサーバーへのSSH接続

Page 51: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

利用する EC2 インスタンスの構成 (2)

設定項目 Authentication Proxy

OS Amazon Linux

所属先サブネット プライベートサブネット

ドメイン参加 なし

ソフトウェア ※後述のため省略

セキュリティグループ アウトバウンドルール インバウンドルール

プロトコル ポート範囲 送信先 備考 プロトコル ポート範囲 送信元 説明

TCP 443 0.0.0.0/0 ソフトウェアインストールDUOへの接続

UDP 1812 10.0.0.0/16 RADIUS認証

TCP 22 10.0.0.0/16 踏み台からの通信

Page 52: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Step1. DUO の設定

Page 53: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

DUO の管理画面にログイン

Web ブラウザで https://admin.duosecurity.com/login?next=%2F にアクセスしてログインします

Page 54: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

ワンタイムパスワードを入力してログイン

“Text Me” をクリックして登録時に指定した電話番号宛にSMSでワンタイムパスワードを送付 送られてきたワンタイムパスワードを入力して “Submit”

Page 55: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

RADIUS アプリケーションの作成 (1)

1. [Applications] をクリック

2. [Protect an Application] をクリック

Page 56: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

RADIUS アプリケーションの作成 (2)

1. 検索窓で “RADIUS” と入力して検索

2. “RADIUS” の [Protect this Application] をクリック

Page 57: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

RADIUS アプリケーションの作成 (3)

“Integration key”, “Secret key”, “API hostname” の 3 つを控えます

Page 58: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

認証対象ユーザーの作成 (1)

2. [Add User] をクリック

1. [Users] をクリック

Page 59: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

認証対象ユーザーの作成 (2)

1. WorkSpaces のユーザー名 (sandbox\testuser01というユーザーの場合は、 “testuser01” のみ) を入力

2. [Add User] をクリック

Page 60: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

スマートフォンの登録と Duo Mobile アプリの登録 (1)

画面下部

1. 作成したユーザーの設定ページが開きます

2. [Add Phone] をクリックします

Page 61: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

スマートフォンの登録と Duo Mobile アプリの登録 (2)

1. [Phone] を選択します

2. 電話番号を国番号を付与して入力します

3. [Add Phone] をクリックします

Page 62: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

スマートフォンの登録と Duo Mobile アプリの登録 (3)

[Activate Duo Mobile] をクリックします

Page 63: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

スマートフォンの登録と Duo Mobile アプリの登録 (4)

[Generate Duo Mobile Activation Code] をクリックします

Page 64: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

スマートフォンの登録と Duo Mobile アプリの登録 (5)

[Send Instructions by SMS] をクリックします

Page 65: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

スマートフォンの登録と Duo Mobile アプリの登録 (6)

1. リンクをクリックします

2. [開く] をクリックします

3. Duo Mobile のアプリが開き、鍵が登録されます

あらかじめ Duo Mobile のアプリをスマートフォンにインストールしておきます

Page 66: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

スマートフォンの登録と Duo Mobile アプリの登録 (6)

デバイス情報等が登録されていることを確認します

Page 67: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Step2. Authentication Proxy の構築と設定

Page 68: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Authentication Proxy のモジュールをインストール (1)

(1) Authentication Proxy 用の EC2 インスタンスに ssh でログインします

(2)下記のコマンドを実行して、Authentication Proxy のモジュールをインストールするために必要なモジュールをダウンロード/インストールします

(3) Python のバージョンが2.6 または 2.7 であることを確認します

$ ssh [email protected]

$ sudo yum install gcc make openssl-devel python-devel libffi-devel

$ python --version

Page 69: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Authentication Proxy のモジュールをインストール (2)

(1) Authentication Proxy のモジュールをダウンロードして解凍し、インストールを行います

$ wget https://dl.duosecurity.com/duoauthproxy-latest-src.tgz$ tar xzf duoauthproxy-latest-src.tgz

$ lsduoauthproxy-2.6.0-src duoauthproxy-latest-src.tgz$ cd duoauthproxy-2.6.0-src$ export PYTHON=python$ make

(2) 解凍されたモジュールが格納されたディレクトリを確認し、ビルドします

Page 70: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Authentication Proxy のモジュールをインストール (3)

(1) ビルドしたモジュールの格納先に移動し、インストールを行います。途中の選択肢はデフォルトのまま Enter で進みます

$ cd duoauthproxy-build$ sudo ./install

In what directory do you wish to install the Duo Authentication Proxy?[/opt/duoauthproxy]

Enter the name of a user account under which the Authentication Proxy should be run:[nobody]

Copying files... Done.

Create an initialization script to run the proxy upon startup? [yes/no] yes

Installation completed. Before starting the Authentication Proxy,Please edit the configuration file at:

/opt/duoauthproxy/conf/authproxy.cfg

Page 71: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

設定ファイルの編集

(1) authproxy.cfg を編集します

$ sudo vi /opt/duoauthproxy/conf/authproxy.cfg

Page 72: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

[ad_client] セクションをコメントアウト

[ad_client]

; The hostname or IP address of your domain controller

host=

; Username of the account that will read from your Active Directory database

service_account_username=

; Password corresponding to service_account_username

service_account_password=

; The LDAP distinguished name of an AD or OU containing all of the users you

; wish to permit to log in

search_dn=

[ad_client]

; The hostname or IP address of your domain controller

; host=

; Username of the account that will read from your Active Directory database

; service_account_username=

; Password corresponding to service_account_username

; service_account_password=

; The LDAP distinguished name of an AD or OU containing all of the users you

; wish to permit to log in

; search_dn=

既定の設定

編集後の設定

Page 73: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

[duo_only_client] セクションのコメントアウトを外す

;[duo_only_client]

[duo_only_client]

既定の設定

編集後の設定

Page 74: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

[radius_server_auto] セクションをコメントアウトする

[radius_server_auto]

; Your Duo integration key

; ikey=

; Your Duo secret key

; skey=

; Your Duo API hostname (e.g. "api-XXXX.duosecurity.com")

; api_host=

; The IP address or IP range of the device(s) or application(s) that will be

; contacting the authentication proxy via RADIUS

; radius_ip_1=

; A shared secret that you'll enter both here and in the configuration of the

; device(s) or application(s) with the corresponding radius_ip_x value. We

; recommend as strong a password as possible. (max 128 chars)

; radius_secret_1=

; Protocol followed in the event that Duo services are down.

; Safe: Authentication permitted if primary authentication succeeds

; Secure: All authentication attempts will be rejected

; failmode=safe

; Mechanism the Auth Proxy should use to perform primary auth. Should correspond

; with a "client" section elsewhere in this configuration file

; client=ad_client

; Port on which to listen for incoming RADIUS Access Requests

; port=1812

Page 75: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

[radius_server_duo_only] セクションに設定を記入する

; Include radius_server_duo_only when primary auth is handled elsewhere and you want

; to submit the passcode or factor choice as the RADIUS password field

; Config Options: https://duo.com/docs/authproxy_reference#radius-duo-only

[radius_server_duo_only]

ikey=DIIAPP0H1JJAX4L23ZNV

skey=rJyw40td00THZNuV50cLB4Y6VrnWitXSxmwmDo5J

api_host=api-0a1086d6.duosecurity.com

radius_ip_1=10.0.2.199

radius_ip_2=10.0.3.118

radius_secret_1=P@ssw0rd!

radius_secret_2=P@ssw0rd!

client=duo_only_client

https://duo.com/docs/awsworkspaces#configure-the-proxy-for-your-aws-directory

“設定値の確認” で控えた値ikey : Integration Keyskey : Secret Keyapi_host : API Hostname

Directory Services の DNS アドレス

Directory Services への多要素認証設定時に割り当てるパスワード。同じものを設定する

Page 76: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Authentication Proxy の起動

$ sudo /opt/duoauthproxy/bin/authproxyctl start

$ sudo /opt/duoauthproxy/bin/authproxyctl status

duoauthproxy (pid xxxxx) is running

Root 権限で起動します

ステータスの確認

Page 77: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Step3. Directory Services の設定

Page 78: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services のセキュリティ グループ変更 (1)

Microsoft AD に割り当てられているセキュリティ グループは既定では Directory Services からアウトバウンド向けに RADIUS で使われる “UDP 1812” が解放されていません。

そのため、この状態で RADIUS サーバーの登録を行っても失敗します。

Page 79: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services のセキュリティ グループ変更 (2)

[WorkSpaces] をクリック

Page 80: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services のセキュリティ グループ変更 (3)

1. [ディレクトリ] をクリック

2. 対象のディレクトリの [セキュリティグループ] に記載されている ID を控えます

Page 81: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services のセキュリティ グループ変更 (4)

1. [セキュリティグループ] をクリック

2. 控えたセキュリティ グループの ID を入力してフィルタリング

3. [アウトバウンド] を選択

4. [編集] をクリック

Page 82: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services のセキュリティ グループ変更 (5)

1. [ルールの追加] をクリック

2. 各項目を下記の様に指定タイプ: カスタム UDPポート範囲: 1812送信先: カスタム、10.0.0.0/16

3. [保存] をクリック

Page 83: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services のセキュリティ グループ変更 (6)

新しく追加されたことを確認

Page 84: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services の構成 (1)1. Directory Services のマネジメント コンソールを開きます

2. [ディレクトリ] をクリック

3. MFA 設定対象の Directory ID のリンクをクリック

Page 85: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services の構成 (2)

[多要素認証] タブをクリック

Page 86: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services の構成 (3)

1. [多要素認証の有効化] をクリック2. Authentication Proxy の IP アドレスを指定します。複数ある場合はカンマ区切りで指定します。

3. 既定値の “1812” とします

4. “[radius_server_duo_only] セクションに設定を記入する” で “radius_secret_1” および“radius_secret_2” に設定した値を記述します

5. “PAP” を選択します

6. “サーバータイムアウト” x “最大試行回数” が 60 より大きくなるように設定します。タイムアウトは 20 以上を指定します 7. [ディレクトリの更新] をクリックします

Page 87: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Directory Services の構成 (4)

[完了済み] になることを確認します

Page 88: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Step4. WorkSpaces の登録

Page 89: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

登録コードの確認

1. WorkSpaces をクリックします

2. 対象の WorkSpaces の [登録コード] を控えます

Page 90: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

WorkSpaces の登録とログイン

1. 控えた登録コードを入力します

2. [登録] をクリックします

3. ユーザーのアカウントとパスワードを入力します

4. Duo Mobile を開き、 鍵マークをクリックし、表示された数字を入力します

5. [サインイン] をクリックします

Page 91: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

WorkSpaces のデスクトップ表示

Page 92: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Appendix. 補足事項

Page 93: 多要素認証による Amazon WorkSpaces の利用

© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Authentication Proxy のログ確認

$ tail -f /opt/duoauthproxy/log/authproxy.log

2017-11-28T08:27:51+0000 [DuoForwardServer (UDP)] Sending request from 10.0.2.199 to radius_server_duo_only2017-11-28T08:27:51+0000 [DuoForwardServer (UDP)] Received new request id 3 from ('10.0.2.199', 59920)2017-11-28T08:27:51+0000 [DuoForwardServer (UDP)] (('10.0.2.199', 59920), 3): login attempt for username u'testuser01'2017-11-28T08:27:51+0000 [DuoForwardServer (UDP)] http POST to https://api-0a1086d6.duosecurity.com:443/rest/v1/preauth2017-11-28T08:27:51+0000 [duoauthproxy.lib.http._DuoHTTPClientFactory#info] Starting factory <_DuoHTTPClientFactory: https://api-0a1086d6.duosecurity.com:443/rest/v1/preauth>2017-11-28T08:27:52+0000 [HTTPPageGetter (TLSMemoryBIOProtocol),client] (('10.0.2.199', 59920), 3): Got preauth result for: u'auth'2017-11-28T08:27:52+0000 [HTTPPageGetter (TLSMemoryBIOProtocol),client] http POST to https://api-0a1086d6.duosecurity.com:443/rest/v1/auth2017-11-28T08:27:52+0000 [duoauthproxy.lib.http._DuoHTTPClientFactory#info] Starting factory <_DuoHTTPClientFactory: https://api-0a1086d6.duosecurity.com:443/rest/v1/auth>2017-11-28T08:27:52+0000 [duoauthproxy.lib.http._DuoHTTPClientFactory#info] Stopping factory <_DuoHTTPClientFactory: https://api-0a1086d6.duosecurity.com:443/rest/v1/preauth>2017-11-28T08:27:52+0000 [HTTPPageGetter (TLSMemoryBIOProtocol),client] (('10.0.2.199', 59920), 3): Duo authentication returned 'allow': 'Success. Logging you in...'2017-11-28T08:27:52+0000 [HTTPPageGetter (TLSMemoryBIOProtocol),client] (('10.0.2.199', 59920), 3): Returning response code 2: AccessAccept2017-11-28T08:27:52+0000 [HTTPPageGetter (TLSMemoryBIOProtocol),client] (('10.0.2.199', 59920), 3): Sending response2017-11-28T08:27:52+0000 [duoauthproxy.lib.http._DuoHTTPClientFactory#info] Stopping factory <_DuoHTTPClientFactory: https://api-0a1086d6.duosecurity.com:443/rest/v1/auth>

“/opt/duoauthproxy/log/authproxy.log” で、Directory Services との接続や WorkSpaces の認証に関するログなどを確認することができます下記の例では、 WorkSpaces へのログインの過程をトラックしています。