Write file block_openai.sh
This commit is contained in:
parent
1b1b5fde0e
commit
5f58648188
1 changed files with 20 additions and 0 deletions
|
@ -313,6 +313,26 @@ write_files:
|
||||||
curl https://git.sr.ht/~marcuskammer/cloudinit/blob/main/.sbclrc -o /home/marcus/.sbclrc && chown marcus:marcus /home/marcus/.sbclrc
|
curl https://git.sr.ht/~marcuskammer/cloudinit/blob/main/.sbclrc -o /home/marcus/.sbclrc && chown marcus:marcus /home/marcus/.sbclrc
|
||||||
sbcl --non-interactive --eval "(ql:quickload '(:hunchentoot :spinneret :dexador :rove :vecto :woo :clsql-sqlite3))" --quit
|
sbcl --non-interactive --eval "(ql:quickload '(:hunchentoot :spinneret :dexador :rove :vecto :woo :clsql-sqlite3))" --quit
|
||||||
|
|
||||||
|
- path: /home/marcus/block_openai.sh
|
||||||
|
owner: 'marcus:marcus'
|
||||||
|
permissions: '0755'
|
||||||
|
defer: True
|
||||||
|
content: |
|
||||||
|
#!/bin/bash
|
||||||
|
# Purpose: Block OpenAI ChatGPT bot CIDR
|
||||||
|
# Tested on: Debian and Ubuntu Linux
|
||||||
|
# Author: Vivek Gite {https://www.cyberciti.biz} under GPL v2.x+
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
file="/tmp/out.txt.$$"
|
||||||
|
wget -q -O "$file" https://openai.com/gptbot-ranges.txt 2>/dev/null
|
||||||
|
|
||||||
|
while IFS= read -r cidr
|
||||||
|
do
|
||||||
|
sudo ufw deny proto tcp from $cidr to any port 80
|
||||||
|
sudo ufw deny proto tcp from $cidr to any port 443
|
||||||
|
done < "$file"
|
||||||
|
[ -f "$file" ] && rm -f "$file"
|
||||||
|
|
||||||
- path: /home/marcus/setup_user_all.sh
|
- path: /home/marcus/setup_user_all.sh
|
||||||
owner: 'marcus:marcus'
|
owner: 'marcus:marcus'
|
||||||
permissions: '0755'
|
permissions: '0755'
|
||||||
|
|
Loading…
Add table
Reference in a new issue