ssh site as parameter of jenkins job - ssh

I use jenkins to connect towards a ssh site and do some operation. This is possible through Publish Over SSH Plugin and it works well, but I have a lot of server and to use a ssh site I need to configure each one. I would like to use the ip of my machine as parameter in a jenkins job, without any configuration.
Is this possible?
Thanks in advance.

There is no problem whatsoever to put the IP address of your machine as, say, a string parameter for your build. You may put your machine's host name as well. I suppose though that I am missing something in your question.

Related

Is it possible to host a Minecraft server on GitHub Codespaces?

I downloaded the Fabric server jar file to a GitHub Codespace and am able to run the server without trouble. However, I am unable to determine the IP needed to connect to the server. Starting the server automatically forwards port 25565 and I make the port public. However, I can't figure out which IP to paste into Minecraft to connect to it. How do I figure out the IP of the server?
I found an answer thanks to inspiration from this question.
Steps:
Set up the fabric server jar as you normally would, but on the codespace. Start the server.
Split the terminal so one is running Java (server console) and the other is running bash.
Install ngrok via npm i ngrok --save-dev.
Once the server is finished setting up, run the command ./node_modules/.bin/ngrok tcp 25565.
Copy the ip shown under Forwarding (minus the tcp:// part and including the port). This should look something like 4.tcp.ngrok.io:17063.
You now have the ip of the serve!
Note: The free version of ngrok has URLs which change every time, as well as a limit, but for small-scale servers this shouldn't be an issue. You are also limited by the free codespace usage limit GitHub puts in place. However, you can easily get around this by creating a secondary account that you use codespaces on only for the server.

Access Server via SSH When IP Address Is Blocked

The entire scenario of my situation seems 10/10 sketchy, I'll admit. So I won't bother convincing you this isn't a malicious attempt to access a server that isn't mine - I'll simply say once, that this is a legitimate need for assistance.
That said, basically my problem goes back to me being a little too restrictive when it came to SSH access to my CentOS 6 server. Basically I restricted access to my custom SSH port from only two IP addresses - one being my home address, and one being my work address - via iptables. The problem is, I no longer work where I do, and my home IP address changed ever since I upgraded my internet.
Obviously this means I no longer am able to connect to my server via SSH since I don't own that IP address anymore.
My question is, is there anything I can do to access this server? I have no console access, but I do at least know the IP address I used to use to log into the server (maybe possible to spoof an IP address, but I have no clue). The only other thing I can think of is I have DirectAdmin installed on the server and can still login with the admin account. Other than that, I've got nothing.
If anyone has any idea on what I can do, it would be greatly appreciated.
You can change the SSH port number from Directadmin file editor (if you have root password),
Then restart the sshd service from service manager
And you can connect to SSH via new port number!

Hosting site using xampp server from local network without port-forwarding

I want to make my site available world wide. Im using xampp server for hosting. I have no access to any kind of servers and modems. Situation is shown below:
My site server has local ip assigned by wifi router and it runs Windows 8.
Remember I have no access on any kind of servers and modems so port port-forwarding is impossible (out of my scope).
Its actually difficult, but not impossible.
One way, I would approach this is:
I would host a page on internet.
Then take request and store it in database.
One of my program will always be running from my computer.
Then check for request and curl the request to localhost. For this you may use Node.js (taking data from database using GET method and curl it to localhost).
This is the best I could think of. And I am working on it, when the code is ready I'll make it open source and notify you :)
But still, it's difficult, as you need to put user's request to sleep for 2 seconds and then transferring it.
Its slow, but may work out for you.
Disadvantages:
Program will be very slow and memory usage will be more.
Breaking may happen many times.
High bandwidth wastage
If not encrypted, MIM (Men in Middle) may possible.
Advantages:
Indirect method of hosting
Need not to worry about your code being lost.
I am looking forward for a better alternative and I would like to keep this question for bounty once again.
If you cannot open the necessary ports within your LAN you will require access to an external server. However, the external server does not need to host any code, e.g.
Create a Linux based ec2 instance using Amazon's free tier.
Install a package to redirect remote to local ports:
a. using socat:
Install socat using your distributions package manager
Connect via SSH: ssh -N -R 42500:127.0.0.1:80 -o ServerAliveInterval=60 ubuntu#xxx.xxx.xxx.xxx -N -R 8080:localhost:80 "socat TCP-LISTEN:8080,fork TCP:127.0.0.1:42500"
b. using a webserver and reverse proxy:
Install apache or nginx and any required reverse proxy modules and configure your VirtualHost to proxy requests to a local port, e.g. :8080 -> 127.0.0.1:42500
Connect via SSH: ssh -N -R 42500:127.0.0.1:80 -o ServerAliveInterval=60 ubuntu#xxx.xxx.xxx.xxx
Your machine is now reachable via the ec2 instance http://xxx.xxx.xxx.xxx:8080/.
I occasionally use this technique when debugging web service callbacks.
Update 17-02-2014
If you are a Windows user you will need to install a third-party tool to support ssh. Options include:
cygwin
git bash
PuTTY
PuTTY is the easiest choice if you are not familiar with *nix tools. To configure remote port forwarding in PuTTY expand the following setting: Connection -> SSH -> Tunnels. Given the previously described scenario, populate Source port as 42500, Desination as 127.0.0.1:80 and tick the Remote option. (You may also need to add the path to a PuTTY compatible private key in the Connection -> SSH -> Auth tab depending on your server configuration.
To test you have successfully forwarded a port, execute the command netstat -lnt on your server. You will see output similar to:
tcp 0 0 127.0.0.1:42500 0.0.0.0:* LISTEN
Finally you can test with curl http://127.0.0.1:42500. You will see the output of your own machines web root running on port 80.
if you don't have a public IP address and cannot use port forwarding it is impossible to host the site
As people have said you need a public IP address. However, even if you did you should not use xampp as a public server, as it is designed for development and therefore has some security settings disabled.
I would recommend buying some shared web hosting, and uploading it to that. (you can get cheap hosting if you google 'shared web hosting', plus free .tk domains are avaliable: http://www.dot.tk/)
Do your company has any vpn network?
If it does and you have access to the vpn network, you can include your server to the vpn network and your guest will only need to login to your company vpn network then access your site like in a local network without using port forwarding. And since your data is very confidential, I assume that using vpn will also help to increase the security of your data.
Please correct me if I'm wrong.
Thank You.
What you are asking is not possible without port forwarding.
Lets break it into steps.
To host your site locally you will need a IP that is static so that
users can access it specifically.
You will need a domain so that it can be converted into user friendly name.
A 24x7 Internet Connection is must! You added a Wifi Router in your Diagram and most of today's router are capable of port forwarding.
What i will do in your scenario is:
Instead of using XAMP, i will install WAMP because i am more familiar with it and easy to configure.(totally personal preference)
Then i would set my server "ONLINE".(Google how to set WAMP server online)
Forward port "80" from router settings to my local computer ip address.(mostly it is tagged as "Virtual Server","Firewall","Port Forwarding",etc vary router to router in settings)
Suppose you have a local ip "192.168.1.3" and global/router IP "254.232.123.232" then you would redirect all the HTTP request done towards router to your local IP.
[[[[254.232.123.232]]]] --+ :80 +-- --------->192.168.1.3
That is good for now, but then you will need to tackle dynamic IP problem of router. But don't worry, thanks to some free sites that will be easy!
Go to no-ip.org -> Setup Account -> and create a entry, just a subdomain for now to test whether everything is working fine.(subdomain like mysite.no-ip.org, later purchase a real Domain)
Input your IP address there(Router IP) and download its application which will automatically update their server if your local IP changes.
Wait for some minutes and Voila! Your site is live.

How to access Solr from an external IP address?

I have Solr running on my server on localhost in the Jetty container.
This seems like an obvious question, but how do I access the web interface from outside the server itself, like from an external IP address? Obviously, authentication will be important as part of any solution.
I am also running Apache2 on the server, if that is a good solution. I'm surprised I can't find anything about this.
I finally stumbled upon an answer to this. I don't really need persistent access to the Solr admin panel, so I can easily access it using local port forwarding in SSH.
All I had to do was run the following from a terminal on my local machine:
ssh -L 8983:localhost:8983 mlissner#IP-OF-SERVER-RUNNING-SOLR -N
And then open my browser to http://localhost:8983/solr/
Much easier than setting up an Apache config, doing proxies, and whatever else.
It depends on your Jetty ContextPath. For example:
....
WebAppContext explorerWebapp = new WebAppContext();
explorerWebapp.setContextPath("/solr");
....
and then just navigate to your index:
http://localhost:PORT/solr/

service that takes xxx.1.2.3.4.theservice.com and resolves to IP 1.2.3.4

Does anyone know of a free service that's out there that takes xxx.1.2.3.4.theservice.com and resolves to IP 1.2.3.4?
I need this so that I can launch ec2 boxes and point my selenium test scripts at them. I would just use IPs but I need the subdomains to work. Or is there some alternative way to accomplish the same goal? I don't want to mess with the hosts files on my test computers.
More specifically, I need a dns entry X such that music.X and www.X and mail.X to all resolve to my IP.
It sounds like what you need to do is set up your own internal DNS server.
You can create whatever domains you want, and any systems you point to that server will use the entries you create.