←︎ tools :: ac4d3b4


1
commit ac4d3b47aff93420ed99198fa297ce8b6eca7fce (HEAD -> master)
2
Author: acidvegas <acid.vegas@acid.vegas>
3
Date:   Sat Mar 21 01:16:55 2020 -0400
4
5
    updated
6
---
7
 altdns.py         | 24 --------------
8
 deploy-anope      |  1 -
9
 deploy-nginx      | 96 +++++++++++++++++++++++++++++++++----------------------
10
 deploy-unrealircd |  2 ++
11
 monitor           |  1 +
12
 startbots         | 44 +++++--------------------
13
 6 files changed, 69 insertions(+), 99 deletions(-)
14
15
diff --git a/altdns.py b/altdns.py
16
deleted file mode 100644
17
index 48e5afd..0000000
18
--- a/altdns.py
19
+++ /dev/null
20
@@ -1,24 +0,0 @@
21
-#!/usr/bin/env python
22
-import socket
23
-
24
-dns = (
25
-	'chat.mirccloud.com',
26
-	'irc.fagz.net',
27
-	'irc.hardchats.net',
28
-	'irc.j3ws.biz',
29
-	'irc.j3ws.org',
30
-	'irc.k0de.org',
31
-	'irc.ngr.bz',
32
-	'irc.wepump.in',
33
-	'serious.fuckin.business'
34
-)
35
-
36
-servers = set([i[4][0] for i in socket.getaddrinfo('irc.supernets.org', 6667)])
37
-for hostname in dns:
38
-	try:
39
-		if socket.gethostbyname(hostname) in servers:
40
-			print('OK\t\t' + hostname)
41
-		else:
42
-			print('FAIL\t' + hostname)
43
-	except:
44
-		print('ERROR\t' + hostname)
45
diff --git a/deploy-anope b/deploy-anope
46
index 477d08c..0f90f5b 100755
47
--- a/deploy-anope
48
+++ b/deploy-anope
49
@@ -1,7 +1,6 @@
50
 #!/bin/sh
51
 set -xev
52
 
53
-CURRENT='2.0.6'
54
 ANOPE=$HOME/services
55
 BACKUP=$HOME/services.backup
56
 SOURCE=$HOME/services.source
57
diff --git a/deploy-nginx b/deploy-nginx
58
index 6f7c68b..c92de4c 100755
59
--- a/deploy-nginx
60
+++ b/deploy-nginx
61
@@ -1,40 +1,60 @@
62
 #!/bin/sh
63
 set -xev
