aboutsummaryrefslogtreecommitdiffstats
path: root/main/freeradius/APKBUILD
blob: a581be1113062e076ee6ce3e68d3a30284a8e257 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# Contributor: Vladyslav Frolov <frolvlad@gmail.com>
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=freeradius
_realname=freeradius
pkgver=3.0.13
pkgrel=2
pkgdesc="RADIUS (Remote Authentication Dial-In User Service) server"
url="http://freeradius.org/"
arch="all"
license="GPL"
depends=""
makedepends="libressl-dev mariadb-dev postgresql-dev gdbm-dev readline-dev
	bash libtool autoconf automake perl-dev python2-dev openldap-dev krb5-dev
	unixodbc-dev linux-pam-dev sqlite-dev talloc-dev libpcap-dev
	linux-headers curl-dev hiredis-dev json-c-dev"
pkggroups="radius"
pkgusers="radius"
install="$pkgname.pre-install"
subpackages="$pkgname-dbg $pkgname-doc $pkgname-dev $pkgname-ldap $pkgname-lib
	$pkgname-mssql $pkgname-mysql $pkgname-sql $pkgname-perl
	$pkgname-postgresql $pkgname-python $pkgname-radclient $pkgname-sqlite
	$pkgname-unixodbc $pkgname-pam $pkgname-eap $pkgname-krb5
	$pkgname-rest $pkgname-redis"
provides="freeradius3=$pkgver-r$pkgrel"
source="ftp://ftp.freeradius.org/pub/freeradius/old/$_realname-server-$pkgver.tar.gz
	$pkgname.confd
	$pkgname.initd

	musl-fix-headers.patch
	fix-scopeid.patch
	freeradius-313-default-config.patch
	libressl.patch
	"

_builddir="$srcdir"/$_realname-server-$pkgver

radconfdir="/etc/raddb"
radmodsdir="$radconfdir/mods-available"
radlibdir="/usr/lib/freeradius"
radmodsconfdir="$radconfdir/mods-config"
ldpath="$radlibdir"

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
	# remove certs generation
	# rm -rf raddb/certs || return 1
}

build() {
	cd "$_builddir"
	# freeradius requries json.h to be in a dir called 'json'. We fool
	# the configure script with a symlink pointing to proper location.
	ln -s /usr/include/json-c json

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--datarootdir=/usr/share \
		--libdir="$radlibdir" \
		--with-logdir=/var/log/radius \
		--with-radacctdir=/var/log/radius/radacct \
		--with-system-libtool \
		--with-system-libltdl \
		--with-shared-libs \
		--with-udpfromto \
		--with-rlm_sql_sqlite \
		--with-rlm_sql_postgresql \
		--with-rlm_sql_mysql \
		--with-rlm_krb5 \
		--with-rlm_rest \
		--with-rlm_redis \
		--with-rlm_rediswho \
		--without-rlm_eap_tnc \
		--without-rlm_eap_ikev2 \
		--without-rlm_sql_iodbc \
		--without-rlm_sql_oracle \
		--without-rlm_yubikey \
		--without-rlm_ykclient \
		--with-jsonc-include-dir="$PWD" \
		|| return 1

	make -j1 LDFLAGS="$LDFLAGS -lssl" || return 1
}

package() {
	cd "$_builddir"
	install -d -m0750 -o root -g radius \
		"${pkgdir}"${radconfdir} || return 1
	install -d -m0750 -o radius -g radius \
		"$pkgdir"/var/run/radius || return 1
	install -d -m0750 -o radius -g radius \
		"$pkgdir"/var/log/radius || return 1
	install -d -m0750 -o radius -g radius \
		"$pkgdir"/var/log/radius/radacct || return 1

	PACKAGE=yes make -j1 R="$pkgdir" install || return 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 || return 1
	install -m644 -D "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/radiusd || return 1
	#Install misses to create this
	mkdir -p "${pkgdir}"${radmodsconfdir}/sql/ippool-dhcp/postgresql
}

_mvdb() {
	for dir in ippool-dhcp ippool counter main cui; do
		mkdir -p "${subpkgdir}"${radmodsconfdir}/sql/$dir
		mv "${pkgdir}"${radmodsconfdir}/sql/$dir/$1 \
		 "${subpkgdir}"${radmodsconfdir}/sql/$dir || return 1
	done
	mkdir -p "${subpkgdir}"${radlibdir}
	mv "${pkgdir}"${radlibdir}/rlm_sql_${1}.so "${subpkgdir}"${radlibdir} \
		|| return 1
}

