-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
puppet_helper.groovy uses deprecated remoting mode #749
Comments
This is true for Jenkins >= 2.54 and Jenkins LTS >= 2.46.2 See:
Note: Calling the groovy helper like this works. I don't see the difference:
I have a working prototype with SSH |
Thanks @elconas. Would be interested ti see your PR :) |
The pull request is work in progress. Right now everything looks good, however I need to fix the xtypes to be jenkins version aware. I could use something like this in the provider that should work with all packages and plattforms.
Also we need to add explicit cli_remoting option to the x_types to provide heuristics + explicit settings for the new CLI. However fixing the x_types is kind of difficult. If someone (@oc243) can jump in to fix it based on the puppet code in the pull request, thanks. |
It seems the native types and providers can not easily be ported, as all data is supplied via stdin (user config via json), making it impossible to provide the helper script via stdin, which is a requirement to avoid remoing (See https://github.com/jenkinsci/jenkins/blob/729016989e13632bc980957d05060510efddf41f/core/src/main/java/hudson/cli/GroovyCommand.java#L97-L100) So all native types need to be refactored, to supply the data via cmdline as argument to the command (e.g. groovy = update_user '...json_data_..') with proper escaping. This involves editing the puppet_helper.groovy (expects data from stdin) as well as all native types. :( |
I personally think it is time for a rewrite of rtyler/jenkins based on native types and providers ONLY and for jenkins 2.46.2 and 2.54 onward (new major version), using the remoting free cli and supporting -auth @file as authentication, as this would enable the module to configure matrix security, active directory and LDAP integration (cli authenticating via username password and with SSH Key) and everything that is missing now. Then all legacy code could be thrown away. This could then also be a Puppet4 only rewrite with fixes for puppetserver using all the nice iterations and such ... |
It sounds like there's little reason to keep using the cli jar. It should be possible to replace the cli based providers with something that uses the |
I found that a valid workaround (as long as CLI and Jenkins are running on the same machine) is to write the puppet_helper.groovy json data to the temporary file instead of stdin (already happening), make it readbale by jenkins and provide the filename as command line parameter transparently. This avoids printing the json data on ps ax output (including credentials, which may be a security risk) and makes groovy work with latest Jenkins non remoting CLI, also with username and password, which allows to AD and LDAP usage (which we do) |
Great job |
Nice Job, but how is this supposed to work now?
on a fresh installation will result in:
Can you add more documentation? |
@stefanandres Hi, unfortunately this never worked with this module since jenkins 2.0 is released, as all cli commands fail for Jenkins 2.0. This is due to "secure by default", which means prior to Jenkins 2.0 jenkins was "unsecure" by default. Since 2.0 it is "full_control" per default. Howevber how can puppet use the CLI to create users if there is no bootstrapping user. We solved this by using https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Jenkins+upon+start+up and creating a init script that creates the bootstrapping user during startup. This is all in a provate module, "wrapping" rtyler/jenkins. |
I rather seems the new installation without jenkins::security was in unauthentiated mode (when I used http://...:8080 I could do anything without logging in). After executing jenkins::security with full_control, it prompts me to create an initial user, but the CLI will fail (as you explained). |
@stefanandres I prepared an extended version of the pull request, adding Jenkins 2.0 bootstrapping user support (See #761). Maybe you can try this one (please see README.md in this branch for how to setup bootstrap user). @jhoblitt How to proceed. Is there anything needed from your side for this pull request to be approved ? |
Okay - the #761 fix seems to work:
|
@stefanandres Nice, Great, Thanks. I also try to fix the spec. |
Okay, I won't be able to use this pull request though. When creating a bootstrap user it just wipes my securityrealm.ldap configuration from config.xml after a jenkins restart. So the entire design of creating a local user for using remote-cli won't work when using external users. :/ |
@stefanandres bootstrap users are only needed for local authentication mode (full_access). If you have AD / LDAP, you can use cli_username and cli_password without the bootstrap users. |
@elconas Thanks, but alas the module still deploys a puppet.bootstrapping.groovy file which leads to the ldap configuration being wiped upon restart. This is the configuration I used
(ldap came from augeas) When removing the puppet.bootstrapping.groovy file before the restart (gotta be quick for this), jenkins will load fine with LDAP and even the remote CLI is working with the cli_username, cli_password. |
@stefanandres I fixed the code. puppet.bootstrapping.groovy is now only created if bootstrap users is not empty. This should work with your ldap setting now. |
Really appreciate your effort! Which branch is the current one that has all the fixes? https://github.com/elconas/puppet-jenkins/commits/fix_749_withbootstrapuser doesn't seem to have changes since a few days ;-) |
Yes this one https://github.com/elconas/puppet-jenkins/tree/fix_749_withbootstrapuser, I always rebase and push --force :) |
Ah, okay - yep, this doesn't create the bootstrap file any longer now when no user is defined |
Thank you for this! we need this with our LDAP config as well (managed via Augeas) - will be testing this out extensively, and will give feedback |
After upgrading to the recent apt-4.1.0, the branch no longer works:
Can you make this compatible? |
FYI prefixing groovy with -remoting may provide a workaround.
|
My puppet config uses the bootstrap script as described in [0]. However, it appears to have been broken by the deprecation of remoting mode [1]. When puppet runs I now get:
It looks as if we now need to use the ssh or http authentication methods in the
create_or_update_user
function ofpuppet_helper.groovy
.[0] https://github.com/jenkinsci/puppet-jenkins#cli-helper
[1] jenkinsci/jenkins#2795
The text was updated successfully, but these errors were encountered: