DEV Community

Cover image for Cara membuat jail fail2ban untuk Nextcloud
Erol Joudy
Erol Joudy

Posted on β€’ Originally published at blog.erol.dev

3 2

Cara membuat jail fail2ban untuk Nextcloud

Instalasi fail2ban

Jalankan perintah berikut secara berurutan untuk menginstall fail2ban.

sudo wget -q https://github.com/fail2ban/fail2ban/releases/download/0.11.2/fail2ban_0.11.2-1.upstream1_all.deb
Enter fullscreen mode Exit fullscreen mode
sudo apt install ~/fail2ban_0.11.2-1.upstream1_all.deb
Enter fullscreen mode Exit fullscreen mode

Selanjutnya untuk mengecek status failban apakah berjalan dengan baik, jalankan perintah berikut.

sudo systemctl status fail2ban
Enter fullscreen mode Exit fullscreen mode

Sedangkan untuk mengecek versi fail2ban yang terpasang, dapat dicek dengan perintah berikut.

fail2ban-client -V
Enter fullscreen mode Exit fullscreen mode

Konfigurasi fail2ban

Membuat filter untuk Nextcloud

Jalankan perintah berikut ini, untuk membuat sebuah filter fail2ban bernama nextcloud.conf.

sudo nano /etc/fail2ban/filter.d/nextcloud.conf
Enter fullscreen mode Exit fullscreen mode

Salin dan isi file dengan baris dibawah ini.

[Definition]
_groupsre = (?:(?:,?\s*"\w+":(?:"[^"]+"|\w+))*)
failregex = ^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Login failed:
            ^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Trusted domain error.
datepattern = ,?\s*"time"\s*:\s*"%%Y-%%m-%%d[T ]%%H:%%M:%%S(%%z)?"
Enter fullscreen mode Exit fullscreen mode

Simpan file tersebut.

Membuat jail untuk Nextcloud

Jalankan perintah berikut ini, untuk membuat sebuah jail fail2ban bernama nextcloud.local.

sudo nano /etc/fail2ban/jail.d/nextcloud.local
Enter fullscreen mode Exit fullscreen mode

Salin dan isi dengan baris dibawah ini.

[nextcloud]
backend = auto
enabled = true
port = 80,443
protocol = tcp
filter = nextcloud
maxretry = 3
bantime = 86400
findtime = 43200
logpath = /var/www/nextcloud/nextcloud.log
Enter fullscreen mode Exit fullscreen mode

Image of AssemblyAI tool

Transforming Interviews into Publishable Stories with AssemblyAI

Insightview is a modern web application that streamlines the interview workflow for journalists. By leveraging AssemblyAI's LeMUR and Universal-2 technology, it transforms raw interview recordings into structured, actionable content, dramatically reducing the time from recording to publication.

Key Features:
πŸŽ₯ Audio/video file upload with real-time preview
πŸ—£οΈ Advanced transcription with speaker identification
⭐ Automatic highlight extraction of key moments
✍️ AI-powered article draft generation
πŸ“€ Export interview's subtitles in VTT format

Read full post

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay