Skip to content
This repository was archived by the owner on Mar 23, 2021. It is now read-only.

Commit 4ff0e1e

Browse files
Fixed an issue with binary detection, to prevent errors when yum is detected on Ubuntu
Prevented IPv6 Disable (breaks NFS on RHEL/CentOS) Re-designed NetBoot and added ability to edit images
1 parent 3f96b56 commit 4ff0e1e

12 files changed

+662
-341
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
* Added validation for SUS Base URL and Branch name(s) with live feedback
88
* Added (missing) option for SUS sync at 9:00 AM
99
* Improved detection of the last SUS sync date and time
10+
* Added proxy configuration to SUS
1011
* Added validation for NetBoot Image Name, Subnet and Netmask with live feedback
12+
* Added checks for NetBoot supporting services
13+
* Provisioned for NFS support for NetBoot Images
1114
* Updated service controls for TFTP on RHEL/CentOS
1215
* Added validation for Hostname, IP Address, Netmask, Gateway and DNS Servers with live feedback
1316
* Added functionality to dynamically determine primary network interface, to allow for variations

CreateNetSUSInstaller.sh

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ cp -R SUS/var/lib/reposado temp/installer/resources/reposado
4949
cp -R webadmin/webadminInstall.sh temp/installer/install-webadmin.sh
5050
cp -R webadmin/var/appliance/dialog.sh temp/installer/resources/dialog.sh
5151
cp -R webadmin/var/www temp/installer/resources/html
52+
rm -f temp/installer/resources/html/webadmin/scripts/netbootname.py
5253
if [ -x "/usr/bin/xattr" ]; then find temp -exec xattr -c {} \; ;fi # Remove OS X extended attributes
5354
find temp -name .DS_Store -delete # Clean out .DS_Store files
5455
find temp -name .svn | xargs rm -Rf # Clean out SVN garbage

LDAPProxy/LDAPProxyInstall.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ slapd slapd/password1 password netsuslp
3232
" | sudo debconf-set-selections
3333
apt_install slapd
3434
unset DEBIAN_FRONTEND
35-
fi
36-
if [[ $(which yum 2>&-) != "" ]]; then
35+
elif [[ $(which yum 2>&-) != "" ]]; then
3736
yum_install openldap-servers
3837
yum_install expect
3938
fi

NetBoot/netbootInstall.sh

+105-104
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ if [[ $(which apt-get 2>&-) != "" ]]; then
3030
apt_install tftpd-hpa
3131
# apt_install openbsd-inetd
3232
apt_install netatalk
33-
#apt_install nfs-kernel-server
33+
apt_install nfs-kernel-server
3434
apt_install python-configparser
35-
fi
36-
if [[ $(which yum 2>&-) != "" ]]; then
35+
elif [[ $(which yum 2>&-) != "" ]]; then
3736
yum_install avahi
3837
yum_install samba
3938
yum_install samba-client
@@ -56,12 +55,14 @@ if [[ $(which yum 2>&-) != "" ]]; then
5655
fi
5756
sed -i 's/.*- -tcp -noddp -uamlist uams_dhx.so.*/- -tcp -noddp -uamlist uams_dhx.so,uams_dhx2_passwd.so/' /etc/netatalk/afpd.conf
5857
fi
59-
#yum_install nfs-utils
58+
yum_install nfs-utils
6059
yum_install vim-common
6160
chkconfig messagebus on >> $logFile 2>&1
6261
chkconfig avahi-daemon on >> $logFile 2>&1
62+
chkconfig rpcbind on >> $logFile 2>&1
6363
service messagebus start >> $logFile 2>&1
6464
service avahi-daemon start >> $logFile 2>&1
65+
service rpcbind start >> $logFile 2>&1
6566
fi
6667

