Skip to content
This repository has been archived by the owner on Jun 21, 2018. It is now read-only.

oracle_sso function can't connect from behind proxy #40

Open
cliffano opened this issue Nov 6, 2017 · 15 comments
Open

oracle_sso function can't connect from behind proxy #40

cliffano opened this issue Nov 6, 2017 · 15 comments
Assignees
Labels

Comments

@cliffano
Copy link

cliffano commented Nov 6, 2017

Could you please confirm whether oracle_sso function works behind a proxy?

I have tried setting up both
a) environment variables proxy setting (http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY, no_proxy, and NO_PROXY)
b) oracle_java's proxy_server attribute
but I kept getting connection error to download.oracle.com

I could only get it working by explicitly passing the proxy details to Net::HTTP.start:

response = Net::HTTP.start(uri.host, uri.port, <proxy_host>, <proxy_port>, :use_ssl => uri.scheme == 'https') do |http|

Would you expect the above to be necessary? Or should it use environment variables?
I understand that Net::HTTP should inherit the environment variables, but it didn't work.

Using ruby-2.2 with oracle_java 2.9.1 .

@antoineco
Copy link
Owner

Proxy parameters should be handled by the function but they're currently not (see referenced issue). As an interim solution I would have expected the environment variables to work though. Are you sure these were set in the context of your puppet run? Are you running in agent/server mode?

Regarding the broader connection issues, Oracle had the wonderful idea to change their SSO service 2 weeks after I pushed v2.9, effectively breaking my module. It looks like they keep changing the way it works regularly, so I'm waiting for some stability before drafting a patch version.

@antoineco antoineco self-assigned this Nov 6, 2017
@antoineco antoineco added the bug label Nov 6, 2017
@cliffano
Copy link
Author

cliffano commented Nov 7, 2017

Yes, I debugged all ENV's http_proxy, HTTP_PROXY, https_proxy, and HTTPS_PROXY right before the line with response = Net::HTTP.start . Confirmed that the values are set correctly.

I was running Puppet masterless. Not agent/server mode.

My initial expectation from reading the documentation of oracle_java, I was hoping that the env vars proxy to be honoured as a fallback, and only overwritten if proxy_server attribute is set.
If proxy_server is set to empty, then it should enforce proxy to never be used.
If proxy_server is set to undef, then fallback to env vars if set.

That Oracle SSO service change is a pain, thanks very much for your work with oracle_java.
I'll be happy to help testing the proxy bug fix.

@antoineco
Copy link
Owner

You're absolutely right, I neglected the proxy parameters when I wrote the feature because of the sense of urgency (users of my module were pretty much stuck because of Oracle's SSO), and I use a transparent proxy myself so I didn't see that issue.

It's a easy fix, I'll try to push it this week. In the meantime I recommend using v2.8.3.

@cliffano
Copy link
Author

cliffano commented Nov 7, 2017

Oracle sure doesn't make it easy for the users :).

Btw, I tried v2.8.3 and I got this error Unreleased Java SE version 8u151. Pretty sure this is the same issue that happened after Oracle changed JDK download process, and the reason why I upgraded to v2.9.x .

@antoineco
Copy link
Owner

Ah, yes if you absolutely want that version on v2.8 you'll have to pass the checksum and URL manually via parameters. If not, you'll get 8u144 by default.

@cliffano
Copy link
Author

cliffano commented Nov 7, 2017

I'm happy to downgrade for the time being :).

cliffano added a commit to shinesolutions/puppet-aem-curator that referenced this issue Nov 7, 2017
@tomashejatko
Copy link

Hello, do we know workaround pls?
I cannot use older version, because it looks that older versions of Java are not available anymore :
Error: Execution of '/usr/bin/curl http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jre-8u144-linux-x64.tar.gz -o /tmp/jre-8u144-linux-x64.tar.gz_e3808f24d0f588b0c313fa18b50683c620171205-26143-n07uyb -fsSL --max-redirs 5 --cookie oraclelicense=accept-securebackup-cookie --proxy http://proxy.xxx:3128' returned 22: curl: (22) The requested URL returned error: 404 Not Found Error: /Stage[main]/Oracle_java::Download/Archive[/usr/java/jre-8u144-linux-x64.tar.gz]/ensure: change from absent to present failed: Execution of '/usr/bin/curl http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jre-8u144-linux-x64.tar.gz -o /tmp/jre-8u144-linux-x64.tar.gz_e3808f24d0f588b0c313fa18b50683c620171205-26143-n07uyb -fsSL --max-redirs 5 --cookie oraclelicense=accept-securebackup-cookie --proxy http://proxy.xxx:3128' returned 22: curl: (22) The requested URL returned error: 404 Not Found N
And when I go with master branch, there is proxy problem :
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, Connection refused - connect(2) at /etc/puppet/environments/development/modules/oracle_java/manifests/download.pp:33:17 on node mon2.xxx

@antoineco
Copy link
Owner

@arteal can you try the branch mentioned above?

@tomashejatko
Copy link

I'm using current HEAD, my Puppetfile :

mod 'aco-oracle_java',
:git => 'https://github.com/antoineco/aco-oracle_java.git',
:ref => 'cb5c29cfe9c41978d86fa0116494f9d36818cc3c'

And I use proxy_server parameter :

class { 'oracle_java':
version => '8u151',
type => 'jre',
add_alternative => true,
proxy_server => "http://${proxy}"
}

It works only if my puppet master can reach internet

@antoineco
Copy link
Owner

Your current HEAD is the master branch, not the sso-proxy branch.

@tomashejatko
Copy link

Ah, I'm really sorry, I've missed that. Now I am on sso-proxy branch, but unfortunately it is still not working for me :( I have pulled right version, merged that from development to production environment, restarted puppet master, but I still got :

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, Connection refused - connect(2) at /etc/puppet/environments/development/modules/oracle_java/manifests/download.pp:33:17 on node mon2.xxx

@wysockip
Copy link

Hi @antoineco
By any change can I get some update how to get this stuff working? (proxy + sso). Which version i should use?

@antoineco
Copy link
Owner

@wysockip this feature has not been released but you can try to checkout the sso-proxy git branch. If this works fine for you I can include it in the next release, I just need testers since I don't have a proxy server at hand.

@wysockip
Copy link

wysockip commented May 23, 2018

so i have this part in my agent.pp:

class { 'oracle_java':
format => 'tar.gz',
install_path => '/usr/java',
ssousername => 'mymail',
ssopassword => 'mypass',
type => 'jdk',
check_checksum => false,
version => '8u161',
build => '-b12',
urlcode => '/2f38c3b165be4555a1fa6e98c45e0808'
proxy_server => 'http://10.10.10.10:12345'
}

and it's giving me:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Connection refused - Connection refused at ..path../download.pp:33:17

Should i put the proxy_server in the config or it will take the $http_proxy value from the environment variables automatically?

btw proxy is OK, as i used it for curls, wget's etc and working fine

@tomashejatko
Copy link

I have set it up in code, even in ENV vars, but still not working for me - same error as @wysockip

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants