2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchurl, fetchpatch, autoreconfHook, talloc, finger_bsd, perl
|
2016-03-16 08:15:55 +01:00
|
|
|
, openssl
|
|
|
|
, linkOpenssl? true
|
|
|
|
, openldap
|
2017-01-26 03:00:26 +01:00
|
|
|
, withLdap ? true
|
2016-03-16 08:15:55 +01:00
|
|
|
, sqlite
|
2017-01-26 03:00:26 +01:00
|
|
|
, withSqlite ? true
|
2016-03-16 08:15:55 +01:00
|
|
|
, libpcap
|
|
|
|
, withPcap ? true
|
|
|
|
, libcap
|
|
|
|
, withCap ? true
|
|
|
|
, libmemcached
|
|
|
|
, withMemcached ? false
|
|
|
|
, hiredis
|
|
|
|
, withRedis ? false
|
2019-09-22 09:38:09 +02:00
|
|
|
, libmysqlclient
|
2016-03-16 08:15:55 +01:00
|
|
|
, withMysql ? false
|
2016-10-01 23:23:05 +02:00
|
|
|
, json_c
|
2016-03-16 08:15:55 +01:00
|
|
|
, withJson ? false
|
|
|
|
, libyubikey
|
|
|
|
, withYubikey ? false
|
|
|
|
, collectd
|
|
|
|
, withCollectd ? false
|
2018-08-01 02:19:25 +02:00
|
|
|
, curl
|
|
|
|
, withRest ? false
|
2016-03-16 08:15:55 +01:00
|
|
|
}:
|
2016-03-13 08:22:27 +01:00
|
|
|
|
2016-03-16 08:15:55 +01:00
|
|
|
assert withSqlite -> sqlite != null;
|
|
|
|
assert withLdap -> openldap != null;
|
|
|
|
assert withPcap -> libpcap != null;
|
|
|
|
assert withCap -> libcap != null;
|
|
|
|
assert withMemcached -> libmemcached != null;
|
|
|
|
assert withRedis -> hiredis != null;
|
2019-09-22 09:38:09 +02:00
|
|
|
assert withMysql -> libmysqlclient != null;
|
2016-03-16 08:15:55 +01:00
|
|
|
assert withYubikey -> libyubikey != null;
|
|
|
|
assert withCollectd -> collectd != null;
|
2018-08-01 02:19:25 +02:00
|
|
|
assert withRest -> curl != null && withJson;
|
2016-03-13 08:22:27 +01:00
|
|
|
|
2016-03-16 08:15:55 +01:00
|
|
|
## TODO: include windbind optionally (via samba?)
|
|
|
|
## TODO: include oracle optionally
|
|
|
|
## TODO: include ykclient optionally
|
|
|
|
|
2021-01-15 08:07:56 +01:00
|
|
|
with lib;
|
2016-03-13 08:22:27 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "freeradius";
|
2020-08-20 10:38:50 +02:00
|
|
|
version = "3.0.21";
|
2016-03-13 08:22:27 +01:00
|
|
|
|
2017-01-26 03:00:26 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-${version}.tar.gz";
|
2020-08-20 10:38:50 +02:00
|
|
|
sha256 = "1bij07angf6ll6bq8lccd4fx1a1clf7k13kh5vbryh6lf7a19y9b";
|
2017-01-26 03:00:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ autoreconfHook ];
|
|
|
|
|
|
|
|
buildInputs = [ openssl talloc finger_bsd perl ]
|
2016-10-01 23:23:05 +02:00
|
|
|
++ optional withLdap openldap
|
|
|
|
++ optional withSqlite sqlite
|
|
|
|
++ optional withPcap libpcap
|
|
|
|
++ optional withCap libcap
|
|
|
|
++ optional withMemcached libmemcached
|
|
|
|
++ optional withRedis hiredis
|
2019-09-22 09:38:09 +02:00
|
|
|
++ optional withMysql libmysqlclient
|
2016-10-01 23:23:05 +02:00
|
|
|
++ optional withJson json_c
|
|
|
|
++ optional withYubikey libyubikey
|
2018-08-01 02:19:25 +02:00
|
|
|
++ optional withCollectd collectd
|
|
|
|
++ optional withRest curl;
|
|
|
|
|
2016-03-16 08:15:55 +01:00
|
|
|
|
2016-03-13 08:22:27 +01:00
|
|
|
configureFlags = [
|
2018-08-01 02:19:25 +02:00
|
|
|
"--sysconfdir=/etc"
|
|
|
|
"--localstatedir=/var"
|
2016-03-16 08:15:55 +01:00
|
|
|
] ++ optional (!linkOpenssl) "--with-openssl=no";
|
2016-03-13 08:22:27 +01:00
|
|
|
|
2021-01-15 08:07:56 +01:00
|
|
|
patches = lib.optional withRest (fetchpatch {
|
2020-02-27 17:59:01 +01:00
|
|
|
# Fix HTTP/2 in rest
|
|
|
|
url = "https://github.com/FreeRADIUS/freeradius-server/commit/6286520698a3cc4053b4d49eb0a61d9ba77632aa.patch";
|
|
|
|
sha256 = "1ycvr3ql1mfkvzydnn4aiygnidicv2hgllppv37nb1p2pk02159g";
|
|
|
|
});
|
|
|
|
|
2016-04-27 09:07:38 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/main/checkrad.in --replace "/usr/bin/finger" "${finger_bsd}/bin/finger"
|
|
|
|
'';
|
|
|
|
|
2020-02-28 10:50:43 +01:00
|
|
|
# By default, freeradius will generate Diffie-Hellman parameters and
|
|
|
|
# self-signed TLS certificates during installation. We don't want
|
|
|
|
# this, for several reasons:
|
|
|
|
# - reproducibility (random generation)
|
|
|
|
# - we don't want _anybody_ to use a cert where the private key is on our public binary cache!
|
|
|
|
# - we don't want the certs to change each time the package is rebuilt
|
|
|
|
# So let's avoid anything getting into our output.
|
|
|
|
makeFlags = [ "LOCAL_CERT_FILES=" ];
|
|
|
|
|
2016-03-13 08:22:27 +01:00
|
|
|
installFlags = [
|
|
|
|
"sysconfdir=\${out}/etc"
|
|
|
|
"localstatedir=\${TMPDIR}"
|
2020-02-28 10:50:43 +01:00
|
|
|
"INSTALL_CERT_FILES=" # see comment at makeFlags
|
2016-03-16 08:15:55 +01:00
|
|
|
];
|
2016-03-13 08:22:27 +01:00
|
|
|
|
2018-08-01 02:19:25 +02:00
|
|
|
outputs = [ "out" "dev" "man" "doc" ];
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://freeradius.org/";
|
2016-03-13 08:22:27 +01:00
|
|
|
description = "A modular, high performance free RADIUS suite";
|
2017-09-02 01:08:07 +02:00
|
|
|
license = licenses.gpl2;
|
2020-02-27 18:07:55 +01:00
|
|
|
maintainers = with maintainers; [ sheenobu willibutz fpletz lheckemann elseym ];
|
2016-08-02 19:50:55 +02:00
|
|
|
platforms = with platforms; linux;
|
2016-03-13 08:22:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|