6768
# Prepare the firewall in case it is enabled later
@@ -78,14 +79,14 @@ if [[ $(which ufw 2>&-) != "" ]]; then
7879
# TFTP
7980
ufw allow 69/udp >> $logFile
8081
# NFS
81-
#ufw allow 111/tcp >> $logFile
82-
#ufw allow 111/udp >> $logFile
83-
#ufw allow 892/tcp >> $logFile
84-
#ufw allow 892/udp >> $logFile
85-
#ufw allow 2049/tcp >> $logFile
86-
#ufw allow 2049/udp >> $logFile
87-
#ufw allow 32769/udp >> $logFile
88-
#ufw allow 32803/tcp >> $logFile
82+
ufw allow 111/tcp >> $logFile
83+
ufw allow 111/udp >> $logFile
84+
ufw allow 892/tcp >> $logFile
85+
ufw allow 892/udp >> $logFile
86+
ufw allow 2049/tcp >> $logFile
87+
ufw allow 2049/udp >> $logFile
88+
ufw allow 32769/udp >> $logFile
89+
ufw allow 32803/tcp >> $logFile
8990
elif [[ $(which firewall-cmd 2>&-) != "" ]]; then
9091
# HTTP
9192
firewall-cmd --zone=public --add-port=80/tcp >> $logFile 2>&1
@@ -105,22 +106,22 @@ elif [[ $(which firewall-cmd 2>&-) != "" ]]; then
105106
firewall-cmd --zone=public --add-port=69/udp >> $logFile 2>&1
106107
firewall-cmd --zone=public --add-port=69/udp --permanent >> $logFile 2>&1
107108
# NFS
108-
#firewall-cmd --zone=public --add-port=111/tcp >> $logFile 2>&1
109-
#firewall-cmd --zone=public --add-port=111/tcp --permanent >> $logFile 2>&1
110-
#firewall-cmd --zone=public --add-port=111/udp >> $logFile 2>&1
111-
#firewall-cmd --zone=public --add-port=111/udp --permanent >> $logFile 2>&1
112-
#firewall-cmd --zone=public --add-port=892/tcp >> $logFile 2>&1
113-
#firewall-cmd --zone=public --add-port=892/tcp --permanent >> $logFile 2>&1
114-
#firewall-cmd --zone=public --add-port=892/udp >> $logFile 2>&1
115-
#firewall-cmd --zone=public --add-port=892/udp --permanent >> $logFile 2>&1
116-
#firewall-cmd --zone=public --add-port=2049/tcp >> $logFile 2>&1
117-
#firewall-cmd --zone=public --add-port=2049/tcp --permanent >> $logFile 2>&1
118-
#firewall-cmd --zone=public --add-port=2049/udp >> $logFile 2>&1
119-
#firewall-cmd --zone=public --add-port=2049/udp --permanent >> $logFile 2>&1
120-
#firewall-cmd --zone=public --add-port=32769/udp >> $logFile 2>&1
121-
#firewall-cmd --zone=public --add-port=32769/udp --permanent >> $logFile 2>&1
122-
#firewall-cmd --zone=public --add-port=32803/tcp >> $logFile 2>&1
123-
#firewall-cmd --zone=public --add-port=32803/tcp --permanent >> $logFile 2>&1
109+
firewall-cmd --zone=public --add-port=111/tcp >> $logFile 2>&1
110+
firewall-cmd --zone=public --add-port=111/tcp --permanent >> $logFile 2>&1
111+
firewall-cmd --zone=public --add-port=111/udp >> $logFile 2>&1
112+
firewall-cmd --zone=public --add-port=111/udp --permanent >> $logFile 2>&1
113+
firewall-cmd --zone=public --add-port=892/tcp >> $logFile 2>&1
114+
firewall-cmd --zone=public --add-port=892/tcp --permanent >> $logFile 2>&1
115+
firewall-cmd --zone=public --add-port=892/udp >> $logFile 2>&1
116+
firewall-cmd --zone=public --add-port=892/udp --permanent >> $logFile 2>&1
117+
firewall-cmd --zone=public --add-port=2049/tcp >> $logFile 2>&1
118+
firewall-cmd --zone=public --add-port=2049/tcp --permanent >> $logFile 2>&1
119+
firewall-cmd --zone=public --add-port=2049/udp >> $logFile 2>&1
120+
firewall-cmd --zone=public --add-port=2049/udp --permanent >> $logFile 2>&1
121+
firewall-cmd --zone=public --add-port=32769/udp >> $logFile 2>&1
122+
firewall-cmd --zone=public --add-port=32769/udp --permanent >> $logFile 2>&1
123+
firewall-cmd --zone=public --add-port=32803/tcp >> $logFile 2>&1
124+
firewall-cmd --zone=public --add-port=32803/tcp --permanent >> $logFile 2>&1
124125
else
125126
# HTTP
126127
if iptables -L | grep DROP | grep -v 'tcp dpt:https' | grep -q 'tcp dpt:http' ; then
@@ -164,54 +165,54 @@ else
164165
iptables -I INPUT -p udp --dport 69 -j ACCEPT
165166
fi
166167
# NFS
167-
#if iptables -L | grep DROP | grep -q 'tcp dpt:sunrpc' ; then
168-
# iptables -D INPUT -p tcp --dport 111 -j DROP
169-
#fi
170-
#if ! iptables -L | grep ACCEPT | grep -q 'tcp dpt:sunrpc' ; then
171-
# iptables -I INPUT -p tcp --dport 111 -j ACCEPT
172-
#fi
173-
#if iptables -L | grep DROP | grep -q 'udp dpt:sunrpc' ; then
174-
# iptables -D INPUT -p udp --dport 111 -j DROP
175-
#fi
176-
#if ! iptables -L | grep ACCEPT | grep -q 'udp dpt:sunrpc' ; then
177-
# iptables -I INPUT -p udp --dport 111 -j ACCEPT
178-
#fi
179-
#if iptables -L | grep DROP | grep -q 'tcp dpt:892' ; then
180-
# iptables -D INPUT -p tcp --dport 892 -j DROP
181-
#fi
182-
#if ! iptables -L | grep ACCEPT | grep -q 'tcp dpt:892' ; then
183-
# iptables -I INPUT -p tcp --dport 892 -j ACCEPT
184-
#fi
185-
#if iptables -L | grep DROP | grep -q 'udp dpt:892' ; then
186-
# iptables -D INPUT -p udp --dport 892 -j DROP
187-
#fi
188-
#if ! iptables -L | grep ACCEPT | grep -q 'udp dpt:892' ; then
189-
# iptables -I INPUT -p udp --dport 892 -j ACCEPT
190-
#fi
191-
#if iptables -L | grep DROP | grep -q 'tcp dpt:nfs' ; then
192-
# iptables -D INPUT -p tcp --dport 2049 -j DROP
193-
#fi
194-
#if ! iptables -L | grep ACCEPT | grep -q 'tcp dpt:nfs' ; then
195-
# iptables -I INPUT -p tcp --dport 2049 -j ACCEPT
196-
#fi
197-
#if iptables -L | grep DROP | grep -q 'udp dpt:nfs' ; then
198-
# iptables -D INPUT -p udp --dport 2049 -j DROP
199-
#fi
200-
#if ! iptables -L | grep ACCEPT | grep -q 'udp dpt:nfs' ; then
201-
# iptables -I INPUT -p udp --dport 2049 -j ACCEPT
202-
#fi
203-
#if iptables -L | grep DROP | grep -q 'udp dpt:filenet-rpc' ; then
204-
# iptables -D INPUT -p udp --dport 32769 -j DROP
205-
#fi
206-
#if ! iptables -L | grep ACCEPT | grep -q 'udp dpt:filenet-rpc' ; then
207-
# iptables -I INPUT -p udp --dport 32769 -j ACCEPT
208-
#fi
209-
#if iptables -L | grep DROP | grep -q 'tcp dpt:32803' ; then
210-
# iptables -D INPUT -p tcp --dport 32803 -j DROP
211-
#fi
212-
#if ! iptables -L | grep ACCEPT | grep -q 'tcp dpt:32803' ; then
213-
# iptables -I INPUT -p tcp --dport 32803 -j ACCEPT
214-
#fi
168+
if iptables -L | grep DROP | grep -q 'tcp dpt:sunrpc' ; then
169+
iptables -D INPUT -p tcp --dport 111 -j DROP
170+
fi
171+
if ! iptables -L | grep ACCEPT | grep -q 'tcp dpt:sunrpc' ; then
172+
iptables -I INPUT -p tcp --dport 111 -j ACCEPT
173+
fi
174+
if iptables -L | grep DROP | grep -q 'udp dpt:sunrpc' ; then
175+
iptables -D INPUT -p udp --dport 111 -j DROP
176+
fi
177+
if ! iptables -L | grep ACCEPT | grep -q 'udp dpt:sunrpc' ; then
178+
iptables -I INPUT -p udp --dport 111 -j ACCEPT
179+
fi
180+
if iptables -L | grep DROP | grep -q 'tcp dpt:892' ; then
181+
iptables -D INPUT -p tcp --dport 892 -j DROP
182+
fi
183+
if ! iptables -L | grep ACCEPT | grep -q 'tcp dpt:892' ; then
184+
iptables -I INPUT -p tcp --dport 892 -j ACCEPT
185+
fi
186+
if iptables -L | grep DROP | grep -q 'udp dpt:892' ; then
187+
iptables -D INPUT -p udp --dport 892 -j DROP
188+
fi
189+
if ! iptables -L | grep ACCEPT | grep -q 'udp dpt:892' ; then
190+
iptables -I INPUT -p udp --dport 892 -j ACCEPT
191+
fi
192+
if iptables -L | grep DROP | grep -q 'tcp dpt:nfs' ; then
193+
iptables -D INPUT -p tcp --dport 2049 -j DROP
194+
fi
195+
if ! iptables -L | grep ACCEPT | grep -q 'tcp dpt:nfs' ; then
196+
iptables -I INPUT -p tcp --dport 2049 -j ACCEPT
197+
fi
198+
if iptables -L | grep DROP | grep -q 'udp dpt:nfs' ; then
199+
iptables -D INPUT -p udp --dport 2049 -j DROP
200+
fi
201+
if ! iptables -L | grep ACCEPT | grep -q 'udp dpt:nfs' ; then
202+
iptables -I INPUT -p udp --dport 2049 -j ACCEPT
203+
fi
204+
if iptables -L | grep DROP | grep -q 'udp dpt:filenet-rpc' ; then
205+
iptables -D INPUT -p udp --dport 32769 -j DROP
206+
fi
207+
if ! iptables -L | grep ACCEPT | grep -q 'udp dpt:filenet-rpc' ; then
208+
iptables -I INPUT -p udp --dport 32769 -j ACCEPT
209+
fi
210+
if iptables -L | grep DROP | grep -q 'tcp dpt:32803' ; then
211+
iptables -D INPUT -p tcp --dport 32803 -j DROP
212+
fi
213+
if ! iptables -L | grep ACCEPT | grep -q 'tcp dpt:32803' ; then
214+
iptables -I INPUT -p tcp --dport 32803 -j ACCEPT
215+
fi
215216
service iptables save >> $logFile 2>&1
216217
fi
217218

