How to compile luci-app-radius

This topic only outlines how to compile luci-app-radius, which is a very simple radius management in LuCI that sets radius up for users and clients. This implementation would not likely be suitable as a real home network AAA server.

This topic could probably be used as an outline on how to compile other openwrt packages for the Omnia environment.

This topic assumes knowledge of the command line, how to install applications in the build host system and other related knowledge.

Find some space on a local disk. The Vagrant LXC and the source code was close to 12 gigabytes.

One of the first things to do is retrieve the luci-app-radius package:

git clone GitHub - MuJJus/luci-app-radius: OpenWrt Radius Server Management

For the next steps, follow the instructions on how to build TurrisOS from sources. Before the Vagrant LXC is created, copy the luci-app-radius directory into the source directory. The source directory will be either openwrt or turris-os depending on the repository you pulled it from.

The luci-app-radius directory was copied to a subdirectory under feeds.

user@buildhost:/[build-directory]/turris-os$ mkdir feeds/luci-app-radius
user@buildhost:/[build-directory]/turris-os$ cp -rp /[source-directory]/luci-app-radius feeds/luci-app-radius

Now, create and ssh into the container from the instructions above.

Once in the container follow the steps to update and install the feeds and copy the config from the instructions. Then create a link from the luci-app-radius directory into “package/feeds/packages”:

vagrant@turris-buildroot:/openwrt$ cd package/feeds/packages/
vagrant@turris-buildroot:/openwrt/package/feeds/packages$ ln -s …/…/…/feeds/luci-app-radius/luci-app-radius .

Change directory up to “/openwrt”.

Next run “make menuconfig”

vagrant@turris-buildroot:/openwrt$ make menuconfig

luci-app-radius depends on freeradius2-democerts, freeradius2-mod-eap-mschapv2, freeradius2-mod-eap-peap, freeradius2-mod-eap-tls, and freeradius2-mod-files. That means it will not show up in menuconfig until all it’s dependencies are selected.

To select all the dependencies needed, go to the

Network —>

menu then the

FreeRADIUS (version 2) —>

menu, then pick each of the dependencies as “M”. Beyond that it shouldn’t matter what else is selected since only one program is being compiled. Avoid de-selecting anything to minimize disruptions. Exit out of the “menuconfig”

The package can now be built:

vagrant@turris-buildroot:/openwrt$ make package/luci-app-radius/install

The resulting package can be found at:

/openwrt/bin/mvebu/packages/packages/luci-app-radius_0.1-1_all.ipk

All that’s left is to copy it to the router and install it. It is recommended to re-naming it to luci-app-radius_0.1-1_all.opk since the opkg manager on the Omnia doesn’t appear to recognize ipk packages once they’re installed and apparently cannot be uninstalled it until it is reinstalled as an opk package.

For now the compiled package can be found here, though that may be removed in the future. Also don’t install packages on your router from a strange source.

FROM fedora:25

ENV SDK OpenWrt-SDK-mvebu_gcc-4.8-linaro_musl-1.1.15_eabi.Linux-x86_64

RUN dnf upgrade -y &&
dnf install -y git wget bzip2 findutils ccache gcc which &&
wget --no-check-certificate https://api.turris.cz/openwrt-repo/omnia/$SDK.tar.bz2 --directory-prefix=/tmp &&
mkdir -p /turris/ipk &&
tar xvjf /tmp/$SDK.tar.bz2 --directory=/turris &&
rm -rf /tmp/$SDK.tar.bz2 &&
git clone https://github.com/MuJJus/luci-app-radius.git /turris/$SDK/package/luci-app-radius &&
export PATH=$PATH:/turris/$SDK/staging_dir/toolchain-arm_cortex-a9+vfpv3_gcc-4.8-linaro_musl-1.1.15_eabi/bin &&\
make CXX=arm-openwrt-linux-g++ LD=arm-openwrt-linux-ld V=s -C /turris/$SDK &&
cp /turris/OpenWrt-SDK-mvebu_gcc-4.8-linaro_musl-1.1.15_eabi.Linux-x86_64/bin/mvebu-musl/packages/base/*.ipk /turris/ipk/

CMD [“cp”,"-r","/turris/ipk/","/tmp"]

put this is a file called “Dockerfile”
**indent every line between RUN and CMD by 3-4 spaces for better readability

docker build -t turris.radius .
docker run --rm -v /tmp:/tmp turris.radius

these files will now appear in /tmp/ipk/ on the host system
luci-app-radius_0.1-1_all.ipk

**delete docker image
docker rmi turris.radius

I’m horrible with these online editors…how did you make those grey boxes? Is there a way to indent text? I would like to create a few leading spaces for my posted Dockerfile.

This is just an alternate way to compile that package. you don’t really need to do it with Docker, you can see the commands that we’re used. I think the whole make menuconfig thing is for creating images and is probably a bit overkill for compiling a single package. I haven’t had any issues installing ipk packages, what issues were you having?

For now the compiled package can be found here1, though that may be removed in the future. Also don’t install packages on your router from a strange source.

Sorry, just had to comment on this…for anyone else but you, that is a strange source : )

If you look at the Makefile for luci-app-radius

DEPENDS:=+freeradius2-democerts +freeradius2-mod-eap-mschapv2 +freeradius2-mod-eap-peap +freeradius2-mod-eap-tls +freeradius2-mod-files

this means that the the luci-app-radius is dependent upon these package (this dependency information is stored the ipk package itself) so when you try to install luci-app-radius, opkg will read that dependency information and will attempt to download and install the above freeradius2 package before installing luci-app-radius.
luci-app-radius cannot be installed without these package being installed first (unless you force it).

since these freeradius2 packages already exist in the turris repo, when don’t need to take them into account when compiling the luci-app-radius package.

That’s why I said it. Haha.

Sort of. luci-app-radius wont show up in menuconfig unless they’re also selected in menuconfig.