Code Monkey home page Code Monkey logo

pa-uid-generic's Introduction

PA Generic User-ID Updater

This is a quick python script allowing regular expressions to be defined to process generic UDP messages (e.g. UDP syslog) for usernames, ip, and mac addresses.

The script assumes mac addresses will be included in all messages and when a full user<->mac<->ip address mapping is formed will send a User-ID update to the configured palo alto firewall.

Requirements

A requirements.txt has been provided from a pip freeze of a working copy.

  • python2
  • peewee
  • pandevice

Environment Variables

  • PA_HOSTNAME: hostname or ip of the palo alto firewall (required)
  • PA_USERNAME: username for account with at a minimum "Operational Requests" and "User-ID Agent" permitted on the Palo Alto firewall (required)
  • PA_PASSWORD: password for account (required)
  • LISTEN_HOST: ip to listen for log traffic on
  • LISTEN_PORT: port to listen for log traffic on (currently UDP only)
  • LOCAL_DOMAIN: domain to append to user when not fully qualified
  • DB_PATH: path for sqlite database
  • LOG_LEVEL: log level passed into pythons logging config
  • WORKER_TIMEOUT: base timeout if api requests to pa fail temporarily
  • UPDATE_MIN: timeout between updates of PA

Usage

Native

# install python requirements
pip install peewee pandevice

# define loggers
cp logger_definitions.py-sample logger_definitions.py

# export required env
export PA_HOSTNAME=10.0.0.1
export PA_USERNAME=uid-user
export PA_PASSWORD=uid-user
export LISTEN_HOST=0.0.0.0
export LISTEN_PORT=1514
export LOCAL_DOMAIN=mydomain.com
export DB_PATH=device.db
export LOG_LEVEL=INFO

python2 ./pa-uid-generic.py

Systemd

An example unit file has been included at systemd/pa-uid-generic.service-sample, requires environment variables to be defined in a file named 'env'.

Docker

# requires environment variables to be defined in a file named 'env' and 'logger_definitions.py' to be defined
docker run -d \
--env-file env \
-p 1514:1514/udp \
-v /etc/localtime:/etc/localtime:ro \
-v logger_definitions.py:/app/pa-uid-generic/logger_definitions.py:ro \
-v device.db:/app/pa-uid-generic/device.db \
mitcdh/pa-uid-generic

Logical Map

Logical map of pa-uid-generic.py

Credits

pa-uid-generic's People

Contributors

mitcdh avatar

Stargazers

 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.