@@ -340,34 +341,34 @@ if [ ! -d "/home/afpuser" ]; then
340341
fi
341342

342343
# Configure nfs
343-
#if [ -f "/etc/default/nfs-kernel-server" ]; then
344-
# sed -i 's/.*RPCMOUNTDOPTS.*/RPCMOUNTDOPTS="--port 892"/' /etc/default/nfs-kernel-server
345-
# touch /etc/modprobe.d/lockd.conf
346-
# sed -i '/^lockd/d' /etc/modules
347-
# echo "lockd" >> /etc/modules
348-
#fi
349-
#if [ -f "/etc/sysconfig/nfs" ]; then
350-
# if grep -q LOCKD_TCPPORT /etc/sysconfig/nfs; then
351-
# sed -i 's/.*LOCKD_TCPPORT.*/LOCKD_TCPPORT=32803/' /etc/sysconfig/nfs
352-
# sed -i 's/.*LOCKD_UDPPORT.*/LOCKD_UDPPORT=32769/' /etc/sysconfig/nfs
353-
# sed -i 's/.*MOUNTD_PORT.*/MOUNTD_PORT=892/' /etc/sysconfig/nfs
354-
# else
355-
# sed -i 's/.*RPCMOUNTDOPTS.*/RPCMOUNTDOPTS="-p 892"/' /etc/sysconfig/nfs
356-
# fi
357-
#fi
358-
#if [ -f "/etc/modprobe.d/lockd.conf" ]; then
359-
# if ! grep -q nlm_tcpport /etc/modprobe.d/lockd.conf; then
360-
# echo "options lockd nlm_tcpport=32803" >> /etc/modprobe.d/lockd.conf
361-
# fi
362-
# sed -i 's/.*nlm_tcpport.*/options lockd nlm_tcpport=32803/' /etc/modprobe.d/lockd.conf
363-
# if ! grep -q nlm_udpport /etc/modprobe.d/lockd.conf; then
364-
# echo "options lockd nlm_udpport=32769" >> /etc/modprobe.d/lockd.conf
365-
# fi
366-
# sed -i 's/.*nlm_udpport.*/options lockd nlm_udpport=32769/' /etc/modprobe.d/lockd.conf
367-
#fi
368-
#sed -i "/NetBootSP0/d" /etc/exports
369-
#echo "/srv/NetBoot/NetBootSP0 *(ro,no_subtree_check,no_root_squash,insecure)" >> "/etc/exports"
370-
#exportfs -a
344+
if [ -f "/etc/default/nfs-kernel-server" ]; then
345+
sed -i 's/.*RPCMOUNTDOPTS.*/RPCMOUNTDOPTS="--port 892"/' /etc/default/nfs-kernel-server
346+
touch /etc/modprobe.d/lockd.conf
347+
sed -i '/^lockd/d' /etc/modules
348+
echo "lockd" >> /etc/modules
349+
fi
350+
if [ -f "/etc/sysconfig/nfs" ]; then
351+
if grep -q LOCKD_TCPPORT /etc/sysconfig/nfs; then
352+
sed -i 's/.*LOCKD_TCPPORT.*/LOCKD_TCPPORT=32803/' /etc/sysconfig/nfs
353+
sed -i 's/.*LOCKD_UDPPORT.*/LOCKD_UDPPORT=32769/' /etc/sysconfig/nfs
354+
sed -i 's/.*MOUNTD_PORT.*/MOUNTD_PORT=892/' /etc/sysconfig/nfs
355+
else
356+
sed -i 's/.*RPCMOUNTDOPTS.*/RPCMOUNTDOPTS="-p 892"/' /etc/sysconfig/nfs
357+
fi
358+
fi
359+
if [ -f "/etc/modprobe.d/lockd.conf" ]; then
360+
if ! grep -q nlm_tcpport /etc/modprobe.d/lockd.conf; then
361+
echo "options lockd nlm_tcpport=32803" >> /etc/modprobe.d/lockd.conf
362+
fi
363+
sed -i 's/.*nlm_tcpport.*/options lockd nlm_tcpport=32803/' /etc/modprobe.d/lockd.conf
364+
if ! grep -q nlm_udpport /etc/modprobe.d/lockd.conf; then
365+
echo "options lockd nlm_udpport=32769" >> /etc/modprobe.d/lockd.conf
366+
fi
367+
sed -i 's/.*nlm_udpport.*/options lockd nlm_udpport=32769/' /etc/modprobe.d/lockd.conf
368+
fi
369+
sed -i "/NetBootSP0/d" /etc/exports
370+
echo "/srv/NetBoot/NetBootSP0 *(ro,no_subtree_check,no_root_squash,insecure)" >> "/etc/exports"
371+
exportfs -a
371372

