南アルプス 鳳凰三山観音岳より富士山を望む


Date/Time: 2013:09:29 11:28:31
Camera: Panasonic
Model: DMC-LX2
Exporsure Time: 1/400
FNumber: 8.0
Aperture Value: 6.0
Focal Length: 6.3

Close

y2blog » WordPress KUSANAGI 環境をカスタマイズする(その2)

10

24

2017

WordPress KUSANAGI 環境をカスタマイズする(その2)

ConoHa VPSのAPIを用いて環境設定を行う


KUSANAGIの環境設定を行う前に、ConoHa VPSの仮想基盤側のFirewall設定を変更してよりセキュアな環境を構築しておくことにする.前の記事で書いたように、KUSANAGIをアプリケーションイメージテンプレートからデプロイした場合、デプロイされたKUSANAGI環境には HTTPサーバ(nginx) やMySQL等のアプリが最初から起動された状態でOSが立ちあがってしまう.


更に問題なのはOS側のFirewall環境であるfirewalld のサービスは停止された状態で外部(インターネット)側からのアクセスは全て開放状態になってしまっていることだ.SSHサービスも(TCP/22)で立ちあがっている.この状態はKUSANAGIの環境設定を行うまでの比較的短い期間とは言え、無防備な状態でサーバを外部に晒すことになる.ハッキリ言ってこのデフォルト設定は非常にマズイ.


幸いなことに、ConoHa VPSには仮想基盤側に備わったFirewall環境がユーザに提供されている.しかも機能が非常に限定的とは言え、管理コンソールのGUI画面から簡単に外部アクセスを遮断することが可能だ.前の記事でこの仮想基盤側のFirewall設定を変更してKUSANAGIの環境構築中は外部からのアクセスを遮断する設定にしたのはこのような理由によるものだ.


最初の環境設定だけは使い勝手の悪いコンソール画面を使わなければならないが、SSHの環境設定が済めば後は手許のPC側からSSHリモートアクセスを通じてKUSANAGIの環境を構築することが可能だ.


ConoHa APIを使ってみる


ConoHa APIはOpenStackをベースに実装されているので、OpenStackに対応した各種ツールを用いることが可能だ.私はまだOpenStack環境に習熟していないので、今回はConoHaのホームページで公開されているREST API を使った方法で設定してみることにする.ConoHa API の説明は下記のページを参照して欲しい.


 ・APIを使用するためのトークンを取得する

 ・トークン発行 – Identity API v2.0

REST APIを呼び出す方法は幾つもあるが、今回はUNIX系のOSであれば手軽に利用可能な “curl” コマンドを用いてアクセスしてみることにする.トークンの取得方法は上記のページに説明があるのでここでは詳しく説明しない.


先ず最初に管理コンソールにログインし、該当するVPSのAPI情報を取得する必要がある.テナントIDとAPIユーザー名およびパスワード情報を取得する.パスワードは予め自分で設定して置く必要がある.これらの情報は決して他人に知られないように大切に取り扱う必要がある.この情報があれば誰でも勝手にサーバを作成や削除、ネットワークの構成を変えたりすることができてしまう.


API Basic Info
先ずは管理コンソール上で自分のテナントIDとAPIユーザー名、パスワードを設定しておく

上記のConoHaのページでは、curlコマンドに “-i” オプションを付加して、HTTPレスポンスヘッダ情報を出力しているが、JSON形式のデータを整形する pythonツール “mjson.tool” と組み合わせると上手く処理できないので、ここでは “-i” オプションは使っていない.



