This topic contains 1 reply, has 1 voice, and was last updated by  Ryan McBee 2 years, 10 months ago.

Updating Licenses on Remote Iguana Servers

  • I work for a vendor that bundles Iguana on our servers and I’ve been working to automate Upgrading Iguana. Upgrading the application is straightforward enough (stage new files, stop service, deploy files, start service) but updating the licenses has been a manual process so I set out to automate the chore.

    I am able to update all of our servers using this Lua script because we are using a site to site VPN connection so I have http access to our Iguana instances. I have them all registered in Iguana’s Remote server list and I have synchronized credentials across them. If these conditions cannot be met this script will fail.

    The license file is a CSV formatted simply as ServerID,License. It was obtained from the Interfaceware website after I opened each customer and refreshing the maintenance expiration date. I then downloaded, by clicking ‘Save to CSV’ and manually removed the columns we don’t need.

    require("stringutil")
    require("node")
    
    serverList = {}
    user       = 'admin'
    password   = 'password'
    licensefile = 'D:/activations.csv'
    
    function main() 
       getServerIPs()
       getRemoteIDs()
       parseLicenseFile()
       updateLicenses()
    end
    
    function getServerIPs ()
       local f =    io.open('IguanaConfiguration.xml','r')
       local iguanaConfig = f:read('*a') 
       f:close()
       local parsedConfig = xml.parse{data=iguanaConfig}
       local remoteList = parsedConfig.iguana_config.remote_iguana_list   
       for i=1, remoteList:childCount() do
          local s = remoteList:child('remote_iguana',i)
          serverList[i]={ip=s.host}
       end    
       return 'Remote Server IPs read from IguanaConfiguration.xml'
    end
    
    function getRemoteIDs()
       for i=1, #serverList do 
          local s=serverList[i].ip
          local serverInfo=net.http.get{url='http://'..s..':6543/monitor_query?',
             auth={username=user,password=password}, 
             timeout=60, 
             live=true}
          local x=xml.parse{data=serverInfo}
          serverList[i]={ip=serverList[i].ip, id=x.IguanaStatus.IguanaId}
       end
       return 'Retrieved Server IDs from Remote Server List'
    end
    
    function parseLicenseFile()
       local f = io.open(licensefile)
       local r = f:read('*a')
       f:close()
       
       local t=r:split('\n')
       local x ={}
       for i=1,#t do 
          local s = t[i]:split(',')
          x[s[1]] = s[2]
       end
       
       for i=1, #serverList do 
          local l = x[serverList[i].id:S()]
          trace(l)
          serverList[i]={ip=serverList[i].ip, id=serverList[i].id, lisc=l}
       end
       trace(serverList)
       return 'Server Licenses Mapped to IPs'
    end
    
    function updateLicenses() 
       for i=1, #serverList do 
          local u = 'http://'..serverList[i].ip:S()..':6543/submit_license_settings.html?NewLicenseHex='..serverList[i].lisc
          trace(u)
          local updatelisc = net.http.get{url=u,
             auth={username=user,password=password},
             timeout=60,
             live=true}
       end
       return 'Server Licenses Applied'
    end
    

    M.R. McBee

    Upon further review this isn’t actually working, the update settings page requires javascript. I was tricked because the first chunk of my license were already updated. I’m going to post this in the questions forum.

    M.R. McBee

You must be logged in to reply to this topic.