• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » Install, Configure PyFilter to Control Illegitimate SSH Login Attempts

By Abhishek Ghosh April 6, 2018 7:44 pm Updated on April 25, 2018

Install, Configure PyFilter to Control Illegitimate SSH Login Attempts

Advertisement

There are various intrusion prevention software available to prevent brute-force attacks. Here is How to Install, Configure PyFilter to Control Illegitimate SSH Login Attempts. PyFilter project is sponsored by Digital Ocean and developed by individual developer as Free Software under GNU GPL 3.0 License. PyFilter has own Github repo, own website. I guess a question will arise in mind – why not Fail2Ban but PyFilter? PyFilter has PyFilter-Admin which provides statistical information including total bans which is not easy to setup with Fail2Ban (we have shown configuration with Badips with Fail2Ban for analytics). As it is modern, written in Python, in future we hope that we can easily implement Big Data analysis tools with it or create a WordPress Plugin. There is nothing wrong to test different prevention software. Fail2Ban of course time tested, powerful but never just easy even for an used sysadmin to handle. There are actually more bigger hammers for intrusion prevention, but commonly our need is limited to LAMP/LEMP servers and SSH. Here is official website and official GitHub repo of PyFilter :

Vim
1
2
https://pyfilter.co.uk/
https://github.com/Jason2605/PyFilter

Here is PyFilter Admin :

Vim
1
https://github.com/Jason2605/PyFilter-Admin

Developer has written guide on Digital Ocean and official website. We are combining PyFilter and PyFilter-Admin in this guide.

Advertisement

---

Remember : If you get wrongly locked-in, you need to either login to web admin console of webhost to flash iptables or request your webhost to do so. We will suggest to use our method to use cron to flash iptables every 5 minutes during testing if your web admin console of webhost has no web based SSH (that is not uncommon among OpenVZ servers). As we told before – before throwing stones towards hackers, you should be careful. Do not run Fail2Ban or DenyHost with PyFilter.

Install, Configure PyFilter to Control Illegitimate SSH Login Attempts

 

Install, Configure PyFilter to Control SSH Login Attempts

 

PyFilter needs Python 3. Python 3 is by default installed on Ubuntu 16.04 (and will be on Ubuntu 18.04 LTS). For single server installation, you simply need to clone the GitHub repo :

Vim
1
2
3
cd ~
git clone https://github.com/Jason2605/PyFilter.git
ls -al

You’ll see a directory named PyFilter.git. You will move that directory to /usr/local/ :

Vim
1
2
sudo mv PyFilter /usr/local/PyFilter
cd /usr/local/PyFilter

Next, work on the configuration files :

Vim
1
2
sudo cp Config/config.default.json Config/config.json
cat Config/config.json

You’ll see the defaults settings as output. You can change the settings as per your need. This is default config file :

Vim
1
https://github.com/Jason2605/PyFilter/blob/master/Config/config.default.json

Add your server’s IP or VPN’s IP in "ignored_ips": ["127.0.0.1"], during testing. Last step is simply executing the script and creating system service :

Vim
1
2
3
4
5
sudo chmod +x run.sh
./run.sh
## create service
sudo chmod +x install.sh
./install.sh

Now, if you run :

Vim
1
sudo systemctl status PyFilter

You’ll get normal expected output like any other system service. We need to install GEOIP, which is optional unless you need the name of countries.

Vim
1
2
## pip install geoip2
pip3 install geoip2

If you face error, that is not strange. If you face error, ask on StackOverflow. Not everything on this earth has explainable reason!

For using PyFilter-Admin and manually add IPs via it, you need Redis :

Vim
1
2
pip3 install redis
nano Config/config.json

Find the line "database": "sqlite" and change it to "database": "redis". This will be the config :

Vim
1
2
3
4
5
6
7
8
9
10
  "redis": {
    "host": "127.0.0.1",
    "password": null,
    "database": 0,
    "sync_bans": {
      "active": true,
      "name": "your_hostname",
      "check_time": 600
    }
  },

Restart PyFilter like any other service and check status :

Vim
1
2
sudo systemctl restart PyFilter
sudo systemctl status PyFilter

It is better to install PyFilter-Admin on development server first to test than running on LAMP server with production WordPress like site. For running PyFilter-Admin, run these commands :

Vim
1
2
3
git clone https://github.com/Jason2605/PyFilter-Admin
pip install -r requirements.txt
python run_server.py

Default username is PyFilter The default password is PyFilter12345. Just to remind, for Django we run :

Vim
1
python manage.py runserver your-server-ip:8000

Then navigate to the admin panel’s URL in a browser like :

Vim
1
http://your-server-ip:8000/admin/

This Article Has Been Shared 274 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Install, Configure PyFilter to Control Illegitimate SSH Login Attempts

  • SELinux and Security in the Context of Cloud Servers

    SELinux Was Developed By United States National Security Agency (NSA). SELinux and Security in the Context of Cloud Servers Can Be Questionable.

  • WordPress XML-RPC Attack & Fake PHP5-FPM Error

    WordPress XML-RPC Attack Can Bring DDoS Resulting in Random 502 PHP5-FPM Errors on Nginx Server or Can Make the Database Down. Here is Fix.

  • Setup SFTP Without Shell Access For WordPress, Cloud Server

    Often We Need To Host Account On VPS OR Cloud Server Where It Is Desired To Have A Setup SFTP Without Shell Access For WordPress Like cPanel.

  • How to Install Virtualmin/Webmin on Ubuntu 16.04

    Many Users Want A Free cPanel Like Web Hosting Control Panel. Virtualmin is Free. Here is How to Install Virtualmin/Webmin on Ubuntu 16.04.

  • HP Will Not Sell Cheap Cloud Servers To Amazon Like Companies

    Hewlett Packard Enterprise Will Not Sell Cheap Cloud Servers To Amazon Like Companies Who Order Building Servers at China To Save Dual Loss.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Proxy Server: Design Pattern in Programming January 30, 2023
  • Cyberpunk Aesthetics: What’s in it Special January 27, 2023
  • How to Do Electrical Layout Plan for Adding Smart Switches January 26, 2023
  • What is a Data Mesh? January 25, 2023
  • What is Vehicular Ad-Hoc Network? January 24, 2023

About This Article

Cite this article as: Abhishek Ghosh, "Install, Configure PyFilter to Control Illegitimate SSH Login Attempts," in The Customize Windows, April 6, 2018, January 31, 2023, https://thecustomizewindows.com/2018/04/install-configure-pyfilter-to-control-illegitimate-ssh-login-attempts/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT