我正在寻找一种快速方法来保护 Tomcat 实例和在其上运行的所有 web 应用程序,以便访问任何页面都需要凭据(简单的用户名/密码)。
我猜Realm是做到这一点的“正确”方式,但这似乎不太容易设置。我们更喜欢一种您根本不必更改 web 应用程序本身的方式。任何人都知道是否有一种“快速而肮脏”的方法来实现这一目标?
是否可以解决,哪个公钥用于授予用户对服务器的访问权限?
例如,~/.ssh/authorized_keys文件中存储了 5 个公钥。我想知道哪个密钥的使用频率最高,并根据密钥而不是密码进行身份验证来计算每个身份验证事件。
我有一个 Apache 配置,它使用以下代码限制对网站的访问 -
<Directory /var/www/html/website/test/>
AuthName "Dyne Drewett Test Site"
AuthType Basic
AuthUserFile /usr/local/etc/apache/.htpasswd
require valid-user
</Directory>
Run Code Online (Sandbox Code Playgroud)
有谁知道我如何修改它以允许对/test/. 谢谢。
更新
在@dunxd 的一些帮助之后,我现在有了这个,我猜这一定是错误的,因为在转到所请求的页面(在/dyne_drewett/目录中找到)时,我仍然收到 401 错误。任何进一步的帮助都会很棒。
# Main directory rules
<Directory /var/www/html/website/test/>
# General access to the site
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from 192.168.1
# Authorisation settings
AuthName "Dyne Drewett Test Site"
AuthType Basic
AuthUserFile /usr/local/etc/apache/.htpasswd
require valid-user
</Directory>
# Theme directory rules
<Directory /var/www/html/website/test/wp-content/themes/dyne_drewett/>
# General access to the folder
Options …Run Code Online (Sandbox Code Playgroud) 我想将 Apache 配置为直接从文件系统提供文件,但对用户进行身份验证/授权。如何配置 Apache 以便它调用我的身份验证中间件?
基本上:
1) 如果用户未通过身份验证,则重定向到登录。否则根据数据库检查会话 cookie。
2) 根据用户身份(授权)允许访问某些文件。
configuration authentication authorization middleware apache-2.2