Jump to content

Allow/ignore the monitor ( /server) request from based on IP address


leons

Recommended Posts

6 hours ago, leons said:

Is it possible to ignore the http;//xxapplicationxx/server based on an ip address? I want to allow the access to the server monitor from certain ipaddresses and ignore the other requests.

Hi,

UniServerModule.BlockedIPList

UniServerModule.WhiteIPList

Or using login and password, please see this demo: 

\FMSoft\Framework\uniGUI\Demos\Desktop\ServerControlPanel
procedure TUniServerModule.UniGUIServerModuleControlPanelLogin(
  ASession: TUniGUISession; const Auser, APassword: string;
  var LoginValid: Boolean; LoginAttempt: Integer);
begin

  if SameText(AUser, 'demo') and SameText(APassword, 'demo') then
    LoginValid:=True
  else
  begin
    if LoginAttempt=3 then
      ASession.Terminate('Login Failed');
  end;

end;

 

Link to comment
Share on other sites

12 hours ago, leons said:

yes that was my intention. 

UniServerModule:

procedure TUniServerModule.UniGUIServerModuleHTTPCommand(
  ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo;
  var Handled: Boolean);
var
  s: string;
begin
  s := ARequestInfo.Document.ToLower;

  if (s.StartsWith('/server') and (ARequestInfo.RemoteIP = '127.0.0.1')) then
  begin
    AResponseInfo.ResponseNo := 401;
    AResponseInfo.ContentText := 'Access denied!';
    Handled := True;
  end;
end;

 

  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...

@Sherzod,

If I have a WhiteIPList filled with some IP addresses, these IP addresses are allowed to work with the unigui server.

I filled in some IP addresses in my WhiteIPList because they are secure, but I want other IP addresses to work, is this possible if I have a WhiteIPList filled in or only the IP addresses in this list can access the server?

Example:

1. WhiteIPList populated with: 121.45.55.66

2. I try to connect with this IP (121.45.55.66) and everything is fine

3. If i try to connect with IP 21.22.33.99, then I get "Access denied 21.22.33.99"

How to enable IP 21.22.33.99 to work with a server without adding it to WhiteIPList?

Link to comment
Share on other sites

22 hours ago, Sherzod said:

Hello,

I think it's easier for you to add this IP to WhiteIPList.

I will use this logic and must to know what is right way to do it.

"In this situation, there are some limitations that the user will encounter:

1. My application is not a website, this is a web application, REST server, etc. and it will need access data.

2. If the user wants to connect to this web application, then he will need:

2.1 full URL of the application (there is some data that you will receive from the owner of the server to connect to the application)

2.2 user and password

3. If they know this information and want to use a Site-to-Site VPN, then they will receive information about which country they will need to use to connect to the web application.

4. A certain IP address can always be added to the list of trusted addresses (WhiteIPList) and blocking by country will not be affected

I think that the combination of all these parameters will allow the normal operation of even such users.""

 

So

1. if IP from another Country is in WhiteIPList, then will not be blocked

2. I try it but when is populated some Ip's in WhiteIPList, then every IP outside of this list is blocked.

 

So this is a bug with WhiteIPList or is the right way to work ?

Link to comment
Share on other sites

2 minutes ago, irigsoft said:

So is this a bug with WhiteIPList, or is right way to work

Your question regarding WhiteIPList is not very clear.

3 minutes ago, irigsoft said:

1. if IP from another Country is in WhiteIPList, then will not be blocked

2. I try it but when is populated some Ip's in WhiteIPList, then every IP outside of this list is blocked.

If I understand you correctly, that is exactly how it should work.

Link to comment
Share on other sites

2 hours ago, Sherzod said:

Your question regarding WhiteIPList is not very clear.

If I understand you correctly, that is exactly how it should work.

I create my logic in another topic, when the ip is in the whiteiplist, then I do not check this ip by country.

if it's not there, then I'm checking the state.

But I understand that if I put some IP addresses in whiteIpList, then only those IP addresses can connect to my server, others are blocked by default from the unigui framework.

Am I right ?

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...