Jump to content

UniServer.BlockeIPList using


artem_niko

Recommended Posts

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?

Link to comment
Share on other sites

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;

 

  • Like 1
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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;

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...