2023-03-07 02:50:45 +01:00
|
|
|
FROM freeradius/freeradius-server:latest
|
2019-10-31 01:48:15 +01:00
|
|
|
EXPOSE 1812 1813
|
2023-03-07 02:50:45 +01:00
|
|
|
ARG RADIUS_USER=freerad
|
|
|
|
ARG TZ=Etc/UTC
|
|
|
|
ENV TZ=$TZ
|
|
|
|
# These all need to be on one line else the cache ends up in the layers.
|
|
|
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
freeradius-utils \
|
2022-06-20 12:16:55 +02:00
|
|
|
hostname \
|
2023-03-07 02:50:45 +01:00
|
|
|
python3 \
|
|
|
|
python3-pip \
|
|
|
|
python-is-python3 \
|
|
|
|
tzdata \
|
2022-06-20 12:16:55 +02:00
|
|
|
iproute2 \
|
2023-03-07 02:50:45 +01:00
|
|
|
iputils-ping iputils-tracepath \
|
2022-08-01 10:55:44 +02:00
|
|
|
openssl \
|
2023-03-07 02:50:45 +01:00
|
|
|
curl && apt-get clean
|
2022-06-20 12:16:55 +02:00
|
|
|
|
2023-03-02 03:47:23 +01:00
|
|
|
ADD rlm_python/mods-available/ /etc/raddb/mods-available/
|
|
|
|
COPY rlm_python/sites-available/ /etc/raddb/sites-available/
|
2022-06-20 12:16:55 +02:00
|
|
|
|
|
|
|
# Set a working directory of /etc/raddb
|
|
|
|
WORKDIR /etc/raddb
|
2019-10-31 01:48:15 +01:00
|
|
|
|
2020-01-02 08:54:50 +01:00
|
|
|
# Enable the python and cache module.
|
2023-02-17 08:02:01 +01:00
|
|
|
RUN ln -s /etc/raddb/mods-available/python3 /etc/raddb/mods-enabled/python3 && \
|
|
|
|
ln -s /etc/raddb/sites-available/check-eap-tls /etc/raddb/sites-enabled/check-eap-tls
|
2019-10-31 01:48:15 +01:00
|
|
|
|
2022-06-20 12:16:55 +02:00
|
|
|
# disable auth via methods we don't support!
|
2023-03-07 02:50:45 +01:00
|
|
|
# RUN rm /etc/raddb/mods-available/sql && \
|
|
|
|
# rm /etc/raddb/mods-enabled/{passwd,totp}
|
|
|
|
|
2019-10-31 01:48:15 +01:00
|
|
|
|
2022-06-20 12:16:55 +02:00
|
|
|
# Allows the radiusd user to write to the directory
|
2023-03-10 00:00:19 +01:00
|
|
|
RUN chown -R $RADIUS_USER. /etc/raddb/ && \
|
2023-02-17 08:02:01 +01:00
|
|
|
chmod 775 /etc/raddb/certs && \
|
|
|
|
chmod 640 /etc/raddb/clients.conf
|
2019-10-31 01:48:15 +01:00
|
|
|
|
2022-06-20 12:16:55 +02:00
|
|
|
RUN mkdir -p /pkg/pykanidm/
|
|
|
|
COPY pykanidm/ /pkg/pykanidm/
|
2019-10-31 01:48:15 +01:00
|
|
|
|
2022-06-20 12:16:55 +02:00
|
|
|
# install the package and its dependencies
|
2023-02-17 08:02:01 +01:00
|
|
|
RUN python3 -m pip install --no-cache-dir --no-warn-script-location /pkg/pykanidm && \
|
|
|
|
rm -rf /pkg/*
|
|
|
|
|
2023-03-02 03:47:23 +01:00
|
|
|
COPY rlm_python/radius_entrypoint.py /radius_entrypoint.py
|
2019-10-31 01:48:15 +01:00
|
|
|
|
2022-10-02 03:28:58 +02:00
|
|
|
ENV KANIDM_CONFIG_FILE="/data/kanidm"
|
2022-06-20 12:16:55 +02:00
|
|
|
|
2023-03-07 02:50:45 +01:00
|
|
|
RUN chmod a+r /etc/raddb/certs/ -R
|
|
|
|
USER $RADIUS_USER
|
2023-02-17 08:02:01 +01:00
|
|
|
|
2022-09-29 02:08:15 +02:00
|
|
|
CMD [ "/usr/bin/python3", "/radius_entrypoint.py" ]
|