logmon


Namelogmon JSON
Version 0.0.2 PyPI version JSON
download
home_pageNone
SummaryLinux authentication log monitor and commands executor
upload_time2024-09-07 12:01:05
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords authentication logs monitoring telegram
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Linux authentication log (auth.log) monitor and commands executor

## Install
Make dir and creane venv

    $ sudo mkdir -p /opt/apps/logmon
    $ sudo python3 -m venv /opt/apps/logmon/

Install package in venv

    $ sudo /opt/apps/logmon/bin/python3 -m pip install logmon


## Init telegram
    $ cd /opt/apps/logmon && sudo ./bin/python3 -m logmon.init
Initialise telegram bot token and admin chat id

## Run log monitor in command line (for test)
    $ cd /opt/apps/logmon && sudo ./bin/python3 -m logmon.main_watcher
Read /var/log/auth.log and send events to admin telegram

## Run commands executor in command line (for test)
    $ cd /opt/apps/logmon && sudo ./bin/python3 -m logmon.main_executor

Read commands from admin chat

    /stat - show system cpus load and memory usage
    
    /run args - run command from args and return response
    
    /rb - reboot

    /sd - shutdown

## Run log monitor as service

Create and edit .service file

    $ sudo nano /etc/systemd/system/logmon-watcher.service

Paste

    [Unit]
    Description=Logmon-watcher
    After=network.target

    [Service]
    Environment=VIRTUAL_ENV=/opt/apps/logmon
    Environment=PYTHONPATH=/opt/apps/logmon
    ExecStart=/opt/apps/logmon/bin/python3 -m logmon.main_watcher
    Restart=always
    RestartSec=60

    [Install]
    WantedBy=multi-user.target

Enable and start service

    $ sudo systemctl enable logmon-watcher.service
    $ sudo systemctl start logmon-watcher.service


## Run commands executor as service
    $ sudo nano /etc/systemd/system/logmon-executor.service

Paste

    [Unit]
    Description=Logmon-executor
    After=network.target

    [Service]
    Environment=VIRTUAL_ENV=/opt/apps/logmon
    Environment=PYTHONPATH=/opt/apps/logmon
    ExecStart=/opt/apps/logmon/bin/python3 -m logmon.main_executor
    Restart=always
    RestartSec=60

    [Install]
    WantedBy=multi-user.target

Enable and start service

    $ sudo systemctl enable logmon-executor.service
    $ sudo systemctl start logmon-executor.service

