<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>防火牆 - 東東 GCP 教學 - GCP 實戰講師</title>
	<atom:link href="https://dongdonggcp.com/tag/%E9%98%B2%E7%81%AB%E7%89%86/feed/" rel="self" type="application/rss+xml" />
	<link>https://dongdonggcp.com</link>
	<description>助你考取證照，轉職成功</description>
	<lastBuildDate>Tue, 11 Jun 2024 03:41:34 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://dongdonggcp.com/wp-content/uploads/2025/04/cropped-340838097_121391010914395_5443948698124160121_n-32x32.jpg</url>
	<title>防火牆 - 東東 GCP 教學 - GCP 實戰講師</title>
	<link>https://dongdonggcp.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">243235092</site>	<item>
		<title>Cloud IAP 簡單介紹和實作, 防火牆不用全開，讓你安全又方便連線到虛擬機器</title>
		<link>https://dongdonggcp.com/2024/06/11/cloud-iap-introduction-and-connect-vm-easily/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cloud-iap-introduction-and-connect-vm-easily</link>
					<comments>https://dongdonggcp.com/2024/06/11/cloud-iap-introduction-and-connect-vm-easily/#comments</comments>
		
		<dc:creator><![CDATA[東東]]></dc:creator>
		<pubDate>Tue, 11 Jun 2024 03:41:34 +0000</pubDate>
				<category><![CDATA[Compute Engine (VM)]]></category>
		<category><![CDATA[Google Cloud Platform]]></category>
		<category><![CDATA[Cloud IAP]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[VM]]></category>
		<category><![CDATA[資訊安全]]></category>
		<category><![CDATA[防火牆]]></category>
		<guid isPermaLink="false">https://dongdonggcp.com/?p=6477</guid>

					<description><![CDATA[<p>Cloud IAP 簡單介紹, 防火牆不用全開，讓你安全又方便連線到虛擬機器<br />
現在 GCP 改善了，你不用再做自己的 SSH Key了，<br />
你可以只允許 Cloud IAP 的 IP Range，<br />
不用 Allow 全世界的 IP，也不用 Allow 自家的 IP。<br />
以後再也不用自己做 SSH Key了，實在是非常方便呢！！</p>
<p>The post <a href="https://dongdonggcp.com/2024/06/11/cloud-iap-introduction-and-connect-vm-easily/">Cloud IAP 簡單介紹和實作, 防火牆不用全開，讓你安全又方便連線到虛擬機器</a> first appeared on <a href="https://dongdonggcp.com">東東 GCP 教學 - GCP 實戰講師</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>以前如果要直接點擊 SSH 按鈕連線到你的主機，</p>



<p>通常必須要讓防火牆規則，開放所有的 IP 來源的 Port 22，</p>



<p>像這樣：Allow 0.0.0.0/0 Port 22</p>



<p>代表不是只有你，</p>



<p>全世界的駭客都可以連到你的主機 Port 22。</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1090" height="355" src="https://dongdonggcp.com/wp-content/uploads/2024/06/ssh-button.png?w=1024" alt="" class="wp-image-6481" srcset="https://dongdonggcp.com/wp-content/uploads/2024/06/ssh-button.png 1090w, https://dongdonggcp.com/wp-content/uploads/2024/06/ssh-button-300x98.png 300w, https://dongdonggcp.com/wp-content/uploads/2024/06/ssh-button-1024x334.png 1024w, https://dongdonggcp.com/wp-content/uploads/2024/06/ssh-button-768x250.png 768w" sizes="(max-width: 1090px) 100vw, 1090px" /></figure>



<p>如果要安全地連，必須自己做 SSH Key，從本機 SSH 來連，</p>



<p>才可以設定防火牆只允許自家 IP，然後擋掉其他 IP，有點麻煩。</p>



<p>但是現在 GCP 改善了，你不用再做自己的 SSH Key了，</p>



<p>你可以只允許 Cloud IAP 的 IP Range 35.235.240.0/20，</p>



<p>不用 Allow 全世界的 IP，也不用 Allow 自家的 IP。</p>



<p>Cloud IAP 的技術原理可以直接看<a href="https://cloud.google.com/iap/docs/concepts-overview?hl=zh-cn#compute-engine">這篇</a>，本文直接實作給你看。</p>



<p>以下是我新建一條防火牆，</p>



<p>只允許 Cloud IAP 的 IP 範圍：</p>



<figure class="wp-block-image size-large"><img decoding="async" width="629" height="665" src="https://dongdonggcp.com/wp-content/uploads/2024/06/cloud-iap-ip-range.png?w=629" alt="" class="wp-image-6484" srcset="https://dongdonggcp.com/wp-content/uploads/2024/06/cloud-iap-ip-range.png 629w, https://dongdonggcp.com/wp-content/uploads/2024/06/cloud-iap-ip-range-284x300.png 284w" sizes="(max-width: 629px) 100vw, 629px" /></figure>



<p>你只要點擊 SSH 按鈕，就可以直接連線了。</p>



<p>連上之後，從 Linux 查看連線的來源 IP 為 35.235.244.82，果然是 Cloud IAP 的範圍。</p>



<figure class="wp-block-image size-large"><img decoding="async" width="894" height="226" src="https://dongdonggcp.com/wp-content/uploads/2024/06/e5be9e-35-235-e4be86e980a3.png?w=894" alt="" class="wp-image-6486" srcset="https://dongdonggcp.com/wp-content/uploads/2024/06/e5be9e-35-235-e4be86e980a3.png 894w, https://dongdonggcp.com/wp-content/uploads/2024/06/e5be9e-35-235-e4be86e980a3-300x76.png 300w, https://dongdonggcp.com/wp-content/uploads/2024/06/e5be9e-35-235-e4be86e980a3-768x194.png 768w" sizes="(max-width: 894px) 100vw, 894px" /></figure>



<p>也從防火牆 Log 來看，也是一樣。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1005" height="950" src="https://dongdonggcp.com/wp-content/uploads/2024/06/firewall-log-iap.png?w=1005" alt="" class="wp-image-6488" srcset="https://dongdonggcp.com/wp-content/uploads/2024/06/firewall-log-iap.png 1005w, https://dongdonggcp.com/wp-content/uploads/2024/06/firewall-log-iap-300x284.png 300w, https://dongdonggcp.com/wp-content/uploads/2024/06/firewall-log-iap-768x726.png 768w" sizes="(max-width: 1005px) 100vw, 1005px" /></figure>



<p>以後再也不用自己做 SSH Key了，實在是非常方便呢！！</p>



<p>最後提醒一下，原本那條 default-allow-ssh 防火牆規則，記得要停用喔！不然駭客還是會找到你喔！</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="563" height="906" src="https://dongdonggcp.com/wp-content/uploads/2024/06/disable_allow_ssh_all_2.png?w=563" alt="" class="wp-image-6495" srcset="https://dongdonggcp.com/wp-content/uploads/2024/06/disable_allow_ssh_all_2.png 563w, https://dongdonggcp.com/wp-content/uploads/2024/06/disable_allow_ssh_all_2-186x300.png 186w" sizes="(max-width: 563px) 100vw, 563px" /></figure>



<p></p><p>The post <a href="https://dongdonggcp.com/2024/06/11/cloud-iap-introduction-and-connect-vm-easily/">Cloud IAP 簡單介紹和實作, 防火牆不用全開，讓你安全又方便連線到虛擬機器</a> first appeared on <a href="https://dongdonggcp.com">東東 GCP 教學 - GCP 實戰講師</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://dongdonggcp.com/2024/06/11/cloud-iap-introduction-and-connect-vm-easily/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">6477</post-id>	</item>
	</channel>
</rss>
