GitHub Windows client behind proxy - github
I'm trying to get the GitHub client for Windows working. I am on a corporate Win 7 x64 computer behind a corporate proxy and firewall. Following various other posts and experimenting with multiple combinations of environment variables and config variables I have found the only way to get cloning and push updates to work is by using the HTTPS_PROXY environment variable, including my full corporate domain user ID and password.
This is unacceptable from a security standpoint. Is there any other way to get this to work?
Additional notes:
The following worked:
Add an environment variable called HTTPS_PROXY with the value http://[domain]\[userid]:[password]#someproxy.mycorp.com:8080
The following did not work:
Omitting user id and password from HTTPS_PROXY variable
Using an environment variable called HTTP_PROXY (no S)
Adding the http.proxy variable to the global config file (.gitconfig)
Adding the https.proxy variable to the global config file
In all cases, the GitHub client still does not recognize the proxy: The content of the file TheLog.txt always shows the following on startup:
[time]|INFO|thread:4|GitHub.Helpers.StartupLogger|Proxy information: (None)
[time]|INFO|thread:4|GitHub.Helpers.StartupLogger|Couldn't fetch creds for proxy
And is followed by the output of several failed proxy authentication attempts, all of which indicate "Credentials are missing."
Add these entries to your '.gitconfig' file in your user directory (go to %USERPROFILE%):
[http]
proxy = http://<proxy address>:<proxy port>
[https]
proxy = https://<proxy address>:<proxy port>
And if you don't want to store your password in plaintext, I would use a local proxy forwarder like CNTLM which allows you to direct all traffic through it and can store the passwords hashed.
Unlike the original question, if you don't care if your password is in plain text add these:
[http]
proxy = http://<username>:<password>#<proxy address>:<proxy port>
[https]
proxy = https://<username>:<password>#<proxy address>:<proxy port>
Tried everything of above - and didn't succeed, only thing that helped me is CNTLM - http://cntlm.sourceforge.net/.
Install it and run cntlm -H, than authenticate to corp proxy, edit cntlm.ini file with the output of cntlm, restart the windows service. Update .gitconfig with:
[https] proxy = localhost:3128
[http] proxy = localhost:3128
Now cntlm will do all the authentication, and you'll be able to use GitHub(and Dropbox, btw) behind the corp proxy. At least until next password change :) (than do cntlm -H stuff again)
I was able to make GitHub Shell to work with our corporate proxy. I'm starting GitHub Shell and execute following command:
export http_proxy=http://<username>:<password>#<corporate proxy>:3128
I would really like to make GUI to work too. But I don't want to set Windows global environment variable which contains my corporate credential information.
Strangely GitHub GUI Client is able to connect to GitHub for user authentication, but only problem is with cloning, pulling and pushing projects from and into GitHub. It seems like the problem is with git implementation. I was able to configure git to run through our proxy without putting my credentials in the git global settings and it was asking for my credentials while performing pull or push requests. But that was working only in Git Shell.
If you’re using GitHub for Windows in a corporate, chances are high that you’re behind a big bad Corporate Firewall/Proxy. GitHub for Windows doesn’t yet have the proxy parameters in its GUI for setting Options.
To configure GitHub for Windows to use your corporate proxy, edit the .gitconfig file typically found at C:\Users\.gitconfig or C:\Documents & Settings\.gitconfig
Close GitHub for Windows; In .gitconfig, just add
[https]
proxy = proxy.yourcompany.com:port
I've also run into this issue, and tried to dig into it a bit as well (disassembled the client).
The piece of code that generates the log messages we're seeing is as follows:
private static void LogProxyServerConfiguration()
{
WebProxy defaultProxy = WebProxy.GetDefaultProxy();
string str = defaultProxy.Address != (Uri)null ? defaultProxy.Address.ToString() : "(None)";
StartupLogger.log.Info((IFormatProvider)CultureInfo.InvariantCulture, "Proxy information: {0}", str);
try
{
if (defaultProxy.Credentials == null)
{
StartupLogger.log.Info((IFormatProvider)CultureInfo.InvariantCulture, "Couldn't fetch creds for proxy", new object[0]);
}
else
{
NetworkCredential credential = defaultProxy.Credentials.GetCredential(GitHubClient.GitHubDotComUri, "Basic");
StartupLogger.log.Info((IFormatProvider)CultureInfo.InvariantCulture, "Proxy is authenticated: {0}", credential != null && !string.IsNullOrWhiteSpace(credential.UserName));
}
}
catch (Exception ex)
{
StartupLogger.log.InfoException("Couldn't fetch creds for proxy", ex);
}
}
So this block only logs the proxy information that's setup in IE. The log message appears to have no bearing on what we have setup in the config files or environmental variables.
i dont know about your firewall, but my campus use proxy
do you use any git gui? EDIT : just noticed that you're using github client for windows
i am using tortoisegit and its very easy to set the proxy. Just right click anywhere, tortoisegit>network, enable proxy server and set server address, username, and password. done
as far as i remember, tortoisegit will also works out-of-the-box with github.
Here is the way to set proxy in github
git config --global http.proxy http://<username>:<pass>#<ip>:<port>
git config --global https.proxy http://<username>:<pass>#<ip>:<port>
Here in my college we don't have username and password, so if our college
ip is 172.16.10.10 and
port is 8080
git config --global http.proxy http://172.16.10.10:8080
git config --global https.proxy http://172.16.10.10:8080
P.S -> I would recommend using this method to set proxy as things will fall into place as you will learn further
Source
I found this blog to be useful. It describes ntlmaps proxy. It's probably less secure, but worked smoothly. I couldn't get cntlm working.
For us, the solution involved two different things. First, as described in Sogger's answer, you need to add the entries to your .gitconfig file, located in %USERPROFILE%.
[http]
proxy = http://<proxy address>:<proxy port>
[https]
proxy = https://<proxy address>:<proxy port>
Second, (and this was the missing piece for us,) you need to configure an exception on the proxy server to allow non-authenticated proxy traffic to *.github.com
In iPrism, it looks like this:
The problem is not so much the proxy, but the authentication. Bypassing the authentication requirement allows the needed communication to clone and work with projects using the GitHub desktop client.
Also note that this approach did not require storing proxy credentials in the .gitconfig file.
In case you need to force Git or GitHub client to bypass the proxy (use the direct connection), just set the proxy URI in the .gitconfig to an empty string. You'll probably have to edit the file manually, I didn't manage to persuade the git config command to set the value of a configuration directive to an empty string (tried git config --global http.proxy "").
So just add the following lines to the ~/.gitconfig:
[http]
proxy = ""
[https]
proxy = ""
Related
keycloak Invalid parameter: redirect_uri
When I am trying to hit from my api to authenticate user from keycloak, but its giving me error Invalid parameter: redirect_uri on keycloak page. I have created my own realm apart from master. keycloak is running on http. Please help me.
What worked for me was adding wildchar '*'. Although for production builds, I am going to be more specific with the value of this field. But for dev purposes you can do this. Setting available under, keycloak admin console -> Realm_Name -> Cients -> Client_Name. EDIT: DO NOT DO THIS IN PRODUCTION. Doing so creates a large security flaw.
If you are a .Net Devloper Please Check below Configurations keycloakAuthentication options class set CallbackPath = RedirectUri,//this Property needs to be set other wise it will show invalid redirecturi error I faced the same error. In my case, the issue was with Valid Redirect URIs was not correct. So these are the steps I followed. First login to keycloack as an admin user. Then Select your realm(maybe you will auto-direct to the realm). Then you will see below screen Select Clients from left panel. Then select relevant client which you configured for your app. By default, you will be Setting tab, if not select it. My app was running on port 3000, so my correct setting is like below. let say you have an app runs on localhost:3000, so your setting should be like this
If you're getting this error because of a new realm you created You can directly change the URL in the URL bar to get past this error. In the URL that you are redirected to (you may have to look in Chrome dev tools for this URL), change the realm from master to the one you just created, and if you are not using https, then make sure the redirect_uri is also using http. If you're getting this error because you're trying to setup Keycloak on a public facing domain (not localhost) Step 1) Follow this documentation to setup a MySql database (link's broken. If you find some good alternative documentation that works for you, feel free to update this link and remove this message). You may also need to refer to this documentation. Step 2) Run the command update REALM set ssl_required = 'NONE' where id = 'master'; Note: At this point, you should technically be able to login, but version 4.0 of Keycloak is using https for the redirect uri even though we just turned off https support. Until Keycloak fixes this, we can get around this with a reverse proxy. A reverse proxy is something we will want to use anyhow to easily create SSL/TLS certificates without having to worry about Java keystores. Note 2: After writing these instructions, Keycloak come out with their own proxy. They then stopped supporting it and recommended using oauth2 proxy instead. It is lacking some features the Keycloak proxy had, and an unoffical version of that proxy is still being maintained here. I haven't tried using either of these proxies, but at this point, you might want to stop following my directions and use one of those instead. Step 3) Install Apache. We will use Apache as a reverse proxy (I tried NGINX, but NGINX had some limitations that got in the way). See yum installing Apache (CentOs 7), and apt-get install Apache (Ubuntu 16), or find instructions for your specific distro. Step 4) Run Apache Use sudo systemctl start httpd (CentOs) or sudo systemctl start apache2 (Ubuntu) Use sudo systemctl status httpd (CentOs) or sudo systemctl status apache2 (Ubuntu) to check if Apache is running. If you see in green text the words active (running) or if the last entry reads Started The Apache HTTP Server. then you're good. Step 5) We will establish a SSL connection with the reverse proxy, and then the reverse proxy will communicate to keyCloak over http. Because this http communication is happening on the same machine, you're still secure. We can use Certbot to setup auto-renewing certificates. If this type of encryption is not good enough, and your security policy requires end-to-end encryption, you will have to figure out how to setup SSL through WildFly, instead of using a reverse proxy. Note: I was never actually able to get https to work properly with the admin portal. Perhaps this may have just been a bug in the beta version of Keycloak 4.0 that I'm using. You're suppose to be able to set the SSL level to only require it for external requests, but this did not seem to work, which is why we set https to none in step #2. From here on we will continue to use http over an SSH tunnel to manage the admin settings. Step 6) Whenever you try to visit the site via https, you will trigger an HSTS policy which will auto-force http requests to redirect to https. Follow these instructions to clear the HSTS rule from Chrome, and then for the time being, do not visit the https version of the site again. Step 7) Configure Apache. Add the virtual host config in the code block below. If you've never done this, then the first thing you'll need to do is figure out where to add this config file. On RHEL and some other distros you'll need to find where your httpd.conf or apache2.conf file is located. That config file should be loading virtual host config files from another folder such as conf.d. If you are using Ubuntu or Debian, your config files will be located in /etc/apache2/sites-available/ and you'll have an extra step of needing to enable them by running the command sudo a2ensite name-of-your-conf-file.conf. That'll create a symlink in /etc/apache2/sites-enabled/ which is where Apache looks for config files on Ubuntu/Debian (and remember the config file was placed in sites-available, slightly different). All distros Once you've found the config files, change out, or add, the following virtual host entries in your config files. Make sure you don't override the already present SSL options that where generated by certbot. When done, your config file should look something like this. <VirtualHost *:80> RewriteEngine on #change https redirect_uri parameters to http RewriteCond %{request_uri}\?%{query_string} ^(.*)redirect_uri=https(.*)$ RewriteRule . %1redirect_uri=http%2 [NE,R=302] #uncomment to force https #does not currently work #RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} #forward the requests on to keycloak ProxyPreserveHost On ProxyPass / http://127.0.0.1:8080/ ProxyPassReverse / http://127.0.0.1:8080/ </VirtualHost> <IfModule mod_ssl.c> <VirtualHost *:443> RewriteEngine on #Disable HSTS Header set Strict-Transport-Security "max-age=0; includeSubDomains;" env=HTTPS #change https redirect_uri parameters to http RewriteCond %{request_uri}\?%{query_string} ^(.*)redirect_uri=https(.*)$ RewriteRule . %1redirect_uri=http%2 [NE,R=302] #forward the requests on to keycloak ProxyPreserveHost On ProxyPass / http://127.0.0.1:8080/ ProxyPassReverse / http://127.0.0.1:8080/ #Leave the items added by certbot alone #There should be a ServerName option #And a bunch of options to configure the location of the SSL cert files #Along with an option to include an additional config file </VirtualHost> </IfModule> Step 8) Restart Apache. Use sudo systemctl restart httpd (CentOs) or sudo systemctl restart apache2 (Ubuntu). Step 9) Before you have a chance to try to login to the server, since we told Keycloak to use http, we need to setup another method of connecting securely. This can be done by either installing a VPN service on the keycloak server, or by using SOCKS. I used a SOCKS proxy. In order to do this, you'll first need to setup dynamic port forwarding. ssh -N -D 9905 user#example.com Or set it up via Putty. All traffic sent to port 9905 will now be securely routed through an SSH tunnel to your server. Make sure you whitelist port 9905 on your server's firewall. Once you have dynamic port forwarding setup, you will need to setup your browser to use a SOCKS proxy on port 9905. Instructions here. Step 10) You should now be able to login to the Keycloak admin portal. To connect to the website go to http://127.0.0.1, and the SOCKS proxy will take you to the admin console. Make sure you turn off the SOCKS proxy when you're done as it does utilize your server's resources, and will result in a slower internet speed for you if kept on. Step 11) Don't ask me how long it took me to figure all of this out.
IMPORTANT UPDATE IN KEYCLOAK 18 In the newest keycloak 18, they have deprecated the redirect_uri variable for the openid connect logout -> https://www.keycloak.org/docs/latest/upgrading/index.html#openid-connect-logout
Go to keycloak admin console > SpringBootKeycloak> Cients>login-app page. Here in valid-redirect uris section add http://localhost:8080/sso/login This will help resolve indirect-uri problem
For me, I had a missing trailing slash / in the value for Valid Redirect URIs
[For Keycloak version 18 or Higher] None of the mentioned solutions should be working if you are using Keycloak 18 or a higher version. According to the version 18 release note. Keycloak does not support logout with redirect_uri anymore. you need to include post_logout_redirect_uri and id_token_hint as parameters. Please check the answer of this question for more information. keycloak: using react user can login but when I try logout I get a message "Invalid parameter: redirect_uri"
Log in the Keycloak admin console website, select the realm and its client, then make sure all URIs of the client are prefixed with the protocol, that is, with http:// for example. An example would be http://localhost:8082/* Another way to solve the issue, is to view the Keycloak server console output, locate the line stating the request was refused, copy from it the redirect_uri displayed value and paste it in the * Valid Redirect URIs field of the client in the Keycloak admin console website. The requested URI is then one of the acceptables.
If you're seeing this problem after you've made a modification to the Keycloak context path, you'll need to make an additional change to a redirect url setting: Change <web-context>yourchange/auth</web-context> back to <web-context>auth</web-context> in standalone.xml Restart Keycloak and navigate to the login page (/auth/admin) Log in and select the "Master" realm Select "Clients" from the side menu Select the "security-admin-console" client from the list that appears Change the "Valid Redirect URIs" from /auth/admin/master/console/* to /yourchange/auth/admin/master/console/* Save and sign out. You'll again see the "Invalid redirect url" message after signing out. Now, put in your original change <web-context>yourchange/auth</web-context> in standalone.xml Restart Keycloak and navigate to the login page (which is now /yourchange/auth/admin) Log in and enjoy
I faced the same issue. I rectified it by going to the particular client under the realm respectively therein redirect URL add * after your complete URL.
I had the same problem with "localhost" in the redirect URL. Change to 127.0.0.1 in the "Valid Redirect URIs" field of clients config (KeyCloak web admin console). It works for me.
It seems that this problem can occur if you put whitespace in your Realm name. I had name set to Debugging Realm and I got this error. When I changed to DebuggingRealm it worked. You can still have whitespace in the display name. Odd that keycloak doesn't check for this on admin input.
even I faced the same issue. I rectified it by going to the particular client under the realm respectively therein redirect URL add * after your complete URL. THE PROBLEM WILL BE SOLVED Example: redirect URI: http:localhost:3000/myapp/generator/*
Looking at the exact rewrite was key for me. the wellKnownUrl lookup was returning "http://127.0.01:7070/" and I had specified "http://localhost:7070" ;-)
I faced the Invalid parameter: redirect_uri problem problem while following spring boot and keycloak example available at http://www.baeldung.com/spring-boot-keycloak. when adding the client from the keycloak server we have to provide the redirect URI for that client so that keycloak server can perform the redirection. When I faced the same error multiple times, I followed copying correct URL from keycloak server console and provided in the valid Redirect URIs space and it worked fine!
This error is also thrown when your User does not have the expected Role delegated in User definition(Set role for the Realm in drop down).
Your redirect URI in your code(keycloak.init) should be the same as the redirect URI set on Keycloak server (client -> Valid Uri)
Ran into this problem too. After two days of pulling my hair out I discovered that the URLs in Keycloak are case sensitive. However the browser coverts the URL to lowercase, which means that uppercase URLs in Keycloak will never work. e.g. my server name is MYSERVER (hostname returns MYSERVER) Keycloak URLs are https://MYSERVER:8080/* Browse to https://myserver:8080 -> fails invalid_url Browse to https://MYSERVER:8080 -> fails invalid_url Change Keycloak URLs to https://myserver:8080/* Browse to https://myserver:8080 -> works Browse to https://MYSERVER:8080 -> works
We also saw this, but only on certain URLs. After seeing this clue, I realized that the Java URI constructor has to be able to decode it, like so URI uri = URI.create(redirectUri); We had a { and } in our URLs which normally worked fine, but when going through two layers of URL decode/encode, Java decided the { and } were invalid. We'll be changing our curly braces to something else to get around the double encode/decode issue.
I know other people provided the same answer, but my reputation was not high enough to upvote them. In the redirect menu, Mine had a redirect of " 0.0.0.0:8080/* ". I added (actualIP) followed by :8080/* and it worked.
In your client, set the origin of your request. In my case, localhost:3000 (javaScript client)
If you are using the Authorization Code Flow then the response_type query param must be equal to code. See https://www.keycloak.org/docs/3.3/server_admin/topics/sso-protocols/oidc.html
You need to check the keycloak admin console for fronted configuration. It must be wrongly configured for redirect url and web origins.
If you're trying to redirect to the keycloak login page after logout (as I was), that is not allowed by default but also needs to be configured in the "Valid Redirect URIs" setting in the admin console of your client.
Check that the value of the redirect_uri parameter is whitelisted for the client that you are using. You can manage the configuration of the client via the admin console. The redirect uri should match exactly with one of the whitelisted redirect uri's, or you can use a wildcard at the end of the uri you want to whitelist. See: https://www.keycloak.org/docs/latest/server_admin/#_clients Note that using wildcards to whitelist redirect uri's is allowed by Keycloak, but is actually a violation of the OpenId Connect specification. See the discussion on this at https://lists.jboss.org/pipermail/keycloak-dev/2018-December/011440.html
My issue was caused by the wrong client_id (OPENID_CLIENT_ID) I had defined in the deployment.yaml. Make sure this field is assigned with the one in Keycloak client id.
The problem seems related to an invalid value in Valid Redirect URIs field. You can try with one of these tips: set the same value of Client ID (if it's a URL) making it end with /* , or tryingToLearn 's reponse [https://stackoverflow.com/a/51420355/97799] (but beware of security issues).
I into this due to a malformed redirect url in the keycloak client: https://http://192.168.1.10/hub/oauth_callback As soon as I took out https:// the error
I'm using version 20.0.2 and, for me, the solution was to simply add a '+' in the "Valid post logout redirect URIs" field: As stated in the help balloon, "A value of '+' will use the list of valid redirect uris".
I faced a similar issue because I create a realm with two words and had a space on it. eg Test Realm, this gave me this error. I put an underscore and was good to go eg, Test_Realm.
How to configure GIT HTTPS client certificate authentication in Eclipse using EGit?
I set up a GIT server (Gitblit) that uses HTTPS client authentication. I have a working configuration and key material with the standard GIT client on Linux (Debian). Until now I didn't figure out how to correctly configure: The standard GIT client (command line, v1.9.5) on Windows (Win7 64) Eclipse (Luna) with EGit.
For Windows 7, I successfully used these parameters: [http "https://git.repository.net"] proxy = proxy.to.use:1234 sslCert = "C:/Path/to/mycert.crt" sslKey = "C:/Path/to/mycert.key" sslVerify = true sslCertPasswordProtected = false Be sure to not forget the quotes, or you will run into trouble with forward slashes. I think git will also prompt you for the password, if you leave one on the key, but I'm not sure how well it can cache, and for me it got old quick to re-enter that password routinely. Regarding Eclipse: I can at least verify, that the current SimRel 2018-9 doesn't work with that .gitconfig, so I'm still looking for a way to make it work.
How to configure Mongodb MMS to go via a Proxy?
How to I change the monitoring-agent.config to go out via proxy with authentication? The change log states... Monitoring Agent 2.3.1.89-1 Released 2014-07-08 Added support for HTTP proxy configuration in the agent configuration file. But I can't see how to do this. Following wdberkeley's link I can add this value to the monitoring-agent.config file. httpProxy=http://"pxproxy01":3128 But this gives.. Failure getting conf. Op: Get Err: Proxy Authentication Required Is there anyway to set the authentication user/password ?
Edit file: C:\MMSData\Monitoring\monitoring-agent.config Add line... httpProxy=http://<insert_server_address>:<insert_port> e.g. httpProxy=http://PROXY01.server.com:3128 Then get the proxy control team, who ever they be, to exclude the following from requiring authentication. https://mms.mongodb.com 80 https://mms.mongodb.com 443 This has worked for me. I now have the MMS Agent on Windows sending stat's to the MMS service. Thanks to #wdberkeley for starting me off on this route. wdberkeley, the page you linked to does not exist & the classic page PDF & HTTP versions state 'HTTP_PROXY' not 'httpproxy' (on OSx section & tar.gz section), section '6.6 Monitoring Agent Configuration' does state the correct property name 'httpproxy'.
Proxy URL 'incache....com:8080' does not contain a valid hostname
Recently I was forced to switch from SVN to TFS. I'm trying to get this working with TEE on our RedHat box. Any action seems to end with something like this: user#rh: tf -map $/XX/XX . -workspace:app-job -server:http://tfs.domain.com:8080/tfs/TFS2008/ -profile:TFS1_PRF_C Password: An error occurred: Proxy URL 'incache.domain.com:8080' does not contain a valid hostname. Could someone help with that?
Your question is a little vague about what you expect to happen here (are you supposed to be using an HTTP proxy to access your TFS server? Or is the problem that it's assuming your HTTP proxy?) I'm going to assume that you do not need to use an HTTP proxy to access your internal TFS server, since in most corporate environments your proxy is used to get outside the network, not inside. By default, the Team Explorer Everywhere CLC does try to use your system HTTP proxy, however this is configurable in your connection profile. In order to override your default system HTTP proxy for that profile, you can set the profile property httpProxyIgnoreGlobal to true: tf profile -edit -boolean:httpProxyIgnoreGlobal=true TFS1_PRF_C
"RA layer request failed" error with Subclipse, no errors with web browser
I'm using STS 2.8.1 (I think it's based on Eclipse Indigo) with Subclipse 1.6.18. I'm trying to check some code out from a repository, but when I add the repository location, I get the following error: RA layer request failed svn: Server sent unexpected return value (503 Service Unavailable) in response to OPTIONS request for 'http://a.b.com:18080/svn/myproject' The thing is, if I try to access that repository from a web browser (e.g. Chrome or IE), I'm allowed to access it. It asks for my username and password, and after I enter them, I can see the project tree. Does anyone know why I can access from the web browser but not from STS? The proxy settings are configured correctly for Subclipse (and I can access other repositories from STS, but not that one).
This is usually due to an SVN setting (c:\Documents and Settings\_username_\Application Data\Subversion\servers or ~/.subversion/servers) overriding an Eclipse setting. Or one of those settings could have the wrong password for the proxy. However, the OP Neets reports: I'm able to connect to other repository locations (so the proxy password is correct) I solved it, adding the corresponding exception in the servers file, like this: http-proxy-exceptions = exception.com That is compliant with what describes the openDNS article Configuring Subversion to Use a Proxy Server: http-proxy-exceptions This specifies a set of repository addresses for which you don't need to access a proxy server. For example, if you have a repository on your local LAN, then you probably won't need a proxy to access it. This should be a comma-delimited list of servers, and you can use an asterisk as a wildcard. If all of the repositories that you will access require you to use a proxy server, then you can leave this out. The following shows a sample configuration that will use a proxy server to access all servers outside of the example.com domain: [global] http-proxy-exceptions = *.example.com http-proxy-host = proxy.example.com http-proxy-port = 8080 http-proxy-username = myuserid http-proxy-password = mypassword