eap() {
	depends="freeradius=$pkgver-r$pkgrel"
	provides="freeradius3-eap=$pkgver-r$pkgrel"
	pkgdesc="EAP module for FreeRADIUS server"
	mkdir -p "${subpkgdir}"${radlibdir} "$subpkgdir"/usr/bin
	mv "${pkgdir}"${radlibdir}/rlm_eap*.so "${subpkgdir}"${radlibdir} \
		|| return 1
	mv "$pkgdir"/usr/bin/radeapclient "$subpkgdir"/usr/bin || return 1
	mkdir -p "${subpkgdir}"${radmodsdir}
	mv "${pkgdir}"${radmodsdir}/eap "${subpkgdir}"${radmodsdir} || return 1
	mkdir -p "${subpkgdir}"${radconfdir}
	mv "${pkgdir}"${radconfdir}/certs "${subpkgdir}"${radconfdir} || return 1
}

ldap() {
	depends="freeradius=$pkgver-r$pkgrel"
	provides="freeradius3-ldap=$pkgver-r$pkgrel"
	pkgdesc="LDAP module for FreeRADIUS server"
	mkdir -p "${subpkgdir}"${radlibdir}
	mv "${pkgdir}"${radlibdir}/rlm_ldap* "${subpkgdir}"${radlibdir} \
		|| return 1
}

krb5() {
	depends="freeradius=$pkgver-r$pkgrel"
	provides="freeradius3-krb5=$pkgver-r$pkgrel"
	pkgdesc="Kerberos module for FreeRADIUS server"
	mkdir -p "${subpkgdir}"${radlibdir}
	mv "${pkgdir}"${radlibdir}/rlm_krb5* "${subpkgdir}"${radlibdir} \
		|| return 1
}