372373
# Configure samba
373374
# Change SMB setting for guest access

SUS/susInstall.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ if [[ $(which apt-get 2>&-) != "" ]]; then
2727
apt_install libapache2-mod-php
2828
apt_install php-xml
2929
apt_install curl
30-
fi
31-
if [[ $(which yum 2>&-) != "" ]]; then
30+
elif [[ $(which yum 2>&-) != "" ]]; then
3231
yum_install mod_ssl
3332
yum_install php
3433
yum_install php-xml

base/NetSUSInstaller.sh

+11-12
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ if grep -q 'net.ipv6.conf.lo.disable_ipv6' /etc/sysctl.conf; then
144144
sed -i '/net.ipv6.conf.default.disable_ipv6/d' /etc/sysctl.conf
145145
sed -i '/net.ipv6.conf.lo.disable_ipv6/d' /etc/sysctl.conf
146146
fi
147-
echo "
148-
# Disable IPv6
149-
net.ipv6.conf.all.disable_ipv6 = 1
150-
net.ipv6.conf.default.disable_ipv6 = 1
151-
" >> /etc/sysctl.conf
147+
#echo "
148+
## Disable IPv6
149+
#net.ipv6.conf.all.disable_ipv6 = 1
150+
#net.ipv6.conf.default.disable_ipv6 = 1
151+
#" >> /etc/sysctl.conf
152152

