背景
事情 (yumではバージョンが古いものしか入らない?という噂本当?) によりFreeRadiusの最新版をソースからbuildしたところ少し嵌ったので書いておきます.
インストール手順まとめ
結論からまとめると以下の様な手順でbuildできました.
% sudo yum install -y libtalloc-devel
% sudo yum install -y openssl-devel
% ./configure
% make
hogehoge.soへのsymbolic linkはhogehoge-develをインストールすると作成されるというのを初めて知りました.まぁ,そうですねぇ.うーん,Linuxは難しい.個人的にはBSDの方が楽だなぁ.
七転八倒具合
- github.com上でhttps://github.com/FreeRADIUS/freeradius-server/をfork
- forkしたものをclone
- configureするとこける
% cd freeradius-server
% ./configure
(snip)
configure: WARNING: talloc library not found. Use --with-talloc-lib-dir=<path>.
configure: error: FreeRADIUS requires libtalloc
- libtallocが無いということなのでインストール
% sudo yum install -y libtalloc
- まだconfigureでこける
% cd freeradius-server
% ./configure
(snip)
configure: WARNING: talloc library not found. Use --with-talloc-lib-dir=<path>.
configure: error: FreeRADIUS requires libtalloc
6.libtallocが入っていないのかと確認してみる,と入ってはいる… が,libtalloc.soが無い!!
% ls /usr/lib64/ | grep libtalloc
libtalloc.so.2
libtalloc.so.2.1.2
- ということで,symbolic linkを張る.
% sudo ln -s /usr/lib64/libtalloc.so{.2,}
8.再度configureにチャレンジ…が,今度はヘッダーファイルが無いと怒られる…まぁ,そうですね.
% ./configure
(snip)
configure: WARNING: talloc headers not found. Use --with-talloc-include-dir=<path>.
configure: error: FreeRADIUS requires libtalloc
- 開発用のファイルもインストールして再度チャレンジ…も,また,ライブラリが無いと…
% sudo yum install -y libtalloc-devel
% ./configure
(snip)
configure: error: in `/usr/local/src/freeradius-server':
configure: error: failed linking to libcrypto. Use --with-openssl-lib-dir=<path>, or --with-openssl=no (builds without OpenSSL)
See `config.log' for more details
- opensslをインストールして再度チャレンジ…
% sudo yum install -y openssl
% ./configure
(snip)
configure: error: in `/usr/local/src/freeradius-server':
configure: error: failed linking to libcrypto. Use --with-openssl-lib-dir=<path>, or --with-openssl=no (builds without OpenSSL)
See `config.log' for more details
- だんだん飽きてきた…が,libcryptoって複数あるじゃないですか…で,OpenSSLの方にリンクを張る…さて…
% ls /usr/lib64/libcrypto*
/usr/lib64/libcrypto.so.1.0.1e /usr/lib64/libcrypto.so.10
% sudo ln -s /usr/lib64/libcrypto.so{.1.0.1e,}
% ./configure
(snip)
configure: error: in `/usr/local/src/freeradius-server':
configure: error: failed linking to libssl. Use --with-openssl-lib-dir=<path>, or --with-openssl=no (builds without OpenSSL)
See `config.log' for more details
- いくつかdisableされたものもあるけど,ようやくconfigureが通った!!
% ls /usr/lib64/libssl*
/usr/lib64/libssl.so.1.0.1e /usr/lib64/libssl.so.10 /usr/lib64/libssl3.so
$ sudo ln -s /usr/lib64/libssl.so{.1.0.1e,}
% ./configure
(snip)
configure: creating ./config.status
config.status: creating all.mk
config.status: creating config.h
- 何がdisableされたかチェックしてみようとするが,WARNINGがやけに少ない…
% grep WARNING config.log
configure:5642: WARNING: snmpget not found - Simultaneous-Use and checkrad may not work
configure:5687: WARNING: snmpwalk not found - Simultaneous-Use and checkrad may not work
configure:6881: WARNING: pcap library not found, silently disabling the RADIUS sniffer, and ARP listener. Use --with-pcap-lib-dir=<path>.
configure:7121: WARNING: collectdclient library not found. Use --with-collectdclient-lib-dir=<path>.
configure:7339: WARNING: cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=<path>.
- ということで,configureを遣り直してstdoutに出たものもチェックすると,大量にdisableされていたことが分かる.
% ./configure > config.log.stdout 2>&1
% grep WARNING config.log.stdout
(沢山出てくる)
- が,とりあえず,buildしてみると,大量のエラーが出てもうmakeそう…
% make
(snip)
In file included from src/modules/rlm_eap/libeap/eap_tls.c:74:0:
src/modules/rlm_eap/libeap/eap_tls.h:58:1: エラー: 不明な型名 ‘fr_tls_status_t’ です
fr_tls_status_t eap_tls_process(eap_session_t *eap_session);
^
src/modules/rlm_eap/libeap/eap_tls.h:67:46: エラー: 不明な型名 ‘SSL’ です
void eap_tls_gen_mppe_keys(REQUEST *request, SSL *s, char const *prf_label);
^
src/modules/rlm_eap/libeap/eap_tls.h:68:29: エラー: 不明な型名 ‘SSL’ です
void eap_ttls_gen_challenge(SSL *s, uint8_t *buffer, size_t size);
^
src/modules/rlm_eap/libeap/eap_tls.h:69:49: エラー: 不明な型名 ‘SSL’ です
void eap_tls_gen_eap_key(RADIUS_PACKET *packet, SSL *s, uint32_t header);
(snip)
- eap_tls.cでincludeされているsrc/include.hを調べてみるとWITH_TLSがdefineされないとコンパイルが通らない様に見え,openssl/ssl.hが無いと駄目な模様…ってそりゃそうだ…が,何でconfigure通ったんだろうか…
% grep -rl 'define.*WITH_TLS'
src/include/features-h
src/include/features.h
src/main/listen.c
% view src/include/features.h
(snip)
# ifdef WITHOUT_TLS
# ifndef HAVE_OPENSSL_SSL_H
# error TLS requires OpenSSL
# endif
# else
# ifdef HAVE_OPENSSL_SSL_H
# ifndef WITH_TLS
# ifndef NO_OPENSSL
# define WITH_TLS (1)
# endif
# endif
# endif
# endif
(snip)
- openssl-develを入れて再度チャレンジ…おお,compile通った!!
% sudo yum install -y openssl-devel
% ./configure
% make
(snip)