Git Product home page Git Product logo

awzuelsdorf / geoip_windows_firewall Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 20 KB

This repo allows one to create a SQLite database and CSV file of IP address ranges for countries in APNIC and use that database to identify a minimal set of IP CIDRs that can be used to block connections from certain countries that do not need inbound or outbound access to or from the user's Windows PC. It also enables one to update or create firewall rules to block connections from the given coun tries.

License: Apache License 2.0

PowerShell 26.55% Python 64.39% Shell 9.06%

geoip_windows_firewall's Introduction

#GeoIP Windows Firewall#

This repo allows one to create a SQLite database and CSV file of IP address ranges for countries in APNIC and use that database to identify a minimal set of IP CIDRs that can be used to block connections from certain countries that do not need inbound or outbound access to or from the user's Windows PC. It also enables one to update or create firewall rules to block connections from the given countries.

##Acknowledgements##

Thanks to Jason Fossen for developing the Import-FirewallBlocklist.ps1 script.

##Generating the Firewall CIDRs##

You can run ./create_ip_cidrs.sh on a system that has curl, which, python, and virtualenv available to generate the consolidated_china_iran_russian_hong_kong_north_korea.txt file that you can use as input for Import-FirewallBlocklist.ps1. If you are using Git for Windows and a version of python that is at least 3.6.8, you should already have what you need. This shell script will also generate the two CSVs that are needed to generate the list of consolidated IP CIDRs.

Once you have generated consolidated_china_iran_russian_hong_kong_north_korea.txt, please refer to the 'Apply Firewall Rules' section to apply the firewall rules.

##Apply Firewall Rules##

  • The Import-FirewallBlocklist.ps1 script requires Powershell version 3 to be installed.
  • In a Powershell shell with administrator privileges:
    • Make note of your current user's execution policies using Get-ExecutionPolicy -Scope CurrentUser
    • Run Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser
    • Run .\Import-FirewallBlocklist.ps1 -inputfile .\consolidated_china_iran_russian_hong_kong_north_korea.txt

None of these commands should have errors. If they do, please resolve them and re-run the commands before continuing.

##Verification##

  • Open a command prompt or terminal and run ping weibo.com and ping xinhuanet.com. You should receive a 'General failure' response from these commands.
  • Open a command prompt or terminal and run ping whitehouse.gov and ping weather.gov. You should receive a response other than 'General failure' from these commands.

If you get an unintended result from pinging these websites, please ensure that your commands finished without errors. If you're still having issues, please open an issue with a short screen recording or link to a YouTube video where you go through the Apply Firewall Rules section and run the ping commands for these four websites. Please do not submit screenshots or other media or attempt to submit an issue without a recording that goes through all parts of the application and verification processes.

##Licensing##

Apache License 2.0

geoip_windows_firewall's People

Contributors

awzuelsdorf avatar

Watchers

 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.