Here is a script that pulls the serialnumber from a device’s firmware and autopopulates it in the “Enter hostname for this computer:” field during Full Registration. The script is /images/postiniscripts/fog.customhostname. I can ping 8.8.8.8 from the FOG server so I don’t think UFW is blocking that. Important note, when UFW is disabled, there is no delay.
#!/bin/bash
zmyip=`ip route get 8.8.8.8 | awk 'NR==1 {print $NF}' | cut -d "." -f1-2`;
case "${zmyip}" in
10.1)
zsitecode="NYC";
;;
10.2)
zsitecode="LA";
;;
*)
# Default code for the unknowns
zsitecode="CRP";
;;
esac
zchassis=`dmidecode -s chassis-type`;
zchassis="${zchassis%"${zchassis##*[![:space:]]}"}"; #Remove training space
zchassis="${zchassis,,}"; # Convert string to lower
if [ "$zchassis" == "laptop" ]; then
zchtype="P";
elif [ "$zchassis" == "tablet" ]; then
zchtype="T";
else
# Everything else is a desktop
zchtype="D";
fi
zserialno=`dmidecode -s chassis-serial-number`;
zserialno="${zserialno%"${zserialno##*[![:space:]]}"}"; # Remove trailing whitespace
# get the serial no from the baseboard if chassis doesn't give it up
if [ "$zserialno" == "" ]; then
zserialno=`dmidecode -s baseboard-serial-number`;
zserialno="${zserialno%"${zserialno##*[![:space:]]}"}";
fi
LEN=$(echo ${#zserialno});
if [ "$LEN" -gt 11 ]; then
# get the right most characters of the serial number (usually the most
# unique characters). Logic for 11 is Site(3)+HW(1)+Serial(11)=15 characters
zserialno=${zserialno:(-11)};
fi
# default host name is returned to the fog.man.reg script
host_default_name="$zserialno";
Here are my UFW rules in /etc/ufw.user.rules:
### RULES ###
### tuple ### allow tcp 3306 0.0.0.0/0 any fogserver2 in
-A ufw-user-input -p tcp --dport 3306 -s fogserver2 -j ACCEPT
### tuple ### allow tcp 21,80,111,138,139,443,445,2049,20048 0.0.0.0/0 any 0.0.0.0/0 in
-A ufw-user-input -p tcp -m multiport --dports 21,80,111,138,139,443,445,2049,20048 -j ACCEPT
### tuple ### allow udp 66,67,68,69,111,137,4011 0.0.0.0/0 any 0.0.0.0/0 in
-A ufw-user-input -p udp -m multiport --dports 66,67,68,69,111,137,4011 -j ACCEPT
This is the screen where there is a huge delay

then it skips the Post init script
