Master-Slave LDAP server switching when one fails

You can share your Lua Scripts with everybody here.

Master-Slave LDAP server switching when one fails

Postby FTP » Fri Oct 14, 2016 2:12 pm

-- Description: Master-Slave LDAP server switching when one fails
-- You should add the below scripts into "Event Manager -> FTP/SSH/HTTP -> OnExceedUSERPASS"
-- And you should also enable anti-hammer feature under "Domain > Settings > General Settings > Password & Security > Enable Anti-hammer"
-- Author: Luke
-- Date: 2016-10-14

Code: Select all

local MasterServer = ""
local SlaveServer = ""
local domain = "%Domain"
local ip = "%IP"

c_DelTempBlockIp(domain, ip)

if c_GetOptionInt(domain, DOPTION_ENABLE_LDAP_INT) == 1 then

   local ldapServer = c_GetOptionStr(domain, DOPTION_LDAP_HOST_STR)
   local ldapPort = c_GetOptionInt(domain, DOPTION_LDAP_PORT_INT)

   local socket = connect(ldapServer, ldapPort)
   if socket == nil then
      if ldapServer == MasterServer then
         c_SetOptionStr(domain, DOPTION_LDAP_HOST_STR, SlaveServer)
         c_SetOptionStr(domain, DOPTION_LDAP_HOST_STR, MasterServer)



The above scripts use a modified version of luasocket library, you can download and unzip it into the working directory of Wing FTP Server. The download URL:
Site Admin
Tue Sep 29, 2009 6:09 am

Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 2 guests