
訪問者の IP アドレスに基づいて認証を要求またはバイパスするように Joomla を設定するにはどうすればよいですか?
特定の IP アドレスまたはサブネットからアクセスしている場合を除き、訪問者にログインを要求する Joomla Web サイトを設定したいと思います。
また、ログインは LDAP ベースにしたいと思います。
私は Joomla サイトをローカル ネットワーク上でホストし、ポート転送を使用してルーター経由で公開します。
答え1
特定の IP アドレスまたはサブネットからアクセスしている場合を除き、訪問者にログインを要求する Joomla Web サイトを設定したいと思います。
以下のように Joomla の仮想ホストを作成します。
<VirtualHost *:80>
ServerName joomla.yourdomain.com
ServerAdmin ...
DocumentRoot /var/www/html/joomla
ErrorLog logs/joomla.error_log
<Directory "/var/www/html/joomla">
Options ...
Order allow,deny
Allow from 192.168.1.0/24
Satisfy Any
</Directory>
</VirtualHost>
また、ログインは LDAP ベースにしたいと思います。
これを行うには、構文、 このようなもの:
LoadModule authz_ldap_module modules/mod_authz_ldap.so
<IfModule mod_authz_ldap.c>
<Location /var/www/html/joomla>
AuthBasicProvider ldap
AuthzLDAPAuthoritative Off
AuthLDAPURL ldap://IP:3268/dc=domain,dc=com?sAMAccountName
AuthLDAPBindDN cn=binduser,dc=domain,dc=com
AuthLDAPBindPassword secret
AuthType Basic
AuthName "Authorization required"
require valid-user
AuthzLDAPLogLevel debug
</Location>
</IfModule>
LDAP (MS-AD) を使用した HTTPS 認証はオプションですか?
はい。
答え2
これがあなたが求めているものかどうかはわかりませんが...
もう一つの選択肢は、.htaccessファイルを変更してIPによるアクセスを許可することです。
<Limit GET>
Order Deny,Allow
Deny from all
Allow from 100.100.100.100
</Limit>
オプション: カンマで区切って複数のアドレスを追加できます。
100.100.100.101, 100.100.100.102
答え3
参照すべきApacheのドキュメントはアクセス制御(「ホスト別」セクション) 認証、承認、アクセス制御(「満足」指令)mod_auth_basic、 そして認証希望する設定例は次のとおりです。
AuthType Basic
AuthBasicProvider ldap
AuthName "Joomla"
# change the ldap attributes to what matches your environment
AuthLDAPBindDN "uid=example,ou=example,dc=example,dc=com"
AuthLDAPBindPassword example
AuthLDAPURL "ldap://example.com:port/basedn?attribute?scope?filter"
Order allow,deny
# change the ip to match your network that should not have to authenticate
Allow from 10.0.0.0/24
Satisfy any
答え4
nginx をプロキシ フロントエンドとして設定する必要があります。nginx では、次の設定ディレクティブを使用してこれを実行できます。
auth_basic "Restricted";
auth_basic_user_file htpasswd;
satisfy any;
allow 10.0.0.0/24;
allow 10.1.0.0/24;
allow 10.2.1.1;
deny all;
この方法では、明示的にリストされている IP の認証をバイパスしallow
、他のすべての IP に対して認証ポップアップ ダイアログを表示できます。