64
-pacman -S certbot nginx-mainline
65
-htpasswd -c /home/irc/public_html/conf/.htpasswd restricted
66
-certbot --nginx -d hub.supernets.org
67
-echo "worker_processes auto;"
68
-echo "worker_cpu_affinity auto;"
69
-echo "error_log logs/error.log;"
70
-echo -e "\nevents {"
71
-echo -e "\tworker_connections 1024;"
72
-echo "}"
73
-echo "\nhttp {"
74
-echo -e "\tinclude mime.types;"
75
-echo -e "\tdefault_type application/octet-stream;"
76
-echo -e "\taccess_log off;"
77
-echo -e "\tsendfile on;"
78
-echo -e "\tserver_tokens off;"
79
-echo -e "\tserver {"
80
-echo -e "\t\tlisten PORT ssl;"      #note: change port
81
-echo -e "\t\tlisten [::]:PORT ssl;" #note: change port
82
-echo -e "\t\troot /home/supernets/www;"
83
-echo -e "\t\tserver_name hub.supernets.org;"
84
-echo -e "\t\tcharset UTF-8;"
85
-echo -e "\t\t#satisfy all;"
86
-echo -e "\t\tallow 1.2.3.4; # Link 1" #note: add all ipv4/ipv6 links
87
-echo -e "\t\tallow 1.2.3.4; # Link 2"
88
-echo -e "\t\tallow 1.2.3.4; # Link 3"
89
-echo -e "\t\tallow 1.2.3.4; # Link 4"
90
-echo -e "\t\tallow 1.2.3.4; # Link 5"
91
-echo -e "\t\tdeny all;"
92
-echo -e "\t\tauth_basic \"Restricted\";"
93
-echo -e "\t\tauth_basic_user_file /home/supernets/www/.htpasswd;"
94
-echo -e "\t}"
95
-echo "}"
96
-git clone --depth 1 https://github.com/supernets/www $HOME/www
97
-certbot certonly --email admin@supernets.org --rsa-key-size 4096 --webroot -w $HOME/www/ -d supernets.org -d webchat.supernets.org -d www.supernets.org
98
-echo -e "[Unit]\nDescription=Lets Encrypt renewal\n\n[Service]\nType=oneshot\nExecStart=/usr/bin/certbot renew -n -q --agree-tos --post-hook=\"systemctl reload nginx\"" > /etc/systemd/system/certbot.service
99
-echo -e "[Unit]\nDescription=Twice daily renewal of Let's Encrypts certificates\n\n[Timer]\nOnCalendar=0/12:00:00\nRandomizedDelaySec=1h\nPersistent=true\n\n[Install]\nWantedBy=timers.target" > /etc/systemd/system/certbot.timer
100
-systemctl enable certbot.timer && systemctl start certbot.timer
101
-systemctl enable nginx         && systemctl start nginx
102
+
103
+HUB="hub.supernets.org" # change me
104
+USERNAME=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
105
+PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
106
+PORT="9999" # change me
107
+
108
+setup_home() {
109
+	mkdir /home/acidvegas/www
110
+	wget -O /home/acidvegas/www/badwords.conf   https://raw.githubusercontent.com/supernets/unrealircd/master/doc/conf/badwords.conf
111
+	wget -O /home/acidvegas/www/except.conf     https://raw.githubusercontent.com/supernets/unrealircd/master/doc/conf/except.conf
112
+	wget -O /home/acidvegas/www/ircd.conf       https://raw.githubusercontent.com/supernets/unrealircd/master/doc/conf/unrealircd.remote.conf # edit this
113
+	wget -O /home/acidvegas/www/modules.conf    https://raw.githubusercontent.com/supernets/unrealircd/master/doc/conf/modules.conf
114
+	wget -O /home/acidvegas/www/opers.conf      https://raw.githubusercontent.com/supernets/unrealircd/master/doc/conf/opers.conf             # edit this
115
+	wget -O /home/acidvegas/www/spamfilter.conf https://raw.githubusercontent.com/supernets/unrealircd/master/doc/conf/spamfilter.conf
116
+	chown acidvegas:acidvegas /home/acidvegas/www && chown acidvegas:acidvegas /home/acidvegas/www/* && chmod 755 /home/acidvegas/www/*.conf
117
+}
118
+
119
+setup_nginx() {
120
+	echo -e "error_log /dev/null;" > /etc/nginx/nginx.conf
121
+	echo -e "http {" >> /etc/nginx/nginx.conf
122
+	echo -e "\taccess_log off;" >> /etc/nginx/nginx.conf
123
+	echo -e "\tsendfile on;" >> /etc/nginx/nginx.conf
124
+	echo -e "\tsendfile_max_chunk 1m;" >> /etc/nginx/nginx.conf
125
+	echo -e "\tserver_tokens off;" >> /etc/nginx/nginx.conf
126
+	echo -e "\tserver {" >> /etc/nginx/nginx.conf
127
+	echo -e "\t\tlisten [::]:$PORT ssl http2;" >> /etc/nginx/nginx.conf
128
+	echo -e "\t\tlisten $PORT ssl http2;" >> /etc/nginx/nginx.conf
129
+	echo -e "\t\troot /home/acidvegas/www;" >> /etc/nginx/nginx.conf
130
+	echo -e "\t\tserver_name $HUB;" >> /etc/nginx/nginx.conf
131
+	echo -e "\t\tcharset UTF-8;" >> /etc/nginx/nginx.conf
132
+	echo -e "\t\tsatisfy all;" >> /etc/nginx/nginx.conf
133
+	echo -e "\t\tallow 1.1.1.1; # Link 1" >> /etc/nginx/nginx.conf
134
+	echo -e "\t\tallow 2.2.2.2; # Link 2" >> /etc/nginx/nginx.conf
135
+	echo -e "\t\tallow 3.3.3.3; # Link 3" >> /etc/nginx/nginx.conf
136
+	echo -e "\t\tallow 4.4.4.4; # Link 4" >> /etc/nginx/nginx.conf
137
+	echo -e "\t\tdeny all;" >> /etc/nginx/nginx.conf
138
+	echo -e "\t\tauth_basic \"Restricted\";" >> /etc/nginx/nginx.conf
139
+	echo -e "\t\tauth_basic_user_file /etc/nginx/.htpasswd;" >> /etc/nginx/nginx.conf
140
+	echo -e "\t\tssl_certificate /etc/letsencrypt/live/$HUB/fullchain.pem;" >> /etc/nginx/nginx.conf
141
+	echo -e "\t\tssl_certificate_key /etc/letsencrypt/live/$HUB/privkey.pem;" >> /etc/nginx/nginx.conf
142
+	echo -e "\t\tssl_session_tickets off;" >> /etc/nginx/nginx.conf
143
+	echo "\t}" >> /etc/nginx/nginx.conf
144
+	echo "}" >> /etc/nginx/nginx.conf
145
+	printf "$USERNAME:$(openssl passwd -apr1 $PASSWORD)\n" > /etc/nginx/.htpasswd
146
+	systemctl enable nginx && systemctl start nginx
147
+}
148
+
149
+setup_certbot() {
150
+	certbot certonly --standalone -d $HUB -m admin@supernets.org
151
+	echo -e "[Unit]\nDescription=cerbot renewal\n\n[Service]\nType=oneshot\nExecStart=/usr/bin/certbot renew -n --quiet --agree-tos --deploy-hook systemctl restart nginx" > /etc/systemd/system/certbot.service
152
+	echo -e "[Unit]\nDescription=cerbot renewal timer\n\n[Timer]\nOnCalendar=0/12:00:00\nRandomizedDelaySec=1h\nPersistent=true\n\n[Install]\nWantedBy=timers.target" > /etc/systemd/system/certbot.timer
153
+	systemctl enable certbot.timer && systemctl start certbot.timer
154
+}
155
+
156
+setup_home
157
+setup_nginx
158
+setup_certbot
159
+echo "Remote include: https://$USERNAME:$PASSWORD@$HUB:$PORT/"
160
diff --git a/deploy-unrealircd b/deploy-unrealircd
161
index b787771..b013e44 100755
162
--- a/deploy-unrealircd
163
+++ b/deploy-unrealircd
164
@@ -24,6 +24,8 @@ deploy() {
165
 	SPKI=$($UNREAL/unrealircd spkifp | sed -n 5p)
166
 	echo -e "\nAdd the following line into the hub\'s links.conf file for this link:\n$SPKI"
167
 	$UNREAL/unrealircd start &
168
+	#crontab -l | { cat; echo "*/5 * * * * /home/ak/unrealircd/unrealircd croncheck"; } | crontab -
169
+	#crontab -l | { cat; echo "@reboot /home/ak/unrealircd/unrealircd croncheck";     } | crontab -
170
 }
