qiita にまとめました。 https://qiita.com/bashaway/items/6adc75265973de9b5fcc 目的 †
実現方法 †
環境 †
作業内容 †プロキシサーバのAD参加 †リゾルバの設定でドメイン名とNSを指定 †#vi /etc/resolv.conf search VIRTUAL.PROSPER2.LOCAL nameserver 192.168.10.204 hostsファイルに自サーバ名を登録 †#vi /etc/hosts 127.0.0.1 VMproxy01 ADに登録されるコンピュータ名を設定 †#vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=VMproxy01 指定したADサーバに登録するための設定 †#vi /etc/samba/smb.conf workgroup = VIRTUAL server string = VMproxy01 security = ads hosts allow = 127. realm = VIRTUAL.PROSPER2.LOCAL 認証系の設定ファイル書き換え(winbindを利用、kerberos認証を利用) †#LANG=en_US ;authconfigがうまく動かない場合があるらしい #authconfig --enablewinbind --update ;コマンドで/etc/nsswitch.confを書き換えてくれる #authconfig --krb5kdc=192.168.10.204 --krb5realm=VIRTUAL.PROSPER2.LOCAL --update ;コマンドで/etc/krb5.confを書き換えてくれる プロキシサーバ登録用ユーザをADに作成 †ユーザ名:squid コンピュータをADに登録 †#/etc/init.d/smb stop #/etc/init.d/winbind stop ;テストでしくったときに影響を与えないようにサービスとしては停止しておく # net ads join -U squid ;ADに参加しているユーザを指定(ここではプロキシ動作のためのADユーザを指定) Enter squid's password: Using short domain name -- VIRTUAL Joined 'VMPROXY01' to realm 'virtual.prosper2.org' No DNS domain configured for vmproxy01. Unable to perform DNS Update. DNS update failed! なんかエラーみたいだけどOK。ADで自動インストールされたDNSにも正引き、逆引きで登録しておく。 動作チェックなど †デーモンの起動と自動起動の設定をいれておく †#/etc/init.d/smb start #/etc/init.d/winbind start #chkconfig --add smb #chkconfig --add winbind #chkconfig smb on #chkconfig winbind on サービス稼動状況 †#wbinfo -t checking the trust secret for domain DOMAIN via RPC calls succeeded と表示されていればOK(rootでのみ確認可能) ユーザ一覧 †#wbinfo -u VIRTUAL\administrator VIRTUAL\guest VIRTUAL\krbtgt VIRTUAL\squid VIRTUAL\u-limit VIRTUAL\u-unlimit でユーザがリストアップされていればOK ユーザ認証 †#wbinfo -a VIRTUAL.PROSPER2.ORG\\UID%PWD plaintext password authentication succeeded challenge/response password authentication succeeded と表示されていればOK sambaとsquidの連携設定(権限追加) †squidにwinbindの権限を追加 †# id squid uid=23(squid) gid=23(squid) groups=23(squid) # usermod -G wbpriv squid # id squid uid=23(squid) gid=23(squid) groups=23(squid),88(wbpriv) でsquidがwbprivに所属していればOK squid.confの修正 †#基本的な設定 visible_hostname VMproxy01 #NTLM認証の基本的な設定とACL auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp auth_param ntlm children 5 external_acl_type ldap_group %LOGIN /usr/lib/squid/squid_ldap_group -v 3 -b "OU=ALPHA,DC=VIRTUAL,DC=PROSPER2,DC=ORG" -h 192.168.10.204 -D "CN=squid,OU=ALPHA,DC=VIRTUAL,DC=PROSPER2,DC=ORG" -w squidpass -f "(&(objectclass=person)(sAMAccountName=%u)(memberOf=CN=%g,OU=ALPHA,DC=VIRTUAL,DC=PROSPER2,DC=ORG))" -S acl gr_unlimit external ldap_group proxy_unlimit acl gr_limit external ldap_group proxy_limit acl whitelist url_regex -i "/etc/squid/whitelist.txt" acl intrasite url_regex -i "/etc/squid/intrasite.txt" acl clientlist src "/etc/squid/clientlist.txt" #ADに登録されたメンバーにプロキシ利用の許可を与える # deny : from unexpected clients http_access deny !clientlist # permit : any client to whitelist # no logging username http_access allow whitelist # permit : AD Security Group # logging username http_access allow gr_unlimit http_access allow gr_limit # deny : default http_access deny all # 192.168.10.202 VMpxext01 cache_peer 192.168.10.202 parent 3128 0 no-query # permit : any client to whitelist cache_peer_access 192.168.10.202 allow whitelist # permit : Unlimit group to any cache_peer_access 192.168.10.202 allow gr_unlimit # permit : Limit group to intrasite cache_peer_access 192.168.10.202 allow gr_limit intrasite cache_peer_access 192.168.10.202 deny gr_limit !intrasite cache_peer_access 192.168.10.202 deny all always_direct allow intrasite never_direct allow all その他の注意事項など †ログ表示 †#tailf /var/log/squid/access.log 1357570423.423 0 192.168.20.35 TCP_DENIED/407 4670 GET http://www.google.co.jp/ - NONE/- text/html 1357570423.815 373 192.168.20.35 TCP_MISS/200 25077 GET http://www.google.co.jp/ VIRTUAL\XXXX DIRECT/74.125.235.120 text/html リターンコード407で認証が必要とされたあとにすぐ200で正常に完了している。 設定ファイルの反映 †whitelist.txt,intrasite.txt,clientlist.txt は squid の通常ACLを利用しているため ログへのユーザ名表示 †ユーザ名は squid.conf のhttp_access ラインで判断するため http_accessのACLにユーザ判別の ホワイトリストの更新 †システムユーザおよび制限ユーザがアクセスできるホワイトリストはアクセスしたいURLだけでなく 設定ファイル †squid.conf †[root@VMproxy01 ~]# cat /etc/squid/squid.conf auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp auth_param ntlm children 5 external_acl_type ldap_group %LOGIN /usr/lib/squid/squid_ldap_group -v 3 -b "OU=ALPHA,DC=VIRTUAL,DC=PROSPER2,DC=ORG" -h 192.168.10.204 -D "CN=squid,OU=ALPHA,DC=VIRTUAL,DC=PROSPER2,DC=ORG" -w squidpass -f "(&(objectclass=person)(sAMAccountName=%u)(memberOf=CN=%g,OU=ALPHA,DC=VIRTUAL,DC=PROSPER2,DC=ORG))" -S acl gr_unlimit external ldap_group proxy_unlimit acl gr_limit external ldap_group proxy_limit acl whitelist url_regex -i "/etc/squid/whitelist.txt" acl intrasite url_regex -i "/etc/squid/intrasite.txt" acl clientlist src "/etc/squid/clientlist.txt" acl manager proto cache_object acl localhost src localhost acl localhost src 127.0.0.1/32 acl SSL_ports port 443 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 allow manager localhost http_access deny manager http_access deny !Safe_ports http_access deny CONNECT !SSL_ports # deny : from unexpected clients http_access deny !clientlist # permit : any client to whitelist # no logging username http_access allow whitelist # permit : AD Security Group # logging username http_access allow gr_unlimit http_access allow gr_limit # deny : default http_access deny all # 192.168.10.202 VMpxext01 cache_peer 192.168.10.202 parent 3128 0 no-query # permit : any client to whitelist cache_peer_access 192.168.10.202 allow whitelist # permit : Unlimit group to any cache_peer_access 192.168.10.202 allow gr_unlimit # permit : Limit group to intrasite cache_peer_access 192.168.10.202 allow gr_limit intrasite cache_peer_access 192.168.10.202 deny gr_limit !intrasite cache_peer_access 192.168.10.202 deny all always_direct allow intrasite never_direct allow all # Squid normally listens to port 3128 http_port 3128 # We recommend you to use at least the following line. hierarchy_stoplist cgi-bin ? # Uncomment and adjust the following to add a disk cache directory. #cache_dir ufs /var/spool/squid 100 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 visible_hostname VMproxy01 whitelist.txt †[root@VMproxy01 ~]# cat /etc/squid/whitelist.txt adobe.com adobe.co.jp adobe.jp windowsupdate.com windowsupdate.co.jp microsoft.com microsoft.co.jp aspnetcdn.com webtrends.com jquery.com msn.com atdmt.com intrasite.txt †[root@VMproxy01 squid]# cat /etc/squid/intrasite.txt www.prosper2.org taruo.net ugtop.com clientlist.txt †[root@VMproxy01 squid]# cat /etc/squid/clientlist.txt 192.168.10.0/24 192.168.20.0/24
Counter: 34237,
today: 3,
yesterday: 0
|