Bulk add the MS Office 365 subnets to Sophos XG Firewall.

Recently, i needed to white list Office365 from SSL Inspection. However, FQDN matching on a firewall policy was not fixing the issue.

I had to resort to adding the subnets manually, but the list of subnets is HUGE and would take hours to add manually.

As per usual, i hate to do repetitive work (Normal Engineer behavior – globally!)

 

WARNING – THIS COULD BREAK YOUR APPLIANCE. USE AT YOUR OWN RISK.

Step #1 – SSH into your appliance using the user admin
Step #2 – Select Appliance Management (“5.  Device Management” )
Step #3 – Select Advanced Shell (“3.  Advanced Shell” )
Step #4 – Copy and paste the below commands (in bulk) into the advanced CLI of your appliance.

psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-4','13.67.234.27','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-5','13.75.42.168','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-6','52.112.0.0','255.252.0.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-7','13.107.64.0','255.255.192.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-8','131.253.128.0','255.255.224.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-9','131.253.160.0','255.255.240.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-10','104.44.200.0','255.255.254.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-11','23.103.128.0','255.255.254.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-12','104.44.195.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-13','104.44.195.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-14','104.44.200.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-15','104.44.201.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-16','13.107.3.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-17','13.107.66.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-18','13.107.8.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-19','13.107.8.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-20','132.245.0.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-21','132.245.112.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-22','132.245.128.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-23','207.46.5.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-24','23.103.130.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-25','65.55.127.0','255.255.255.0','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-26','111.221.76.128','255.255.255.128','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-27','132.245.1.0','255.255.255.128','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-28','132.245.113.0','255.255.255.128','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-29','132.245.129.0','255.255.255.128','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-30','134.170.0.0','255.255.255.128','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-31','134.170.115.128','255.255.255.128','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-32','134.170.54.128','255.255.255.128','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-33','157.55.238.0','255.255.255.128','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-34','157.55.40.128','255.255.255.128','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-35','66.119.158.0','255.255.255.128','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-36','111.221.122.192','255.255.255.192','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-37','111.221.77.0','255.255.255.192','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-38','134.170.113.192','255.255.255.192','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-39','134.170.54.0','255.255.255.192','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-40','157.55.232.128','255.255.255.192','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-41','157.55.46.64','255.255.255.192','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-42','157.56.135.64','255.255.255.192','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-43','157.56.185.0','255.255.255.192','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-44','23.103.176.128','255.255.255.192','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-45','23.103.178.128','255.255.255.192','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-46','66.119.157.192','255.255.255.192','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-47','23.103.176.192','255.255.255.224','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-48','23.103.178.192','255.255.255.224','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-49','104.208.152.137','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-50','104.210.1.218','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-51','104.40.75.8','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-52','104.40.76.196','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-53','104.41.207.112','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-54','104.41.210.140','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-55','104.42.229.230','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-56','104.43.12.164','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-57','104.46.101.116','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-58','104.46.105.95','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-59','104.46.96.162','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-60','104.46.97.194','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-61','111.221.101.75','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-62','13.107.3.128','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-63','13.107.3.129','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-64','13.67.186.105','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-65','13.67.214.76','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-66','13.67.222.144','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-67','13.67.234.27','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-68','13.75.42.168','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-69','13.88.183.247','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-70','13.88.241.210','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-71','13.89.44.84','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-72','13.91.108.91','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-73','13.91.40.251','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-74','13.92.136.118','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-75','13.92.80.132','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-76','13.93.209.18','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-77','13.94.47.37','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-78','13.95.233.176','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-79','13.95.236.192','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-80','137.116.132.4','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-81','137.116.157.126','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-82','137.116.159.19','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-83','137.116.159.228','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-84','168.63.14.15','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-85','168.63.219.57','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-86','191.233.80.151','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-87','191.233.95.169','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-88','191.234.19.21','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-89','191.234.20.241','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-90','191.234.21.145','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-91','191.234.23.27','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-92','207.46.156.136','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-93','207.46.230.50','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-94','23.101.115.193','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-95','23.101.116.26','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-96','23.101.156.198','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-97','23.101.158.111','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-98','23.102.17.214','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-99','23.102.24.114','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-100','23.97.164.28','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-101','23.97.72.141','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-102','23.99.101.49','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-103','23.99.115.104','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-104','23.99.121.255','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-105','23.99.122.87','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-106','23.99.124.9','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-107','23.99.213.58','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-108','40.112.188.2','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-109','40.113.16.205','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-110','40.114.244.22','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-111','40.118.251.206','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-112','40.68.229.156','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-113','40.68.230.133','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-114','40.76.24.177','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-115','40.76.24.32','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-116','40.77.16.36','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-117','40.78.145.194','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-118','40.78.68.158','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-119','40.78.71.48','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-120','40.79.38.101','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-121','40.79.74.185','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-122','40.83.176.46','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-123','40.83.177.162','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-124','40.86.90.132','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-125','52.163.224.242','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-126','52.163.231.126','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-127','52.164.255.104','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-128','52.165.35.53','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-129','52.169.105.194','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-130','52.169.106.115','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-131','52.169.30.95','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-132','52.174.166.107','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-133','52.174.166.156','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-134','52.174.166.73','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-135','52.175.38.240','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-136','52.178.145.227','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-137','52.178.148.1','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-138','52.178.148.152','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-139','52.178.158.225','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-140','52.178.34.159','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-141','52.178.36.12','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-142','52.178.36.169','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-143','52.178.38.115','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-144','52.232.129.71','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-145','52.232.132.60','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-146','52.232.135.81','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-147','52.233.29.169','255.255.255.255','2');"
psql -U nobody -d corporate -c "INSERT INTO tblhost (hostname,netid,netmask,hosttype) VALUES ('o365-148','52.233.30.121','255.255.255.255','2');"

Step #6 – Create a host group, add all the hosts that start with “o365-”
Step #7 – Use the host group created above in your firewall policies.

Leave a comment