Change Intellij HTTP proxy from command line - intellij-idea

According to our company policy we need to change password regularly, which means I have to update the proxy authentication password.
I have a script that solves all of this, except for the Intellij proxy setting.
Therefor, my question is: Is it possible to change Intellij IDEA's HTTP proxy setting from the command line?
The setting I'm refering to is Appearance & Behavior > System Settings > HTTP Proxy in Intellij.
I'm using IntelliJ IDEA 2016.2.4

No there is not. The password value is stored in the file .IntelliJIdea/config/options/proxy.settings.pwd but it is encrypted. Otherwise your script could modify it. You might be able to dig through the source code and see how the encryption works to see if you can replicate it in your script.

Related

Weblogic run configuration in IntelliJ idea - disable basic authentication

I need to disable basic auth on weblogic server, which can be done by adding <enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials> into config.xml in a weblogic domain.
I'm deploying a web service to weblogic directly from IntelliJ Idea and every time I start deploy, the config.xml is replaced by a new one, so I cannot change config manually. I guess I need to pass some extra arguments in IntelliJ's run configuration. Does anyone has any experiences with this?
It was my mistake. I tried to modify config.xml and forgot my server is still running. According to this page I think it's pretty obvious why this happens. So, it has nothing to do with IntelliJ Idea.
Caution: Do not edit configuration files for a domain that is
currently running. Because Oracle WebLogic Server rewrites the files
periodically, your changes will be lost. Depending on your platform,
you also could cause Oracle WebLogic Server failures.

Changing Mac System Proxy Settings In Command Line Tool Application

Is it possible to change proxy settings ( like what networksetup does ) in a command line tool app ? I mean I want to write a command line tool that can change network and proxy settings in mac.
If yes, Can anybody provide any source that I can go and search for starting points and learn about it ?
You can simply use NSTask to run networksetup with desired arguments. In order to do that you must include AppKit framework to your application. (But please note that you need root privilege to use networksetup in order to change proxy settings)

how to change OpenLDAP configuration ( slapd.conf ) programmatically

I need to make some configuration changes to slapd.conf. Changes are related to enabling SSL, enabling synch-replication etc.
For example, i need to add following block of configuration in slapd.conf to enable synch-replication over SSL :
TLSCACertificateFile /etc/openldap/cacerts/cacert.pem
TLSCertificateFile /etc/openldap/certs/servercrt.pem
TLSCertificateKeyFile /etc/openldap/certs/serverkey.pem
TLSVerifyClient never
Right now, I am trying to do this with shell script. Script will edit text in slapd.conf using sed, awk commands and some logic to place the text correctly in slapd.conf.
I don't think this is the best way to make configuration changes in slapd.conf.
Is there an API/commands for shell to do the same.
Please also suggest any java api for the same ?
I am using OpenLDAP.
Thanks in Advance.
If you used online configuration with the -F slapd.d option you could do it via an LDAP API.

Make Maven Proxy/Server settings configurable based on location?

