sameersbn / sameersbn/docker-gitlab

[gitlab-shell] permissions on log file are set to root:root, so git operations fail

Open
#1,400 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

wontfix
Dominant language
Shell
Stars
8.1k
Forks
2.1k
Avg merge
17h 47m
Merged PRs (30d)
7

Description

Hi,

First off, thanks for this repo and all the work that you've done to set this up. It's been a huge help to us and you've been super responsive to version updates, as well as making the new features configurable.

The issue I have seen came up when migrating from 8.16.x to 10.1.0. Once I updated image versions and let the migrations run, I started validating the configuration/repos/pipelines/etc. I found that git operations from a client (e.g. git pushes) would result in failures from the container. The error message was the following:

/usr/lib/ruby/2.3.0/logger.rb:703:in `initialize': Permission denied @ rb_sysopen - /var/log/gitlab/gitlab-shell/gitlab-shell.log (Errno::EACCES)
	from /usr/lib/ruby/2.3.0/logger.rb:703:in `open'
	from /usr/lib/ruby/2.3.0/logger.rb:703:in `open_logfile'
	from /usr/lib/ruby/2.3.0/logger.rb:695:in `set_dev'
	from /usr/lib/ruby/2.3.0/logger.rb:635:in `initialize'
	from /usr/lib/ruby/2.3.0/logger.rb:353:in `new'
	from /usr/lib/ruby/2.3.0/logger.rb:353:in `initialize'
	from /home/git/gitlab-shell/lib/gitlab_logger.rb:15:in `new'
	from /home/git/gitlab-shell/lib/gitlab_logger.rb:15:in `<top (required)>'
	from /home/git/gitlab-shell/lib/gitlab_net.rb:6:in `require_relative'
	from /home/git/gitlab-shell/lib/gitlab_net.rb:6:in `<top (required)>'
	from /home/git/gitlab-shell/lib/gitlab_shell.rb:4:in `require_relative'
	from /home/git/gitlab-shell/lib/gitlab_shell.rb:4:in `<top (required)>'
	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /home/git/gitlab-shell/bin/gitlab-shell:18:in `<main>'
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

As you can see, it's a simple file system access and was easily resolved by chown git:git /var/log/gitlab/gitlab-shell.log so that the shell could actually read the file.

Is this something that's more widespread than my situation? If so, would it be worth ensuring permissions on the log files?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how /var/log/gitlab/gitlab-shell/gitlab-shell.log is created and opened from lib/gitlab_logger.rb, then reproduce a git operation in the container. Check the resulting file ownership and permissions; done means git operations can write to the log without Errno::EACCES after migration.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, git, ruby
Domain
infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.