Skip to content

Instantly share code, notes, and snippets.

@iilei
Last active February 23, 2020 09:16
Show Gist options
  • Save iilei/c2d594ed4291b93f65c516de74e693fd to your computer and use it in GitHub Desktop.
Save iilei/c2d594ed4291b93f65c516de74e693fd to your computer and use it in GitHub Desktop.
[WIP] attempt to get argon2 password hashing into keycloak 9.0.0
FROM jboss/keycloak:9.0.0
ENV HASH_PROVIDER_NAME=argon2-password-hash-provider
ENV HASH_PROVIDER_REF=9.0.0
ENV MAVEN_REF=3.5.4
USER root
RUN microdnf install wget yum
WORKDIR /etc/yum.repos.d/
RUN wget https://download.opensuse.org/repositories/home:waveclaw:UnrealIRCd5/RHEL_7/home:waveclaw:UnrealIRCd5.repo && \
yum --assumeyes install argon2
RUN mkdir -p /opt/jboss
WORKDIR /opt/jboss
# install maven
RUN wget https://apache.uib.no/maven/maven-3/${MAVEN_REF}/binaries/apache-maven-${MAVEN_REF}-bin.tar.gz -O /tmp/apache-maven-${MAVEN_REF}-bin.tar.gz &&\
tar zxvf /tmp/apache-maven-${MAVEN_REF}-bin.tar.gz -C /tmp && \
mv /tmp/apache-maven-${MAVEN_REF} /opt/jboss/maven &&\
export M2_HOME=/opt/jboss/maven
# see https://github.com/dreezey/keycloak-argon2-password-hash-provider/tree/9.0.0
RUN wget https://github.com/dreezey/${HASH_PROVIDER_NAME}/archive/${HASH_PROVIDER_REF}.tar.gz -O /tmp/${HASH_PROVIDER_NAME}.tar.gz &&\
tar zxvf /tmp/${HASH_PROVIDER_NAME}.tar.gz -C /tmp && \
mkdir -p /usr/src && mv /tmp/${HASH_PROVIDER_NAME}-${HASH_PROVIDER_REF} /usr/src/${HASH_PROVIDER_NAME}-${HASH_PROVIDER_REF}
WORKDIR /usr/src/${HASH_PROVIDER_NAME}-${HASH_PROVIDER_REF}
RUN export PATH="$PATH:/opt/jboss/maven/bin" && \
mvn install
RUN echo "layers=keycloak,custom" >| /opt/jboss/keycloak/modules/layers.conf && \
mkdir -p /opt/jboss/keycloak/modules/system/layers/custom && \
cp /usr/src/${HASH_PROVIDER_NAME}-${HASH_PROVIDER_REF}/jar-module/target/${HASH_PROVIDER_NAME}-module-${HASH_PROVIDER_REF}.jar /opt/jboss/keycloak/modules/system/layers/custom/ && \
cp -r /usr/src/${HASH_PROVIDER_NAME}-${HASH_PROVIDER_REF}/ear-module/target/${HASH_PROVIDER_NAME}-bundle-${HASH_PROVIDER_REF}.ear /opt/jboss/keycloak/standalone/deployments/
USER 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment