How to pass the incoming http requests to RDP machine - java

Sorry if this questions was already asked and answered, i just really have no clue how to ask formulate this question.
So i've got the next issue. I got the access through RDP to the machine in some private network. Also we got some services which is accessible in that private network. That service, which is basically some corporate repository is a place where some dependecies in our project pulled of from. What i trying to do is to configure this project locally, and for that purpose i need the posibility to pull that depenedencies of from that repository on my local machine. This dependecies are pulled by Maven, and as far as i understand basically during the pulling process, it's just a http requests back'n'forward process. In my thoughts, theoreticaly, i could configure somehow some sort of proxy from computer to the RDP machine, and pass all that incoming traffic to the remote machine and answer on the requests there (on the remote machine) and get answers on my local machine.
One more thing worth to mention. I use ZScaller proxy to connect to that machine via RDP. Again, from my thoughts, not that was really an issue, but just in case.
My questions, is that possible, and how can i do it? Any tips for that.
Thank you very much!

Related

How to make a local test server for an android app?

I basically need to create a test server, something that I can use locally to perform tasks for my application.
So my android app is basically a search engine, however the search queries will be made on the server and the results then fetched from the server on the mobile device as JSON objects.
Is there any way to replicate this functionality locally? I would just like to set up a server, include the Spring framework, the Google Custom Search API and develop it all in Java, then ship it to a live server directly when it's finished. (Most presumably a free tier Amazon AWS server, either EC2 or Lambda, not sure what the difference is).
Not quite sure where or how to get started so any help is appreciated, thank you!
p.s. I may try dabbling in some machine learning at a later date, but I don't know if this will affect anything, this will most likely be after I've got a live server up and running.
EDIT: Sorry, so how would I fetch data from a local server from my mobile device? Do I need special software? Do I need to configure a local server? How can my mobile device fetch data from a second project when its being run on the first?
My app will fetch data from a server, so how can I create a dummy server, for it to fetch data from? Will I need to create a fully functioning online server, or can this just be done through creating a local server of some sort and then simply plugging my android device in and running the code? I have absolutely no idea how to test it without putting it online.
You can run a local installation of Tomcat server on your own machine.
Access the server by visiting "http://localhost:8080/" (or) http://127.0.0.1:8080". You can basically listening to your own local machine / host's 8080 port. Sometimes, it could be port 80 instead of 8080.
Please explore on how to host a Spring or Java application on a local server.
A good starting point would be to learn J2EE or Enterprise Java. You can configure Databases from your local installation.
If you opt for PHP as your language on server side, there is a pre-defined package called WAMP (for Windows), LAMP (for Linux), MAMP (for MAC) and XAMPP.
The above package are nothing but a package which contains a Server, Database and a Server side language usually PHP, if needed Python or Perl.
Please explain in which step you are getting issues so that anyone can help you exactly.

Filtering URLs to allow only the ones that are publicly visible

Users in my app can send messages between them and they can embed images from public sites in the content. I'd like to download those images and store them in my own storage, so my app won't break when the images are deleted from the internet.
I'm corcened about the security implications.
What if the user sends a message with a img src that starts with http://localhost. I'll be requesting my own server.
What if the src is a private ip. I'll be connecting to servers in my private network.
What if the src is a host that resolves to 127.0.0.1.
And other nasty ideas I can't think of.
What can I do in order to check I'm downloading an image from a public server and not hitting my owns.
I'm using standard Java.
There are front end and backend solutions for this.
Simply prevent your app from accepting such links. Use patterns to ensure certain things are filtered, for example, localhost links or abusive links. Even if they are shortened. https://stackoverflow.com/a/8151742/2110818
Or configure your firewall to ensure that ports 80 and 443 are not accessible on the machine that has the apache server. There's plenty you can do.
Which server are you using or are going to use to host your server? For example, you can secure tomcat or other servers and prevent things from happening like here: https://www.mulesoft.com/tcat/tomcat-security
Also, one should try to prevent any kind of unvalidated redirect anyways even within their code. So, don't just focus on external threats, your own code could hurt you. Check this out to know more: https://www.owasp.org/index.php/Unvalidated_Redirects_and_Forwards_Cheat_Sheet
But, I think the most relevant solution to prevent internal and external threats is to configure your machine well and ensure the firewall covers all aspects. There are detailed guides for securing servers out there.

Need to call from jxfs client to jxfs server

I am very new to jxfs things. I have a requirement to call jxfs server which is in cloud server from the jxfs client which is in ATM environment.. How can i call?.. I need to call this one through the Jxfs RMI concept. It would be appreciated one if any example code is available. If atleast you are having code for calling from jxfs server to jxfs client, please post it.
Thanks in advance guys.
One of the interesting things about J/XFS and remote device access (based on RMI) is that it is just matter of configuration.
You need to configure a J/XFS repository in order to handle a remote device (basically set 'remoteAccess' to true).
Then accessing these devices from the programming point of view is just the same as they were local devices.
Architecture is explained here: ftp://ftp.cencenelec.eu/CWA/CEN/WS-J-XFS/cwa14923/cwa14923-01-2004-May.pdf
Details, when programming may differ depending on the J/XFS implementation you are using.
Trying to answer your question below:
Whenever you want to access a device remotely in J/XFS, RMI is used. You need to make the following setup:
On a server (should be accessible) you need to start a JxfsServer. The JxfsServer will use a Read.repository
whith all the ATM's and devices configured on them as workstations, with the right IP addresses.
On the ATM, you need to install:
J/XFS libs
J/XFS device services for the devices on the ATM
Setup the DSstarter:
Will use the SpecificDeviceManagerRMI connecting to the JxfsServer you started before.
On your server (cloud) wherever you are going to use the J/XFS client you can get the remote controls by performing
the J/XFS initialization as follows:
jxfsDM_ = JxfsDeviceManager.getReference();
jxfsDM_.initialize("com.jxfs.forum.communication.rmi.SpecificDeviceManagerRMI,<atmWorkstation>,AppTest,2006;<jxfsserverhostname>,");
Then you can get the remote device controls with getDevice(...), and start using them as if they were local devices.
Please, note that handling RMI ports can be tricky, specially in a secured environment as ATM network. Make sure all the ports you need are open.

