gpt4 book ai didi

php - Laravel chmod(/var/dev/project/storage/oauth-public.key) : Operation failed: Operation not permitted

转载 作者:IT王子 更新时间:2023-10-29 00:10:35 24 4
gpt4 key购买 nike

更新以下软件包后,我收到一个错误,即找不到 oauth-public.key 文件。

Package operations: 1 install, 2 updates, 0 removals

Updating laravel/framework (v5.4.27 => v5.4.28): Downloading (100%)
Installing defuse/php-encryption (v2.1.0): Downloading (100%)
Updating league/oauth2-server (5.1.3 => 5.1.4): Downloading (100%)

首先我删除了project/storage中的两个oauth-文件,然后执行这个命令:php artisan passport:install生成新的oauth-强>文件。

现在尝试访问 api 路由时出现以下错误。

(1/1) ErrorException chmod(/var/dev/project/storage/oauth-public.key): Operation failed: Operation not permitted

堆栈跟踪

in CryptKey.php (line 51)

at HandleExceptions->handleError(2, 'chmod(/var/dev/project/storage/oauth-public.key): Operation failed: Operation not permitted', '/var/dev/project/vendor/league/oauth2-server/src/CryptKey.php', 51, array('keyPath' => 'file:///var/dev/project/storage/oauth-public.key', 'passPhrase' => null, 'keyPathPerms' => '644'))

at chmod('file:///var/dev/project/storage/oauth-public.key', 384) in CryptKey.php (line 51)

at CryptKey->__construct('file:///var/dev/project/storage/oauth-public.key') in ResourceServer.php (line 50)

文件权限

-rw-r--r-- user:user oauth-private.key
-rw-r--r-- user:user oauth-public.key

更新 1

我发现 oauth Libaray 引入了安全修复程序。 Oauth V5 Security Improvements

Version 5.1.4 is a backwards compatbile with other 5.1.x releases.

You will notice in your server logs a message like this:

You must set the encryption key going forward to improve the security of this library - see this page for more information https://oauth2.thephpleague.com/v5-security-improvements/

To supress this notice once you have instantiated an instance of \League\OAuth2\Server\AuthorizationServer you should call the setEncryptionKey() method passing in at least 32 bytes of random data.

You can generate this using base64_encode(random_bytes(32)). Alternatively if you’re using a framework such as Laravel which has a encryption key already generated you can pass in that (in the case of Laravel use env('APP_KEY')).

问题是 Laravel Passport 的维护者必须解决这个问题。

更新 2

在我删除供应商文件夹并再次执行 composer install 后,我仍然遇到同样的错误。

最佳答案

试试:

sudo chown www-data:www-data storage/oauth-*.key
sudo chmod 600 storage/oauth-*.key

它解决了我的问题。

关于php - Laravel chmod(/var/dev/project/storage/oauth-public.key) : Operation failed: Operation not permitted,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44879899/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com