4 ms·
This won't work AFAIK. open takes a file path and gives you back a fd that doesn't know anything about fs paths (it tracks the underlying inode). Thus, nginx
by kilburn 8y ago
This won't work AFAIK.
open takes a file path and gives you back a fd that doesn't know anything about fs paths (it tracks the underlying inode).
Thus, nginx may open(key) before the directory is renamed, and open(cert) afterwards. The first fd is now pointing to the old key, while the second fd points to the new cert.
- viraptor 8y agohttps://linux.die.net/man/2/openat https://linux.die.net/man/2/openat solves that specific issue.
- nightfly 8y agoThe actual problem is you can't atomically replace a directory with another one. You have to do tricks where you have a symlink to the real directory and atomically replace the symlink with a new symlink to the new directory. Another comment pointed out though that most of the time you only need to update the cert, and not the key. So it's mostly a moot issue..