Disable ssl cert valid. for isup()

This commit is contained in:
ABelliqueux 2022-10-25 18:43:20 +02:00
parent 1da4beb6ab
commit 9114f97918
5 changed files with 40 additions and 21 deletions

13
app.py
View File

@ -88,11 +88,12 @@ def isup(host_l, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if useSSL: if useSSL:
sslcontext = ssl.create_default_context() sslcontext = ssl.create_default_context()
if os.path.exists(CAfile): # ~ if os.path.exists(CAfile):
sslcontext.load_verify_locations(cafile=CAfile) # ~ sslcontext.load_verify_locations(cafile=CAfile)
else: # ~ else:
sslcontext.check_hostname = False # Dont validate cert, we juts want to see if host is live
sslcontext.verify_mode = ssl.CERT_NONE sslcontext.check_hostname = False
sslcontext.verify_mode = ssl.CERT_NONE
s = sslcontext.wrap_socket(s, server_hostname=host_l) s = sslcontext.wrap_socket(s, server_hostname=host_l)
try: try:
s.settimeout(3.0) s.settimeout(3.0)
@ -102,7 +103,7 @@ def isup(host_l, port):
return 1 return 1
except (socket.error, socket.timeout) as e: except (socket.error, socket.timeout) as e:
if DEBUG: if DEBUG:
print("Error on connect to " + host_l + ":" + str(port) + ": %s" % e) print("Error on connection to " + host_l + ":" + str(port) + ": %s" % e)
return 0 return 0
finally: finally:
s.close() s.close()

View File

@ -38,6 +38,13 @@ sha256 : ec3e17fc9b41f8c5181484e9866be2d1d92cab8403210e3d22f4f689edd4cfde
* Add media folder sync (scp, rsync, http upload) * Add media folder sync (scp, rsync, http upload)
* Install script ; Wifi setup, generate/install SSH keys/ nginx SSL cert/key fore each host, change hostname, static IPs * Install script ; Wifi setup, generate/install SSH keys/ nginx SSL cert/key fore each host, change hostname, static IPs
## 0.5 : 2022-10-XX-videopi.img.xz
md5 :
sha256 :
* Add rt8821cu driver back
* Use safe overclocking settings for rpi1, 3, 4, better memory split
* Add blink function to pilpil
# FS checklist # FS checklist
* /etc/dhcpcd.conf * /etc/dhcpcd.conf
@ -48,14 +55,16 @@ sha256 : ec3e17fc9b41f8c5181484e9866be2d1d92cab8403210e3d22f4f689edd4cfde
* /etc/ssl/private/nginx-selfsigned.key * /etc/ssl/private/nginx-selfsigned.key
* /etc/ssl/certs/nginx-selfsigned.crt * /etc/ssl/certs/nginx-selfsigned.crt
* /etc/wpa_supplicant/wpa_supplicant.conf * /etc/wpa_supplicant/wpa_supplicant.conf
* dd if=/dev/zero of=/home/pil/Videos/remove_me bs=4MB count=100
# DOING NEXT : # DOING NEXT :
* ~ Test with several rpis * ~ Test with several rpis
* Define http auth secret at setup * Define http auth secret at setup
* Increase live host scan when host first found
# DONE : # DONE :
* Increase live host scan when host first found
# OTHER: # OTHER:
* get_client_rssi.sh on server * get_client_rssi.sh on server

View File

@ -32,7 +32,7 @@ then
exit 0 exit 0
fi fi
DD_BS="128K" DD_BS="128K"
DISK_IMAGE="$HOME/niels/imgs/2022-10-21-pilpil.img.xz" DISK_IMAGE="$HOME/niels/imgs/2022-10-25-pilpil-WIP.img.xz"
if [ ! -f "$DISK_IMAGE" ] if [ ! -f "$DISK_IMAGE" ]
then then
red "Disk image not found, aborting..." red "Disk image not found, aborting..."
@ -64,7 +64,7 @@ BAND="bg"
# Hidden SSID # Hidden SSID
#~ HIDE="802-11-wireless.hidden false" #~ HIDE="802-11-wireless.hidden false"
# Set channel manually # Set channel manually
#~ CHAN="802-11-wireless.channel 1" CHAN="802-11-wireless.channel 1"
# #
# #
# 0. Create AP connection # 0. Create AP connection
@ -81,6 +81,8 @@ nmcli con modify $SSID wifi-sec.psk $PASSWD
# 0.a set IP range on server # 0.a set IP range on server
echo -e "Setting IP range $IP_RANGE/24 in /etc/NetworkManager/system-connections/$SSID.nmconnection ... \n" echo -e "Setting IP range $IP_RANGE/24 in /etc/NetworkManager/system-connections/$SSID.nmconnection ... \n"
sudo sed -i "/method=shared/a address1=$IP_RANGE/24, $IP_RANGE" /etc/NetworkManager/system-connections/$SSID.nmconnection sudo sed -i "/method=shared/a address1=$IP_RANGE/24, $IP_RANGE" /etc/NetworkManager/system-connections/$SSID.nmconnection
# Remove existing leases
sudo rm /var/lib/NetworkManager/dnsmasq-$IFW.leases
sudo systemctl restart NetworkManager sudo systemctl restart NetworkManager
nmcli radio wifi on nmcli radio wifi on
@ -231,7 +233,7 @@ network={
yellow "Client $(($IP-9))/$CLIENT_NUMBER done." yellow "Client $(($IP-9))/$CLIENT_NUMBER done."
if [ $IP -le $IP_CNT ] if [ $IP -le $IP_CNT ]
then then
red "Please swap sd card in reader and enter uppercase 'yes' to proceed with next client :" red "Please swap sd card in reader and enter uppercase 'yes' to proceed with next client or hit Ctrl-C:"
read -n 4 GO_ON read -n 4 GO_ON
if [ "$GO_ON" != "YES" ] if [ "$GO_ON" != "YES" ]
then then

View File

@ -183,15 +183,15 @@ function parseResult(command, infos_array) {
//~ document.getElementById("timeline").children[0].children[0].hasAttribute('media_id') //~ document.getElementById("timeline").children[0].children[0].hasAttribute('media_id')
// Toggle loop indicator // Toggle loop indicator
if (infos_array[i].loop == "true") { if (infos_array[i].loop == "true") {
document.getElementById("loop_ind_" + infos_array[i].host).style.backgroundColor = "#0f0" document.getElementById("loop_ind_" + infos_array[i].host).style.backgroundColor = "#78E738"
} else { } else {
document.getElementById("loop_ind_" + infos_array[i].host).style.backgroundColor = "#f00" document.getElementById("loop_ind_" + infos_array[i].host).style.backgroundColor = "#A42000"
}; };
// Toggle repeat indicator // Toggle repeat indicator
if (infos_array[i].repeat == "true") { if (infos_array[i].repeat == "true") {
document.getElementById("repeat_ind_" + infos_array[i].host).style.backgroundColor = "#0f0" document.getElementById("repeat_ind_" + infos_array[i].host).style.backgroundColor = "#78E738"
} else { } else {
document.getElementById("repeat_ind_" + infos_array[i].host).style.backgroundColor = "#f00" document.getElementById("repeat_ind_" + infos_array[i].host).style.backgroundColor = "#A42000"
}; };
}; };
break; break;

View File

@ -77,6 +77,14 @@ tr:nth-child(2n+1) {background-color: #888;}
border-radius: 4px; border-radius: 4px;
background: linear-gradient(0deg, #b9b9b9 10%, #f9f9f9 80%); background: linear-gradient(0deg, #b9b9b9 10%, #f9f9f9 80%);
} }
.btn:hover {
background:#C8FFBD;
box-shadow: 0 0 10px #A5FF9F;
}
.btn:active {
background: #91FF7C;
box-shadow: 0 0 18px #91FF7C;
}
.btn_txt {display: block;font-size: small;} .btn_txt {display: block;font-size: small;}
/*Right column*/ /*Right column*/
.right_col {width: 79.9%;display: inline-block;} .right_col {width: 79.9%;display: inline-block;}
@ -90,17 +98,16 @@ tr:nth-child(2n+1) {background-color: #888;}
} }
.left_col button .btn_txt { .left_col button .btn_txt {
display:none; display:none;
position: relative; color: #fff;
left: 40%; font-weight: bold;
top:80%;
color:#fff;
font-weight:bold;
font-size: medium; font-size: medium;
background-color: #ff3030; background-color: #ff3030;
border: 1px solid #fff; border: 1px solid #fff;
padding: 0 .5%; padding: 0 .5%;
width: 100px;
position: absolute;
} }
.left_col button:hover .btn_txt {display:initial;} .left_col button:hover .btn_txt {display:block;}
.col_1 { .col_1 {
width: 40%; width: 40%;
float: left; float: left;
@ -114,7 +121,7 @@ tr:nth-child(2n+1) {background-color: #888;}
} }
.indicator { .indicator {
display:inline-block; display:inline-block;
background-color: #f00; background-color: #C32600;
margin: 0 0 0 5%; margin: 0 0 0 5%;
padding: 0.3em; padding: 0.3em;
} }