Giter Site home page Giter Site logo

sina2 / gcp-block-country-ja Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gh640/gcp-block-country-ja

0.0 0.0 0.0 11 KB

🚧 (Japanese) Google Cloud Platform で特定の国からのアクセスをブロックするルールを作成するためのサンプルスクリプトです。

Python 100.00%

gcp-block-country-ja's Introduction

gcp_block_country.py

Google Cloud Platform で特定の国からのアクセスをブロックするルールを作成するためのサンプルスクリプトです。 あくまでもサンプルです。

必須

使い方

git clone でスクリプトをダウンロードします。

git clone https://github.com/gh640/gcp-block-country-ja

対象とする IP アドレスの範囲をリストしたテキストファイルを用意します。

curl -O https://ipv4.fetus.jp/cn.txt

ファイルの中身のサンプル:

#
# [cn] 中華人民共和国 (China)
#  https://ipv4.fetus.jp/cn.txt
#  出力日時: xxx
#

1.0.1.0/24
1.0.2.0/23
1.0.8.0/21
1.0.32.0/19

GCP プロジェクトと国コードを指定して dry run モードで実行します。

python gcp_block_country.py --gcp-project my-project --country-code cn --dry-run

問題がなさそうであれば dry run オプションを外して実行します。

python gcp_block_country.py --gcp-project my-project --country-code cn
$ python gcp_block_country.py --help
usage: gcp_block_country.py [-h] [--dry-run] --country-code COUNTRY_CODE --gcp-project GCP_PROJECT

Google Cloud Platform で特定の国からのアクセスをブロックするルールを作成するためのスクリプト

optional arguments:
  -h, --help            show this help message and exit
  --dry-run             ドライラン
  --country-code COUNTRY_CODE
                        国コード
  --gcp-project GCP_PROJECT
                        GCP プロジェクト
usage: gcp_block_country.py [-h] [--dry-run] --country-code COUNTRY_CODE

有効な国コード

現在、以下の国コードが利用可能です。

  • cn: **
  • ru: ロシア
  • au: オーストラリア

説明記事

関連リポジトリ

参考

gcp-block-country-ja's People

Contributors

gh640 avatar sina2 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.