Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

install.sh: umask 077 fails the test gate and installs an unexecutable MTProxy (203/EXEC)

Đang mở
#10 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, shell
Lĩnh vực
devops, testing-qa

Hướng nghiên cứu

Bắt đầu với deploy/install.sh và deploy/install-mtproxy.sh, sau đó kiểm tra TestLoadAcceptsSystemdCredentialReadPermissions trong internal/config/config_test.go. Tái hiện các lỗi với umask 077, chạy go test ./... và kiểm tra cây MTProxy đã cài đặt cùng mtproxy.service. Được xem là hoàn tất khi cổng kiểm thử đạt, MTProxy khởi động với tư cách người dùng dịch vụ của nó và /readyz trả về 200.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

deploy/install.sh sets umask 077 on line 3. Two things downstream inherit it and break, so the stock installer cannot complete on a clean machine. Both are reproducible from a fresh clone.

Environment: Ubuntu 22.04.5 LTS, x86_64, commit 52a5feb7fac38f68da5afef9cedd9b3bfc8473ca.

1. go test ./... fails, aborting the install

install.sh runs the suite at line 146:

(cd "$repository" && "$go_binary" test ./...)

TestLoadAcceptsSystemdCredentialReadPermissions creates the profiles file with os.WriteFile(profiles, []byte(content), 0444). Go applies the process umask, so under umask 077 the file lands as 0400 instead of 0444. The test then unsets CREDENTIALS_DIRECTORY and asserts that Load rejects a group/other-readable file — but nothing is group/other-readable, so Load correctly accepts it and the assertion fires:

--- FAIL: TestLoadAcceptsSystemdCredentialReadPermissions (0.00s)
    config_test.go:248: group/other-readable profiles file outside a credential directory was accepted
FAIL	github.com/telegramdesktop/tproxy-server/internal/config

With set -euo pipefail the installer stops here, before writing any configuration.

Confirmed to be umask and nothing else — same tree, same binary, back to back:

$ (umask 077; go test ./internal/config/)
--- FAIL: TestLoadAcceptsSystemdCredentialReadPermissions
FAIL	github.com/telegramdesktop/tproxy-server/internal/config	0.013s

$ (umask 022; go test ./internal/config/)
ok  	github.com/telegramdesktop/tproxy-server/internal/config	0.008s

The robust fix is in the test — an explicit os.Chmod(profiles, 0444) after os.WriteFile makes the fixture independent of the caller's umask. Scoping the test run in the installer ((umask 022; cd "$repository" && "$go_binary" test ./...)) also works, but only papers over a test that silently changes meaning with the environment.

2. MTProxy is installed unexecutable, mtproxy.service fails 203/EXEC

deploy/install-mtproxy.sh inherits the same umask. make therefore creates objs/ and objs/bin/ as 0700 and the binary as 0700, and chown -R root:root "$build_directory" then makes them root-owned before the tree is moved to /opt/MTProxy:

drwx------  root root  /opt/MTProxy/objs
drwx------  root root  /opt/MTProxy/objs/bin
-rwx------  root root  /opt/MTProxy/objs/bin/mtproto-proxy

mtproxy.service runs with User=mtproxy, which can neither traverse objs/bin nor execute the binary:

mtproxy.service: Main process exited, code=exited, status=203/EXEC
mtproxy.service: Failed with result 'exit-code'.
mtproxy.service: Scheduled restart job, restart counter is at 13.

This one is quieter than the first, because the installer itself keeps going and only fails at the very end with a message that points somewhere else:

tproxy-server did not become ready

tproxy-server and caddy are both healthy at that point (/healthz returns 200); it is /readyz returning 503 backend unavailable because there is no reachable MTProxy on 127.0.0.1:2398. The install looks like a relay problem when the actual cause is file permissions three directories away.

umask 022 in install-mtproxy.sh, or an explicit chmod of the installed tree, resolves it. After

find /opt/MTProxy -type d -exec chmod 0755 {} +
chmod 0755 /opt/MTProxy/objs/bin/mtproto-proxy

mtproxy.service starts normally and /readyz returns 200.

Note

Since umask 077 is set by the installer itself rather than by the operator, both failures should reproduce on any clean Ubuntu 22.04+ / Debian 12+ host following the documented quick start.

Ngôn ngữ chính
Go
Star
424
Fork
49
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của telegramdesktop/tproxy-server

Tất cả issue của telegramdesktop/tproxy-server

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.