153153
log ""
154154
log "The NetSUSLP has been installed."
@@ -175,22 +175,21 @@ if [[ $(which update-rc.d 2>&-) != "" ]]; then
175175
if [[ $(which systemctl 2>&-) != "" ]]; then
176176
update-rc.d smbd disable >> $logFile 2>&1
177177
update-rc.d tftpd-hpa disable >> $logFile 2>&1
178-
#systemctl disable nfs-server >> $logFile 2>&1
178+
systemctl disable nfs-server >> $logFile 2>&1
179179
# systemctl disable openbsd-inetd >> $logFile 2>&1
180-
#service nfs-server stop >> $logFile 2>&1
180+
service nfs-server stop >> $logFile 2>&1
181181
else
182182
echo manual > /etc/init/smbd.override
183183
echo manual > /etc/init/tftpd-hpa.override
184-
#update-rc.d nfs-kernel-server disable >> $logFile 2>&1
184+
update-rc.d nfs-kernel-server disable >> $logFile 2>&1
185185
# update-rc.d openbsd-inetd disable >> $logFile 2>&1
186-
#service nfs-kernel-server stop >> $logFile 2>&1
186+
service nfs-kernel-server stop >> $logFile 2>&1
187187
fi
188188
log "If you are installing NetSUSLP for the first time, please follow the documentation for setup instructions."
189-
fi
190-
if [[ $(which chkconfig 2>&-) != "" ]]; then
189+
elif [[ $(which chkconfig 2>&-) != "" ]]; then
191190
service httpd restart >> $logFile 2>&1
192191
chkconfig tftp off >> $logFile 2>&1
193-
#chkconfig nfs off > /dev/null 2>&1
192+
chkconfig nfs off > /dev/null 2>&1
194193
#if [ -f "/etc/sysconfig/xinetd" ]; then
195194
# service xinetd restart >> $logFile 2>&1
196195
#fi

