Skip to content

Commit

Permalink
Renamed Rìg to Ellis.
Browse files Browse the repository at this point in the history
A Python package named "rig" already exists :-/

Removed some references to "Rìg".
  • Loading branch information
Frzk committed Sep 22, 2016
1 parent bbddb3b commit e8141ab
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 51 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Pull Requests
=============

1. Fork the Rìg repository
1. Fork the Ellis repository
2. Create a new branch for each feature or improvement
3. Send a pull request from each feature branch to the **develop** branch

Expand Down Expand Up @@ -37,4 +37,4 @@ Enhancement Requests are only for **EXISTING** features. For a new feature, plea
2. Add the ``enhancement`` label to the issue
3. Describe your idea

.. _here: https://github.com/Frzk/Rig/issues
.. _here: https://github.com/Frzk/Ellis/issues
14 changes: 7 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
=====
Rìg
=====
=======
Ellis
=======

Rìg monitors systemd-journald_ logs for specific entries and triggers actions based on them.
Ellis monitors systemd-journald_ logs for specific entries and triggers actions based on them.

Rìg can obviously be used as an `Intrusion Prevention System (IPS)`_ but can also be used in a more general way to run a Python script whenever a pattern appears in the logs.
Ellis can obviously be used as an `Intrusion Prevention System (IPS)`_ but can also be used in a more general way to run a Python script whenever a pattern appears in the logs.

About
=====

I started Rìg as a pet project with two ideas in mind:
I started Ellis as a pet project with two ideas in mind:

* I wanted to build something based on `Python's asyncio framework`_ because it looked very interesting and powerful - I needed to learn more about it ! ;
* I also wanted to be warned whenever someone would successfully log on my PC through SSH.

And then I realized that the combination of these two ideas would make a perfect candidate ! It then evolved into something more generic that looks a lot like the well-known fail2ban_.

Rìg specifically focuses on systemd-journald. It's written in Python and uses the asyncio framework for better performance (well, I hope so).
Ellis specifically focuses on systemd-journald. It's written in Python and uses the asyncio framework for better performance (well, I hope so).

Features
========
Expand Down
2 changes: 1 addition & 1 deletion rig.py → ellis.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# coding: utf-8

from rig.main import main
from ellis.main import main

if __name__ == '__main__':
main()
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions rig/action.py → ellis/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class Action(object):
"""
An Action is what Rìg executes when a Rule reaches its limit.
An Action is what Ellis executes when a Rule reaches its limit.
It's mostly a function with parameters. i.e. an Action is valid if it is
*callable*.
Expand Down Expand Up @@ -50,11 +50,11 @@ def __init__(self, module, func, args=None):

# Let's try to import the required module from the 'actions' package:
try:
mod = importlib.import_module("rig_actions." + self.mod_name)
mod = importlib.import_module("ellis_actions." + self.mod_name)
except ImportError:
raise ValueError(("Provided action ({mod}.{func}) does not exist "
"(unable to import '{mod}' module from the "
"'actions' package)")
"'ellis_actions' package)")
.format(mod=self.mod_name, func=self.func_name))

# If it succeeded, we can go on and try to retrieve the function from
Expand Down
30 changes: 15 additions & 15 deletions rig/rig.py → ellis/ellis.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
from .search_matches import SearchMatches


class Rig(object):
class Ellis(object):
"""
"""
def __init__(self, config_file=None):
"""
Initializes a newly created Rig object.
Initializes a newly created Ellis object.
The initialization process takes care of reading the configuration
file and build the necessary parts (rules, systemd units to watch,...)
Expand All @@ -44,29 +44,29 @@ def __init__(self, config_file=None):

def load_config(self, config_file=None):
"""
If `config_file` is not None, tries to load Rìg configuration from
If `config_file` is not None, tries to load Ellis configuration from
the given location. If, for some reason, the file can't be read,
Rìg will not start.
Ellis will not start.
If no configuration file is given (`config_file` is None), tries to
load Rìg configuration from these potential locations,
load Ellis configuration from these potential locations,
in this specific order:
1. `/etc/rig.conf`
2. `/etc/rig/rig.conf`
3. `./rig.conf`
1. `/etc/ellis.conf`
2. `/etc/ellis/ellis.conf`
3. `./ellis.conf`
If more than one of these files exist, the configuration is merged
which can lead to one or more section(s) being overriden.
The last file (`./rig.conf`) takes precedence over the second one,
The last file (`./ellis.conf`) takes precedence over the second one,
which takes precedence over the first one.
"""
if config_file is None:
config_file = [
'/etc/rig.conf',
'/etc/rig/rig.conf',
os.path.join(os.path.dirname(__file__), 'rig.conf'),
'/etc/ellis.conf',
'/etc/ellis/ellis.conf',
os.path.join(os.path.dirname(__file__), 'ellis.conf'),
]

