Skip to content
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

Added support for Unix Domain Sockets in Pomerium Reverse Proxy #7772

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

biru-codeastromer
Copy link
Contributor

Fixes #6893

Changes Made:

  • Updated documentation to include instructions for configuring Pomerium with Unix domain sockets.
  • Modified config.yaml and docker-compose.yaml in the documentation of unix domain sockets part to demonstrate the new configuration.

Testing Done:

1. Initial Setup:

  • Created and set up docker-compose.yaml with Jenkins and Pomerium configurations.
  • Completed the Jenkins Setup Wizard by accessing http://localhost:8080.

2. Pomerium Configuration:

  • Created config.yaml with placeholders for sensitive information.
  • Generated a signing key using OpenSSL and added it to the config.yaml.

3. Integration and Running Services:

  • Updated docker-compose.yaml to include Pomerium, linked with Jenkins using Unix domain sockets.
  • Restarted services and verified access to Jenkins at https://jenkins.localhost.pomerium.io.

4. JWT Authentication:

  • Installed JWT Auth and skip-certificate-check plugins in Jenkins.
  • Configured JWT authentication in Manage Jenkins > Configure Global Security.

5. Verification:

  • Verified JWT authentication by checking the user identity in the Jenkins dashboard.
  • Inspected JWT claims at https://verify.localhost.pomerium.io.

6. Authorization Testing:

  • Configured Jenkins authorization settings and verified permissions for different users.

7. Functionality Testing:

  • Triggered builds in Jenkins to ensure proper communication via Unix domain sockets.

Please review and provide feedback.

Additional note -

Removed the version field from docker-compose.yaml as it is no longer required with newer versions of Docker Compose and caused errors during local testing.

@biru-codeastromer biru-codeastromer requested a review from a team as a code owner December 21, 2024 11:11
@probot-autolabeler probot-autolabeler bot added the documentation Jenkins documentation, including user and developer docs, solution pages, etc. label Dec 21, 2024
@zbynek
Copy link
Contributor

zbynek commented Dec 21, 2024

@biru-codeastromer Are you sure the communication goes through unix sockets and not the 8080 TCP port? I'd expect unix:///run/jenkins/jenkins.socket to come up in the config instead of http://jenkins:8080, but I have no experience with Pomerium.

@cmo-pomerium could you please review this?

@biru-codeastromer
Copy link
Contributor Author

biru-codeastromer commented Dec 21, 2024

Thank you for your observation, @zbynek Sir!

I initially configured the route to use unix:///run/jenkins/jenkins.socket, as expected for Unix domain sockets. However, Pomerium returned the following error:

pomerium-1 -* error decoding 'routes[1]': unix:///run/jenkins/jenkins.socket: unix:///run/jenkins/jenkins.socket url does not contain a valid hostname

Due to this, I reverted to using http://jenkins:8080 as a fallback, which worked successfully for the integration. I suspect this might be a limitation or unsupported behavior in Pomerium when using Unix sockets.

If this fallback behavior is acceptable, I will document it explicitly in the PR. However, I would appreciate further input, especially from @cmo-pomerium, to confirm whether this is an expected limitation or if there's a recommended workaround to enable Unix domain socket communication.

Also Sir @kmartens27 may you please review and guide how to improve this .Thanks!
Looking forward to your feedback!

Copy link
Contributor

@kmartens27 kmartens27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks very much for the work here @biru-codeastromer. I have provided some feedback on documentation formatting/grammar/other areas, but also wanted to question whether there was any testing done on lts-jdk17. As Jenkins does not suppport Java 11, it would be better to utilize a supported LTS version within the code examples provided. If you have not had a chance to test on the latest LTS, I would suggest updating everything and running through the process to ensure that it would work on a current LTS. I recognize that there are other mentions of jdk11 on the page, but these will need to be updated as well (outside of this PR). If your tests work, the other areas of this page can be updated accordingly.

Please share if you have any questions on this!


Starting from Jenkins version 2.452.1 , Jenkins supports Unix domain sockets. This can be particularly useful for improving security and performance.

### Prerequisites
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Prerequisites
=== Prerequisites

Suggestion to use the same type of formatting as elsewhere on the page.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll update the header formatting for consistency with the rest of the document by changing it.

Comment on lines +308 to +310
### Configuration Steps

## 1. Update Pomerium Configuration :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Configuration Steps
## 1. Update Pomerium Configuration :
=== Configuration steps
==== Update you Pomerium configuration:

Adjust header formatting to match the rest of the page, remove number from step to match rest of the page formatting, ensure the step is a smaller heading size than the Configuration Steps header. Adjust to use sentence case for header.

If these are all steps to configure, they may not need their own headers. They can be listed under the configuration steps header with their respective order (1 -> 2 -> 3) or smaller headers if they have a bunch of information attached, but since steps 3 and 4 have only one sentence, using the steps as headers is unnecessary.

Copy link
Contributor Author

@biru-codeastromer biru-codeastromer Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Sir for the feedback. I’ll update the headers to be smaller and ensure they are consistent with the rest of the page, combining some of the steps to make the flow more natural.

is: username
```

## 2. Configure Jenkins :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 2. Configure Jenkins :
==== Configure Jenkins:

Adjusting formatting to be aligned with the rest of the page/site. Again, if these steps are all part of the Configuration Steps header, they do not need to be their own separate headings and could just be listed steps underneath "Configuration Steps".

- /var/run/jenkins:/var/run/jenkins
```

