Git Product home page Git Product logo

pyknock's Introduction

pyknock

UDP port knocking suite with HMAC-PSK authentication. Once it receives valid packet signed with valid pre-shared key, it runs command to open or close access. Commands should be specified by user via server command line. Server allows use of substitution placeholders in configured commands:

  • $ip - IP address mentioned in signed packet
  • $af - IP address type: inet or inet6
  • $cmd - requested action: open or close

See Usage for examples.


❤️ ❤️ ❤️

You can say thanks to the author by donations to these wallets:

  • ETH: 0xB71250010e8beC90C5f9ddF408251eBA9dD7320e
  • BTC:
    • Legacy: 1N89PRvG1CSsUk9sxKwBwudN6TjTPQ1N8a
    • Segwit: bc1qc0hcyxc000qf0ketv4r44ld7dlgmmu73rtlntw

Main Idea

In this application UDP datagrams are choosen for a reason. Typical configuration of firewalled machine allows only packets to some public ports and drops packets to all other ports. With UDP external observer can't distinguish between accepted packet and packet dropped by firewall. Therefore, if firewall configuration drops all UDP packets except packets to pyknock port, external observer can't even detect there is something awaiting for magic packet. So, it may be used to hide machine completely from network for unauthenticated peers. Also, it may be used as classical port-knocking solution, adding another protection layer to sensitive network application.

Features

  • Uses cryptographically authenticated messages.
  • Resistant to replay attacks.
  • Post-quantum ready cryptography (HMAC-PSK with SHA-256).
  • Works completely in user-space. May run even as unprivileged user.

Requirements

Only Python 2.6+ required. Python 3 is also supported.

Installation

Place file anywhere you want and run. Or use pip install pyknock to install it into your system as python package. Scripts shall become available at standard binary paths.

Usage

Server example:

pyknock-server MySecretPSK 'ipset add -exist myallowedset $ip timeout 3600' 'ipset del -exist myallowedset $ip'

Client example:

pyknock-client open my-protected-host.com MySecretPSK

Client behind NAT example:

pyknock-client -S $(curl -s https://canihazip.com/s) open my-protected-host.com MySecretPSK

See help for more options.

pyknock's People

Contributors

snawoot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.