0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CentOS 8でmod_auth_casを使う

Posted at

イントロ

CAS認証をほどよく愛する私としては、CentOS 8(およびRHEL 8)環境で、これまでCentOS 6、CentOS 7ではEPELリポジトリで提供されていたmod_auth_casが無くなっているそうで悲しんでます。

現時点ではrpmを拾ってきてインストールすることは無理そうなので、仕方ないので自前ビルドすることにします。

やりかた

以下のサイトにある説明をベースに、CentOS 7で # yum install mod_auth_cas した時の環境に合わせて変更しています。
https://iam.uconn.edu/mod_auth_cas-installation-and-configuration/

下準備

# yum install httpd httpd-devel
# yum install gcc libcurl-devel openssl-devel pcre-devel
# yum install autoconf automake make libtool redhat-rpm-config
# yum install wget tar

ビルド

# cd /usr/local/src
# wget https://github.com/apereo/mod_auth_cas/archive/v1.2.tar.gz
# tar xvzf v1.2.tar.gz
# cd mod_auth_cas-1.2
# autoreconf -iv
# ./configure --with-apxs=/usr/bin/apxs
# make
# make check
# make install

httpd用設定

# mkdir /var/cache/httpd/mod_auth_cas
# chown apache:apache /var/cache/httpd/mod_auth_cas

# vi /etc/httpd/conf.d/auth_cas.conf
LoadModule auth_cas_module modules/mod_auth_cas.so
CASCookiePath /var/cache/httpd/mod_auth_cas/
CASCertificatePath /etc/pki/tls/certs/ca-bundle.crt
CASLoginURL https://sso.yourdomain/cas/login
CASValidateURL https://sso.yourdomain/cas/serviceValidate

# systemctl restart httpd

.htaccessの設置

# vi /var/www/html/.htaccess
AuthType CAS
Require valid-user

SELinuxへの対応

SELinuxが有効な場合は、CAS認証後に401エラーになるため、 SELinuxをEnforcingで利用する場合は、一度エラー画面を確認した後で以下を実行します。

# yum install policycoreutils-python-utils
# grep "httpd" /var/log/audit/audit.log | audit2allow --module=mod_auth_cas -all

module mod_auth_cas 1.0;

require {
        type http_port_t;
        type httpd_t;
        class tcp_socket name_connect;
}

# ============= httpd_t ==============

# !!!! This avc can be allowed using one of the these booleans:
#     httpd_can_network_connect, httpd_graceful_shutdown, httpd_can_network_relay, nis_enabled
allow httpd_t http_port_t:tcp_socket name_connect;


# grep "httpd" /var/log/audit/audit.log | audit2allow --module=mod_auth_cas -all
# semodule -i mod_auth_cas.pp
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?