Más contenido relacionado La actualidad más candente (20) Similar a 【第20回セキュリティ共有勉強会】Amazon FSx for Windows File Serverをセキュリティ観点で試してみたお話 (20) Más de Hibino Hisashi (19) 【第20回セキュリティ共有勉強会】Amazon FSx for Windows File Serverをセキュリティ観点で試してみたお話1. Amazon FSx for Windows File Server
をセキュリティ観点で試してみたお話
2018/12/22(土)
第20回セキュリティ共有勉強会
日比野 恒
2. 自己紹介
名前:日比野 恒 (ひびの ひさし)
所属:有給消化中のなんちゃってニート
セキュリティアーキテクト (CISSP、CISA、情報処理安全確保支援士)
その他:日本Elasticユーザーグループ(JEUG)のオーガナイザー
オープンな技術 オープンな環境×
【オープンSIEM構想】
「オープンな技術」や「オープンな環境」でSIEMを作りたい!!
「個人の知見やスキルは、社会の利益のために使われるべき」というマインド
4. 今回、検証で確認しかったこと
✓ FSx for Windows File Serverでフォルダやファイルに対する監査ログがどこまで取れるのか
✓ CloudWatchLogs InsightでElasticsearch Serviceと同じように監査が出来るのか
※本日は時間の関係でこちらはまた別の機会に(笑)
5. Amazon FSx for Windows FileServerとは
新発表 – Amazon FSx for Windows ファイルサーバー – 高速・完全マネージド型・セキュアなファイルサーバー
https://aws.amazon.com/jp/blogs/news/new-amazon-fsx-for-windows-file-server-fast-fully-managed-and-secure/
✓ AWS環境で利用出来るフルマネージド型のWindowsネイティブのファイルサーバサービス
✓ 現時点では、US East (N. Virginia)、US East (Ohio)、US West (Oregon)、Europe (Ireland)で利用可能
✓ 前提として、AWS Managed Microsoft AD(Active Directory)環境が必須
✓ Multi-AZ対応する場合は、複数AZにFileSystemを作成して自前でDFSレプリケーション等を設定
✓ FileSystemのバックアップ(VSSによるスナップショット)は自動で取得してくれる
✓ FileSystem作成後にスループットやディスク容量を設定変更することが出来ない
✓ Security Groupによる通信制御、Windows ACLによるオブジェクト操作制御が可能
✓ FSxに対する管理アクティビティは、AWS CloudTrailにロギングされる
7. こんな感じの構成で検証してみた
Amazon FSx for
Windows File Server
VPC (172.31.0.0/16)
AWS Region @US East1(N. Virginia)
Join a Domain
Join a Domain
Logging
Visualize
RDP
Data Analytics
Data Lake
EC2
(Windows)
FSx for Windows File Serverには
AWS Directory ServiceのMicrosoft ADが必須というツラミ
8. サクッと環境構築出来るはずが...
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action":[
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
"ec2:CreateNetworkInterface",
"ec2:DescribeNetworkInterfaces",
"ec2:DeleteNetworkInterface“
],
"Resource": "*“
},
{
"Effect": "Allow",
"Action": "es:ESHttpPost",
"Resource": "arn:aws:es:*:*:*“
}
]
}
IAMポリシーに「AWSLambdaVPCAccessExecutionRole」を
追加しているにも関わらず、ポリシーに権限が足りないと怒られるという...
10. ゆえにこんな構成となってしまった(笑)
Amazon FSx for
Windows File Server
EC2
(Windows)
Join a Domain
Join a Domain
Logging
Visualize
RDP
Data Analytics
Data Lake
EC2
(AmazonLinux2)
泣く泣くEC2で
Logstashを作ることに...
input cloudwatch_logs
output amazon_es
VPC (172.31.0.0/16)
AWS Region @US East1(N. Virginia)
11. 環境構築の大まかな流れ
【Step1】
AWS Directory Service
でMicrosoft ADを作成
【Step2】
EC2でWindowsサーバを
構築(ファイル操作用マシン)
【Step3】
Amazon FSx for Windows
File ServerでFileSystem
を構築
【Step4】
S3でBucketを作成
(CloudTrail証跡用)
【Step5】
CloudWatchLogsで
ロググループを作成
(CloudTrail証跡用)
【Step6】
CloudTrailの証跡を作成
(US-East1 Region用)
【Step7】
Amazon Elasticsearch
Serviceでクラスタを作成
【Step8】
EC2でLogstashサーバを
構築(ログ連携用)
12. 【参考】今回利用したLogstash.conf
input {
cloudwatch_logs {
region => "us-east-1"
log_group => [ "AWS_CloudTrailLogs" ]
sincedb_path => "/var/lib/logstash/sincedb_cloudtrail"
}
}
filter {
json {
source => "message"
}
date {
match => [ “eventtime", "ISO8601" ]
target => "@timestamp"
}
mutate {
remove_field => [ "message", “eventtime” ]
}
}
output {
amazon_es {
hosts => ["vpc-secfsx-wl2gm3d7lwjqw3l2ecb2tl24am.us-east-1.es.amazonaws.com"]
region => "us-east-1"
index => "cloudtrail-%{+YYYY.MM.dd}"
}
}
Amazon ESのVPC エンドポイントのFQDNを指定
※input cloudwatch_logs pluginとoutput amazon_es pluginは、Logstashインストール後に別途インストール済み
13. Amazon FSx APIについて
Amazon FSx API Reference
https://docs.aws.amazon.com/ja_jp/fsx/latest/APIReference/welcome.html
No API名(eventName) 概要
1 CreateBackup Windows FileSystemのバックアップを作成する。
2 CreateFileSystem Windows FileSystemを作成する。
3 CreateFileSystemFromBackup 作成済みのバックアップからFileSystemをリストアする。
4 DeleteBackup 作成済みのバックアップを削除する。
5 DeleteFileSystem 作成済みのWindows FileSystemを削除する。
6 DescribeBackups 作成済みのバックアップの一覧を参照する。
7 DescribeFileSystems 作成済みのFileSystemの一覧を参照する。
8 ListTagsForResource 作成済みのFileSystemおよびバックアップのタグの一覧を参照する。
9 TagResource FSxリソースのARNにタグを付与する。
10 UntagResource FSxリソースのARNからタグを解除する。
11 UpdateFileSystem FileSystemの構成情報の設定を変更する。
14. 検証シナリオとその結果
No 検証シナリオ 結果
1 AWSコンソールでFSxのFileSystemを作成する。 CloudTrailで「CreateFileSystem」のログ記録あり。
2 AWSコンソールで作成したFileSystemの構成情報を参照する。 CloudTrailで「DescribeFileSystems」のログ記録あり。
3 FileSystem(share配下)をWindowsサーバから参照する。 CloudTrailでログ記録なし。(該当API無し)
4 share配下にフォルダを作成する。 CloudTrailでログ記録なし。(該当API無し)
5 作成したフォルダ内にテキストファイルを作成する。 CloudTrailでログ記録なし。(該当API無し)
6 作成したテキストファイルをローカルにドラッグ&ドロップする。 CloudTrailでログ記録なし。(該当API無し)
7 フォルダ内のテキストファイルを削除する。 CloudTrailでログ記録なし。(該当API無し)
8 AWSコンソールでFileSystemのバックアップを作成する。 CloudTrailで「CreateBackup」のログ記録あり。
9 AWSコンソールでFileSystemのバックアップからリストアする。 CloudTrailで「CreateFileSystemFromBackup」のログ記録あり。
10 AWSコンソールでFileSystemのバックアップを削除する。 CloudTrailで「DeleteBackup」のログ記録あり。
11 AWSコンソールでリストアしたFileSystemを削除する。 CloudTrailで「DeleteFileSystem」のログ記録あり。
※Windowsサーバ上でのオブジェクト操作はAPIに無いため、当然CloudTrailでログ記録されない。(ログ取得方法無し)
16. Amazon FSx API操作ログ(共通項目)の形式
No Field Value (Sample)
1 apiVersion 2018/3/1
2 awsRegion us-east-1
3 eventID 6cfeb52f-a01b-4490-9392-f6c7306b3dd5
4 eventName
5 eventSource fsx.amazonaws.com
6 eventType AwsApiCall
7 eventVersion 1.05
8 recipientAccountId
9 requestID 77f0007e-4ebf-4cbf-81fb-e96055b8f1b5
10 sourceIPAddress
11 userAgent
aws-internal/3 aws-sdk-java/1.11.462 Linux/4.9.124-0.1.ac.198.71.329.metal1.x86_64 OpenJDK_64-
Bit_Server_VM/25.192-b12 java/1.8.0_192
12 userIdentity.accessKeyId
13 userIdentity.accountId
14 userIdentity.arn arn:aws:iam::
5 userIdentity.principalId
16 userIdentity.sessionContext.attributes.creationDate December 17th 2018, 21:09:16.000
17 userIdentity.sessionContext.attributes.mfaAuthenticated TRUE
19 userIdentity.type IAMUser
20 userIdentity.username
AWSアカウント:IAMユーザ名
IAMユーザ名
AWSコンソールを操作していた端末の送信元グローバルIPアドレス
アクセスキー
Amazon FSx API名
AWSアカウント(12桁の数字)
AWSアカウント(12桁の数字)
AWSアカウント(12桁の数字)
※誰が、いつ、どこのIPから操作したかの情報は、オレンジ枠内のFieldで取得が可能(MFAでログインしているかも監査可能)
17. Amazon FSx API操作(CreateFileSystem固有)ログの形式
No Field Value (Sample)
1 requestParameters.clientRequestToken d8dbea28-2b57-4988-a029-fa4a3dec23dd
2 requestParameters.fileSystemType WINDOWS
3 requestParameters.securityGroupIds sg-c967d1bf
4 requestParameters.storageCapacity 300
5 requestParameters.subnetIds subnet-28466b07
6 requestParameters.windowsConfiguration.activeDirectoryId d-906714b22a
7 requestParameters.windowsConfiguration.copyTagsToBackups FALSE
8 requestParameters.windowsConfiguration.throughputCapacity 8
9 responseElements.fileSystem.creationTime 2018/12/17 16:02
10 responseElements.fileSystem.dNSName fs-0ceaab46063afae3c.securitytest.local
11 responseElements.fileSystem.fileSystemId fs-0ceaab46063afae3c
12 responseElements.fileSystem.fileSystemType WINDOWS
13 responseElements.fileSystem.kmsKeyId arn:aws:kms:us-east-1:[AWSアカウント(12桁)]:key/239db606-7606-4586-9ae5-b67b3efc104e
14 responseElements.fileSystem.lifecycle CREATING
15 responseElements.fileSystem.ownerId
16 responseElements.fileSystem.resourceARN arn:aws:fsx:us-east-1:[AWSアカウント(12桁)]:file-system/fs-0ceaab46063afae3c
17 responseElements.fileSystem.storageCapacity 300
19 responseElements.fileSystem.subnetIds subnet-28466b07
20 responseElements.fileSystem.vpcId vpc-0eaa1e75
21 responseElements.fileSystem.windowsConfiguration.activeDirectoryId d-906714b22a
22 responseElements.fileSystem.windowsConfiguration.automaticBackupRetentionDays 7
23 responseElements.fileSystem.windowsConfiguration.copyTagsToBackups FALSE
24 responseElements.fileSystem.windowsConfiguration.dailyAutomaticBackupStartTime 10:30
25 responseElements.fileSystem.windowsConfiguration.throughputCapacity 8
AWSアカウント(12桁の数字)
18. Amazon FSx API操作(CreateFileSystemFromBackup固有)ログの形式
No Field Value (Sample)
1 requestParameters.backupId backup-02efb9ebe8120dcf1
2 requestParameters.clientRequestToken aaa82bfa-1484-49b8-85d8-309feecb4281
3 requestParameters.securityGroupIds sg-c967d1bf
4 requestParameters.subnetIds subnet-6dd50c62
5 requestParameters.windowsConfiguration.activeDirectoryId d-906714b22a
6 requestParameters.windowsConfiguration.copyTagsToBackups FALSE
7 requestParameters.windowsConfiguration.throughputCapacity 8
8 responseElements.fileSystem.creationTime 2018/12/17 15:19
9 responseElements.fileSystem.dNSName fs-0e5bf2471de94baaf.securitytest.local
10 responseElements.fileSystem.fileSystemId fs-0e5bf2471de94baaf
11 responseElements.fileSystem.fileSystemType WINDOWS
12 responseElements.fileSystem.kmsKeyId arn:aws:kms:us-east-1:[AWSアカウント(12桁)]:key/239db606-7606-4586-9ae5-b67b3efc104e
13 responseElements.fileSystem.lifecycle CREATING
14 responseElements.fileSystem.ownerId
15 responseElements.fileSystem.resourceARN arn:aws:fsx:us-east-1:[AWSアカウント(12桁)]:file-system/fs-0e5bf2471de94baaf
16 responseElements.fileSystem.storageCapacity 300
17 responseElements.fileSystem.subnetIds subnet-6dd50c62
19 responseElements.fileSystem.vpcId vpc-0eaa1e75
20 responseElements.fileSystem.windowsConfiguration.activeDirectoryId d-906714b22a
21 responseElements.fileSystem.windowsConfiguration.automaticBackupRetentionDays 7
22 responseElements.fileSystem.windowsConfiguration.copyTagsToBackups FALSE
23 responseElements.fileSystem.windowsConfiguration.dailyAutomaticBackupStartTime 3:30
24 responseElements.fileSystem.windowsConfiguration.throughputCapacity 8
25 responseElements.fileSystem.windowsConfiguration.weeklyMaintenanceStartTime 7:09:30
AWSアカウント(12桁の数字)
19. Amazon FSx API操作(DeleteFileSystem固有)ログの形式
No Field Value (Sample)
1 requestParameters.clientRequestToken 28628002-7986-4fd4-9ca1-fb589f8ed972
2 requestParameters.fileSystemId fs-0e5bf2471de94baaf
3 requestParameters.windowsConfiguration.skipFinalBackup TRUE
4 responseElements.fileSystemId fs-0e5bf2471de94baaf
5 responseElements.lifecycle DELETING
21. Amazon FSx API操作(CreateBackup固有)ログの形式
No Field Value (Sample)
1 requestParameters.clientRequestToken 880b52a1-28ca-46dd-aee8-88c0a3829ae9
2 requestParameters.fileSystemId fs-07250e4af618c544d
3 responseElements.backup.backupId backup-0452aabaa11506521
4 responseElements.backup.creationTime 2018/12/17 15:30
5 responseElements.backup.fileSystem.fileSystemId fs-07250e4af618c544d
6 responseElements.backup.fileSystem.storageCapacity 300
7 responseElements.backup.fileSystem.windowsConfiguration.automaticBackupRetentionDays 7
8 responseElements.backup.fileSystem.windowsConfiguration.copyTagsToBackups FALSE
9 responseElements.backup.fileSystem.windowsConfiguration.dailyAutomaticBackupStartTime 3:30
10 responseElements.backup.fileSystem.windowsConfiguration.weeklyMaintenanceStartTime 7:09:30
11 responseElements.backup.kmsKeyId arn:aws:kms:us-east-1:[AWSアカウント(12桁)]:key/239db606-7606-4586-9ae5-b67b3efc104e
12 responseElements.backup.lifecycle CREATING
13 responseElements.backup.resourceARN arn:aws:fsx:us-east-1:[AWSアカウント(12桁)]:backup/backup-0452aabaa11506521
14 responseElements.backup.type USER_INITIATED
22. Amazon FSx API操作(DeleteBackup固有)ログの形式
No Field Value (Sample)
1 requestParameters.backupId backup-0cdd90d9a03492ba2
2 requestParameters.clientRequestToken f5b62746-8805-4712-a5f2-8c99b8379eee
3 responseElements.backupId backup-0cdd90d9a03492ba2
4 responseElements.lifecycle DELETED
24. 【参考】掛かったコスト
No サービス名 内訳 金額
1 EC2 ① $0.032 per On Demand Windows t2.small Instance Hour 239 Hrs
② $0.023 per On Demand Linux t2.small Instance Hour 21.063 Hrs
$7.65
$0.48
2 Directory Service ① $0.000 per hour for 1500 hours for Microsoft AD (Standard Edition)
domain controllers usage under the global free trial 626.637 Hrs
② $0.000 per hour for 1500 hours- small directory usage under the global
free trial period 3.071 Hrs
$0.00
$0.00
3 Amazon FSx ① Storage capacity 300GB ($39.00/month)
② Throughput capacity 8MB/s ($17.60/month)
$39.00
$17.60
4 CloudTrail AWS CloudTrail USE1-FreeEventsRecorded
① 0.0 per free event recorded in US East (N.Virginia) region 38,007 Events
AWS CloudTrail USE1-PaidEventsRecorded
② 0.00002 per paid event recorded in US East (N.Virginia) region 21,127 Events
$0.00
$0.42
5 CloudWatch AmazonCloudWatch PutLogEvents
① First 5GB per month of log data ingested is free. 0.062 GB
② First 5GB per month of log data ingested is free. 0.029 GB
$0.00
$0.00
6 S3 ① Amazon Simple Storage Service Requests-Tier1
$0.005 per 1,000 PUT, COPY, POST, or LIST requests 3,887 Requests
② Amazon Simple Storage Service Requests-Tier2
$0.004 per 10,000 GET and all other requests 172 Requests
③ Amazon Simple Storage Service TimedStorage-ByteHrs
$0.023 per GB - first 50 TB / month of storage used 0.000354 GB-Mo
$0.02
$0.00
$0.00
7 Elasticsearch Service ① $0.135 per GB-month of general purpose provisioned storage 1.962 GB-Mo
② $0.151 per m4.large.elasticsearch instance hour (or partial hour) 146 Hrs
$0.26
$22.05
合計:
$87.48
¥9,798
($=¥112)
27. 参考URL
AWS再入門 AWS Directory Service編
https://dev.classmethod.jp/cloud/aws/cm-advent-calendar-2015-aws-re-entering-directoryservice/
AWS Directory Service: 新製品の「Microsoft AD」を試す
https://dev.classmethod.jp/cloud/aws/microsoft-ad-dez-2015/
Windows で SMB アクセス可能なファイルサーバ!Amazon FSx for Windows File Server が発表されました
https://dev.classmethod.jp/cloud/aws/reinvent2018-newlaunch-fsx/
Amazon FSx for Windows File Serverを試す
https://qiita.com/atsumjp/items/3843aaa15771da021ee5
新発表されたAmazon FSx for Windows File Serverの料金まとめ
https://dev.classmethod.jp/cloud/aws/reinvent2018-amazon-fsx-for-windows-file-server-pricing/
AWS CloudTrailのログをAmazon Elasticsearch Serviceへ転送して可視化してみた
https://dev.classmethod.jp/cloud/aws/cloudtrail2elasticsearch/