# Uninstall

    $ sudo systemctl stop logmon-watcher.service ; sudo systemctl disable logmon-watcher.service ; sudo rm /etc/systemd/system/logmon-watcher.service
    
    $ sudo systemctl stop logmon-executor.service ; sudo systemctl disable logmon-executor.service ; sudo rm /etc/systemd/system/logmon-executor.service

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "logmon",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "authentication, logs, monitoring, telegram",
    "author": null,
    "author_email": "DrEm-s <unfol2000@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/82/53/8be6cf8e72b4068e95bb8f14298b78759999ac8dca39d67240afe774b1e6/logmon-0.0.2.tar.gz",
    "platform": null,
    "description": "# Linux authentication log (auth.log) monitor and commands executor\n\n## Install\nMake dir and creane venv\n\n    $ sudo mkdir -p /opt/apps/logmon\n    $ sudo python3 -m venv /opt/apps/logmon/\n\nInstall package in venv\n\n    $ sudo /opt/apps/logmon/bin/python3 -m pip install logmon\n\n\n## Init telegram\n    $ cd /opt/apps/logmon && sudo ./bin/python3 -m logmon.init\nInitialise telegram bot token and admin chat id\n\n## Run log monitor in command line (for test)\n    $ cd /opt/apps/logmon && sudo ./bin/python3 -m logmon.main_watcher\nRead /var/log/auth.log and send events to admin telegram\n\n## Run commands executor in command line (for test)\n    $ cd /opt/apps/logmon && sudo ./bin/python3 -m logmon.main_executor\n\nRead commands from admin chat\n\n    /stat - show system cpus load and memory usage\n    \n    /run args - run command from args and return response\n    \n    /rb - reboot\n\n    /sd - shutdown\n\n## Run log monitor as service\n\nCreate and edit .service file\n\n    $ sudo nano /etc/systemd/system/logmon-watcher.service\n\nPaste\n\n    [Unit]\n    Description=Logmon-watcher\n    After=network.target\n\n    [Service]\n    Environment=VIRTUAL_ENV=/opt/apps/logmon\n    Environment=PYTHONPATH=/opt/apps/logmon\n    ExecStart=/opt/apps/logmon/bin/python3 -m logmon.main_watcher\n    Restart=always\n    RestartSec=60\n\n    [Install]\n    WantedBy=multi-user.target\n\nEnable and start service\n\n    $ sudo systemctl enable logmon-watcher.service\n    $ sudo systemctl start logmon-watcher.service\n\n\n## Run commands executor as service\n    $ sudo nano /etc/systemd/system/logmon-executor.service\n\nPaste\n\n    [Unit]\n    Description=Logmon-executor\n    After=network.target\n\n    [Service]\n    Environment=VIRTUAL_ENV=/opt/apps/logmon\n    Environment=PYTHONPATH=/opt/apps/logmon\n    ExecStart=/opt/apps/logmon/bin/python3 -m logmon.main_executor\n    Restart=always\n    RestartSec=60\n\n    [Install]\n    WantedBy=multi-user.target\n\nEnable and start service\n\n    $ sudo systemctl enable logmon-executor.service\n    $ sudo systemctl start logmon-executor.service\n\n# Uninstall\n\n    $ sudo systemctl stop logmon-watcher.service ; sudo systemctl disable logmon-watcher.service ; sudo rm /etc/systemd/system/logmon-watcher.service\n    \n    $ sudo systemctl stop logmon-executor.service ; sudo systemctl disable logmon-executor.service ; sudo rm /etc/systemd/system/logmon-executor.service\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Linux authentication log monitor and commands executor",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/DrEm-s/logmonitor"
    },
    "split_keywords": [
        "authentication",
        " logs",
        " monitoring",
        " telegram"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c1722d5223b38532aa61cca9c365f14a461d38fcea1809f8131ab6eda4462798",
                "md5": "5138d43ff017c1541efb99e06e77c903",
                "sha256": "81cb6dbe904f4ca7be19acecc983790affb29188ab60ab353e01d3b75ef2b452"
            },
            "downloads": -1,
            "filename": "logmon-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5138d43ff017c1541efb99e06e77c903",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8057,
            "upload_time": "2024-09-07T12:01:04",
            "upload_time_iso_8601": "2024-09-07T12:01:04.249278Z",
            "url": "https://files.pythonhosted.org/packages/c1/72/2d5223b38532aa61cca9c365f14a461d38fcea1809f8131ab6eda4462798/logmon-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "82538be6cf8e72b4068e95bb8f14298b78759999ac8dca39d67240afe774b1e6",
                "md5": "bee288b91515ce50d48cb1b54d516a9c",
                "sha256": "75fc9dd28431c1516c2713e5de1a61cbf1e4b7c3d5c68908fed5c53187cfa932"
            },
            "downloads": -1,
            "filename": "logmon-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "bee288b91515ce50d48cb1b54d516a9c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7016,
            "upload_time": "2024-09-07T12:01:05",
            "upload_time_iso_8601": "2024-09-07T12:01:05.640256Z",
            "url": "https://files.pythonhosted.org/packages/82/53/8be6cf8e72b4068e95bb8f14298b78759999ac8dca39d67240afe774b1e6/logmon-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-07 12:01:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DrEm-s",
    "github_project": "logmonitor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "logmon"
}
        
Elapsed time: 0.65617s