webadmin/var/www/webadmin/SUS.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ function enableButton(id, enable)
105105

106106
function validateBaseURL()
107107
{
108-
var validBaseURL = /^(http|https):\/\/[^ "]+$/.test(document.getElementById("baseurl").value);
108+
var validBaseURL = /^http:\/\/(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[0-9][\/]|[1-9][0-9]|[1-9][0-9][\/]|1[0-9]{2}|1[0-9]{2}[\/]|2[0-4][0-9]|2[0-4][0-9][\/]|25[0-5]|25[0-5][\/])$|^http:\/\/(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][\/]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9][\/])$/.test(document.getElementById("baseurl").value);
109109
showErr("baseurl", validBaseURL);
110110
enableButton("setbaseurl", validBaseURL);
111111
}
112112

113113
function validateBranch()
114114
{
115-
var validBranch = /^[A-Za-z0-9._+\-]{1,256}$/.test(document.getElementById("branchname").value);
115+
var validBranch = /^[A-Za-z0-9._+\-]{1,128}$/.test(document.getElementById("branchname").value);
116116
showErr("branchname", validBranch);
117117
enableButton("addbranch", validBranch);
118118
}
@@ -131,7 +131,7 @@ function toggleProxyAuth()
131131
function validateProxy()
132132
{
133133
var validHttpProxy = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$/.test(document.getElementById("proxy_host").value) || !document.getElementById('http_proxy').checked;
134-
var validHttpPort = document.getElementById("proxy_port").value != "" && !(parseInt(document.getElementById("proxy_port").value) < 0) && !(parseInt(document.getElementById("proxy_port").value) > 65535) || !document.getElementById('http_proxy').checked;
134+
var validHttpPort = /^\d+$/.test(document.getElementById("proxy_port").value) && document.getElementById("proxy_port").value != "" && !(parseInt(document.getElementById("proxy_port").value) < 0) && !(parseInt(document.getElementById("proxy_port").value) > 65535) || !document.getElementById('http_proxy').checked;
135135
var validProxyUser = document.getElementById('http_proxy').checked && document.getElementById("proxy_user").value != "" || !document.getElementById('proxy_auth').checked || document.getElementById('proxy_auth').disabled;
136136
var validProxyPass = document.getElementById("proxy_user").value != "" && document.getElementById("proxy_pass").value != "" || !document.getElementById('proxy_auth').checked || document.getElementById('proxy_auth').disabled;
137137
showErr("proxy_host", validHttpProxy);
@@ -165,7 +165,7 @@ function validateProxy()
165165
<span class ="description">Base URL for the software update server (e.g. "http://sus.mycompany.corp")</span>
166166

167167
<div class="input-group">
168-
<input type="text" name="baseurl" id="baseurl" class="form-control input-sm long-text-input" value="<?php echo $conf->getSetting("susbaseurl")?>" onKeyUp="validateBaseURL();" onChange="validateBaseURL();"/>
168+
<input type="text" name="baseurl" id="baseurl" class="form-control input-sm long-text-input" value="<?php echo $conf->getSetting("susbaseurl")?>" onClick="validateBaseURL();" onKeyUp="validateBaseURL();" onChange="validateBaseURL();"/>
169169
<span class="input-group-btn">
170170
<input type="submit" name="setbaseurl" id="setbaseurl" class="btn btn-primary btn-sm" value="Change URL" disabled="disabled" />
171171
</span>
@@ -284,7 +284,7 @@ function validateProxy()
284284

285285
<div class="input-group">
286286
<div class="input-group-addon no-background">Port</div>
287-
<input type="text" name="proxy_port" id="proxy_port" class="form-control input-sm" value="<?php echo $susProxyPort; ?>" onClick="validateProxy();" onKeyUp="validateProxy();" onChange="validateProxy();" onKeyPress="return event.charCode >= 48 && event.charCode <= 57" />
287+
<input type="text" name="proxy_port" id="proxy_port" class="form-control input-sm" value="<?php echo $susProxyPort; ?>" onClick="validateProxy();" onKeyUp="validateProxy();" onChange="validateProxy();" />
288288
</div>
289289

290290
<br>

0 commit comments

Comments
 (0)