## 3. Restart Services :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 3. Restart Services :
==== Restart services:

Adjusting formatting and capitalization for sentence case.

This is very minimal content and would not need its own header section. This would fit better a listed step with the other steps underneath Configuration Steps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out. I will remove the header for "Restart Services" and integrate it into the rest of the steps under "Configuration Steps."

Comment on lines +393 to +395
### Verification

After restarting the services, verify that Jenkins is accessible through the Unix domain socket by navigating to your Jenkins URL (e.g., `https://jenkins.example.com`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Verification
After restarting the services, verify that Jenkins is accessible through the Unix domain socket by navigating to your Jenkins URL (e.g., `https://jenkins.example.com`).
==== Verification
After restarting the services, verify that Jenkins is accessible through the Unix domain socket by navigating to your Jenkins URL.

Same suggestion for the header as above, I would format these into a list of steps instead of multiple headers, especially with the last two not having enough content to justify such formatting.

In terms of the last part, avoid using e.g. when possible and if possible, the URL should be something used within the examples like https://jenkins.localhost.pomerium.io or http://jenkins:8080 based on the context.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure Sir!

jenkins:
networks:
main: {}
image: jenkins/jenkins:lts-jdk11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also be cautious to use lts-jdk11 as we do not support Java 11 any longer. If this documentation needs to be updated overall to use lts-jdk17 that can be a separate PR, but I would advise testing using a supported version.

@biru-codeastromer
Copy link
Contributor Author

biru-codeastromer commented Jan 6, 2025

thanks very much for the work here @biru-codeastromer. I have provided some feedback on documentation formatting/grammar/other areas, but also wanted to question whether there was any testing done on lts-jdk17. As Jenkins does not suppport Java 11, it would be better to utilize a supported LTS version within the code examples provided. If you have not had a chance to test on the latest LTS, I would suggest updating everything and running through the process to ensure that it would work on a current LTS. I recognize that there are other mentions of jdk11 on the page, but these will need to be updated as well (outside of this PR). If your tests work, the other areas of this page can be updated accordingly.

Please share if you have any questions on this!

Thank you very much @kmartens27 Sir for the detailed feedback and suggestions, and I appreciate the recognition for the work so far.

Regarding the testing with lts-jdk17, I haven't had a chance to test the setup with it yet. I agree that using a supported LTS version would be ideal, so I will update the configuration and run through the process with Java 17 LTS to ensure compatibility. I will also make sure to address the mentions of jdk11 on the page and update them accordingly.

Once I complete the tests and update the documentation, I will submit a follow-up to reflect those changes. If I encounter any issues or have questions, I will reach out for clarification.

Thanks again for your helpful input!

@kmartens27
Copy link
Contributor

Thanks very much @biru-codeastromer, I appreciate it and please let me know if there are any questions or concerns about anything I've shared.

@biru-codeastromer
Copy link
Contributor Author

Thank you so much for your detailed feedback and helpful suggestions @kmartens27 Sir. I’ve committed the smaller changes related to formatting, grammar, and other one-liner suggestions.

For the larger changes of suggested commits, I will work on them now and ensure all the suggestions are fully implemented.

Once I complete the tests and updates, I’ll keep you updated if any issues arise, and I appreciate your continued support.

Thanks again for your time and feedback!

@biru-codeastromer
Copy link
Contributor Author

Thanks very much @biru-codeastromer, I appreciate it and please let me know if there are any questions or concerns about anything I've shared.

Hi Sir,
I noticed that after the merge commit 5f512ca ([Merge branch 'master' into update-pomerium-docs]), one CI tests started failing : @infra-ci-jenkins-io jenkins/infra.ci.jenkins.io/website-jobs/jenkins.io/pr-merge has failed.

I’ve reviewed the changes, but I wasn’t able to identify the cause of the failure. Could you please help clarify why this might be happening? If there’s anything I can do to assist in debugging the issue, I’m happy to help.

Looking forward to your guidance.

Screenshot 2025-01-07 at 1 07 21 AM Screenshot 2025-01-07 at 1 07 29 AM

@kmartens27
Copy link
Contributor

Hi @biru-codeastromer, I'm not sure why that check is failing so I have asked in the jenkins-infra gitter channel. It seems to be something that has started happening over the last few days, but I'm not sure if it is the result of something else being added/removed so I'm hoping that someone from the infra team or in the channel will have insight as to what it might be or how it can be tested. I've provided the link so you can follow along if you'd like.

@biru-codeastromer
Copy link
Contributor Author

Hi @biru-codeastromer, I'm not sure why that check is failing so I have asked in the jenkins-infra gitter channel. It seems to be something that has started happening over the last few days, but I'm not sure if it is the result of something else being added/removed so I'm hoping that someone from the infra team or in the channel will have insight as to what it might be or how it can be tested. I've provided the link so you can follow along if you'd like.

Thanks Sir for the help ! Much appreciated .

Copy link
Contributor

@zbynek zbynek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kmartens27 do you think the content of this PR is valid? As mentioned above I'm not sure that the new config actually makes use of Unix Domain Sockets, and don't even know if/how Pomerium supports them. There's no point having two descriptions of using Pomerium with TCP ports on the same page.

@MarkEWaite
Copy link
Contributor

@zbynek I sent you a separate question by email. If you didn't receive it, could you send me email at [email protected] (Apologies for misusing a pull request comment for something unrelated to the pull request)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Jenkins documentation, including user and developer docs, solution pages, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Pomerium reverse proxy documentation to include support for unix domain sockets
4 participants