Update README.md etc

This commit is contained in:
Sefinek 2024-12-19 15:55:58 +01:00
parent ce1b231dc8
commit 81e8f2c5f2
3 changed files with 73 additions and 55 deletions

View file

@ -10,29 +10,27 @@ See also this: [sefinek/Cloudflare-WAF-To-AbuseIPDB](https://github.com/sefinek/
## 📋 Requirements ## 📋 Requirements
- Node.js + npm - [Node.js + npm](https://nodejs.org)
- Git - [Git](https://git-scm.com)
## 🧪 Tested operating systems
- **Ubuntu Server:** 20.04 & 22.04
*If the distribution you're using to run this tool isn't listed here but works correctly, please create a new [Issue](https://github.com/sefinek/UFW-AbuseIPDB-Reporter/issues) or submit a [Pull request](https://github.com/sefinek/UFW-AbuseIPDB-Reporter/pulls).*
## 📥 Installation ## 📥 Installation
### curl
```bash ```bash
bash <(curl -s https://raw.githubusercontent.com/sefinek/UFW-AbuseIPDB-Reporter/main/install.sh) cd ~
git clone https://github.com/sefinek/UFW-AbuseIPDB-Reporter.git
cd UFW-AbuseIPDB-Reporter
npm install
cp default.config.js config.js
sudo chmod 644 /var/log/ufw.log
node .
^C
npm uninstall corepack -g
npm install pm2 -g
pm2 startup
[Wklej komendę wygenerowana przez pm2 startup]
pm2 save
``` ```
### wget
```bash
bash <(wget -qO- https://raw.githubusercontent.com/sefinek/UFW-AbuseIPDB-Reporter/main/install.sh)
```
The installation script will automatically download and configure the tool on your machine. During the installation process, you will be prompted to provide an [AbuseIPDB API token](https://www.abuseipdb.com/account/api).
## 🖥️ Usage ## 🖥️ Usage
After successful installation, the script will run continuously in the background, monitoring UFW logs and automatically reporting malicious IP addresses. After successful installation, the script will run continuously in the background, monitoring UFW logs and automatically reporting malicious IP addresses.
@ -41,25 +39,20 @@ The tool requires no additional user action after installation. However, it's wo
Servers open to the world are constantly scanned by bots, usually looking for vulnerabilities or other security gaps. Servers open to the world are constantly scanned by bots, usually looking for vulnerabilities or other security gaps.
So don't be surprised if the next day, the number of reports to AbuseIPDB exceeds a thousand. So don't be surprised if the next day, the number of reports to AbuseIPDB exceeds a thousand.
### 🔍 Checking service status ### 🔍 Checking logs
```bash ```bash
sudo systemctl status abuseipdb-ufw.service pm2 logs ufw-abuseipdb
```
To see the current logs generated by the process, use the command:
```bash
journalctl -u abuseipdb-ufw.service -f
``` ```
### 📄 Example report ### 📄 Example report
``` ```
Blocked by UFW (TCP on 80) Blocked by UFW on vserver1 [80/tcp]
Source port: 28586 Source port: 23639
TTL: 116 TTL: 247
Packet length: 48 Packet length: 40
TOS: 0x08 TOS: 0x00
This report (for 46.174.191.31) was generated by: This report (for 45.156.129.52) was generated by:
https://github.com/sefinek/UFW-AbuseIPDB-Reporter https://github.com/sefinek/UFW-AbuseIPDB-Reporter
``` ```

View file

@ -1 +1,26 @@
module.exports = {}; module.exports = {
apps: [{
name: 'ufw-abuseipdb',
script: './index.js',
// Logging configuration
log_date_format: 'HH:mm:ss.SSS DD.MM.YYYY',
merge_logs: true,
log_file: '/var/log/ufw-abuseipdb/combined.log',
out_file: '/var/log/ufw-abuseipdb/out.log',
error_file: '/var/log/ufw-abuseipdb/error.log',
// Application restart policy settings
wait_ready: true,
autorestart: true,
max_restarts: 10,
min_uptime: 20000,
restart_delay: 5000,
exp_backoff_restart_delay: 3000,
// Environment variables configuration
env: {
NODE_ENV: 'production',
},
}],
};

View file

@ -12,42 +12,42 @@ export default [
}, },
}, },
rules: { rules: {
'arrow-spacing': [1, { before: true, after: true }], 'arrow-spacing': ['warn', { before: true, after: true }],
'comma-dangle': [1, { arrays: 'always-multiline', objects: 'always-multiline' }], 'comma-dangle': ['warn', { arrays: 'always-multiline', objects: 'always-multiline' }],
'comma-spacing': 1, 'comma-spacing': 'warn',
'comma-style': 'error', 'comma-style': 'error',
'curly': ['error', 'multi-line', 'consistent'], 'curly': ['error', 'multi-line', 'consistent'],
'dot-location': ['error', 'property'], 'dot-location': ['error', 'property'],
'handle-callback-err': 'off', 'handle-callback-err': 'off',
'indent': [1, 'tab'], 'indent': ['warn', 'tab'],
'keyword-spacing': 1, 'keyword-spacing': 'warn',
'max-nested-callbacks': ['error', { max: 4 }], 'max-nested-callbacks': ['error', { max: 4 }],
'max-statements-per-line': ['error', { max: 2 }], 'max-statements-per-line': ['error', { max: 2 }],
'no-console': 'off', 'no-console': 'off',
'no-empty': 1, 'no-empty': 'warn',
'no-empty-function': 1, 'no-empty-function': 'warn',
'no-floating-decimal': 'error', 'no-floating-decimal': 'error',
'no-lonely-if': 1, 'no-lonely-if': 'warn',
'no-multi-spaces': 1, 'no-multi-spaces': 'warn',
'no-multiple-empty-lines': [1, { max: 3, maxEOF: 1, maxBOF: 0 }], 'no-multiple-empty-lines': ['warn', { max: 3, maxEOF: 1, maxBOF: 0 }],
'no-shadow': ['error', { allow: ['err', 'resolve', 'reject'] }], 'no-shadow': ['error', { allow: ['err', 'resolve', 'reject'] }],
'no-trailing-spaces': 1, 'no-trailing-spaces': 'warn',
'no-unreachable': 1, 'no-unreachable': 'warn',
'no-unused-vars': 1, 'no-unused-vars': 'warn',
'no-use-before-define': ['error', { functions: false, classes: true }], 'no-use-before-define': ['error', { functions: false, classes: true }],
'no-var': 'error', 'no-var': 'error',
'object-curly-spacing': [1, 'always'], 'object-curly-spacing': ['warn', 'always'],
'prefer-const': 'error', 'prefer-const': 'error',
'quotes': [1, 'single'], 'quotes': ['warn', 'single'],
'semi': [1, 'always'], 'semi': ['warn', 'always'],
'sort-vars': 1, 'sort-vars': 'warn',
'space-before-blocks': 1, 'space-before-blocks': 'warn',
'space-before-function-paren': [1, { anonymous: 'never', named: 'never', asyncArrow: 'always' }], 'space-before-function-paren': ['warn', { anonymous: 'never', named: 'never', asyncArrow: 'always' }],
'space-in-parens': 1, 'space-in-parens': 'warn',
'space-infix-ops': 1, 'space-infix-ops': 'warn',
'space-unary-ops': 1, 'space-unary-ops': 'warn',
'spaced-comment': 1, 'spaced-comment': 'warn',
'wrap-regex': 1, 'wrap-regex': 'warn',
'yoda': 'error', 'yoda': 'error',
}, },
ignores: ['node_modules', '*min.js', '*bundle*', 'build/*', 'dist/*'], ignores: ['node_modules', '*min.js', '*bundle*', 'build/*', 'dist/*'],