171
 
172
 #todo: fix this mess
173
diff --git a/monitor b/monitor
174
index e78c2a6..f332ff4 100755
175
--- a/monitor
176
+++ b/monitor
177
@@ -5,5 +5,6 @@ while true; do
178
 		[ $? -ne 0 ] && echo "`date`: ping failed! ($i)" #&& notify-send "`date`: ping failed! ($i)"
179
 		sleep 1
180
 	done
181
+	echo "done"
182
 	sleep 3600
183
 done
184
diff --git a/startbots b/startbots
185
index 85a016c..bab5a9c 100755
186
--- a/startbots
187
+++ b/startbots
188
@@ -1,37 +1,9 @@
189
 #!/bin/sh
190
-start() {
191
-	pkill -9 abduco && pkill -9 python
192
-	cd $HOME/bots              && abduco -fnr FUCKYOU      python 5000.py         && sleep 1
193
-	cd $HOME/bots/anythinggoes && abduco -fnr anythinggoes python anythinggoes.py && sleep 1
194
-	cd $HOME/bots              && abduco -fnr cancer       python cancer.py       && sleep 1
195
-	cd $HOME/bots/dickserv     && abduco -fnr dickserv     python dickserv.py     && sleep 1
196
-	cd $HOME/bots/irccex/efnet && abduco -fnr irccex-efnet python irccex.py       && sleep 1
197
-	cd $HOME/bots/irccex/super && abduco -fnr irccex-super python irccex.py       && sleep 1
198
-	cd $HOME/bots              && abduco -fnr limitserv    python limitserv.py    && sleep 1
199
-	cd $HOME/bots/scroll       && abduco -fnr scroll       python scroll.py       && sleep 1
200
-	cd $HOME/bots              && abduco -fnr spiderweb    python spiderweb.py
201
-}
202
-
203
-get() {
204
-	mkdir $HOME/bots
205
-	wget -O $HOME/bots/5000.py https://raw.githubusercontent.com/acidvegas/trollbots/master/5000.py
206
-	mkdir -P $HOME/bots/anythinggoes/data
207
-	wget -O $HOME/bots/anythinggoes/anythinggoes.py https://github.com/acidvegas/random/blob/master/irc/anythinggoes/anythinggoes.py
208
-	wget -O $HOME/bots/anythinggoes/data/banana.txt https://github.com/acidvegas/random/blob/master/irc/anythinggoes/data/banana.txt
209
-	wget -O $HOME/bots/anythinggoes/data/crab.txt https://github.com/acidvegas/random/blob/master/irc/anythinggoes/data/crab.txt
210
-	wget -O $HOME/bots/anythinggoes/data/crate.txt https://github.com/acidvegas/random/blob/master/irc/anythinggoes/data/crate.txt
211
-	wget -O $HOME/bots/anythinggoes/data/worms.txt https://github.com/acidvegas/random/blob/master/irc/anythinggoes/data/worms.txt
212
-	wget -O $HOME/bots/cancer.py https://raw.githubusercontent.com/acidvegas/random/master/irc/cancer.py
213
-	git clone --depth 1 https://github.com/acidvegas/dickserv.git $HOME/bots/dickserv
214
-	mkdir $HOME/bots/irccex
215
-	git clone --depth 1 https://github.com/pumpcoin/irccex.git $HOME/bots/irccex/irccex-efnet
216
-	git clone --depth 1 https://github.com/pumpcoin/irccex.git $HOME/bots/irccex/irccex-super
217
-	wget -O $HOME/bots/limitserv.py https://raw.githubusercontent.com/acidvegas/limitserv/master/limitserv.py
218
-	git clone --depth 1 https://github.com/ircart/scroll.git $HOME/bots/scroll
219
-	rm -r $HOME/bots/scroll/scroll/data/art
220
-	git clone --depth 1 https://github.com/ircart/ircart.git $HOME/bots/scroll/scroll/data/art
221
-	wget -O $HOME/bots/spiderweb.py https://raw.githubusercontent.com/acidvegas/trollbots/master/spiderweb.py
222
-}
223
-
224
-[ $1 = "start" ] && start && exit 1
225
-[ $1 = "get"   ] && get   && exit 1
226
+pkill -9 abduco && pkill -9 python
227
+cd $HOME/bots              && abduco -fnr 5000         python 5000.py         && sleep 1
228
+cd $HOME/bots/anythinggoes && abduco -fnr anythinggoes python anythinggoes.py && sleep 1
229
+cd $HOME/bots              && abduco -fnr cancer       python cancer.py       && sleep 1
230
+cd $HOME/bots/dickserv     && abduco -fnr dickserv     python dickserv.py     && sleep 1
231
+cd $HOME/bots/irccex/efnet && abduco -fnr irccex-efnet python irccex.py       && sleep 1
232
+cd $HOME/bots/irccex/super && abduco -fnr irccex-super python irccex.py       && sleep 1
233
+cd $HOME/bots/scroll       && abduco -fnr scroll       python scroll.py