self.config.read(config_file, encoding='utf-8')
Expand Down Expand Up @@ -118,7 +118,7 @@ def load_rules(self):

def load_units(self):
"""
Build a set of systemd units that Rìg will watch.
Build a set of systemd units that Ellis will watch.
This set will be used to filter journald entries so that we only
process entries that were produced by these units.
Expand Down Expand Up @@ -176,7 +176,7 @@ async def process_entry(self, message):
def start(self):
"""
"""
print("Starting dev Rìg with {0} rule{1}."
print("Starting Ellis with {0} rule{1}."
.format(len(self.rules), 's' if len(self.rules) > 1 else ''))

with journal.Reader() as j:
Expand Down Expand Up @@ -217,7 +217,7 @@ def exit(self):
"""
"""
# FIXME: do we still need that ?
# test as soon as Rig is really processing entries.
# test as soon as Ellis is really processing entries.

# pendings = asyncio.Task.all_tasks()

Expand Down
2 changes: 1 addition & 1 deletion rig/exceptions.py → ellis/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class NoRuleError(Exception):
"""
Raised when Rìg is started without Rule.
Raised when Ellis is started without Rule.
Possible cases :
- The config file doesn't define any Rule.
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions rig/main.py → ellis/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import sys
import warnings

from .rig import Rig
from .ellis import Ellis
from .exceptions import NoRuleError


__version__ = "1.0.dev1"
__author__ = ("François Kubler <francois+rig@kubler.org>",)
__author__ = ("François Kubler <francois+ellis@kubler.org>",)
__copyright__ = "Copyright (c) 2016 François Kubler"
__license__ = "GPLv3"
__url__ = "https://github.com/Frzk/Rig"
__url__ = "https://github.com/Frzk/Ellis"


def customized_warning(message, category=UserWarning, filename='', lineno=-1):
Expand All @@ -37,7 +37,7 @@ def read_cmdline():
Parses optional command line arguments.
"""
info = {
"prog": "Rìg",
"prog": "Ellis",
"description": "%(prog)s version {0}".format(__version__),
"epilog": "For further help please head over to {0}"
.format(__url__),
Expand All @@ -61,7 +61,7 @@ def read_cmdline():

def main():
"""
Entry point for Rìg.
Entry point for Ellis.
"""
# Monkey patch warnings.showwarning:
warnings.showwarning = customized_warning
Expand All @@ -73,10 +73,10 @@ def main():
config_file = args['config_file']

try:
rig = Rig(config_file)
ellis = Ellis(config_file)
except NoRuleError:
msg = ("There are no valid rules in the config file. "
"Rig can not run without rules.")
"Ellis can not run without rules.")
print_err(msg)
else:
rig.start()
ellis.start()
2 changes: 1 addition & 1 deletion rig/matches.py → ellis/matches.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Matches(dict):
When a new entry appears in the journald log, it is tested against several
:class:`rule.Rule`s :class:`filter.Filter`s. When a match is found, a
counter for this match has to be incremented by one so Rìg can trigger
counter for this match has to be incremented by one so Ellis can trigger
the :class:`rule.Rule` :class:`action.Action` when the :class:`rule.Rule`
limit is reached. Matches allows us to do that.
"""
Expand Down
5 changes: 3 additions & 2 deletions rig/rule.py → ellis/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ def __init__(self, name, filter, limit, action):
*name* is the name of the Rule. It helps you identify the Rule.
*filter* is a string containing the regular expressions that Rìg will
try to detect. It is converted in a :class:`filter.Filter` object.
*filter* is a string containing the regular expressions that Ellis
will try to detect. It is converted in a :class:`filter.Filter`
object.
Each journald message that matches the *filter* increments a counter
for the Rule. When *limit* is reached, the action is executed.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 11 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,36 @@
from setuptools import setup


# Get version from `rig/main.py`:
# Get version from `ellis/main.py`:
version = re.search('^__version__\s*=\s*"(.*)"',
open('rig/main.py').read(),
open('ellis/main.py').read(),
re.M) \
.group(1)


setup(name='rig',
setup(name='ellis',
version=version,
description='Rìg monitors systemd-journald and triggers actions.',
url='http://github.com/Frzk/Rig',
description='Ellis monitors systemd-journald and triggers actions.',
url='http://github.com/Frzk/Ellis',
author='François KUBLER',
author_email='francois+rig@kubler.org',
author_email='francois+ellis@kubler.org',

entry_points={
"console_scripts": ['rig = rig.main:main']
"console_scripts": ['ellis = ellis.main:main']
},

# data_files=[
# ('/usr/lib/systemd/system', ['rig.service']),
# ('/usr/lib/systemd/system', ['ellis.service']),
# ],

packages=[
'rig',
'rig_actions'
'ellis',
'ellis_actions'
],

classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Environnement :: Console',
'Environment :: Console',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Operating System :: POSIX :: Linux',
Expand Down

0 comments on commit e8141ab

Please sign in to comment.