# Contributor: Natanael Copa # Maintainer: Leonardo Arena pkgname=freeradius pkgver=2.2.3 pkgrel=5 pkgdesc="RADIUS (Remote Authentication Dial-In User Service) server" url="http://freeradius.org/" arch="all" license="GPL" depends="freeradius-radclient freeradius-lib" makedepends="openssl-dev mysql-dev postgresql-dev gdbm-dev readline-dev bash libtool autoconf automake perl-dev python-dev openldap-dev unixodbc-dev linux-pam-dev sqlite-dev" pkggroups="radius" pkgusers="radius" install="freeradius.pre-install" subpackages="$pkgname-doc $pkgname-dev $pkgname-dbg $pkgname-ldap $pkgname-lib $pkgname-mssql $pkgname-mysql $pkgname-oracle $pkgname-perl $pkgname-postgresql $pkgname-python $pkgname-radclient $pkgname-sqlite $pkgname-unixodbc $pkgname-pam $pkgname-webif $pkgname-webif-doc" source="ftp://ftp.freeradius.org/pub/freeradius/$pkgname-server-$pkgver.tar.gz freeradius.confd freeradius.initd CVE-2014-2015.patch " _builddir="$srcdir"/$pkgname-server-$pkgver prepare() { cd "$_builddir" for i in $source; do case $i in *.patch) msg "Applying $i" patch -p1 -i "$srcdir"/$i || return 1 ;; esac done update_config_sub || return 1 # we dont have libnsl sed -i 's/nsl, //g' configure.in || return 1 # Fix compilation with heimdal >= 1.3.1 sed -i 's/ -DKRB5_DEPRECATED//' src/modules/rlm_krb5/Makefile.in || return 1 # Fix default config sed -i 's%run_dir = .*%run_dir = \$\{localstatedir\}/run/radius%' \ raddb/radiusd.conf.in || return 1 # disable directive that pulls in freeradius-mysql package sed -i 's%$INCLUDE ${confdir}/sql/mysql/ippool-dhcp.conf%#$INCLUDE ${confdir}/sql/mysql/ippool-dhcp.conf%' \ raddb/modules/dhcp_sqlippool || return 1 rm -f libtool.m4 libtoolize --force -c || return 1 aclocal && ./autogen.sh || return 1 } build() { cd "$_builddir" ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --localstatedir=/var \ --libdir=/usr/lib/freeradius \ --disable-static \ --enable-shared \ --disable-ltdl-install \ --with-system-libtool \ --with-system-libltdl \ --with-udpfromto \ --with-experimental-modules \ --with-rlm_sql_sqlite \ --without-rlm_sql_oracle \ --without-rlm_sql_iodbc \ --without-rlm_sql_firebird \ --without-rlm_sql_db2 \ --without-rlm_ruby \ --without-rlm_rediswho \ --without-rlm_redis \ --without-rlm_krb5 \ || return 1 # * workaround parallel build issue # * add -lssl to fix: # radiusd: symbol 'SSL_set_ex_data': can't resolve symbol in lib # '/usr/lib/freeradius/libfreeradius-eap-2.1.10.so'. make LDFLAGS="$LDFLAGS -lssl" LIBTOOL="$PWD/libtool" || return 1 } package() { cd "$_builddir" install -d -m0750 -o root -g radius "$pkgdir"/etc/raddb install -d -m0750 -o radius -g radius "$pkgdir"/var/run/radius install -d -m0750 -o radius -g radius "$pkgdir"/var/log/radius install -d -m0750 -o radius -g radius "$pkgdir"/var/log/radius/radacct make -j1 R="$pkgdir" LIBTOOL="$PWD/libtool" install #sed -i -e 's:^#user *= *radius:user = radiusd:;s:^#group *= *radius:group = radiusd:' \ # "$pkgdir"/etc/raddb/radiusd.conf || exit 1 chown -R root:radius "$pkgdir"/etc/raddb/* rm -f "$pkgdir/usr/sbin/rc.radiusd" install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/radiusd install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/radiusd install -m644 -D scripts/logrotate.freeradius "$pkgdir"/etc/logrotate.d/$pkgname find $pkgdir -iname *.la -delete } ldap() { depends="freeradius" mkdir -p $subpkgdir/etc/raddb mv $pkgdir/etc/raddb/ldap.attrmap $subpkgdir/etc/raddb || exit 1 mkdir -p $subpkgdir/etc/raddb/modules mv $pkgdir/etc/raddb/modules/ldap $subpkgdir/etc/raddb/modules || exit 1 mkdir -p $subpkgdir/usr/lib/freeradius mv $pkgdir/usr/lib/freeradius/rlm_ldap* $subpkgdir/usr/lib/freeradius || exit 1 } lib() { replaces="freeradius" depends="" mkdir -p $subpkgdir/usr/lib/freeradius $subpkgdir/etc/raddb \ $subpkgdir/usr/share || exit 1 mv $pkgdir/usr/lib/freeradius/libfreeradius-*.so \ $subpkgdir/usr/lib/freeradius || exit 1 mv $pkgdir/etc/raddb/dictionary $subpkgdir/etc/raddb/dictionary || exit 1 mv $pkgdir/usr/share/freeradius $subpkgdir/usr/share/freeradius || exit 1 } mysql() { depends="freeradius" mkdir -p $subpkgdir/etc/raddb/sql mv $pkgdir/etc/raddb/sql/mysql $subpkgdir/etc/raddb/sql || exit 1 mv $pkgdir/etc/raddb/sql/ndb $subpkgdir/etc/raddb/sql || exit 1 mkdir -p $subpkgdir/usr/lib/freeradius mv $pkgdir/usr/lib/freeradius/rlm_sql_mysql* $subpkgdir/usr/lib/freeradius || exit 1 } mssql() { depends="freeradius" arch="noarch" mkdir -p $subpkgdir/etc/raddb/sql mv $pkgdir/etc/raddb/sql/mssql $subpkgdir/etc/raddb/sql || exit 1 } oracle() { depends="freeradius" arch="noarch" mkdir -p $subpkgdir/etc/raddb/sql mv $pkgdir/etc/raddb/sql/oracle $subpkgdir/etc/raddb/sql || exit 1 } perl() { depends="freeradius perl" mkdir -p $subpkgdir/usr/lib/freeradius mv $pkgdir/usr/lib/freeradius/rlm_perl* $subpkgdir/usr/lib/freeradius || exit 1 mkdir -p $subpkgdir/usr/bin mv $pkgdir/usr/sbin/checkrad $subpkgdir/usr/bin/checkrad || exit 1 mkdir -p $subpkgdir/etc/raddb/modules mv $pkgdir/etc/raddb/modules/perl $subpkgdir/etc/raddb/modules/perl || exit 1 } postgresql() { depends="freeradius" mkdir -p $subpkgdir/etc/raddb/sql mv $pkgdir/etc/raddb/sql/postgresql $subpkgdir/etc/raddb/sql || exit 1 mkdir -p $subpkgdir/usr/lib/freeradius mv $pkgdir/usr/lib/freeradius/rlm_sql_postgresql* $subpkgdir/usr/lib/freeradius || exit 1 } python() { depends="freeradius python" mkdir -p $subpkgdir/usr/lib/freeradius mv $pkgdir/usr/lib/freeradius/rlm_python* $subpkgdir/usr/lib/freeradius || exit 1 } radclient() { depends="" mkdir -p $subpkgdir/usr/bin mv $pkgdir/usr/bin/radclient $subpkgdir/usr/bin/radclient || exit 1 } sqlite() { depends="freeradius" mkdir -p $subpkgdir/usr/lib/freeradius mv $pkgdir/usr/lib/freeradius/rlm_sql_sqlite* $subpkgdir/usr/lib/freeradius || exit 1 } unixodbc() { depends="freeradius" mkdir -p $subpkgdir/usr/lib/freeradius mv $pkgdir/usr/lib/freeradius/rlm_sql_unixodbc* $subpkgdir/usr/lib/freeradius || exit 1 } pam() { depends="freeradius" mkdir -p $subpkgdir/usr/lib/freeradius mv $pkgdir/usr/lib/freeradius/rlm_pam* $subpkgdir/usr/lib/freeradius || exit 1 } webif() { depends="php" pkgdesc="Dialupadmin interface for FreeRADIUS" arch="noarch" mkdir -p $subpkgdir/usr/share/webapps/dialupadmin mkdir -p $subpkgdir/usr/share/doc/freeradius/dialupadmin mkdir -p $subpkgdir/etc/raddb/dialupadmin for dir in bin htdocs html lib sql; do mv $_builddir/dialup_admin/$dir \ $subpkgdir/usr/share/webapps/dialupadmin || exit 1 done mkdir -p $subpkgdir-doc/usr/share/doc/freeradius/dialupadmin mv $_builddir/dialup_admin/doc/* \ $subpkgdir-doc/usr/share/doc/freeradius/dialupadmin || exit 1 mv $_builddir/dialup_admin/README \ $subpkgdir-doc/usr/share/doc/freeradius/dialupadmin || exit 1 mv $_builddir/dialup_admin/conf/* $subpkgdir/etc/raddb/dialupadmin || exit 1 for file in $(ls $subpkgdir/usr/share/webapps/dialupadmin/bin) do sed -i "s|/usr/local/dialup_admin/conf|/etc/raddb/dialupadmin|g" \ $subpkgdir/usr/share/webapps/dialupadmin/bin/$file sed -i "s|/data/local/dialupadmin/conf|/etc/raddb/dialupadmin|g" \ $subpkgdir/usr/share/webapps/dialupadmin/bin/$file done } md5sums="3186e75882c5aaed699da55be10511fe freeradius-server-2.2.3.tar.gz fc6693f3df5a0694610110287a28568a freeradius.confd b3eefdfc466d80c241cd1bb11face405 freeradius.initd 7dd09b1b0631f6bf126517e737c5e576 CVE-2014-2015.patch" sha256sums="3be1e132f243ac53a7d35e0710bd116e8e126b64a1fc1198034195355072f593 freeradius-server-2.2.3.tar.gz 2d5b3e1af1299373182f2c8021bdf45c29db5d82b0a077b965a16ded32cb6292 freeradius.confd 719bbe4a44df60e76f68d327f7ee70d4dfd6a95e51f9cb01f850cd4ed153f9de freeradius.initd d70b898811cbbb9d77d9863a7ba9b243b9782bdc767b586e4e9b8787558f1072 CVE-2014-2015.patch" sha512sums="d51208d9926872292ef333bcf4e556a7fd06ac78def846c620422258c18ab77f98a22459a78bb92a35e684469d167a018ba2d47d894c32c7368a57e79fba9ede freeradius-server-2.2.3.tar.gz e248159c0a44f722e405c51c8015d9ad672e42ad0d38ca28f8a051ff911aa4d3e630b9bd4543e9d610940bc4ae50c022594e219ce341b36abe85c572acad418b freeradius.confd 57f12f06ef9112817204dec4ab2591bcd4baf3c8a033afadb2376e115911f76045c70b7a2c80b294a83dac4e05b1ff22335a3bcc9af1c0760682622ab2cdbd31 freeradius.initd 62d98d8316e147d57de9ac05c05c9703c08bd23e294b95827c58fe976cb3bc5ce040d9e310ada552cb2350dde9e9e2c97e2160210cc1ab5d1ce35889000d7951 CVE-2014-2015.patch"