Shweta
Shweta

Reputation: 43

Setup GitHub Webhook for Jenkins installed on AWS EC2

I want to set up GitHub webhook which will trigger Jenkins job. Jenkins is installed on AWS EC2. In this case I have to open Jenkins port so that Webhook will trigger Jenkins Job. I found this https://help.github.com/articles/about-github-s-ip-addresses/ link where they have mentioned GitHub IPs. Should I open all ports for this GitHub IPs? Is it secure and compliant with Best practices ? Is there any other solution which will do the same thing instead of opening ports.

Upvotes: 3

Views: 2161

Answers (2)

Fessant
Fessant

Reputation: 31

Opening of all IP addresses might be quite dangerous. You may add to the whitelist GitHub IP ranges only, provided by the next link in "hooks" block github meta with the 8080 port (or whichever port you are using for a Jenkins at the EC2) For now it is:

  "hooks": [
    "192.30.252.0/22",
    "185.199.108.0/22",
    "140.82.112.0/20"
  ]

Upvotes: 1

Laura Liparulo
Laura Liparulo

Reputation: 2897

I only opened the 8080 for TCP and also UDP and used the Public DNS (IPv4) as Payload url:

http://ec2-XX-XXX-XX-XXX.eu-west-1.compute.amazonaws.com:8080/github-webhook/

remember to end the url exactly with "github-webhook"

Upvotes: 1

Related Questions