Choices regarding IP restrictions on web request - php

Didn't really know what title to give this question so I hope its acceptable.
I am using a system which has an API. I don't have a lot of control over this system, but one thing I need for security reasons is for it to be locked down to my IP. This works, so now the system can only be accessed from my IP.
Now, I have built a custom app which uses the above API. This app is hosted on a server which is different from my IP address. Therefore, when I try to make the API call it fails due to it being restricted. I know this is the case, because if I run the app locally from my location, it works without any problems.
So, the question is whats the best thing to do? I know I could add the IP address of the server which is hosting my app to the systems API. However, I think the servers IP is dynamic which could cause problems. I have also used things like no-ip locally to control my dynamic IP, but I cant imagine I can install this on my web server.
Looking for thoughts as to how I can overcome this problem.
Thanks

Related

Can't browse the subdomain after visiting a couple of pages of the website made with laravel

I developed this website using Laravel 5.5 for my research group and uploaded it to my university web host. The website's address is in the format of xxxx.cse.yyyy.edu .
When I browse some pages of this website it gets inaccessible and I can't even access the cse.yyyy.edu subdomain anymore for a while (usually after 10-12 hours). I can ping the IP address of the CSE subdomain but can't ping the domain address (possibly a DNS issue?). Although I am not sure, I think restarting my local router makes the website accessible again.
The only thing out of the ordinary about the website is the insecure login page that is not using https at the moment. Other than that, everything is just straightforward laravel code adopted from the original laravel documentations.
I'd be happy to provide more information but I don't really know what kind of info I should be providing here.
What do you think might be causing this problem? Thank you in advance!
So, I figured what was causing the problem. I asked the system administrator to look into the logs of the web host. Turns out that web hosts can have a blocking mechanism in case too many 404 errors are generated. Turning off that mechanism solved my issue. Note that this wasn't something I could fix on my own and might be the same in your case if you don't have full access to your web server settings.

Is it possible to use the facebook API on XAMPP (local server)?

