I'm developing a Java application that uses different libraries to connect to SSH servers or to console terminals via serial port. Now halfway into the development I see that it would be really interesting to be able to replace those libraries with the PuTTY program itself. Users would enter the connection parameters (IP address, serial port, SSH keys, ...) into PuTTY as they usually do and the Java application would send the commands to PuTTY and read the output of those commands. Advantages:
PuTTY is very reliable and also it's what the users use when they do the process by hand so it's guaranteed that the data communication will work fine. Also they could use their current saved sessions, settings and any other configuration
No need to import and use different Java libraries for Telnet, SSH, serial communications, etc
In the case of serial port, only one program can be connected to the COM port so it's the only way that the user could send commands without closing the Java application
Is there a way to do this with PuTTY or other equivalent program?
Related
I created two Qt apps: one client and one server.
I use them to send some data for handle a remote device.
If I am in localhost I haven't issues about them, but when i search to connect them by internet i don't know how to find correct Ip server to connect Socket Client.
How i can find this ip node?
Is there a class to find It?
you cannot find it automatically, if this is what you're asking about.
In real life you would deploy your server on some publicly accessible host, give it a domain name (important part as your host can change the IP address at any time) and connect the client via the DNS domain.
However if you're just playing around and you want to show to the world that your app works, specifying the IP address of the server in your client code would be perfectly fine (assuming you're running both the server and the client in the same network).
In that case, if you're running mac/linux run the command ifconfig (or just ip depending on the distribution). On Windows you can run the command ipconfig. Both windows and linux will give you a similar output resembling this:
Pay attention to the network adapters. There can potentially be many of them. You may have some emulated adapters if you have docker or VMWare, you may have the wireless adapters if you have a WiFi card, and then the ethernet adapters if your computer can connect to the the internet with an ethernet cable. Each of these adapters specifies a different IPv4 address. You want to pick the one that is connected to the same network as your client. So for instance if both your server machine and your client running machine are connected to the same wifi, you pick the address from the Wireless LAN adapter
I want to create a Minetest server on my Raspberry Pi 3 in my own network.
I know some discussions have been made (like Any risks in installing my own http server?), but I want to create a Minetest server.
I would like to know
• If it's dangerous to create a server in my own network
• If I can make a protection if it's dangerous.
Thanks
PS : Sorry for the mistakes, I'm French!
I'm going to assume here that you're intending to serve this internally. You certainly wouldn't want to put an external game server on a network that was also shared by your household. The Raspberry PI is assumed to be internal itself without a public IP or any way to be addressed beyond the local network.
Realistically speaking, you can probably assume an internal network is safe enough for inconsequential internal services, if physical and wireless access is adequately controlled. Looks like minetest is a game server, so unless you combine its server with other far more sensitive tasks, it's not like there's any dire consequence to unauthorized access.
But that perspective does seem a little naive, doesn't it? If access were to occur, the raspberry pi could probably be compromised, and from there, the IoT devices in the home, other private services, etc are at risk too. So, perhaps you're just a little too paranoid / experienced / virtuous to leave it at that.
If so, we can probably assume that the connection itself doesn't support much in the way of encryption, but it's likely we can successfully tunnel the connection in any number of ways to add an encryption layer "between" client and server.
The simplest of these is probably ssh. You're already using it to manage your raspberry pi, probably, and if you're not, you might want to (I for one need copy/paste between web and terminal, and I don't want to run gui on pi!). SSH offers a much higher standard of security than most protocols.
Conceptually, you execute an ssh client locally on the game client configured to open a local port on the game client, and forwards packet recieved on that port to a remote port on the ssh server. The remote port need not be accessible on the network directly, only ssh ( the game server would listen on localhost). The ssh tunnel uses strong encryption methods to pass the traffic over the untrusted network ( yours, or perhaps any network for some traffic ).
The process when implemented, would look something like this:
actiate ssh server on pi if not yet done,
obtain ssh client for game client machine. ( Putty for old windows, built in for linux or osx etc, new windows might have better support).
generate ssh keypair on client (each client should do these steps. private keys are ideally never transferred. )
add public key to ssh user on pi and verify that you can login without password
Use SSH tunnel in oyur client to create a local port that tunnels to the remote game server port. https://www.skyverge.com/blog/how-to-set-up-an-ssh-tunnel-with-putty/ looks like a good putty tutorial, https://www.revsys.com/writings/quicktips/ssh-tunnel.html looks decent for unixy environs.
I prefer to take the safe and lazy route, assuming no network is necessarily secure, and weighing the convenience of accessibility against the securiry concerns. Using an ssh tunnel is, once you get used to it, a simple and straightforward way to access services across any untrusted network, by it your own, a public wifi, or the internet at large.
I am trying to understand how TIVA123 processor communicates to windows. I see it does not require any com port and works on In circuit debug interface. Also on the download command I see download utility has arm-none-eabi-objcopy which does not require com port flags. How does it calculate which com port to connect to?
I need advice on this product Moxa NPort 5120A I use to convert the serial outputs of some ethernet cards in order to be able to connect to the network.
Using the Realcom Mode, but whenever I connect it to your network and want to use a software from the PC to control it I need to open the software NPort Administrator, add the device, and then open the Web console, otherwise the doors do not appear to be open and if I do not open the web console software NPort Administrator (with the appropriate button) and I type the IP address of the port in the browser always comes back to me that the server is not responding and I do not load the web page. Has anyone had experience with the Moxa and their products? And 'it possible to use this module that I always have to open the software and open the Web console without having to change any settings to enable the COM port?
Thank you.
Normally with these types of devices you use TCP/IP sockets for communication with the device(s) on the other end. In your application you create a socket and listen for connections. Once a connection is made you process the data coming in and send data out to the device.
You also configure the device on the other end to tell it to connect to a specific IP address/port which is the server or PC running your software which is listening for the connection.
It sounds like that device also offers a device driver that can be installed and causes it to emulate a serial port. In that case, you would configure it that way and have your application open a serial port and communicate with the device as if it were actually attached to a real serial (COM) port.
I'm writing a client/server program which needs to create a secure network pipe between two machines, identifying them both using certificates. The SSH protocol seems like a perfect match for this - its built-in security, support for authenticating both sides, and maturity being big plusses. It can also multiplex connections by using one open connection to connect many generic ports.
The idea is to create an always-on connection (these programs have a dedicated line between the client and server), and to open a port whenever I need one. Can the SSH protocol be used this way? How would I go about incorporating libssh into my programs to support that?
You can do that using libssh. You create a ssh session and for each port you can open a channel for port forwarding. See
http://api.libssh.org/stable/libssh_tutor_forwarding.html
You can even try out this kind functionality with OpenSSH's -M/ControlMaster function.
Both libssh and libssh2 support this functionality.
A little nit: SSH doesn't use certificates, it uses private/public keys.