Skip to content

Commit

Permalink
Merge pull request #4 from jsaathof/fix-build
Browse files Browse the repository at this point in the history
Fix build
  • Loading branch information
nilsbehlen authored Aug 24, 2023
2 parents 8ff6d52 + ba7d31f commit 584db53
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include/json.hpp
*.o
pam_privacyidea.so
*.swp
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
CC = g++
CFLAGS = -g -Wall -fPIC -Iinclude
LDFLAGS = -Wno-undef -lcurl --shared

# Determine which folder to use
libdir.x86_64 = /lib64/security
libdir.i686 = /lib/security

MACHINE := $(shell uname -m)
libdir = $(libdir.$(MACHINE))

target = pam_privacyidea.so
objects = src/pam_privacyidea.o src/PrivacyIDEA.o

all: pam_privacyidea.so

$(objects): src/%.o: src/%.cpp

%.o:
$(CC) -c $(CFLAGS) $< -o $@

$(target): $(objects)
$(CC) $(LDFLAGS) -o $@ $^

clean:
rm -f src/*.o $(target)

install: all
strip --strip-unneeded $(target)
cp $(target) $(libdir)

uninstall:
rm $(libdir)/$(target)

.PHONY: all clean install uninstall
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@
* Multi-Challenge

## Build
This project requires the [very good JSON parser from nlohmann](https://github.com/nlohmann/json). Put the single include file `json.hpp` in `include`.
This project requires the [very good JSON parser from nlohmann](https://github.com/nlohmann/json). Put the `json.hpp` file from the `single_include` folder in `include`.

It also requires the following libraries: `libcurl4-openssl-dev`, `libssl-dev`, `libpam0g-dev`
Compilation requires g++ and make. Installation also uses strip to remove debug symbols from the module.

Compile with:

g++ -Wall -fPIC -g -Iinclude -c /path/to/src/pam_privacyidea.cpp -o obj/(Debug/Release)/src/pam_privacyidea.o
g++ -Wall -fPIC -g -Iinclude -c /path/to/src/PrivacyIDEA.cpp -o obj/(Debug/Release)/src/PrivacyIDEA.o
g++ -shared obj/(Debug/Release)/src/pam_privacyidea.o obj/(Debug/Release)/src/PrivacyIDEA.o -o bin/(Debug/Release)/pam_privacyidea.so -Wno-undef -lcurl
make

Install and remove with:

make install
make uninstall

This will install the PAM module in `/lib/security` or `/lib64/security`

## Configuration
The following values can be appended to the pam config file line that references this module:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 584db53

Please sign in to comment.