Is it possible to use the facebook api like we do it on sites live on the internet , but on XAMPP ( a local server) installed on my computer ? I'd really appreciate your feedback.
Mostly the API's should work fine unless you have a registered domain associated with the API app key.
You have not specified which API you are using [Facebook has a lot of API's with various security levels]
A few disadvantages on working on local machines are as follows
A local machine is identified as an anonymous request coming from some IP as its not associated with a domain. Therefore chances of blocking your API request are high.
Your system may have imposed firewall rules for incoming and outgoing requests, if your local server is not configured to send and receive outbound requests your might be in trouble.
Hope this helps.
This is sent from a mobile, don't ask me how but the comment system doesn't work nicely for me.
A local server is the same as a live website, the only difference is that you run it locally...
If you have an internet connection while running the server, you're basicly the same as every other server....
but well if you don't have internet on it don't expect it to be working....
[but ofcourse you can only connect to it locally and not from other computers xD]
I hope I answered your question now, Feel free to add a comment if you want to.
Yours sincerely,
Mike M.
Yes you can. Just make sure that redirect url must be the url which we put in the facebook while building the app.

How to setup a local server which can accept oAuth callbacks?

I am not sure if this question has a place over here but I am having a lot of trouble setting up a local development server from where I can work on Facebook, Twitter, Google+ and other applications.
As of now I have an Apache environment and I am working on a PHP based platform. The database server is a standard MySQL server. Also, I am working behind a authentication based proxy.
The primary issue that I encounter is, when I made an application on Twitter and entered the relevant details like - website, callbackurl as 127.0.0.1. My application when tried to retrieve the oAuth key, it wasn't able to. I even tried out changing my listening post to something other than 80, but it didn't work either.
I understand that any application of this sort will encounter this problem because 127.0.0.1 is not an address that points to my computer precisely. And I am not aware of any other method other than this. Am I doing something wrong somewhere or is it impossible to develop/test applications which require oAuth via a locally deployed server.
Update
Port forwarding is not a solution because I am behind a firewall and I am part of a private network. Hence, my questions are-
Is this kind of development impossible in such a setup? If yes, then what can I do to? If I work using a dongle, will it possible? Or do I need to procure a static IP?

Getting my ip address

I have a computer on a small network, so my ip is 192.168.2.100.
I am trying to get my real ip. I download the no-ip client but that just seems like a lot of trouble for such a simple thing.
I created this php script that got http://www.ip-adress.com/ page and retrieved the ip it gave me.
Is there a simpler way? Either using C, WSH or something. Or if there is an easier way in php please tell me.
When I get the ip I'll uploaded it to my ftp site so that I can see the ip from work.
No, there's not really an easier way. Your computer really doesn't know the public IP it's behind -- there could any number of layers of NAT between it and the public internet. All it knows is that it receives messages at 192.168.2.100, and sends outgoing messages through the gateway at 192.168.2.1. It has no idea what happens after the packet hits the gateway.
Do note reinvent the wheel, there is a standard protocol, STUN (with already existing implementations), just for that. See also Discovering public IP programatically.
Not quite what you asked for but still applies to what you want. I setup a GMail Notifier on my home computer and go to the account activity page to see which IP address is accessing my Google acount. Secure, simple and works.
If you want to get the eventual IP that the remote site seems when processing your traffic then the only way is to actually access a remote site. In many situations your computer may not be aware that the IP is getting changed by a proxy or a NAT server.
I always use curl http://whatismyip.org to get my public IP while behind NAT.
You can also access this page to get your IP
http://www.biranchi.com/ip.php
Some routers can tell you their external IP address via UPnP, or more specifically, the IGD protocol. If you happen to own an UPnP enabled router, you can try this. IStaticPortMapping::get_ExternalIPAddress sounds promising.
SNMP enabled devices can tell you their IP addresses, too. The OID to ask for is IP-MIB::ipAdEntAddr.
When I need to check my public ip address, I like this website:
http://www.whatismyip.global/
The website keeps a history of your IPs. For me is very usefull!
The way you're doing it is probably as good as any.
You say you have a public FTP site -- do you also have a web site there? Your other option is to have your local machine access a php page on that public facing site. That php page can verify it's you and then use the $_SERVER['REMOTE_ADDR'] to record your external IP.
Unfortunately, you're server will most likely be completely oblivious to what it's own External address appears to be (as it might be set further upstream via some router/gateway)
You could have a look at this link
http://ip-address.domaintools.com/myip.xml
It might be a little easier to parse than what you're currently doing.
I can't think of how you would resolve your IP address from the perspective of another machine. Here's a couple thoughts:
Automate the loading of the
ip-adress.com page and parse it
Look at DynDNS
Your computer has no information on any NAT or routing that takes place between it and the internet except which hop is the next one (usually your router's internal ip). It simply doesn't know at which hop the internal address gets translated into which public address.
Therefore there is no simple function or method you can call, in any language.
The only two ways are to ask someone else. How?:
Ask your NAT router (because it itself does the translation to a public ip) by fetching and parsing the right page on your router's admin site. Arguably most reliable, and fair.
Ask an external host how it sees you, by fetching and parsing a public service such as http://dynamic.zoneedit.com/checkip.html. An example in VB script is here.

can php code break down shared hosting services for the particular IP?

Sorry, i had to put the same post again due to still no solution
I have a strange problem, i just installed my php web site on a shared hosting(php,apache,mysql,linux), all services were working fine. But after configuring my app i just could visit my web site only once, other attempts gives "The server is taking too long to respond.". But from other IP i can access, but only once, it seems all ip addresses being blocked after first visit(even ftp and other services go down, no access at all from the IP), can anyone help to explore this problem ? i don't think that it's my app problem, the app works fine on my local PC. By far The only one is there might be a infinity loop in my code becouse i had this issues on my local pc, but i fixed it, should work fine everywhere. Can infinity loop make blocking all services bind(if this is the way) to particular IP ? but im not sure about this. Never thought this way.
I would look at an infinite loop issue more. I had a similar issue that only showed up on the shared server because my local machine had a different version of php and different error settings.
Sounds like a problem either with sessions or database connections. Is there a page's code that you could share that causes this problem?

Categories