So I'm not sure what the best way to accomplish this is, but basically I have a laptop that I use at work for Maven projects. It works fine when I'm at work, but as soon as I walk out of the door of their corporate proxy and maven server, I often have to do alot of hand-fudging of the settings.xml file when I'm at home if I'm not VPN'ed in:
We have a corporate-installed Maven Repository proxy server to store some of our own artifacts and handle being the middle-man for our commonly used artifacts.
We have an http proxy that we use for connecting to the outside world.
Both configurations have been handled by my settings.xml file for setting a single Nexus group and maven proxies. If I'm not connected to the VPN while away from the office, I have to muck around with the settings.xml each time I'm not on it, then switch it back when I am on it.
What solutions have anyone else found to handle this? I've been trying profiles to manage the proxy, but I can't seem to get it to work correctly, and it's starting to look pretty ugly. Are there some settings configurations that can detect when I'm not behind the proxy at work and not use the corporate proxy server or Maven server?
While I can think of some profile based solution to handle the proxy (basically, reading the <active> value from a property defined in a profile), this wouldn't be fully automated (the profile activation do not support network based stuff) unless you can find a file that is present or not depending on your location (in which case, you could use an existing/missing file trigger but this is kinda hacky). Anyway, this would solve only one part of the problem because mirrors can't be declared in profiles (see MNG-3525).
So, instead of trying to control this with a profile, my suggestion would be to use two settings.xml and to pass your settings-home.xml file with the -s command line option when you're at home.
Another option would be to automate the changes in your settings.xml with a script (Groovy would be a good choice as someone reported in MNG-3525).
I found a use environment variables to set nonProxyHosts together with proxy and noproxy shell aliases to be the most convenient solution when switching between networks with proxy and without it.
In settings.xml, configure proxy with
<host>proxy.corporation.int</host>
<port>8080</port>
<nonProxyHosts>${env.MAVEN_NONPROXY}</nonProxyHosts>
Then in ~/.profile set
export MAVEN_NONPROXY_PROXY='*.corporation.int|local.net|some.host.com'
export MAVEN_NONPROXY_NOPROXY='*'
alias proxy="export MAVEN_NONPROXY=\"$MAVEN_NONPROXY_PROXY\" && export all_proxy=http://proxy.corporation.int:8080"
alias noproxy="export MAVEN_NONPROXY=\"$MAVEN_NONPROXY_NOPROXY\" && unset all_proxy"
To do the switch when roaming, you would just execute from a shell:
[me#linuxbox me]$ proxy
or
[me#linuxbox me]$ noproxy
Obviously, both aliases proxy and noproxy can include much more changes than just setup of MAVEN_NOPROXY and all_proxy.
I was frustrated by the same problem: having to manually edit settings.xml when roaming between networks. So much in fact, that I wrote a Maven plugin that enables automatic discovery of proxy settings. The current implementation uses the proxy-vole library written by Bernd Rosstauscher to detect proxy settings based on OS configuration, browser, and environment settings.
I've just released the source code of the plugin on Github, under an Apache 2.0 license: https://github.com/volkertb/autoproxy-maven-plugin
You're welcome to give it a try and to see if it meets your needs. Any feedback or contributions are welcome!
(Note: you don't necessarily have to add the plugin to your project's POM. You can invoke it from the command line as well, after you've installed it. See the README on the site for more details.)
You can set MAVEN_OPTS when you need to activate a proxy:
export MAVEN_OPTS="-Dhttp.proxyHost=my-proxy-server -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts=*.my.org -Dhttps.proxyHost=my-proxy-server -Dhttps.proxyPort=80 -Dhttps.nonProxyHosts=*.my.org"

How do I use Bazaar with a HTTP proxy?

How do I use Bazaar with a HTTP proxy? I can't find anything in their documentation.
Set the http_proxy environment variable to point to your proxy, eg. (on Windows):
set http_proxy=http://webcache.mycompany.com:3128/
See the "Environment variables" section of http://bazaar-vcs.org/ConfiguringBzr
Also do not forget to set HTTPS_PROXY environment variable.
set https_proxy=http://my.proxy.com:3128/
I post this answer as a reference for those who may later visit this page.
If you still have trouble with proxy connection after trying all the other methods, try setting your proxy settings using dconf and gconf editors.
Note:
The settings that the latest programs are expected to use are the DConf settings but some old programs might still use GConf settings, so it is wise to set your proxy settings in both.
If not already installed, you can easily install dconf and gconf editors from synaptic or the package manager of your distribution.
Proxy Settings:
In your Conf dconf editor traverse to
system > proxy
There you should see the options for setting your ftp, http, https, socks proxy settings.
Note:
In case your proxy needs authentication, and your password contains special characters like# you would know by now (after painstaking searches), that you should replace your # with %40 (the HTML character encoding for #) while configuring your proxy settings, eg. in ~/.bashrc.
Do not follow this practice in the configuration editor. Type your password as it is.
Now, in case of gconf editor, the path to the proxy settings is same, but the options might be a bit different. But, I am sure you can make it out.