CI/CD full automation on RHEL - Problems with jenkins configuration regarding security (user and password)

11 views
Skip to first unread message

leginox

unread,
Feb 13, 2020, 8:02:49 PM2/13/20
to Jenkins Users
Hi all,

I have a question regarding the setup of a full automated Jenkins configuration and I'm thankful for any help that you might have.

I created a Container with a RHEL via Docker on which I installed a jenkins which I'm running in a cloud environment.

I'm able to start the jenkins via java {java_opts} -jar /usr/lib/jenkins/jenkins.war {jenkins_oprts}.

My plan so far was to hand over the initianal password via curl/or python requests library via a post to the "enter initial password form". Therefore I'm opening a session, requesting a Jenkins-Crumb via another post (which successfully works) and then creating a post with authentication admin/initianalpassword as user/pw + crumb in the header. I'm getting a success, but if I try then to access jenkins manually I get asked to enter the initianal password again. I know that the form redirects me to another page where I need to deny that I want to install plugins (I have a script which is transferring the .hpi files automatically and which is working fine), but I'm not able to access this site via a get and I have no clue how to access this site.

Therefor I tried to use the java option -Djenkins.install.runSetupWizard=false when I'm calling the jenkins.war file. Now I'm actually on the the jenkins home page, but I'm not able to set a user and password from there via curl/requests.

I also tried to pass --argumentsRealm.passwd.$ADMIN_USER and --argumentsRealm.roles.$ADMIN_USER=admin, but it did not work.

I also played around with the config.xml by enabling/disabling certain things inside.

Last but not least I tried also to set the jenkins env user and pw on the rhel directly via the deploy.yaml, but jenkins did not pick them up while starting.


I'm very new to all this and went through a lot of trial and error and I would appreciate if someone of you sees my mistake or if I'm on the complete wrong path to help me out.


Thank you so much in advance and I hope that I can come back with any help for other users in the future as well.

Best to you all
Leginox

Ivan Fernandez Calvo

unread,
Feb 14, 2020, 2:08:06 PM2/14/20
to Jenkins Users
Take a look to this article, I think it could help you https://www.praqma.com/stories/start-jenkins-config-as-code/

JonathanRRogers

unread,
Feb 14, 2020, 2:49:45 PM2/14/20
to Jenkins Users
On Thursday, February 13, 2020 at 8:02:49 PM UTC-5, leginox wrote:
Hi all,

I have a question regarding the setup of a full automated Jenkins configuration and I'm thankful for any help that you might have.

I created a Container with a RHEL via Docker on which I installed a jenkins which I'm running in a cloud environment.

Are you running Red Hat Enterprise Linux on a virtual machine managed by a service such as AWS or GCP? Is the Docker daemon running on a host system you control? Are you using an official Jenkins Docker image from https://hub.docker.com/r/jenkins/jenkins or did you create your own?


I'm able to start the jenkins via java {java_opts} -jar /usr/lib/jenkins/jenkins.war {jenkins_oprts}.

My plan so far was to hand over the initianal password via curl/or python requests library via a post to the "enter initial password form". Therefore I'm opening a session, requesting a Jenkins-Crumb via another post (which successfully works) and then creating a post with authentication admin/initianalpassword as user/pw + crumb in the header. I'm getting a success, but if I try then to access jenkins manually I get asked to enter the initianal password again. I know that the form redirects me to another page where I need to deny that I want to install plugins (I have a script which is transferring the .hpi files automatically and which is working fine), but I'm not able to access this site via a get and I have no clue how to access this site.

Therefor I tried to use the java option -Djenkins.install.runSetupWizard=false when I'm calling the jenkins.war file. Now I'm actually on the the jenkins home page, but I'm not able to set a user and password from there via curl/requests.

I also tried to pass --argumentsRealm.passwd.$ADMIN_USER and --argumentsRealm.roles.$ADMIN_USER=admin, but it did not work.

I also played around with the config.xml by enabling/disabling certain things inside.

Last but not least I tried also to set the jenkins env user and pw on the rhel directly via the deploy.yaml, but jenkins did not pick them up while starting.

What is the "rhel directory" and what is the purpose of "deploy.yaml"? I'm not aware of Jenkins itself interpreting any file called "deploy.yaml" but that is a common name for files representing Kubernetes objects. Are you attempting to deploy Jenkins via Kubernetes?
Reply all
Reply to author
Forward
0 new messages