質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Squid

Squidは、TCP/IPネットワークでのユーザーとサーバの通信を中継するオープンソースのプロキシサーバソフト。リバースプロキシやキャッシュサーバとして使用することも可能です。

Active Directory

Active Directoryは、 Windows Serverの機能の一つで、 マイクロソフトによって作られたディレクトリサービスです。 ネットワーク上に存在する様々なハードや利用者情報のアクセス権限などを一元管理が出来ます。

Q&A

0回答

1625閲覧

SquidでActive Directoryを使ったアクセス制限

ITOMO5963

総合スコア98

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Squid

Squidは、TCP/IPネットワークでのユーザーとサーバの通信を中継するオープンソースのプロキシサーバソフト。リバースプロキシやキャッシュサーバとして使用することも可能です。

Active Directory

Active Directoryは、 Windows Serverの機能の一つで、 マイクロソフトによって作られたディレクトリサービスです。 ネットワーク上に存在する様々なハードや利用者情報のアクセス権限などを一元管理が出来ます。

0グッド

0クリップ

投稿2021/09/28 11:39

#実現したいこと
特定の[adusers]グループに所属しているAD登録ユーザ[testuser]のみアクセスを許可したい。
ユーザー認証のみで動作させると正常に動作できますが、グループ制限をかけると、
アクセス許可のユーザーでもアクセスできません。
お力沿いお願いいたします。

参考
http://itsp0.blogspot.com/2017/09/centos7-squidad.html

[access.log]

"time=2021/09/28 19:34:34","un=testuser@tnc.local","credentials=testuser","host=10.1.30.222","src_ip=10.1.30.1", "src_port=1026","dest_ip=-","dest_port=-","url=http://172.31.0.20/","status=407","http_method=GET","referer=-", "user=-","duration=5","dt=-","uri_path=/","byte_in=4647","byte_out=557", "http_user_agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36", "content_type=text/html","action=TCP_DENIED","product=squid" ``` [squid.conf] ``` acl localnet src 10.0.0.0/8 # RFC1918 possible internal network acl localnet src 172.16.0.0/12 # RFC1918 possible internal network acl localnet src 192.168.0.0/16 # RFC1918 possible internal network acl localnet src fc00::/7 # RFC 4193 local private network range acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines acl SSL_ports port 22 # ssh acl Safe_ports port 22 # ssh acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 # https acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais acl Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port 280 # http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http acl CONNECT method CONNECT http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow localhost manager http_access deny manager auth_param basic program /usr/lib64/squid/basic_ldap_auth -v3 -R -b "OU=env,DC=test,DC=LOCAL" -D "CN=squidadmin,CN=USERS,DC=test,DC=LOCAL" -W "/etc/squid/ldap_password" -f "(&(sAMAccountName=%s)(objectclass=person))" -h KVM-AD-SV01.test.local auth_param basic children 10 external_acl_type ldap_group %LOGIN /usr/lib64/squid/ext_ldap_group_acl -v 3 -R -b "OU=env,DC=,DC=LOCAL" -D "CN=squidadmin,CN=USERS,DC=test,DC=LOCAL" -W "/etc/squid/ldap_password" -f '(&(sAMAccountName=%u)(memberof=CN=%g,OU=env,DC=TEST,DC=LOCAL))' -h TEST-AD-SV01.test.local -S acl adusers_group external ldap_group adusers http_access allow adusers_group http_access allow localnet http_access allow localhost # And finally deny all other access to this proxy http_access deny all # Squid normally listens to port 3128 http_port 3128 # Uncomment and adjust the following to add a disk cache directory. cache_mem 256 MB cache_dir ufs /var/spool/squid 200 16 256 # Leave coredumps in the first cache dir coredump_dir /var/spool/squid # Add any of your own refresh_pattern entries above these. refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|?) 0 0% 0 refresh_pattern . 0 20% 4320 forwarded_for off request_header_access X-Forwarded-For deny all request_header_access Via deny all request_header_access Cache-Control deny all #LOGformat指定 logformat customlog "time=%{%Y/%m/%d %H:%M:%S}tl","un=%un","credentials=%credentials","host=%>la","src_ip=%>a","src_port=%>p","dest_ip=%<a","dest_port=%<p","url=%ru","status=%>Hs","http_method=%rm","referer=%{Referer}>h","user=%ui","duration=%tr","dt=%dt","uri_path=%>rp","byte_in=%<st","byte_out=%>st","http_user_agent=%{User-Agent}>h","content_type=%mt","action=%Ss","product=squid" access_log /var/log/squid/access.log customlog ``` [AD情報①] ``` C:\Windows\system32>dsget user "CN=aduser,OU=env,DC=TEST,DC=LOCAL" -memberof "CN=adusers,OU=env,DC=test,DC=local" "CN=Domain Users,CN=Users,DC=test,DC=local" "CN=Domain Admins,CN=Users,DC=test,DC=local" ``` [AD情報②] ``` objectClass: top objectClass: person objectClass: organizationalPerson objectClass: user cn: testuser distinguishedName: CN=testuser,OU=env,DC=test,DC=local instanceType: 4 whenCreated: 09/22/2021 02:18:15 whenChanged: 09/28/2021 10:26:34 displayName: testuser uSNCreated: 4857923 memberOf: CN=adusers,OU=env,DC=test,DC=local memberOf: CN=Domain Users,CN=Users,DC=test,DC=local uSNChanged: 4905543 name: testuser objectGUID: {680902E7-7823-414E-A52C-7F5AE9BB8328} userAccountControl: 66048 badPwdCount: 0 codePage: 0 countryCode: 0 badPasswordTime: 132769238078313713 lastLogoff: 0 lastLogon: 132772792383808714 pwdLastSet: 132767506958762111 primaryGroupID: 512 objectSid: S-1-5-21-2042203649-4088118402-1616471533-1631 adminCount: 1 accountExpires: 9223372036854775807 logonCount: 2 sAMAccountName: testuser sAMAccountType: 805306368 userPrincipalName: testuser@test.local objectCategory: CN=Person,CN=Schema,CN=Configuration,DC=test,DC=local dSCorePropagationData: 09/28/2021 10:26:34 dSCorePropagationData: 09/28/2021 10:19:52 dSCorePropagationData: 09/22/2021 02:38:21 dSCorePropagationData: 01/01/1601 00:00:00 lastLogonTimestamp: 132767507710886374 msTSExpireDate: 11/21/2021 02:19:31 msTSLicenseVersion: 655361 msTSManagingLS: 00429-80651-01504-AT205 msTSLicenseVersion2: 7 msTSLicenseVersion3: C50-10.01-S ADsPath: LDAP://TEST-AD-SV01.test.local/CN=testuser,OU=env,DC=test,DC=local ```

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

TaichiYanagiya

2021/09/28 13:36

403 ではなく 407 なので、http_access の前に basic_ldap_auth で認証失敗しているようです。 パスワードが違うのでは?
ITOMO5963

2021/09/29 00:03 編集

パスワードに間違いはありません。 「/usr/lib64/squid/ext_ldap_group_acl」のグループ制限を外すと正常にアクセスできます。 basic_ldap_authモジュールとext_ldap_group_aclモジュールの単体でも正常にアクセスOKです。
TaichiYanagiya

2021/09/29 01:22

"debug_options 29,3 82,3 84,3" を設定して、/var/log/squid/cache.log を調べるといいと思います。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問