Localyzer Machine Translation through a Proxy Server

From Lingoport Wiki
Revision as of 19:26, 4 November 2020 by Masnes (talk | contribs)
Jump to: navigation, search

Rational

A proxy Server may be used for Localyzer AWS Machine Translation if necessary for IT/Network/Security requirements.

This is done by setting the 'https_proxy' environment variable. Another variable, 'http_proxy', is available for http connections, but will not be needed for use with Amazon Translate.

Quick Proxy Validation

It is recommended that you validate you have access to your proxy from your system, prior to enabling it.

Quick test steps (example proxy used is http://masnes.testproxy.internal.lingoport.io:3128) :

  • ssh to your system
  • install 'telnet', if it is not already present
sudo yum install telnet
  • validate that you can connect to your proxy server, while keeping proxy settings clear - for now:
http_proxy="" https_proxy="" telnet <proxyurl-no-http/s> <proxyport>
Example:
http_proxy="" https_proxy="" telnet masnes.testproxy.internal.lingoport.io 3128
Result
Trying 172.31.81.146...
Connected to masnes.testproxy.internal.lingoport.io.
Escape character is '^]'.
Note: Enter will quit and return you to your terminal.
If the connection takes more than 5 seconds, you may not be able to connect to the proxy, please check your networking connection settings before continuing.
  • Next, as a comparison point, try curling + to an external site that will return the found ip address, without using the proxy settings yet.
Here, we use 'https://canhazip.com' as the external site. We set a timeout in case the connection is blocked.
Command
https_proxy="" curl https://canhazip.com --silent --connect-timeout 5 || echo "NOTE: ...Connection timed out after 5 seconds."
Expected Result
<your systems ip>, something like '34.195.141.162'
Alternate Expected Result - You'll see this if you are blocked from external connections by your firewall. This is ok too:
...Connection timed out after 5 seconds.
  • Next, try using the proxy with curl + an external site that will return the found ip address.
Command
https_proxy="http://<proxyurl>:<proxyport>" curl https://canhazip.com --silent --connect-timeout 5 || echo "FAILED: With proxy, connection timed out after 5 seconds."
Example
https_proxy="http://masnes.testproxy.internal.lingoport.io:3128" curl https://canhazip.com --silent --connect-timeout 5 || echo "FAILED: With proxy, connection timed out after 5 seconds."
Expected Result
<proxy ip>, something different from the above. For the above example it was '54.205.127.98'


2. perform a curl against an ip reporting site with no proxy setting, record the IP returned.

https_proxy="" curl https://canhazip.com https://canhazip.com --silent --connect-timeout 5 || echo "FAILED: With proxy, connection timed out after 5 seconds."


  1. Defining the Proxy for use with LRM AWS Machine Translate

To set a proxy server, define the environment variable "https_proxy" prior to running LRM. Through Jenkins, the easiest way to do so is:

Manage Jenkins -> New Page Configure System -> New Page Global Properties -> Environment Variables -> Add (Button at the bottom of the Environment Variables settings)

Settings should be: Name: https_proxy Value: http://<yourproxy>:<yourproxyport>

Example https_proxy http://masnes.testproxy.internal.lingoport.io:3128

  1. Validating the Proxy