Score:0

ssh tunnel for 443

ss flag

I need get a file by a link (443), which is only possible from server B.

I have 3 servers, (A B C).

It is possible to access server B and download this file by wget from server C.

wget https://NAME:[email protected]/customerInfo/804-577823-10 --no-check-certificate
...
2021-06-18 16:18:01 (24,7 MB/s) - ‘804-577823-10’ saved [163/163]

From A to B, it is only allowed to use for port 22 (ssh), not port 443.

I need to make a tunnel, which will go through from A to B via 22 and download the file from C via wget port 443, exact the same way, as if I were on server B.

In short, I need a ssh tunnel from A to B and then I need to use port 443, for apply/download the file on C via wget from A, same way as on B.

I tried, but no success.

ssh -L 4433:C:443 -Nf B

I tried even with proxy, but no success.

wget -e use_proxy=yes -e http_proxy=C https://NAME:[email protected]/customerInfo/804-577823-10 --no-check-certificate

Is it possible?

Thank you.

UPDATE

SERVER_A:443 -> ssh tunnel by port 22 through SERVER_B -> SERVER_C:443

So if I use on SERVER_A same link as on SERVER_B, I want to get file by wget from SERVER_C.

Simplest way is allow port 443 on SERVER_C for SERVER_A, but it is not possible in this case.

Allowed is only port 22 between SERVER_A and SERVER_B.

It is clearest now?

Thanks.

Score:2
us flag

It depends on who owns the servers in terms of permissions in order to determine what you are able to do. Also, what i do not quite understand is if this a one time download or you are in need of a permanent solution.

After reading your question I would go into server B with a secure shell.

$ ssh user@serverB

Then download the file from there. ( The point at the end is important)

$ scp -P 443 user@serverC:/path/to/file.txt  .

After this you can get send it to server A

$ scp file.txt user@serverA:~/

There are also more sophisticated solutions but it depends on your needs and freedom to act.

Update:

You can send a command to the server over ssh.

ssh user@serverB "wget your file at C"

You could do a double command like:

ssh user@serverB "wget your file @C:443  && scp file.txt you@serverA:~/"

But then you need to have serverB have his public certificates installed at serverA to go pass-wordless. The alternative is a 2 command script like explained above.

genderbee avatar
ss flag
Hello, yes, I know, but I need direct access to this link/file which is on **C** server from **A** server, so I need to configure **A** server so that link from **C** server to be accessible on **A** server. Is it posstible to do it through ssh tunnel?
Whois_me avatar
us flag
Do you own server B ?
genderbee avatar
ss flag
Yes, I can do anything on server B, but not on C, so I can't allow access from server A to C directly via port 443.
ru flag
@genderbee then you have to go the indirect way - scp it to server B, then scp from server B to server A. If you don't own A or C then you really should be talking to their admins because they may not *want* A and C to have any file transfer.
Whois_me avatar
us flag
@genderbee. Although I like the challenge of tunneling computers through the matrix, I really am wondering what you are trying to achieve.
genderbee avatar
ss flag
@rm- It is simple, I just want to configure server **A** to get file by `wget` link (port 443) same way, as I would be on server **B**, using by tunnel (or proxy?). Now, when I try `wget` on server **A**, connection is refused even ssh tunnel is up.
genderbee avatar
ss flag
@rm- See question update please.
Whois_me avatar
us flag
Yes I understand your question. Does my answer resolves your question? If not, you should look at other solutions then wget I guess. Hence my additional question. What are you REALLY trying to to? So we can help outside the scope of your question.
genderbee avatar
ss flag
@rm- I have app based on PHP and this app is using wget call, so it is needed use by `wget`. Still no success.
Whois_me avatar
us flag
Ok let's do this step by step. Can you wget your file when you are logged in server B? Look at: https://www.gnu.org/software/wget/manual/wget.html#URL-Format
genderbee avatar
ss flag
@rm- Yes, I can. Server B is prod, so it is possible to get link by port 443 from server C. Server A is test, and there is no possibility to get link by port 443 from server C. I have only port 22 allowed between server A and B. How can I make on server A (test) functional port 443 for needed link (server C) via tunnel through port 22?
Whois_me avatar
us flag
Next step: Add in this wget command in the ssh command. Like in ssh user@serverB "wget command to server C" and execute on A. This should work. You can test the AB connection first with ssh@user "touch test.txt". There should be a new file "test.txt" present inside server B ( /home/user ) after this command.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.