How does one configure a proxy upstream of browsermob on osx? - python

I'm looking to configure an upstream proxy for browsermob, preferably programmatically from within a python or shell script.
It doesn't look like the python bindings for browsermob include an upstream-proxy configuration command or method. Is there another method I can use?

The python bindings do actually allow you to configure an upstream proxy. When creating a proxy using create_proxy, you can set the value of httpProxy to the IP address and port of the upstream proxy (see the params parameter on create_proxy for details).

Related

how do I use pymongo behind proxy that require authentication

how do I use pymongo behind proxy that require authentication?
I am able to find settings for ssh tunnel servers, such as
How to connect remote mongodb with pymongo
But I am working on a environment that is behind a firewall that need to use proxy authentication. How do I config for that? For OSX terminal I use something similar to this:
export http_proxy="username:password#ip address:port number"
I find this new feature for socks5 proxy authentication https://jira.mongodb.org/browse/CSHARP-734, but I am just looking for basic or NTLM authentication methods, is it supported?
pymongo does not use http protocol.
You can not use http_proxy.
See https://jira.mongodb.org/browse/PYTHON-1182 for details.
But you can use socks5 proxy
for example:i use v2rayN + proxifier on my windows

PyCharm SSH tunneling via local ssh config (~/.ssh/config)

I use ssh deployment on servers via ssh tunnels,
and each of its has specific options and port forwarding placed in ~/.ssh/config.
PyCharm uses by default its own ssh client when using SFTP deploy.
So, it doesn't work with these deployment servers.
How I could force PyCharm to use my default system ssh client or force to use options from ~/.ssh/config file.
Thanks.
PS: PyCharm version is 3.0.1
Provided PyCharm can be made to use port different than 22 (don't know that), you actually have two workarounds:
Simple workaround
Use port forwarding on localhost:
http://www.debian-administration.org/article/449/SSH_dynamic_port_forwarding_with_SOCKS
..and either use -F specific_config for each tunnel, or use -o to specify relevant options (that you normally have in ~/.ssh/config on ssh commandline) directly. Of course, you have to tell PyCharm to connect to localhost:forwarded_port.
Fancy/sophisticated workaround
Use dynamic port forwarding + tsocks, again described in:
http://www.debian-administration.org/article/449/SSH_dynamic_port_forwarding_with_SOCKS

Allowing remote access to Elasticsearch

I have a default installation of Elasticsearch which I am trying to query from a third party server. However, it seems that by default this is blocked.
Is anyone please able to tell me how I can configure Elasticsearch so that I can query it from a different server?
When elasticsearch is installed and run without any configuration changes by default it binds to localhost only. To access the elasticsearch REST API endpoint remotely the below changes has to be made on the server where elasticsearch has been installed.
Elasticsearch Configuration Change
Update the network.host property in elasticsearch.yml as per the guidelines provided in the elasticsearch documentation
For example to bind to all IPv4 addresses on the local machine, change as below
network.host : 0.0.0.0
Firewall Rules Update
Update the Linux firewall to allow access to port 9200. Please refer your Linux documentation for adding rules to the firewall.
For example to allow access to all the servers(public) in CentosOS use the firewall-cmd
sudo firewall-cmd --zone=public --permanent --add-port=9200/tcp
sudo firewall-cmd --reload
Note : In production environment public access is discouraged. A restricted access should be preferred.
In config/elasticsearch.yml, put network.host: 0.0.0.0.
And also add Inbound Rule in firewall for your ElasticSearch port(9200 ByDefault).
It worked in ElasticSearch version 2.3.0
Edit: As Sisso mentions in his comment below, Elasticsearch as of 2.0 at least binds to localhost by default. See https://www.elastic.co/guide/en/elasticsearch/reference/2.0/modules-network.html for more information.
As Damien mentions in his answer, by default ES allows all access to port 9200. In fact, you need to use external tools to provide authentication to the ES resource - something like a webapp frontend or just simple nginx with Basic Auth turned on.
Things that can prevent you from accessing a remote system (you probably know these):
network configuration problems
ES host firewall blocks incoming requests on port 9200
remote host firewall blocks outgoing requests to ES host and/or port 9200
ES is configured to bind to the wrong IP address (by default however, it binds to all available IPs)
Best guess? Check that you can connect from remote host to ES host, then check firewall on both systems. If you can't diagnose further, maybe someone on the ES mailing list (https://groups.google.com/forum/#!forum/elasticsearch) or IRC channel (#elasticsearch on Freenode) can help.
There is no restriction by default, ElasticSearch expose a standard HTTP API on the port 9200.
From your third party server, are you able to: curl http://es_hostname:9200/?
To allow remote access with one default node, settings\elasticsearch.yml should have:
network.host: 0.0.0.0
http.port: 9200
My case I need three instances. For each instance, it's necessary declare also the port range used.
network.host: 0.0.0.0
http.port: 9200-9202

Python DNS Change Server

What is the easiest way of changing the server that is queryed againest when using dnspython
Ive been using the following,
dns.resolver.query(hostname,type)
However from the documentation it appears you can only change the file it looks at for its resolver servers.
Any ideas ?
Resolver can load configuration either from the Windows registry or from /etc/resolv.conf. If you want to configure dns server manually, don't read system configuration (create it with configure=False) and configure it yourself.
Resolver has the nameservers property which is a list of DNS servers IPs (as strings).

Can access AppEngine SDK sites via local ip-address when localhost works just fine and a MacOSX

Can access AppEngine SDK sites via local ip-address when localhost works just fine and a MacOSX using the GoogleAppEngineLauncher.
I'm trying to setup facebook development site (using a dyndns.org hostname pointing at my firewall which redirects the call to my mac book).
It seems like GoogleAppEngineLauncher defaults to localhost and blocks access to the ip-address directly.
Is there a way to change that behaviour in GoogleAppEngineLauncher?
Is this some kind of limitation built in by Google?
It doesn't seem to be an issue of configuration, because there isn't any settings for this.
So I'm guessing patching the source will be required?
As per the latest documentation -a wont work anymore.
This is possible by passing --host argument with dev_appserver.py command
dev_appserver --host=<your_ip_address> <your_app>
--host=
The host address to use for the server. You may need to set this to be able to access the development server from another computer on your network. An address of 0.0.0.0 allows both localhost access and hostname access. Default is localhost.
if you want to access development server using localhost & ip address, use this command:
dev_appserver.py --host=0.0.0.0 <your_app>
For the eclipse (PyDev) users, Right-click on your project Run As > Run Configurations...
In the Arguments Tab, add the -a and -p arguments:
-a 0.0.0.0 -p 80 "${workspace_loc:project}"
This is possible by passing the -a argument to dev_appserver.py, i.e. dev_appserver.py -a <your-ip> <your_app>. See also this article on using public IP addresses with the Google App Engine SDK.
Per the docs, it's technically possible:
--address=...
The host address to use for the
server. You may need to set this to be
able to access the development server
from another computer on your network.
An address of 0.0.0.0 allows both
localhost access and hostname access.
Default is localhost.
However, it may be risky: dev_appserver is strictly focused on development, not hardened in terms of security against the attacks you might be subject to if you serve on the open net. To deploy App Engine apps on your own server(s) (or Amazon, etc), you might be better off with alternative, open-source third-party solutions like appscale or typhoonae!
In Android Studio with Google App Engine plugin.
Just add httpAddress = '0.0.0.0' to app cfg in build.grade file.

Categories