Deploying webservice on remote machine

This might sound a very basic question for the N/W gurus so please try to help me here.
I have developed a simple Webservice in Java and deployed it on a local machine using Eclipse/Ant. The path looks like this -
http://localhost:8284/myws?wsdl
Now, I have provided a static IP for the local machine say XX.XX.XXX.XX and I can ping it from any remote machine over internet.
In my Java program, I have provided endpoint name as -
"http://localhost:8284/myws" and it works fine on local machine and opens the wsdl just fine in a browser.
Now, I want to deploy this webservice in a way that, I can access it remotely using my static IP i.e XX.XX.XXX.XX
Problem 1:
When I try to assign the endpoint as
"http://XX.XX.XXX.XX:8284/myws" my Java program gives error saying
Server Runtime Error: java.net.BindException: Cannot assign requested address: bind
Problem 2:
If I deploy it as "http://localhost:8284/myws", I am not able to access it over internet using URL like http://XX.XX.XXX.XX:8284/myws?wsdl.
Things I have did so far - -
a. Turned off the firewall
b. Created 2 rules inbound/outbound with port 8284 allowed.
My question is, will I need a router to do a port-forwarding thing? Or will I need an IIS to deploy it?
I really want to ignore both of them. If there is any simple way to do that please let me know. Am I missing something? I am able to ping the IP and can also connect through RDC.
Info -
Machine is on Windows 7.
Any help will be greatly appreciated.
Thanks.
I got it solved. I used http://0.0.0.0:8284/cal while binding and not localhost:8284/cal
Works like a gem now! Hope it helps someone.
Regards,
Bhushan.

Using single RMI Registry

I've been using RMI for a project I am currently working on and I want to bind from multiple hosts to a single RMI registry.
However when I attempt to do so I get an error saying
java.rmi.AccessException: Registry.Registry.bind disallowed; origin / 192.168.0.9 is non-local host
I did so googling and it seems that RMI stops remote hosts from binding by default, what I want to know is there some way of overriding or bypassing this?
If anyone any suggestions on how to get past this issue they would be highly appreciated, i've tried using different policy files and overriding the security manger but none seem to work.
There's a way to get around the limitation but it is what it is: a work-around. Anyway, feel free to try it out. It works for us.
On the host that is running the central RMI registry run a small service which will bind a remote object with just one remote method: proxyRebind. The implementation of this method simply binds the object that is supplied to it in the central registry (this would not fail because the registry is on the same machine as this service).
All other hosts would simply lookup this remote object and invoke proxyRebind with their own remote objects.
This works because look-up on remotely hosted registries is allowed. Your original attempt failed because binding on remotely hosted registries is not allowed.
Let me know if you need any further clarity on this.
/RS
2 There's a way to get around
the limitation but it is what it is: a
work-around. Anyway, feel free to try
it out. It works for us.
On the host that is running the
central RMI registry run a small
service which will bind a remote
object with just one remote method:
proxyRebind. The implementation of
this method simply binds the object
that is supplied to it in the central
registry (this would not fail because
the registry is on the same machine as
this service).
All other hosts would simply lookup
this remote object and invoke
proxyRebind with their own remote
objects.
This works because look-up on remotely
hosted registries is allowed. Your
original attempt failed because
binding on remotely hosted registries
is not allowed.
Let me know if you need any further
clarity on this.
This perfectly works. The only thing to take care is following should be always set correctly.
-Djava.rmi.server.hostname="LOCAL HOST IP"
I may be misunderstanding your question, if so please let me know.
I have limited experience with Java RMI, we used it in our Design Patterns class with the Proxy Pattern. (Textbook: Headfirst Design Patterns)
We were not able to get our projects working from outside the university network, but they worked perfectly when connected directly to the network. According to our professor, it wasn't possible to use RMI in our implementation over the internet or wan. A solution she suggested was that a VPN would be required. I believe Vladimir is correct in that it has to do with it being a local naming service.
I may be wrong, but it looks like rmiregistry application is essentially a wrapper over local naming service. Which means there is no way to make it point to remote objects.
What you need is a Naming implementation, and clustered at this. Consider to move into J2EE AS clustering solution. JNDI tree is shared within the cluster.
Thanks for everyones answers the solution I came up with in the end was to use the Cajo Framework this gives a very flexible system for distribution and it allowed for me to handle the registry as I saw fit. It can also work behind NATs, firewalls, and HTTP proxies, which is very useful.
I believe that the method of proxying suggested by rndm.buoy will work in some cases but its may be troublesome on some system. RMI seems to have some issues with associating to the wrong Network Interface I particularly had this issue when running on Debian based Linux distributions.

Categories

Resources