iMac27:~ yasuaki$ curl -X POST -H "Content-type: application/json"  \
 -d '{"auth":{"passwordCredentials":{"username":"gncu60000032","password":"Himitsu"},"tenantId":"70b2---------------------061c"}}' \
 https://identity.tyo1.conoha.io/v2.0/tokens \
 | python -mjson.tool

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2595  100  2466  100   129   2035    106  0:00:01  0:00:01 --:--:--  2034
{
    "access": {
        "metadata": {
            "is_admin": 0,
            "roles": [
                "ea04ba71916e434c8fdc1b9c327f8dae",
                "e79e6014598348f192a03f8456a084a3"
            ]
        },
        "serviceCatalog": [
            {
                "endpoints": [
                    {
                        "publicURL": "https://account.tyo1.conoha.io/v1/70b2---------------------061c",
                        "region": "tyo1"
                    }
                ],
                "endpoints_links": [],
                "name": "Account Service",
                "type": "account"
            },
            {
                "endpoints": [
                    {
                        "publicURL": "https://compute.tyo1.conoha.io/v2/70b2---------------------061c",
                        "region": "tyo1"
                    }
  ...
 
【途中省略】

  ...
                "endpoints_links": [],
                "name": "Identity Service",
                "type": "identity"
            }
        ],
        "token": {
            "audit_ids": [
                "naBbtBS3RKGmGRcmRtGhqw"
            ],
            "expires": "2017-10-23T14:15:03Z",          <=== このトークンが失効する時刻
            "id": "8c7e450281ef4f6b82b47389980f8615",  <=== これがトークン
            "issued_at": "2017-10-22T14:15:03.873407",
            "tenant": {
                "description": "",
                "domain_id": "gnc",
                "enabled": true,
                "id": "70b2---------------------061c",
                "name": "gnct60000032"
            }
        },
        "user": {
            "id": "3cb360e4ff6d40d29e14c4762013b0d9",
            "name": "gncu63000032",
            "roles": [
                {
                    "name": "SwiftOperator"
                },
                {
                    "name": "_member_"
                }
            ],
            "roles_links": [],
            "username": "gncu60000032"
        }
    }
}
iMac27:~ yasuaki$

長々とした結果が帰ってくるが、今回欲しい情報は後の方にある “id”: “8c7e450281ef4f6b82b47389980f8615” という行のコロンを挟んだ右側部分 “8c7e450281ef4f6b82b47389980f8615” が目的のトークン情報だ.(勿論ここのテナントIDとAPIユーザー名、パスワードは出鱈目なのでこの値を使用してもエラーとなるだけだ)


Network APIを用いて仮想基盤側Firewallの設定を変更する


Network Info
管理コンソール上でネットワークインタフェース名などの情報と現在の基盤側Firewall設定を確認

今回やりたい事は標準的なSSHポート(TCP/22)ではなく、ポート番号を変更したSSH(TCP/xxxxx)の利用が可能となるように、仮想基盤側のFirewallに穴を開けることだ.標準的なSSHポート(TCP/22)に関してはConoHaの管理コンソール画面でチェックマークを付ける(“ON”)だけで簡単に設定できるが、標準から外れる今回のSSHポート番号変更はConoHaのNetwork設定APIを駆使して設定しなければならない.


ConoHa VPSの仮想基盤側のFirewallを設定するには、先ずセキュリティーグループを作成し、そのセキュリティーグループに対してセキュリティールールを必要に応じて追加する作業が必要になる.このようにして作成されたセキュリティーグループを該当するポートに適用するという手順が必要になる.


1. セキュリティーグループの設定状態を確認する

セキュリティグループ一覧取得 – Network API v2.0

先ずは自分のConoHaアカウントに紐付いているセキュリティーグループの状態を調べてみよう.テナントIDはConoHaアカウントと紐付いており、初期状態で幾つかのセキュリティーグループが登録されている筈である.セキュリティーグループは個々のVPSサーバ単位では無く、ConoHaユーザアカウント(テナントID)毎に作成される.つまりセキュリティーグループを1つ作成しておけば、ユーザアカウントに紐付く全てのVPSサーバにそのセキュリティーグループを適用する事が可能だ.


私の場合は複数のVPSサーバを複数のリージョンで稼働させており、既に色々とセキュリティーグループの作成を行っているので、沢山のセキュリティーグループ設定が登録されてしまっている.下記に示すセキュリティーグループ一覧の表示結果は、管理コンソールの『接続許可ポート』チェックボックスとして標準で用意されているセキュリティーグループだけを抜粋して表示してある.実際はここで表示されているセキュリティーグループ以外にも自分で登録したセキュリティーグループが登録されている.



 Y2MBAir:~ yasuaki$ curl -X GET \
 -H "Accept: application/json" \
 -H "X-Auth-Token: 45--------------------------d65c" \
  https://networking.tyo1.conoha.io/v2.0/security-groups \ 
 | python -mjson.tool
 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12499    0 12499    0     0  14328      0 --:--:-- --:--:-- --:--:-- 14317
{
    "security_groups": [
        {
            "description": "gncs-ipv6-ssh",
            "id": "1bc16c48-17da-4935-a492-9a1b3d569a49",
            "name": "gncs-ipv6-ssh",
            "security_group_rules": [
                {
                    "direction": "ingress",
                    "ethertype": "IPv6",
                    "id": "043ab252-2222-42e9-826c-6d56694e114f",
                    "port_range_max": 22,
                    "port_range_min": 22,
                    "protocol": "tcp",
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "1bc16c48-17da-4935-a492-9a1b3d569a49",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "egress",
                    "ethertype": "IPv6",
                    "id": "951d5990-8aca-41ce-b6d2-5127eb5f20bd",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "1bc16c48-17da-4935-a492-9a1b3d569a49",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "egress",
                    "ethertype": "IPv4",
                    "id": "e6ef6b58-f787-48b0-a8b8-eca3d86d12ae",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "1bc16c48-17da-4935-a492-9a1b3d569a49",
                    "tenant_id": "70b22-----------------------061c"
                }
            ],
            "tenant_id": "70b22-----------------------061c"
        },
        {
            "description": "default",
            "id": "34daed51-a8a0-48d7-939b-895d7453b578",
            "name": "default",
            "security_group_rules": [
                {
                    "direction": "egress",
                    "ethertype": "IPv4",
                    "id": "0fd84f12-ad12-4dd2-9315-50a5c805d013",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "34daed51-a8a0-48d7-939b-895d7453b578",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "ingress",
                    "ethertype": "IPv4",
                    "id": "1f0189f8-40a9-416b-973f-9066ea77f254",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": "34daed51-a8a0-48d7-939b-895d7453b578",
                    "remote_ip_prefix": null,
                    "security_group_id": "34daed51-a8a0-48d7-939b-895d7453b578",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "egress",
                    "ethertype": "IPv6",
                    "id": "3c3e77f9-805f-4974-b101-1bfef3a54f79",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "34daed51-a8a0-48d7-939b-895d7453b578",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "ingress",
                    "ethertype": "IPv6",
                    "id": "df8f0de1-af27-4618-88c5-2ac5d0f65fbf",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": "34daed51-a8a0-48d7-939b-895d7453b578",
                    "remote_ip_prefix": null,
                    "security_group_id": "34daed51-a8a0-48d7-939b-895d7453b578",
                    "tenant_id": "70b22-----------------------061c"
                }
            ],
            "tenant_id": "70b22-----------------------061c"
        },
        {
            "description": "gncs-ipv4-all",
            "id": "7745dff0-7ba5-437d-a137-768209167355",
            "name": "gncs-ipv4-all",
            "security_group_rules": [
                {
                    "direction": "egress",
                    "ethertype": "IPv6",
                    "id": "67d48be3-ad7b-4ac8-bf64-a7b04fe95f69",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "7745dff0-7ba5-437d-a137-768209167355",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "ingress",
                    "ethertype": "IPv4",
                    "id": "8daa986f-e26a-40ab-b264-2e3704f14fdb",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "7745dff0-7ba5-437d-a137-768209167355",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "egress",
                    "ethertype": "IPv4",
                    "id": "b74da33b-647e-450b-ad86-b43f5a3b9122",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "7745dff0-7ba5-437d-a137-768209167355",
                    "tenant_id": "70b22-----------------------061c"
                }
            ],
            "tenant_id": "70b22-----------------------061c"
        },
        {
            "description": "gncs-ipv4-ssh",
            "id": "be709649-a0c3-47cf-b2ba-73b8cf20e7e3",
            "name": "gncs-ipv4-ssh",
            "security_group_rules": [
                {
                    "direction": "egress",
                    "ethertype": "IPv4",
                    "id": "0f682bc8-0b10-47de-bd77-2d7378c0c28d",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "be709649-a0c3-47cf-b2ba-73b8cf20e7e3",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "ingress",
                    "ethertype": "IPv4",
                    "id": "12f31613-b34c-4175-8f94-3e9299baffdc",
                    "port_range_max": 22,
                    "port_range_min": 22,
                    "protocol": "tcp",
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "be709649-a0c3-47cf-b2ba-73b8cf20e7e3",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "egress",
                    "ethertype": "IPv6",
                    "id": "a6db9a69-c387-4202-bf15-6b12101f434b",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "be709649-a0c3-47cf-b2ba-73b8cf20e7e3",
                    "tenant_id": "70b22-----------------------061c"
                }
            ],
            "tenant_id": "70b22-----------------------061c"
        },
        {
            "description": "gncs-ipv4-web",
            "id": "ccfd68c7-ed70-4484-8b49-fb8ed07f1f53",
            "name": "gncs-ipv4-web",
            "security_group_rules": [
                {
                    "direction": "ingress",
                    "ethertype": "IPv4",
                    "id": "343d11f2-cbc1-499b-8a87-8d6b83576be5",
                    "port_range_max": 80,
                    "port_range_min": 80,
                    "protocol": "tcp",
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "ccfd68c7-ed70-4484-8b49-fb8ed07f1f53",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "ingress",
                    "ethertype": "IPv4",
                    "id": "6d766752-228b-4b2d-b4ad-a45a194136ac",
                    "port_range_max": 20,
                    "port_range_min": 20,
                    "protocol": "tcp",
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "ccfd68c7-ed70-4484-8b49-fb8ed07f1f53",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "egress",
                    "ethertype": "IPv4",
                    "id": "8c27fe00-2b43-4916-8ad7-436ab9e4cdd3",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "ccfd68c7-ed70-4484-8b49-fb8ed07f1f53",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "ingress",
                    "ethertype": "IPv4",
                    "id": "aa614c0f-e5e5-4024-8f1c-0d3339543ac2",
                    "port_range_max": 443,
                    "port_range_min": 443,
                    "protocol": "tcp",
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "ccfd68c7-ed70-4484-8b49-fb8ed07f1f53",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "ingress",
                    "ethertype": "IPv4",
                    "id": "b42e73f9-2cba-4cd7-b913-0fd40212d740",
                    "port_range_max": 21,
                    "port_range_min": 21,
                    "protocol": "tcp",
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "ccfd68c7-ed70-4484-8b49-fb8ed07f1f53",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "egress",
                    "ethertype": "IPv6",
                    "id": "e645502f-d300-478a-90bf-9395cdfe3f7c",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "ccfd68c7-ed70-4484-8b49-fb8ed07f1f53",
                    "tenant_id": "70b22-----------------------061c"
                }
            ],
            "tenant_id": "70b22-----------------------061c"
        },
        {
            "description": "gncs-ipv6-all",
            "id": "d41a76a7-63f7-40d2-abd7-6e2ff98482e3",
            "name": "gncs-ipv6-all",
            "security_group_rules": [
                {
                    "direction": "egress",
                    "ethertype": "IPv4",
                    "id": "25e61411-d789-4ea9-be94-65856ee0e85a",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "d41a76a7-63f7-40d2-abd7-6e2ff98482e3",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "ingress",
                    "ethertype": "IPv6",
                    "id": "6a21c121-c7a4-4fb1-bda3-59b5efc221e4",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "d41a76a7-63f7-40d2-abd7-6e2ff98482e3",
                    "tenant_id": "70b22-----------------------061c"
                },
                {
                    "direction": "egress",
                    "ethertype": "IPv6",
                    "id": "babccbf9-f88e-48c5-ba72-3001fc35f89d",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "d41a76a7-63f7-40d2-abd7-6e2ff98482e3",
                    "tenant_id": "70b22-----------------------061c"
                }
            ],
            "tenant_id": "70b22-----------------------061c"
        }
    ]
}
Y2MBAir:~ yasuaki$ 

表示された結果の見方であるが、brace で囲まれた範囲が1つのセキュリティーグループで、”gncs-ipv6-ssh” という名前が付けられている.1つのセキュリティーグループ中には複数のセキュリティールールが含まれている.


        {                             <=== セキュリティグループ
            "description": "gncs-ipv6-ssh",
            "id": "1bc16c48-17da-4935-a492-9a1b3d569a49",
            "name": "gncs-ipv6-ssh",
            "security_group_rules": [
                {                                                  <=== セキュリティルール
                    "direction": "ingress",
                    "ethertype": "IPv6",
                    "id": "043ab252-2222-42e9-826c-6d56694e114f",
                    "port_range_max": 22,
                    "port_range_min": 22,
                    "protocol": "tcp",
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "1bc16c48-17da-4935-a492-9a1b3d569a49",
                    "tenant_id": "70b22-----------------------061c"
                },
                {                           <=== セキュリティルール
                    "direction": "egress",
                    "ethertype": "IPv6",
                    "id": "951d5990-8aca-41ce-b6d2-5127eb5f20bd",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "1bc16c48-17da-4935-a492-9a1b3d569a49",
                    "tenant_id": "70b22-----------------------061c"
                },
                {                           <=== セキュリティルール
                    "direction": "egress",
                    "ethertype": "IPv4",
                    "id": "e6ef6b58-f787-48b0-a8b8-eca3d86d12ae",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "1bc16c48-17da-4935-a492-9a1b3d569a49",
                    "tenant_id": "70b22-----------------------061c"
                }
            ],
            "tenant_id": "70b22-----------------------061c"
        },


セキュリティルールには、パラメータとして

  "direction" : 入出力の方向(ingress: inbound, egress: outbound)、
  "ethertype" : IPv4/IPv6
  "port_range_max", "port_range_min" : ポート番号の範囲
  "protocol": TCP/UDP/ICMP などのIPプロトコル情報

などが定義されている.


セキュリティールールの各パラメータの詳細は、

 ・セキュリティグループ ルール作成 - Network API v2.0

を参照して欲しい.(但し、あまり詳しい情報は記載されていない)


上記のセキュリティーグループでは、IPv6でのSSH(TCP/22) 接続(inbound)を許可する設定だ.outbound方向のprotocolは"null" が設定されており、これは outbound方向についてはフィルタリングしない(許可)という事だ.IPv6用のセキュリティーグループの設定の中に、IPv4のoutbound方向の許可設定ルールが最後に含まれている.


"description" フィールドが "gncs-" で始まるセキュリティーグループは、管理コンソルの ”接続許可ポート” チェックボックスの各アプリケーションサービスに対応するセキュリティーグループだ.例として IPV4: RDP (3389) のチェックボックスをONに設定すると、下記のセキュリティーグループが追加登録される.



        {
            "description": "gncs-ipv4-rdp",
            "id": "df7a63f0-215c-4d7e-9ee9-f6c7bc6f13fc",
            "name": "gncs-ipv4-rdp",
            "security_group_rules": [
                {
                    "direction": "ingress",
                    "ethertype": "IPv4",
                    "id": "125fbd97-b1d2-4825-94fd-58209b59d4c3",
                    "port_range_max": 3389,
                    "port_range_min": 3389,
                    "protocol": "tcp",
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "df7a63f0-215c-4d7e-9ee9-f6c7bc6f13fc",
                    "tenant_id": "70b2---------------------061c"
                },
                {
                    "direction": "egress",
                    "ethertype": "IPv4",
                    "id": "393d9309-01b4-4745-a05e-05cc51853026",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "df7a63f0-215c-4d7e-9ee9-f6c7bc6f13fc",
                    "tenant_id": "70b2---------------------061c"
                },
                {
                    "direction": "egress",
                    "ethertype": "IPv6",
                    "id": "eb880250-036d-48de-837c-40e90e9abb1f",
                    "port_range_max": null,
                    "port_range_min": null,
                    "protocol": null,
                    "remote_group_id": null,
                    "remote_ip_prefix": null,
                    "security_group_id": "df7a63f0-215c-4d7e-9ee9-f6c7bc6f13fc",
                    "tenant_id": "70b2---------------------061c"
                }
            ],


conoHaのAPIのドキュメントにはパラメータに関する簡単な説明と例しか記載されていないので、セキュリティルールやセキュリティグループ同士の依存関係が良く分からない.


管理コンソール画面で、接続許可ポートのチェックボックスの項目にチェックマークを付けると、自動的にその項目に適応したセキュリティグループがポートに追加される.一度チェックマークを付けた項目のセキュリティグループは画面上でチェックマークを外すと、ポートの設定からは除外されるがセキュリティグループのリストからは削除されない.自分でAPIを叩いて削除しない限りセキュリティグループは残り続けるようだ.使用する予定の無いセキュリティグループが登録されていてもセキュリティ上特に気にする必要は無い.サーバのポートとこのセキュリティグループとが紐付けられた状態でなければ、このセキュリティグループは作用しないからだ.


"default" という名のセキュリティグループは常にポートに紐付けられているようで、全ての接続許可ポートのチェックボックスを外すと、この"default" だけが残った状態となる.接続許可ポートのSSH (22/TCP: IPv4)のチェックを付けると、ポートに紐づくセキュリティグループは "default" と SSH (22/TCP: IPv4)のセキュリティグループとなる.


説明が長くなってしまったので、この続きは『WordPress KUSANAGI 環境をカスタマイズする(その3)』で説明することにする.


  

Calendar

April 2024
S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930  
  • Blogroll

  • Meta