🢀︎ tools :: d419740


commit d419740c326eb902d275bdefbe6e939021cd77c4
Author: acidvegas <acid.vegas@acid.vegas>
Date:   Mon Aug 12 23:01:23 2019 -0400

    updated

diff --git a/deploy-anope b/deploy-anope
index 7c1e606..beffeb2 100755
--- a/deploy-anope
+++ b/deploy-anope
@@ -7,8 +7,7 @@ SOURCE=$HOME/services.source
 
 setup() {
 	git clone --depth 1 https://github.com/supernets/anope.git $SOURCE
-	cd $SOURCE && $SOURCE/Config -nointro -quick && make && make install
-	cd $HOME && rm -rf $SOURCE
+	cd $SOURCE && $SOURCE/Config -nointro -quick && make && make install && cd $HOME && rm -rf $SOURCE
 }
 
 deploy() {
@@ -17,8 +16,7 @@ deploy() {
 }
 
 update() {
-	#todo: check & kill abduco watchdog process
-	[ ! -z $(screen -ls | grep ircdwatchdog) ] && screen -S ircdwatchdog -X quit
+	[ ! -z $(screen -ls | grep ircdwatchdog) ] && screen -S ircdwatchdog -X quit #todo: check & kill abduco watchdog process
 	mkdir $BACKUP
 	cp $NAOPE/conf/services.conf $BACKUP && cp $ANOPE/data/anope.db $BACKUP
 	pkill -9 services
diff --git a/deploy-nginx b/deploy-nginx
index 26b437d..6f7c68b 100755
--- a/deploy-nginx
+++ b/deploy-nginx
@@ -1,7 +1,8 @@
 #!/bin/sh
 set -xev
-
 pacman -S certbot nginx-mainline
+htpasswd -c /home/irc/public_html/conf/.htpasswd restricted
+certbot --nginx -d hub.supernets.org
 echo "worker_processes auto;"
 echo "worker_cpu_affinity auto;"
 echo "error_log logs/error.log;"
@@ -15,10 +16,10 @@ echo -e "\taccess_log off;"
 echo -e "\tsendfile on;"
 echo -e "\tserver_tokens off;"
 echo -e "\tserver {"
-echo -e "\t\tlisten PORT;"      #note: change port
-echo -e "\t\tlisten [::]:PORT;" #note: change port
+echo -e "\t\tlisten PORT ssl;"      #note: change port
+echo -e "\t\tlisten [::]:PORT ssl;" #note: change port
 echo -e "\t\troot /home/supernets/www;"
-echo -e "\t\tserver_name localhost;"
+echo -e "\t\tserver_name hub.supernets.org;"
 echo -e "\t\tcharset UTF-8;"
 echo -e "\t\t#satisfy all;"
 echo -e "\t\tallow 1.2.3.4; # Link 1" #note: add all ipv4/ipv6 links
diff --git a/deploy-unrealircd b/deploy-unrealircd
index 271cf1d..599bd52 100755
--- a/deploy-unrealircd
+++ b/deploy-unrealircd
@@ -1,37 +1,52 @@
 #!/bin/sh
 set -xev
 
-BACKUP=$HOME/unrealircd.backup
-SOURCE=$HOME/unrealircd.source
 UNREAL=$HOME/unrealircd
+BACKUP=$UNREAL.backup
+SOURCE=$UNREAL.source
 
-setup() {
-	git clone --depth 1 https://github.com/supernets/unrealircd.git $SOURCE
-	cd $SOURCE && echo -e "\n" | ./Config -nointro && make && make install
-	cd $HOME && rm -rf $SOURCE && rm $UNREAL/conf/*.conf
+get_latest() {
+	curl -s https://www.unrealircd.org/downloads/list.json | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^version/ {print $2}' | sed 's/\(^"\|"$\)//g'
+}
+
+update_source() {
+	wget -O $SOURCE.tar.gz https://www.unrealircd.org/downloads/unrealircd-latest.tar.gz
+	tar -xvf $SOURCE.tar.gz --one-top-level --strip-components=1
+	rm $SOURCE.tar.gz
+	sed -i 's;//#undef FAKELAG_CONFIGURABLE;#define FAKELAG_CONFIGURABLE;g' $SOURCE/include/config.h
+	sed -i 's_\t\t\tsendnotice(acptr, "*** You were forced to join %s", jbuf);_\t\t\t//sendnotice(acptr, "*** You were forced to join %s", jbuf);_g' $SOURCE/src/modules/m_sapart.c
+	rm -r $SOURCE/doc/conf/aliases $SOURCE/doc/conf/examples $SOURCE/doc/conf/help
+	rm -r $SOURCE/doc/conf/*.conf
+	cp $HOME/dev/git/supernets/unrealircd/doc/conf/*.conf $SOURCE/doc/conf/
+	cp $HOME/dev/git/supernets/unrealircd/src/ssl.cnf $SOURCE/src/ssl.cnf
 }
 
 deploy() {
-	setup
+	git clone --depth 1 https://github.com/supernets/unrealircd.git $SOURCE
+	cd $SOURCE && echo -e "\n" | ./Config -nointro && make && make install && cd $HOME && rm -rf $SOURCE
+	rm $UNREAL/conf/*.conf
 	read -p "Link Name: " NAME
 	SID=$(cat /dev/urandom | tr -dc '0-9' | fold -w 256 | head -n 1 | head --bytes 1)$(cat /dev/urandom | tr -dc 'A-Z0-9' | fold -w 2 | head -n 1)
-	echo "[NOTE] - Your remote include should be in https://USERNAME:PASSWORD@HOSTNAME:PORT format"
+	echo "[NOTE] - Your remote include should be in http(s)://USERNAME:PASSWORD@HOSTNAME:PORT format"
 	read -p "Remote Include: " REMOTE
 	for item in aliases badwords except help ircd modules opers spamfilter; do echo $REMOTE/$item.conf >> $UNREAL/conf/unrealircd.conf; done
 	echo "me { name \"$NAME.supernets.org\"; info \"SuperNETs IRC Network\"; sid $SID; }" >> $UNREAL/conf/unrealircd.conf
 	SPKI=$($UNREAL/unrealircd spkifp | sed -n 5p)
 	echo -e "\nAdd the following line into the hub\'s links.conf file for this link:\n$SPKI"
+	$UNREAL/unrealircd start &
 }
 
 update() {
-	#todo: check & kill abduco watchdog process
 	[ ! -z $(screen -ls | grep ircdwatchdog) ] && screen -S ircdwatchdog -X quit
+	[ ! -z $(abduco     | grep ircdwatchdog) ] && pkill -9 $(abduco | grep ircdwatchdog | awk '{print $4}')
 	mkdir $BACKUP
 	cp $UNREAL/conf/unrealircd.conf $BACKUP && cp $UNREAL/conf/ssl/server.*.pem $BACKUP
+	#cp $UNREAL/conf/links.conf $BACKUP && cp $UNREAL/conf/modules.conf $BACKUP && cp $UNREAL/conf/opers.conf $BACKUP
 	$UNREAL/unrealircd stop
 	rm -rf $UNREAL
-	setup
-	mv $BACKUP/unrealircd.conf $UNREAL/conf/ && mv $BACKUP/server.*.pem $UNREAL/conf/ssl
+	git clone --depth 1 https://github.com/supernets/unrealircd.git $SOURCE
+	cd $SOURCE && echo -e "\n" | ./Config -nointro && make && make install && cd $HOME && rm -rf $SOURCE
+	mv $BACKUP/*.conf $UNREAL/conf/ && mv $BACKUP/server.*.pem $UNREAL/conf/ssl
 	rm -r $BACKUP
 	$UNREAL/unrealircd start
 	watchdog
diff --git a/monitor b/monitor
new file mode 100755
index 0000000..b248485
--- /dev/null
+++ b/monitor
@@ -0,0 +1,8 @@
+#!/bin/sh
+while true; do
+	for i in $(dig irc.supernets.org A irc.supernets.org AAAA +short); do
+		ping -c 1 $i &> /dev/null
+		[ $? -ne 0 ] && echo "`date`: ping failed! ($i)" #&& notify-send "`date`: ping failed! ($i)"
+	done
+	sleep 3600
+done
\ No newline at end of file
diff --git a/updates.py b/updates.py
deleted file mode 100644
index d12ec05..0000000
--- a/updates.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env python
-import re, urllib.request
-
-anope_version      = '2.0.6'
-bootstrap_version  = '4.0.0'
-jquery_version     = '3.3.1'
-unrealircd_version = '4.0.17'
-
-def between(source, start, stop):
-	data = re.compile(start + '(.*?)' + stop, re.IGNORECASE|re.MULTILINE).search(source)
-	return data.group(1) if data else False
-
-def get_source(url):
-	req = urllib.request.Request(url)
-	req.add_header('User-Agent', 'DickServ/1.0')
-	source = urllib.request.urlopen(req, timeout=10)
-	charset = source.headers.get_content_charset()
-	return source.read().decode(charset) if charset else source.read().decode()
-
-def update_anope()      : return between(get_source('http://www.anope.org/'), '<span>Latest Stable Release:</span> Anope ', '\n')
-def update_bootstrap()  : return between(get_source('http://getbootstrap.com/'), '<p>Currently v', '. Code licensed')
-def update_jquery()     : return between(get_source('http://jquery.com/'), '<span>v', '</span>')
-def update_unrealircd() : return between(get_source('http://www.unrealircd.org/docs/FAQ'), '<p>The latest <b>Stable</b> version is <b>', '</b>')
-
-latest_anope = update_anope()
-if latest_anope:
-	if latest_anope != anope_version:
-		print(f'Anope version {latest_anope} has been released!')
-	else:
-		print('Anope is up to date.')
-else:
-	print('[!] - Can not retrieve latest Anope version.')
-latest_bootstrap = update_bootstrap()
-if latest_bootstrap:
-	if latest_bootstrap != bootstrap_version:
-		print(f'Bootstrap version {latest_bootstrap} has been released!')
-	else:
-		print('Bootstrap is up to date.')
-else:
-	print('[!] - Can not retrieve latest Bootstrap version.')
-latest_jquery = update_jquery()
-if latest_jquery:
-	if latest_jquery != jquery_version:
-		print(f'jQuery version {latest_jquery} has been released!')
-	else:
-		print('jQuery is up to date.')
-else:
-	print('[!] - Can not retrieve latest jQuery version.')
-latest_unrealircd = update_unrealircd()
-if latest_unrealircd:
-	if latest_unrealircd != unrealircd_version:
-		print(f'UnrealIRCd version {latest_unrealircd} has been released!')
-	else:
-		print('UnrealIRCd is up to date.')
-else:
-	print('[!] - Can not retrieve latest UnrealIRCd version.')
\ No newline at end of file