aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Richey <joerichey@google.com>2019-01-19 22:06:54 -0800
committerGitHub <noreply@github.com>2019-01-19 22:06:54 -0800
commit8956903569b187652d7f068800c240b24cb2e41e (patch)
tree2778b958dfb30b60f5294f62309a87cf9d5c68b0
parent509bb4d450cdd923bf09d05a5622cb6e98646bce (diff)
parent781395bba8fed008ef8ada0aa2f5f781a5bad30b (diff)
Merge pull request #122 from google/pam
Install pam modules/configs to the right location
-rw-r--r--.gitignore1
-rw-r--r--Makefile29
-rw-r--r--README.md9
-rw-r--r--pam_fscrypt/config6
4 files changed, 26 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore
index 68257d1..e1a4fb5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,5 +7,6 @@ bin/goimports
bin/staticcheck
bin/gocovmerge
bin/misspell
+bin/config
*coverage.out
.vscode
diff --git a/Makefile b/Makefile
index 6e84df6..8c691a5 100644
--- a/Makefile
+++ b/Makefile
@@ -105,7 +105,7 @@ lint: $(BIN)/golint $(BIN)/staticcheck $(BIN)/misspell
misspell -source=text $(FILES)
clean:
- rm -f $(BIN)/$(NAME) $(PAM_MODULE) $(TOOLS) coverage.out $(COVERAGE_FILES)
+ rm -f $(BIN)/$(NAME) $(PAM_MODULE) $(TOOLS) coverage.out $(COVERAGE_FILES) $(PAM_CONFIG)
###### Testing Commands (setup/teardown require sudo) ######
.PHONY: test test-setup test-teardown
@@ -144,23 +144,28 @@ coverage.out: $(BIN)/gocovmerge $(COVERAGE_FILES)
.PHONY: install install-bin install-pam uninstall
install: install-bin install-pam
-INSTALL := sudo install
-DESTDIR := /usr/local/bin
-PAM_MODULE_DIR := /lib/security
-PAM_CONFIG_DIR := /usr/share/pam-configs
+PREFIX := /usr/local
+DESTDIR := $(PREFIX)/bin
install-bin: $(BIN)/$(NAME)
- $(INSTALL) -d $(DESTDIR)
- $(INSTALL) $< $(DESTDIR)
+ install -d $(DESTDIR)
+ install $< $(DESTDIR)
+
+PAM_MODULE_DIR := $(PREFIX)/lib/security
+PAM_INSTALL_PATH := $(PAM_MODULE_DIR)/$(PAM_NAME).so
+PAM_CONFIG := $(BIN)/config
+PAM_CONFIG_DIR := $(PREFIX)/share/pam-configs
install-pam: $(PAM_MODULE)
- $(INSTALL) -d $(PAM_MODULE_DIR)
- $(INSTALL) $< $(PAM_MODULE_DIR)
- $(INSTALL) -d $(PAM_CONFIG_DIR)
- $(INSTALL) $(PAM_NAME)/config $(PAM_CONFIG_DIR)/$(NAME)
+ install -d $(PAM_MODULE_DIR)
+ install $(PAM_MODULE) $(PAM_MODULE_DIR)
+
+ m4 --define=PAM_INSTALL_PATH=$(PAM_INSTALL_PATH) < $(PAM_NAME)/config > $(PAM_CONFIG)
+ install -d $(PAM_CONFIG_DIR)
+ install $(PAM_CONFIG) $(PAM_CONFIG_DIR)/$(NAME)
uninstall:
- rm -f $(DESTDIR)/$(NAME) $(PAM_MODULE_DIR)/$(PAM_MODULE) $(PAM_CONFIG_DIR)/$(NAME)
+ rm -f $(DESTDIR)/$(NAME) $(PAM_INSTALL_PATH) $(PAM_CONFIG_DIR)/$(NAME)
#### Tool Building Commands ####
TOOLS := $(addprefix $(BIN)/,protoc golint protoc-gen-go goimports staticcheck gocovmerge misspell)
diff --git a/README.md b/README.md
index 3fb30e1..c5f9ca7 100644
--- a/README.md
+++ b/README.md
@@ -121,13 +121,14 @@ Once all the dependencies are installed, you can get the repository by running:
go get -d github.com/google/fscrypt/...
```
Running `make` in `$GOPATH/src/github.com/google/fscrypt` builds the
-executable (`fscrypt`) and PAM module (`pam-fscrypt.so`) in the `bin/`
+executable (`fscrypt`) and PAM module (`pam_fscrypt.so`) in the `bin/`
directory. Use `make bin/fscrypt` or `make bin/pam_fscrypt.so`
to build only one.
-Running `sudo make install` installs `fscrypt` to `/usr/local/bin` and
-`pam-fscrypt` to `/lib/security`. Use `make install-bin` or `make install-pam`
-to install only one.
+Running `sudo make install` installs `fscrypt` to `/usr/local/bin`,
+`pam_fscrypt.so` to `/usr/local/lib/security`, and `pam_fscrypt/config` to
+`/usr/local/share/pam-configs`. Use `make install-bin` to only install
+`fscrypt`. Use `make install-pam` to only install the pam files.
See the `Makefile` for instructions on how to customize the build (e.g. installing
to a custom location, using different build flags, building a static binary,
diff --git a/pam_fscrypt/config b/pam_fscrypt/config
index 795a4f8..d857e3b 100644
--- a/pam_fscrypt/config
+++ b/pam_fscrypt/config
@@ -3,11 +3,11 @@ Default: yes
Priority: 0
Auth-Type: Additional
Auth-Final:
- optional pam_fscrypt.so
+ optional PAM_INSTALL_PATH
Session-Type: Additional
Session-Interactive-Only: yes
Session-Final:
- optional pam_fscrypt.so drop_caches lock_policies
+ optional PAM_INSTALL_PATH drop_caches lock_policies
Password-Type: Additional
Password-Final:
- optional pam_fscrypt.so
+ optional PAM_INSTALL_PATH