aio-libs / aio-libs/aiohttp

UNIX socket permission bits

Đang mở
#4,155 13 bình luận 3 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Python
Star
16.5k
Fork
2.4k
Merge trung bình
17 giờ 22 phút
Pull request đã merge (30 ngày)
212

Mô tả

I want to use a unix socket, but it's impossible when umask is 0022 or more strict, because the nginx `www-data` user can't connect and prints "Permission denied" error. I want to change the permission bits for the unix socket without touching umask (a strict umask is needed for other things of my project).

There was a PR https://github.com/aio-libs/aiohttp/pull/4002, but it's closed.

I tried to chmod after `on_startup` signal:

```python
class MyApp:
def __init__(self, config):
self.config = config
self.webapp = web.Application()
self.webapp.on_startup.append(self._on_startup)
# ...

def run_app(self):
web.run_app(
self.webapp,
path=self.config.unix_socket,
# ...
)

async def _on_startup(self, webapp):
os.chmod(self.config.unix_socket, self.config.unix_socket_mode)
```

But the `on_startup` signal is called *before* creating the socket, and `os.chmod` raises "No such file or directory: 'webapp.sock'" error.

Please implement an option for this or explain how to do it with the current version of aiohttp

Or maybe add `on_listen` signal? :)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

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.