artem_niko Posted February 19, 2022 Share Posted February 19, 2022 Good afternoon! I have a few questions about the UniServer.BlockedIPList property. While the project is running, some IP address is added to UniServer.BlockedIPList. After that, it is no longer possible to pass authorization in the project from this IP. It's all good. But, there is one awkward moment. If I remove the blocked IP address from UniServer.BlockedIPList, then in order for the user to be authorized again from his IP, I need to restart the entire project. In what event should the code be placed so that the entire project does not have to be restarted, but only the user can refresh the page in his browser, thereby starting a new session, and if his IP is not in the UniServer.BlockedIPList, then he could enter the project? What event is responsible for this? Loading the list in UniServer.BlockedIPList is performed in the UniGUIMainModuleOnCreate event in the MainModule, including somewhere else. Use UniGUIServerModuleOnCreate? Quote Link to comment Share on other sites More sharing options...
irigsoft Posted February 19, 2022 Share Posted February 19, 2022 4 hours ago, artem_niko said: Good afternoon! I have a few questions about the UniServer.BlockedIPList property. While the project is running, some IP address is added to UniServer.BlockedIPList. After that, it is no longer possible to pass authorization in the project from this IP. It's all good. But, there is one awkward moment. If I remove the blocked IP address from UniServer.BlockedIPList, then in order for the user to be authorized again from his IP, I need to restart the entire project. In what event should the code be placed so that the entire project does not have to be restarted, but only the user can refresh the page in his browser, thereby starting a new session, and if his IP is not in the UniServer.BlockedIPList, then he could enter the project? What event is responsible for this? Loading the list in UniServer.BlockedIPList is performed in the UniGUIMainModuleOnCreate event in the MainModule, including somewhere else. Use UniGUIServerModuleOnCreate? Hello, You have reload in somewhere. I use blockedIPLIst and reload it in UniGUIServerModuleHTTPCommand without restarting the unigui application. TRY unIServerModule.Lock; If FileExists ('YourPathToFile') then BlockedIPList.LoadFromFile ('YourPathToFile'); FINALLY unIServerModule.UnLock; END; 1 Quote Link to comment Share on other sites More sharing options...
artem_niko Posted February 19, 2022 Author Share Posted February 19, 2022 2 minutes ago, irigsoft said: Hello, You have reload in somewhere. I use blockedIPLIst and reload it on UniGUIServerModuleHTTPCommand TRY unIServerModule.Lock; If FileExists (ExtractFilePath(StartPath) + 'YourPathToFile') then BlockedIPList.LoadFromFile (ExtractFilePath(StartPath) + 'YourPathToFile'); FINALLY unIServerModule.UnLock; END; What is unIServerModule.Lock ? For what? Quote Link to comment Share on other sites More sharing options...
irigsoft Posted February 19, 2022 Share Posted February 19, 2022 6 minutes ago, artem_niko said: What is unIServerModule.Lock ? For what? This will Lock Server until interaction with this list (or files) end. More info here: Quote Link to comment Share on other sites More sharing options...
artem_niko Posted February 19, 2022 Author Share Posted February 19, 2022 4 minutes ago, irigsoft said: This will Lock Server until interaction with this list (or files) end. And if I add IP addresses to the list via UniServer.BlockingIPList.Add(...) while the project is running, should I also block the server or something? How will this affect those users who are already logged in and working on their sessions? Quote Link to comment Share on other sites More sharing options...
irigsoft Posted February 19, 2022 Share Posted February 19, 2022 5 minutes ago, artem_niko said: And if I add IP addresses to the list via UniServer.BlockingIPList.Add(...) while the project is running, should I also block the server or something? How will this affect those users who are already logged in and working on their sessions? In the last link I added more information on how to protect the unigui application yourself. I use exclusively UniGUIServerModuleHTTPCommand to block IP by various criteria and all blocked IP addresses are added to BlockedIpLIst as soon as they are blocked, so loading and saving information to a local file is always with me and I do it this way in the procedure save on file by this way: try UniServerModule.Lock; If UniServerModule.BlockedIPList.IndexOf (sRemIP) <= 0 then begin UniServerModule.BlockedIPList.Add (sRemIP); UniServerModule.BlockedIPList.SaveToFile ('YouPathToFile); end; finally UniServerModule.UnLock; end; Quote Link to comment Share on other sites More sharing options...
irigsoft Posted February 19, 2022 Share Posted February 19, 2022 8 minutes ago, artem_niko said: should I also block the server or something I lock server to save or load from file, not to BlockedIpLIst. Adding IP to BlockedIpList does not require locking Quote Link to comment Share on other sites More sharing options...
irigsoft Posted February 19, 2022 Share Posted February 19, 2022 9 minutes ago, artem_niko said: How will this affect those users who are already logged in and working on their sessions? Try to load (reload) this list with IP addresses of bot agents and will know: DisabledIPList.txt This file is larger than blockedIplist allows, but will allow you to check the functionality of the system when reloading the list Quote Link to comment Share on other sites More sharing options...
artem_niko Posted February 19, 2022 Author Share Posted February 19, 2022 1 hour ago, irigsoft said: Adding IP to BlockedIpList does not require locking Why? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.