GithubHelp home page GithubHelp logo

caco-mela's Introduction

Caco mela

Creatore Automatico di Chiavi Operante Mediante Estrazione da LDAP Artigianale

a persimmon with SSH written on it

Read SSH public keys from a LDAP server, add them to authorized_keys file for the corresponding user, without looking at uid and gid numbers.

Only user accounts (UID between UID_MIN and UID_MAX, read from /etc/login.defs) will be considered for update.
All SSH keys will be replaced for all users, with no keys if the user is not found on the LDAP server: this is useful to lock accounts of users that should not be allowed to access the server anymore, just make sure they are excluded from the LDAP filter.
Additionally, it is possible to set users that can be ignored with IGNORED_ACCOUNTS or with command line parameters: Caco mela will not modify the authorized_keys of those users.

Install

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Configure

Three ways to pass options are possible:

  1. Command line arguments, see caco_mela.py --help for details
  2. Environment variables
  3. A .env file, see .env.example

If a variable is set multiple times, the one higher in this list will take precedence.

All UPPER_CASE names in caco_mela.py --help correspond to an environment variable with the same name.
If a variable takes a list, the values are space separated when using command line arguments and comma separated when using environment variables.

Run

Create a systemd unit and timer, a cron job or any other similar mechanism to run the program every X minutes.

You can find an example caco-mela.unit and caco-mela.timer.

Tests

To avoid changing your local authorized_keys, run everything inside a container:

cd tests
docker-compose up

caco-mela's People

Contributors

lvps avatar weee-open-bot avatar

Watchers

 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.