Skip to content

Configure `allow_local_requests_from_hooks_and_services` via gitlab.rb

Summary

Since we upgraded to Gitlab 11 (Omnibus EE starter) it is no longer possible to create WebHooks pointing to the Mattermost instance running on the same host. Instead it gives error:

"Validations failed. Webhook is blocked: Requests to localhost are not allowed"

Steps to reproduce

  • Install from Omnibus package, put Gitlab and Mattermost on the same host
  • Connect Gitlab with Mattermost
  • Activate incoming WebHooks in Mattermost
  • Create WebHook in Mattermost
  • Create Integration with Mattermost notifications in Gitlab
  • Paste URL into appropriate box
  • Click to greate WebHook -> Error

Please note, that the used URLs are

https://git.corp.com

and

https://mattermost.corp.com

What is the current bug behavior?

Error indicating, that connection to localhost is forbidden instead of created integration

What is the expected correct behavior?

Gitlab project to Mattermost integration is created.

Relevant logs and/or screenshots

gitlab-rails/production.log:WebHook Error => URL 'https://mattermost.corp.com/hooks/s3cr3ts3cr3ts3cr3ts3cr3t' is blocked: Requests to localhost are not allowed

Results of GitLab environment info

System information
System:         CentOS 7.5.1804
Proxy:          http_proxy: http://IP.IP.IP.IP:3128
                https_proxy: http://IP.IP.IP.IP:3128
Current User:   git
Using RVM:      no
Ruby Version:   2.4.4p296
Gem Version:    2.7.6
Bundler Version:1.16.2
Rake Version:   12.3.1
Redis Version:  3.2.11
Git Version:    2.17.1
Sidekiq Version:5.1.3
Go Version:     unknown

GitLab information
Version:        11.0.2-ee
Revision:       74d8455
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
DB Version:     9.6.8
URL:            https://git.corp.com
HTTP Clone URL: https://git.corp.com/some-group/some-project.git
SSH Clone URL:  git@git.corp.com:some-group/some-project.git
Elasticsearch:  no
Geo:            no
Using LDAP:     yes
Using Omniauth: no

GitLab Shell
Version:        7.1.4
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks
Git:            /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Checking GitLab Shell ...

GitLab Shell version >= 7.1.4 ? ... OK (7.1.4)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:root, or git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ... 
3/4 ... ok
12/7 ... ok
6/9 ... repository is empty
17/10 ... ok
16/11 ... ok
3/12 ... ok
25/13 ... ok
25/14 ... ok
17/15 ... repository is empty
17/16 ... repository is empty
17/17 ... repository is empty
17/18 ... repository is empty
17/19 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Redis available via internal API: OK

Access to /var/opt/gitlab/.ssh/authorized_keys: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Reply by email is disabled in config/gitlab.yml
Checking LDAP ...

Server: ldapmain
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
        REMOVED...

Checking LDAP ... Finished

Checking GitLab ...

Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ... 
3/4 ... yes
12/7 ... yes
6/9 ... yes
17/10 ... yes
16/11 ... yes
3/12 ... yes
25/13 ... yes
25/14 ... yes
17/15 ... yes
17/16 ... yes
17/17 ... yes
17/18 ... yes
17/19 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.5 ? ... yes (2.4.4)
Git version >= 2.9.5 ? ... yes (2.17.1)
Git user has default SSH configuration? ... yes
Active users: ... 17
Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)

Checking GitLab ... Finished

Possible fixes

Possibly related to commit gitlab-ce@9432a786e499a381bfe5d46f7635c674c4295af1.

Edited by Mark Fletcher