Compiling NSS module in Docker Alpine – fatal error: nss.h: No such file or directory

I built a SSH bastion image which allows customers to plug themselves over reverse SSH (both of them has an assigned port thanks to permitopen clause on authorized keys). I achieved this through a generic account which handles all public keys. Those keys are dynamically retrieved through a BASH script which pulls them from a HTTP server (AuthorizedKeysCommand SSHD option).

My issue comes from the bastion’s userbase which I would like being dynamic too (instead of having a generic user). To do that, I need a HTTP NSS module which does not exist as a native package, so I have to build it myself.

As a beginning, I found this project

Before updating the source code according to my needs, I’m trying to compile it in a sandbox image but I’m facing this compilation error

In file included from nss_http-passwd.c:1:
nss_http.h:8:10: fatal error: nss.h: No such file or directory
 #include <nss.h>
compilation terminated.
make: *** [Makefile:20: nss_http-passwd] Error 1

My current image is

FROM alpine

RUN apk update && 
    apk add bash gcc autoconf automake cmake make libc-dev curl-dev jansson-dev && 
    mkdir /src


COPY . /src/

RUN make && make install

nss and nss-dev Alpine packages are linked to another NSS (Network Security Service)…

Any help would be greatly appreciated!

Source: StackOverflow