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)
if useSSL:
sslcontext = ssl.create_default_context()
if os.path.exists(CAfile):
sslcontext.load_verify_locations(cafile=CAfile)
else:
sslcontext.check_hostname = False
sslcontext.verify_mode = ssl.CERT_NONE
# ~ if os.path.exists(CAfile):
# ~ sslcontext.load_verify_locations(cafile=CAfile)
# ~ else:
# Dont validate cert, we juts want to see if host is live
sslcontext.check_hostname = False
sslcontext.verify_mode = ssl.CERT_NONE
s = sslcontext.wrap_socket(s, server_hostname=host_l)
try:
s.settimeout(3.0)
@ -102,7 +103,7 @@ def isup(host_l, port):
return 1
except (socket.error, socket.timeout) as e:
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
finally:
s.close()

View File

@ -37,7 +37,14 @@ sha256 : ec3e17fc9b41f8c5181484e9866be2d1d92cab8403210e3d22f4f689edd4cfde
* client config file parsing ( look for 'pilpil-client.toml' in ./, ~/., ~/.config/)
* 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
## 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
* /etc/dhcpcd.conf
@ -48,14 +55,16 @@ sha256 : ec3e17fc9b41f8c5181484e9866be2d1d92cab8403210e3d22f4f689edd4cfde
* /etc/ssl/private/nginx-selfsigned.key
* /etc/ssl/certs/nginx-selfsigned.crt
* /etc/wpa_supplicant/wpa_supplicant.conf
* dd if=/dev/zero of=/home/pil/Videos/remove_me bs=4MB count=100
# DOING NEXT :
* ~ Test with several rpis
* Define http auth secret at setup
* Increase live host scan when host first found
# DONE :
* Increase live host scan when host first found
# OTHER:
* get_client_rssi.sh on server

View File

@ -32,7 +32,7 @@ then
exit 0
fi
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" ]
then
red "Disk image not found, aborting..."
@ -64,7 +64,7 @@ BAND="bg"
# Hidden SSID
#~ HIDE="802-11-wireless.hidden false"
# Set channel manually
#~ CHAN="802-11-wireless.channel 1"
CHAN="802-11-wireless.channel 1"
#
#
# 0. Create AP connection
@ -81,6 +81,8 @@ nmcli con modify $SSID wifi-sec.psk $PASSWD
# 0.a set IP range on server
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
# Remove existing leases
sudo rm /var/lib/NetworkManager/dnsmasq-$IFW.leases
sudo systemctl restart NetworkManager
nmcli radio wifi on
@ -231,7 +233,7 @@ network={
yellow "Client $(($IP-9))/$CLIENT_NUMBER done."
if [ $IP -le $IP_CNT ]
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
if [ "$GO_ON" != "YES" ]
then

View File

@ -183,15 +183,15 @@ function parseResult(command, infos_array) {
//~ document.getElementById("timeline").children[0].children[0].hasAttribute('media_id')
// Toggle loop indicator
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 {
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
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 {
document.getElementById("repeat_ind_" + infos_array[i].host).style.backgroundColor = "#f00"
document.getElementById("repeat_ind_" + infos_array[i].host).style.backgroundColor = "#A42000"
};
};
break;

View File

@ -77,6 +77,14 @@ tr:nth-child(2n+1) {background-color: #888;}
border-radius: 4px;
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;}
/*Right column*/
.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 {
display:none;
position: relative;
left: 40%;
top:80%;
color:#fff;
font-weight:bold;
color: #fff;
font-weight: bold;
font-size: medium;
background-color: #ff3030;
border: 1px solid #fff;
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 {
width: 40%;
float: left;
@ -114,7 +121,7 @@ tr:nth-child(2n+1) {background-color: #888;}
}
.indicator {
display:inline-block;
background-color: #f00;
background-color: #C32600;
margin: 0 0 0 5%;
padding: 0.3em;
}