Quantcast
Channel: VMware Communities : Blog List - All Communities
Viewing all articles
Browse latest Browse all 3805

PowerCLIでESXiファイアウォールの構造をみてみる。

$
0
0

ESXiのファイアウォールの構造をPoserCLIで見てみようと思います。

 

ためした環境は、下記です。

  • ESXi 5.0
  • vCenter 5.0
  • PowerCLI 5.1 R2


まず、ESXiのファイアウォールの全体図をイメージ化してみました。

esxifw.png

 

ESXiのファイアウォールは、
デフォルトポリシー(DefaultPolicy)と
ルールセット(Ruleset)で構成されています。

PowerCLI> $hv = Get-VMHost sc-esxi501 | Get-View

PowerCLI> $hv.Config.Firewall | gm -MemberType Property

   TypeName: VMware.Vim.HostFirewallInfo

Name            MemberType Definition
----            ---------- ----------
DefaultPolicy   Property   VMware.Vim.HostFirewallDefaultPolicy DefaultPolicy {get;set;}
DynamicProperty Property   VMware.Vim.DynamicProperty[] DynamicProperty {get;set;}
DynamicType     Property   System.String DynamicType {get;set;}
Ruleset         Property   VMware.Vim.HostFirewallRuleset[] Ruleset {get;set;}


インバウンド、アウトバウンドどちらも、
デフォルトではブロックされます。(~Blocked が True)

PowerCLI> $hv.Config.Firewall.DefaultPolicy

IncomingBlockedOutgoingBlocked DynamicType DynamicProperty
--------------- --------------- ----------- ---------------
          True            True

 

ルールセットには下記があります。

PowerCLI> $hv.Config.Firewall.Ruleset | select Key,Label

Key                Label
---                -----
CIMHttpServer      CIM サーバ
CIMHttpsServer     CIM セキュア サーバ
CIMSLP             CIM SLP
DHCPv6             DHCPv6
DVFilter           DVFilter
DVSSync            DVSSync
HBR                HBR
IKED               IKED
NFC                NFC
WOL                WOL
activeDirectoryAll Active Directory すべて
dhcp               DHCP クライアント
dns                DNS クライアント
faultTolerance     Fault Tolerance
ftpClient          FTP クライアント
gdbserver          gdbserver
httpClient         httpClient
iSCSI              ソフトウェア iSCSI クライアント
netDump            netDump
nfsClient          NFS クライアント
ntpClient          NTP クライアント
remoteSerialPort   VM シリアル ポートはネットワークに接続されます
snmp               SNMP サーバ
sshClient          SSH クライアント
sshServer          SSH サーバ
syslog             syslog
updateManager      vCenter Update Manager
vMotion            vMotion
vSPC               VM シリアル ポートは vSPC に接続されます
vSphereClient      vSphere Client
vpxHeartbeats      VMware vCenter Agent
webAccess          vSphere Web Access


たとえば、SSHサーバを例に見てみると、
ルールセットには、ルールのリスト(Rule)と
許可ホストリスト(AllowedHosts)がひもづくことがわかります。

PowerCLI> $hv.Config.Firewall.Ruleset | where {$_.key -like "sshServer"}

Key             : sshServer
Label           : SSH サーバ
Required        : False
Rule            : {VMware.Vim.HostFirewallRule}
Service         : TSM-SSH
Enabled         : True
AllowedHosts    : VMware.Vim.HostFirewallRulesetIpList
DynamicType     :
DynamicProperty :


SSHサーバのルールは、下記のようになっています。
TCPの22番ポート宛のインバウンド通信についてのルールです。

PowerCLI> $r = $hv.Config.Firewall.Ruleset | where {$_.key -like "sshServer"}
PowerCLI> $r.Rule

Port            : 22
EndPort         :
Direction       : inbound
PortType        : dst
Protocol        : tcp
DynamicType     :
DynamicProperty :


下記のSSHサーバのルールセットでは、
すべてホストからの通信(AllIp)は拒否されています。

PowerCLI> $r.AllowedHosts

IpAddress       :
IpNetwork       : {VMware.Vim.HostFirewallRulesetIpNetwork,
                  VMware.Vim.HostFirewallRulesetIpNetwork,
                  VMware.Vim.HostFirewallRulesetIpNetwork}
AllIp           : False
DynamicType     :
DynamicProperty :


そして、指定したホストからの通信だけ許可しています。ホワイトリスト形式です。

PowerCLI> $r.AllowedHosts | % {$_.IpNetwork}

Network     PrefixLength DynamicType DynamicProperty
-------     ------------ ----------- ---------------
172.16.50.0           24
192.168.4.0           24
192.168.0.0           24

 

以上、ESXiファイアウォールをPowerCLIで見てみました。


Viewing all articles
Browse latest Browse all 3805

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>