lib() {
	depends=""
	pkgdesc="Freeradius shared libraries"
	mkdir -p "${subpkgdir}"${radlibdir} "${subpkgdir}"${radconfdir} \
	 "$subpkgdir"/usr/share/freeradius || return 1
	mv "${pkgdir}"${radlibdir}/libfreeradius-*.so \
	 "${subpkgdir}"${radlibdir} || return 1
	mv "${pkgdir}"/usr/share/freeradius/* \
	 "${subpkgdir}"/usr/share/freeradius || return 1
}

sql() {
	depends="freeradius=$pkgver-r$pkgrel"
	provides="freeradius3-sql=$pkgver-r$pkgrel"
	pkgdesc="SQL module for FreeRADIUS server"
	mkdir -p "${subpkgdir}"${radlibdir}
	for lib in sql sqlippool sql_null sqlcounter; do
		mv "${pkgdir}"${radlibdir}/rlm_${lib}.so \
			"${subpkgdir}"${radlibdir} || return 1
	done
	mkdir -p "${subpkgdir}"${radconfdir}/sites-available
	mv "${pkgdir}"${radconfdir}/sites-available/buffered-sql \
	 "${subpkgdir}"${radconfdir}/sites-available || return 1
	mkdir -p "${subpkgdir}"${radmodsdir}
	mv "${pkgdir}"${radmodsdir}/*sql* "${subpkgdir}"${radmodsdir} \
		|| return 1
}

mysql() {
	depends="freeradius-sql=$pkgver-r$pkgrel"
	provides="freeradius3-mysql=$pkgver-r$pkgrel"
	pkgdesc="MySQL module for FreeRADIUS server"
	_mvdb mysql || return 1
}

mssql() {
	depends="freeradius-sql=$pkgver-r$pkgrel"
	provides="freeradius3-mssql=$pkgver-r$pkgrel"
	pkgdesc="MSSQL module for FreeRADIUS server"
	mkdir -p "${subpkgdir}"${radmodsconfdir}/sql/main
	mv "${pkgdir}"${radmodsconfdir}/sql/main/mssql \
	 "${subpkgdir}"${radmodsconfdir}/sql/main || return 1
}

perl() {
	depends="freeradius=$pkgver-r$pkgrel perl"
	provides="freeradius3-perl=$pkgver-r$pkgrel"
	pkgdesc="Perl module for FreeRADIUS server"
	mkdir -p "${subpkgdir}"${radlibdir}
	mv "${pkgdir}"${radlibdir}/rlm_perl* "${subpkgdir}"${radlibdir} \
		|| return 1
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/sbin/checkrad "$subpkgdir"/usr/bin/checkrad \
		|| return 1
	mkdir -p "${subpkgdir}"${radconfdir}/mods-available
	mv "${pkgdir}"${radconfdir}/mods-available/perl \
		"${subpkgdir}"${radconfdir}/mods-available/perl || return 1
}

postgresql() {
	depends="freeradius-sql=$pkgver-r$pkgrel"
	provides="freeradius3-postgresql=$pkgver-r$pkgrel"
	pkgdesc="PostgreSQL module for FreeRADIUS server"
	_mvdb postgresql || return 1
}

python() {
	depends="freeradius=$pkgver-r$pkgrel python2"
	provides="freeradius3-python=$pkgver-r$pkgrel"
	pkgdesc="Python module for FreeRADIUS server"
	mkdir -p "${subpkgdir}"${radlibdir}
	mv "${pkgdir}"${radlibdir}/rlm_python* "${subpkgdir}"${radlibdir} \
		|| return 1
	for dir in $radmodsdir $radmodsconfdir; do
		mkdir -p "${subpkgdir}"$dir
		mv "${pkgdir}"$dir/python "${subpkgdir}"$dir || return 1
	done
}

radclient() {
	depends=""
	provides="freeradius3-radclient=$pkgver-r$pkgrel"
	pkgdesc="Client for FreeRADIUS server"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/radclient "$subpkgdir"/usr/bin/radclient \
		|| return 1
}

sqlite() {
	depends="freeradius-sql=$pkgver-r$pkgrel"
	provides="freeradius3-sqlite=$pkgver-r$pkgrel"
	pkgdesc="SQLite module for FreeRADIUS server"
	_mvdb sqlite || return 1
}

unixodbc() {
	depends="freeradius=$pkgver-r$pkgrel"
	provides="freeradius3-unixodbc=$pkgver-r$pkgrel"
	pkgdesc="ODBC module for FreeRADIUS server"
	mkdir -p "${subpkgdir}"${radlibdir}
	mv "${pkgdir}"${radlibdir}/rlm_sql_unixodbc.so \
		"${subpkgdir}"${radlibdir} || return 1
}

pam() {
	depends="freeradius=$pkgver-r$pkgrel"
	provides="freeradius3-pam=$pkgver-r$pkgrel"
	pkgdesc="PAM module for FreeRADIUS server"
	mkdir -p "${subpkgdir}"${radlibdir}
	mv "${pkgdir}"${radlibdir}/rlm_pam* "${subpkgdir}"${radlibdir} \
		|| return 1
}

rest() {
	depends="freeradius=$pkgver-r$pkgrel"
	pkgdesc="REST module for FreeRADIUS server"
	mkdir -p "${subpkgdir}"${radlibdir}
	mv "${pkgdir}"${radlibdir}/rlm_rest* "${subpkgdir}"${radlibdir} \
		|| return 1
}

redis() {
	depends="freeradius=$pkgver-r$pkgrel"
	pkgdesc="Redis modules for FreeRADIUS server"
	mkdir -p "${subpkgdir}"${radlibdir}
	mv "${pkgdir}"${radlibdir}/rlm_redis* "${subpkgdir}"${radlibdir} \
		|| return 1
}

sha512sums="b4cb6203ca34ec459ea0f4f7960b4c5039ecd1be3de005251213ab6a9254d11fa9534b96d222eb83e6b35966aaeb6081362fd103eb73e0d76c009a655a47277f  freeradius-server-3.0.13.tar.gz
e248159c0a44f722e405c51c8015d9ad672e42ad0d38ca28f8a051ff911aa4d3e630b9bd4543e9d610940bc4ae50c022594e219ce341b36abe85c572acad418b  freeradius.confd
ba3c424d4eabb147c7aa3e31575a87ddb26b6a792d2a8714e73d8763e07854326a03a83991a7420246ca06bf0b93d0a6f23ec198f5e48647f9d25b40067e852a  freeradius.initd
c49e5eec7497fccde5fd09dba1ea9b846e57bc88015bd81640aa531fb5c9b449f37136f42c85fe1d7940c5963aed664b85da28442b388c9fb8cc27873df03b2d  musl-fix-headers.patch
41d478c0e40ff82fc36232964037c1ab8ffca9fdbb7dca02ed49319906e751c133b5d7bc7773c645cec6d9d39d1de69cba25e8d59afa8d6662563dd17f35f234  fix-scopeid.patch
666e15a3c3e5b98ff8c3168de85b341606af5e2790af379ddec46464e9d7de14a715876a34ba1eb7fa47ddead23f7134128d591db32309db0e4acbdb6f21ef5e  freeradius-313-default-config.patch
b80664efeab55e36880df400021e2c958f65825e55f81d618e087cee5e98f56d149e898f3162744131d3d0bd6c600715e8ddc04a28f0e720c07cc8920ea80ed4  libressl.patch"