Compare commits
14 Commits
wip/sops-s
...
wip/sops-s
Author | SHA1 | Date | |
---|---|---|---|
d3ef88e12c | |||
0ada39be78 | |||
9112a61a16 | |||
![]() |
db343cab67 | ||
![]() |
88eb769cff | ||
![]() |
58177541fa | ||
![]() |
b72a73dd19 | ||
![]() |
10c6b4ef29 | ||
![]() |
f1364f638c | ||
![]() |
d4fa0ac802 | ||
![]() |
6fa2d6966b | ||
![]() |
847f2b7758 | ||
![]() |
d636b3f526 | ||
![]() |
b968095e8a |
804
Makefile
804
Makefile
@@ -50,6 +50,9 @@ browserpass-openbsd64: *.go **/*.go
|
||||
browserpass-freebsd64: *.go **/*.go
|
||||
env GOOS=freebsd GOARCH=amd64 go build -o $@
|
||||
|
||||
browserpass-dragonfly64: *.go **/*.go
|
||||
env GOOS=dragonfly GOARCH=amd64 go build -o $@
|
||||
|
||||
browserpass-windows64: *.go **/*.go
|
||||
env GOOS=windows GOARCH=amd64 go build -o $@.exe
|
||||
|
||||
@@ -75,7 +78,7 @@ clean:
|
||||
rm -rf vendor
|
||||
|
||||
.PHONY: dist
|
||||
dist: clean vendor browserpass-linux64 browserpass-arm browserpass-arm64 browserpass-darwin64 browserpass-darwin-arm64 browserpass-openbsd64 browserpass-freebsd64 browserpass-windows64
|
||||
dist: clean vendor browserpass-linux64 browserpass-arm browserpass-arm64 browserpass-darwin64 browserpass-darwin-arm64 browserpass-openbsd64 browserpass-freebsd64 browserpass-dragonfly64 browserpass-windows64 browserpass-windows
|
||||
$(eval TMP := $(shell mktemp -d))
|
||||
|
||||
# Full source code
|
||||
@@ -84,7 +87,7 @@ dist: clean vendor browserpass-linux64 browserpass-arm browserpass-arm64 browser
|
||||
(cd "$(TMP)" && tar -cvzf "browserpass-native-$(VERSION)-src.tar.gz" "browserpass-native-$(VERSION)")
|
||||
|
||||
# Unix installers
|
||||
for os in linux64 arm arm64 darwin64 darwin-arm64 openbsd64 freebsd64; do \
|
||||
for os in linux64 arm arm64 darwin64 darwin-arm64 openbsd64 freebsd64 dragonfly64; do \
|
||||
mkdir $(TMP)/browserpass-"$$os"-$(VERSION); \
|
||||
cp -a browserpass-"$$os"* browser-files Makefile README.md LICENSE $(TMP)/browserpass-"$$os"-$(VERSION); \
|
||||
(cd $(TMP) && tar -cvzf browserpass-"$$os"-$(VERSION).tar.gz browserpass-"$$os"-$(VERSION)); \
|
||||
@@ -99,7 +102,7 @@ dist: clean vendor browserpass-linux64 browserpass-arm browserpass-arm64 browser
|
||||
|
||||
mkdir -p dist
|
||||
mv "$(TMP)/"*.tar.gz "$(TMP)/"*.msi dist
|
||||
git archive -o dist/browserpass-native-$(VERSION).tar.gz --format tar.gz --prefix=browserpass-native-$(VERSION)/ $(VERSION)
|
||||
git -c tar.tar.gz.command="gzip -cn" archive -o dist/browserpass-native-$(VERSION).tar.gz --format tar.gz --prefix=browserpass-native-$(VERSION)/ $(VERSION)
|
||||
|
||||
for file in dist/*; do \
|
||||
gpg --detach-sign --armor "$$file"; \
|
||||
@@ -132,439 +135,674 @@ install:
|
||||
.PHONY: hosts-chromium
|
||||
hosts-chromium:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "/etc/chromium/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/chromium/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/etc/chromium/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "/Library/Application Support/Chromium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "/etc/chromium/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/chromium/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/etc/chromium/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Application Support/Chromium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-chromium-user
|
||||
hosts-chromium-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "$(XDG_CONFIG_HOME)/chromium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/chromium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/chromium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "${HOME}/Library/Application Support/Chromium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "$(XDG_CONFIG_HOME)/chromium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/chromium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/chromium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Chromium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-chrome
|
||||
hosts-chrome:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "/etc/opt/chrome/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/opt/chrome/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/chrome/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "/Library/Google/Chrome/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Google/Chrome/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Google/Chrome/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "/etc/opt/chrome/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/opt/chrome/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/chrome/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Google/Chrome/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Google/Chrome/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Google/Chrome/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-chrome-user
|
||||
hosts-chrome-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "$(XDG_CONFIG_HOME)/google-chrome/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/google-chrome/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/google-chrome/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "$(XDG_CONFIG_HOME)/google-chrome/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/google-chrome/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/google-chrome/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-edge
|
||||
hosts-edge:
|
||||
@case $(OS) in \
|
||||
# Linux) mkdir -p "/opt/microsoft/msedge/native-messaging-hosts/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/opt/microsoft/msedge/native-messaging-hosts/$(APP_ID).json"; \
|
||||
# [ -e "/opt/microsoft/msedge/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
# Darwin) mkdir -p "/Library/Google/Chrome/NativeMessagingHosts/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Google/Chrome/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
# [ -e "/Library/Google/Chrome/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
# Linux) \
|
||||
# mkdir -p "/opt/microsoft/msedge/native-messaging-hosts/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/opt/microsoft/msedge/native-messaging-hosts/$(APP_ID).json"; \
|
||||
# [ -e "/opt/microsoft/msedge/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
# Darwin) \
|
||||
# mkdir -p "/Library/Google/Chrome/NativeMessagingHosts/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Google/Chrome/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
# [ -e "/Library/Google/Chrome/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-edge-user
|
||||
hosts-edge-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "$(XDG_CONFIG_HOME)/microsoft-edge/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/microsoft-edge/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/microsoft-edge/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
# Darwin) mkdir -p "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
# [ -e "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "$(XDG_CONFIG_HOME)/microsoft-edge/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/microsoft-edge/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/microsoft-edge/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
# Darwin) \
|
||||
# mkdir -p "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
# [ -e "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-vivaldi
|
||||
hosts-vivaldi:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "/etc/opt/vivaldi/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/opt/vivaldi/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/vivaldi/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "/Library/Application Support/Vivaldi/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Application Support/Vivaldi/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Vivaldi/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "/etc/opt/vivaldi/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/opt/vivaldi/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/vivaldi/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Application Support/Vivaldi/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Application Support/Vivaldi/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Vivaldi/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-vivaldi-user
|
||||
hosts-vivaldi-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "$(XDG_CONFIG_HOME)/vivaldi/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/vivaldi/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/vivaldi/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "${HOME}/Library/Application Support/Vivaldi/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Vivaldi/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Vivaldi/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "$(XDG_CONFIG_HOME)/vivaldi/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/vivaldi/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/vivaldi/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Vivaldi/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Vivaldi/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Vivaldi/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-yandex
|
||||
hosts-yandex:
|
||||
@case $(OS) in \
|
||||
Linux) \
|
||||
mkdir -p "/etc/opt/yandex-browser/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/opt/yandex-browser/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/yandex-browser/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Application Support/Yandex/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Application Support/Yandex/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Yandex/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-yandex-user
|
||||
hosts-yandex-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "$(XDG_CONFIG_HOME)/yandex-browser/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/yandex-browser/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/yandex-browser/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Yandex/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Yandex/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Yandex/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-brave
|
||||
hosts-brave:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "/etc/opt/chrome/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/opt/chrome/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/chrome/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "/Library/Application Support/Chromium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "/etc/opt/chrome/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/opt/chrome/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/chrome/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Application Support/Chromium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-brave-user
|
||||
hosts-brave-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "$(XDG_CONFIG_HOME)/BraveSoftware/Brave-Browser/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/BraveSoftware/Brave-Browser/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/BraveSoftware/Brave-Browser/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "$(XDG_CONFIG_HOME)/BraveSoftware/Brave-Browser/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/BraveSoftware/Brave-Browser/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/BraveSoftware/Brave-Browser/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-iridium
|
||||
hosts-iridium:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "/etc/iridium-browser/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/iridium-browser/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/etc/iridium-browser/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "/Library/Application Support/Iridium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Application Support/Iridium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Iridium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "/etc/iridium-browser/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/iridium-browser/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/etc/iridium-browser/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Application Support/Iridium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Application Support/Iridium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Iridium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-iridium-user
|
||||
hosts-iridium-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "$(XDG_CONFIG_HOME)/iridium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/iridium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/iridium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "${HOME}/Library/Application Support/Iridium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Iridium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Iridium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "$(XDG_CONFIG_HOME)/iridium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/iridium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/iridium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Iridium/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Iridium/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Iridium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-slimjet
|
||||
hosts-slimjet:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "/etc/opt/slimjet/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/opt/slimjet/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/slimjet/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "/Library/Application Support/Slimjet/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Application Support/Slimjet/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Slimjet/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "/etc/opt/slimjet/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/opt/slimjet/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/slimjet/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Application Support/Slimjet/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Application Support/Slimjet/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Slimjet/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-slimjet-user
|
||||
hosts-slimjet-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "${HOME}/.config/slimject/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/.config/slimject/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/.config/slimject/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "${HOME}/Library/Application Support/Slimjet/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Slimjet/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Slimjet/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "${HOME}/.config/slimject/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/.config/slimject/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/.config/slimject/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Slimjet/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Slimjet/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Slimjet/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-firefox
|
||||
hosts-firefox:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "$(LIB_DIR)/mozilla/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "/usr/lib/mozilla/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/usr/lib/mozilla/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "/Library/Application Support/Mozilla/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "/Library/Application Support/Mozilla/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Mozilla/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "$(LIB_DIR)/mozilla/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "/usr/lib/mozilla/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/usr/lib/mozilla/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Application Support/Mozilla/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "/Library/Application Support/Mozilla/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Mozilla/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-firefox-user
|
||||
hosts-firefox-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "${HOME}/.mozilla/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "${HOME}/.mozilla/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/.mozilla/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "${HOME}/Library/Application Support/Mozilla/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "${HOME}/Library/Application Support/Mozilla/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Mozilla/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "${HOME}/.mozilla/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "${HOME}/.mozilla/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/.mozilla/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Mozilla/NativeMessagingHosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "${HOME}/Library/Application Support/Mozilla/NativeMessagingHosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Mozilla/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-librewolf
|
||||
hosts-librewolf:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "$(LIB_DIR)/librewolf/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "/usr/lib/librewolf/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/usr/lib/librewolf/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "$(LIB_DIR)/librewolf/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "/usr/lib/librewolf/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "/usr/lib/librewolf/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: hosts-librewolf-user
|
||||
hosts-librewolf-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "${HOME}/.librewolf/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "${HOME}/.librewolf/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/.librewolf/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "${HOME}/.librewolf/native-messaging-hosts/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json" "${HOME}/.librewolf/native-messaging-hosts/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/.librewolf/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
# Browser-specific policies targets
|
||||
|
||||
.PHONY: policies-chromium
|
||||
policies-chromium:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "/etc/chromium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/chromium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/etc/chromium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "/Library/Application Support/Chromium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "/etc/chromium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/chromium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/etc/chromium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Application Support/Chromium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-chromium-user
|
||||
policies-chromium-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "$(XDG_CONFIG_HOME)/chromium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/chromium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/chromium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "${HOME}/Library/Application Support/Chromium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Chromium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Chromium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "$(XDG_CONFIG_HOME)/chromium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/chromium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/chromium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Chromium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Chromium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Chromium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-chrome
|
||||
policies-chrome:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "/etc/opt/chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "/Library/Google/Chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Google/Chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/Library/Google/Chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "/etc/opt/chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Google/Chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Google/Chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/Library/Google/Chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-chrome-user
|
||||
policies-chrome-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "$(XDG_CONFIG_HOME)/google-chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/google-chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/google-chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "${HOME}/Library/Application Support/Google/Chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "$(XDG_CONFIG_HOME)/google-chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/google-chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/google-chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Google/Chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-edge
|
||||
policies-edge:
|
||||
@case $(OS) in \
|
||||
# Linux) mkdir -p "/etc/opt/chrome/policies/managed/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/chrome/policies/managed/$(APP_ID).json"; \
|
||||
# [ -e "/etc/opt/chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
# Darwin) mkdir -p "/Library/Google/Chrome/policies/managed/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Google/Chrome/policies/managed/$(APP_ID).json"; \
|
||||
# [ -e "/Library/Google/Chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
# Linux) \
|
||||
# mkdir -p "/etc/opt/chrome/policies/managed/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/chrome/policies/managed/$(APP_ID).json"; \
|
||||
# [ -e "/etc/opt/chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
# Darwin) \
|
||||
# mkdir -p "/Library/Google/Chrome/policies/managed/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Google/Chrome/policies/managed/$(APP_ID).json"; \
|
||||
# [ -e "/Library/Google/Chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-edge-user
|
||||
policies-edge-user:
|
||||
@case $(OS) in \
|
||||
# Linux|*BSD) mkdir -p "$(XDG_CONFIG_HOME)/microsoft-edge/policies/managed/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/microsoft-edge/policies/managed/$(APP_ID).json"; \
|
||||
# [ -e "$(XDG_CONFIG_HOME)/microsoft-edge/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
# Darwin) mkdir -p "${HOME}/Library/Application Support/Google/Chrome/policies/managed/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json"; \
|
||||
# [ -e "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
# Linux|*BSD|DragonFly) \
|
||||
# mkdir -p "$(XDG_CONFIG_HOME)/microsoft-edge/policies/managed/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/microsoft-edge/policies/managed/$(APP_ID).json"; \
|
||||
# [ -e "$(XDG_CONFIG_HOME)/microsoft-edge/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
# Darwin) \
|
||||
# mkdir -p "${HOME}/Library/Application Support/Google/Chrome/policies/managed/"; \
|
||||
# ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json"; \
|
||||
# [ -e "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
# ;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-vivaldi
|
||||
policies-vivaldi:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "/etc/opt/vivaldi/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/vivaldi/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/vivaldi/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "/Library/Application Support/Vivaldi/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Application Support/Vivaldi/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Vivaldi/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "/etc/opt/vivaldi/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/vivaldi/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/vivaldi/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Application Support/Vivaldi/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Application Support/Vivaldi/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Vivaldi/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-vivaldi-user
|
||||
policies-vivaldi-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "$(XDG_CONFIG_HOME)/vivaldi/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/vivaldi/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/vivaldi/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "${HOME}/Library/Application Support/Vivaldi/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Vivaldi/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Vivaldi/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "$(XDG_CONFIG_HOME)/vivaldi/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/vivaldi/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/vivaldi/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Vivaldi/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Vivaldi/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Vivaldi/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-yandex
|
||||
policies-yandex:
|
||||
@case $(OS) in \
|
||||
Linux) \
|
||||
mkdir -p "/etc/opt/yandex-browser/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/yandex-browser/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/yandex-browser/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Application Support/Yandex/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Application Support/Yandex/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Yandex/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-yandex-user
|
||||
policies-yandex-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "$(XDG_CONFIG_HOME)/yandex-browser/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/yandex-browser/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/yandex-browser/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Yandex/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Yandex/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Yandex/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-brave
|
||||
policies-brave:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "/etc/opt/chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "/Library/Application Support/Chromium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "/etc/opt/chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Application Support/Chromium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-brave-user
|
||||
policies-brave-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "$(XDG_CONFIG_HOME)/BraveSoftware/Brave-Browser/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/BraveSoftware/Brave-Browser/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/BraveSoftware/Brave-Browser/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "${HOME}/Library/Application Support/Google/Chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "$(XDG_CONFIG_HOME)/BraveSoftware/Brave-Browser/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/BraveSoftware/Brave-Browser/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/BraveSoftware/Brave-Browser/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Google/Chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-iridium
|
||||
policies-iridium:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "/etc/opt/chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "/Library/Application Support/Chromium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "/etc/opt/chrome/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/chrome/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Application Support/Chromium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-iridium-user
|
||||
policies-iridium-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "$(XDG_CONFIG_HOME)/iridium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/iridium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/iridium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "${HOME}/Library/Application Support/Iridium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Iridium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Iridium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "$(XDG_CONFIG_HOME)/iridium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "$(XDG_CONFIG_HOME)/iridium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "$(XDG_CONFIG_HOME)/iridium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Iridium/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Iridium/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Iridium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-slimjet
|
||||
policies-slimjet:
|
||||
@case $(OS) in \
|
||||
Linux) mkdir -p "/etc/opt/slimjet/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/slimjet/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/slimjet/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "/Library/Application Support/Slimjet/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Application Support/Slimjet/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Slimjet/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux) \
|
||||
mkdir -p "/etc/opt/slimjet/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/slimjet/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/etc/opt/slimjet/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "/Library/Application Support/Slimjet/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Application Support/Slimjet/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "/Library/Application Support/Slimjet/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
||||
.PHONY: policies-slimjet-user
|
||||
policies-slimjet-user:
|
||||
@case $(OS) in \
|
||||
Linux|*BSD) mkdir -p "${HOME}/.config/slimjet/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/.config/slimjet/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/.config/slimjet/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) mkdir -p "${HOME}/Library/Application Support/Slimjet/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Slimjet/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Slimjet/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
|
||||
Linux|*BSD|DragonFly) \
|
||||
mkdir -p "${HOME}/.config/slimjet/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/.config/slimjet/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/.config/slimjet/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
Darwin) \
|
||||
mkdir -p "${HOME}/Library/Application Support/Slimjet/policies/managed/"; \
|
||||
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Slimjet/policies/managed/$(APP_ID).json"; \
|
||||
[ -e "${HOME}/Library/Application Support/Slimjet/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
|
||||
;; \
|
||||
*) \
|
||||
echo "The operating system $(OS) is not supported"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac
|
||||
|
120
PROTOCOL.md
120
PROTOCOL.md
@@ -41,23 +41,31 @@ should be supplied as a `message` parameter.
|
||||
|
||||
## List of Error Codes
|
||||
|
||||
| Code | Description | Parameters |
|
||||
| ---- | ----------------------------------------------------------------------- | ----------------------------------------------------------- |
|
||||
| 10 | Unable to parse browser request length | message, error |
|
||||
| 11 | Unable to parse browser request | message, error |
|
||||
| 12 | Invalid request action | message, action |
|
||||
| 13 | Inaccessible user-configured password store | message, action, error, storeId, storePath, storeName |
|
||||
| 14 | Inaccessible default password store | message, action, error, storePath |
|
||||
| 15 | Unable to determine the location of the default password store | message, action, error |
|
||||
| 16 | Unable to read the default settings of a user-configured password store | message, action, error, storeId, storePath, storeName |
|
||||
| 17 | Unable to read the default settings of the default password store | message, action, error, storePath |
|
||||
| 18 | Unable to list files in a password store | message, action, error, storeId, storePath, storeName |
|
||||
| 19 | Unable to determine a relative path for a file in a password store | message, action, error, storeId, storePath, storeName, file |
|
||||
| 20 | Invalid password store ID | message, action, storeId |
|
||||
| 21 | Invalid gpg path | message, action, error, gpgPath |
|
||||
| 22 | Unable to detect the location of the gpg binary | message, action, error |
|
||||
| 23 | Invalid password file extension | message, action, file |
|
||||
| 24 | Unable to decrypt the password file | message, action, error, storeId, storePath, storeName, file |
|
||||
| Code | Description | Parameters |
|
||||
| ---- | ----------------------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| 10 | Unable to parse browser request length | message, error |
|
||||
| 11 | Unable to parse browser request | message, error |
|
||||
| 12 | Invalid request action | message, action |
|
||||
| 13 | Inaccessible user-configured password store | message, action, error, storeId, storePath, storeName |
|
||||
| 14 | Inaccessible default password store | message, action, error, storePath |
|
||||
| 15 | Unable to determine the location of the default password store | message, action, error |
|
||||
| 16 | Unable to read the default settings of a user-configured password store | message, action, error, storeId, storePath, storeName |
|
||||
| 17 | Unable to read the default settings of the default password store | message, action, error, storePath |
|
||||
| 18 | Unable to list files in a password store | message, action, error, storeId, storePath, storeName |
|
||||
| 19 | Unable to determine a relative path for a file in a password store | message, action, error, storeId, storePath, storeName, file |
|
||||
| 20 | Invalid password store ID | message, action, storeId |
|
||||
| 21 | Invalid gpg path | message, action, error, gpgPath |
|
||||
| 22 | Unable to detect the location of the gpg binary | message, action, error |
|
||||
| 23 | Invalid password file extension | message, action, file |
|
||||
| 24 | Unable to decrypt the password file | message, action, error, storeId, storePath, storeName, file |
|
||||
| 25 | Unable to list directories in a password store | message, action, error, storeId, storePath, storeName |
|
||||
| 26 | Unable to determine a relative path for a directory in a password store | message, action, error, storeId, storePath, storeName, directory |
|
||||
| 27 | The entry contents is missing | message, action |
|
||||
| 28 | Unable to determine the recepients for the gpg encryption | message, action, error, storeId, storePath, storeName, file |
|
||||
| 29 | Unable to encrypt the password file | message, action, error, storeId, storePath, storeName, file |
|
||||
| 30 | Unable to delete the password file | message, action, error, storeId, storePath, storeName, file |
|
||||
| 31 | Unable to determine if directory is empty and can be deleted | message, action, error, storeId, storePath, storeName, directory |
|
||||
| 32 | Unable to delete the empty directory | message, action, error, storeId, storePath, storeName, directory |
|
||||
|
||||
## Settings
|
||||
|
||||
@@ -157,6 +165,35 @@ is the ID of a password store, the key in `"settings.stores"` object.
|
||||
}
|
||||
```
|
||||
|
||||
### Tree
|
||||
|
||||
Get a list of all nested directories for each of a provided array of directory paths. The `storeN`
|
||||
is the ID of a password store, the key in `"settings.stores"` object.
|
||||
|
||||
#### Request
|
||||
|
||||
```
|
||||
{
|
||||
"settings": <settings object>,
|
||||
"action": "tree"
|
||||
}
|
||||
```
|
||||
|
||||
#### Response
|
||||
|
||||
```
|
||||
{
|
||||
"status": "ok",
|
||||
"version": <int>,
|
||||
"data": {
|
||||
"directories": {
|
||||
"storeN": ["<storeNPath/directory1>", "<...>"],
|
||||
"storeN+1": ["<storeN+1Path/directory1>", "<...>"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Fetch
|
||||
|
||||
Get the decrypted contents of a specific file.
|
||||
@@ -184,6 +221,55 @@ Get the decrypted contents of a specific file.
|
||||
}
|
||||
```
|
||||
|
||||
### Save
|
||||
|
||||
Encrypt the given contents and save to a specific file.
|
||||
|
||||
#### Request
|
||||
|
||||
```
|
||||
{
|
||||
"settings": <settings object>,
|
||||
"action": "save",
|
||||
"storeId": "<storeId>",
|
||||
"file": "relative/path/to/file.gpg",
|
||||
"contents": "<contents to encrypt and save>"
|
||||
}
|
||||
```
|
||||
|
||||
#### Response
|
||||
|
||||
```
|
||||
{
|
||||
"status": "ok",
|
||||
"version": <int>
|
||||
}
|
||||
```
|
||||
|
||||
### Delete
|
||||
|
||||
Delete a specific file and empty parent directories caused by the deletion, if any.
|
||||
|
||||
#### Request
|
||||
|
||||
```
|
||||
{
|
||||
"settings": <settings object>,
|
||||
"action": "delete",
|
||||
"storeId": "<storeId>",
|
||||
"file": "relative/path/to/file.gpg"
|
||||
}
|
||||
```
|
||||
|
||||
#### Response
|
||||
|
||||
```
|
||||
{
|
||||
"status": "ok",
|
||||
"version": <int>
|
||||
}
|
||||
```
|
||||
|
||||
### Echo
|
||||
|
||||
Send the `echoResponse` in the request as a response.
|
||||
|
46
README.md
46
README.md
@@ -30,7 +30,7 @@ The following operating systems provide a browserpass package that can be instal
|
||||
|
||||
- Arch Linux: [browserpass](https://www.archlinux.org/packages/community/x86_64/browserpass/)
|
||||
- Gentoo Linux: [browserpass](https://packages.gentoo.org/packages/www-plugins/browserpass)
|
||||
- Debian sid: [webext-browserpass](https://packages.debian.org/sid/webext-browserpass)
|
||||
- Debian sid: [webext-browserpass](https://packages.debian.org/sid/webext-browserpass) (note: users report ([#126](https://github.com/browserpass/browserpass-native/issues/126)) that it's not suitable for any browser besides Chromium and Firefox, use manual installation if you plan to use other browsers).
|
||||
- openSUSE Tumbleweed: [browserpass-native](https://software.opensuse.org/package/browserpass-native)
|
||||
- NixOS: [browserpass](https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/security/browserpass/default.nix) - also read [Install on Nix / NixOS](#install-on-nix--nixos)
|
||||
- macOS: [browserpass](https://github.com/Amar1729/homebrew-formulae/blob/master/browserpass.rb) in a user-contributed tap [amar1729/formulae](https://github.com/amar1729/homebrew-formulae)
|
||||
@@ -161,26 +161,28 @@ See below the list of available `make` goals to configure various browsers. Use
|
||||
|
||||
If you provided `PREFIX` and/or `DESTDIR` while running `make install`, remember that you must provide the same parameters, for example `make PREFIX=/usr/local hosts-chromium-user`:
|
||||
|
||||
| Command | Description |
|
||||
| -------------------------- | ------------------------------------------------------------------------------------ |
|
||||
| `make hosts-chromium-user` | Configure browserpass for Chromium browser, for the current user only |
|
||||
| `make hosts-firefox-user` | Configure browserpass for Firefox browser, for the current user only |
|
||||
| `make hosts-librewolf-user`| Configure browserpass for Librewolf browser, for the current user only |
|
||||
| `make hosts-chrome-user` | Configure browserpass for Google Chrome or Opera browsers, for the current user only |
|
||||
| `make hosts-edge-user` | Configure browserpass for Microsoft Edge browser, for the current user only |
|
||||
| `make hosts-brave-user` | Configure browserpass for Brave browser, for the current user only |
|
||||
| `make hosts-iridium-user` | Configure browserpass for Iridium browser, for the current user only |
|
||||
| `make hosts-vivaldi-user` | Configure browserpass for Vivaldi browser, for the current user only |
|
||||
| `make hosts-slimjet-user` | Configure browserpass for Slimjet browser, for the current user only |
|
||||
| `sudo make hosts-chromium` | Configure browserpass for Chromium browser, system-wide |
|
||||
| `sudo make hosts-firefox` | Configure browserpass for Firefox browser, system-wide |
|
||||
| `sudo make hosts-librewolf`| Configure browserpass for Librewolf browser, system-wide |
|
||||
| `sudo make hosts-chrome` | Configure browserpass for Google Chrome or Opera browsers, system-wide |
|
||||
| `sudo make hosts-edge` | Configure browserpass for Microsoft Edge browser, system-wide |
|
||||
| `sudo make hosts-brave` | Configure browserpass for Brave browser, system-wide |
|
||||
| `sudo make hosts-iridium` | Configure browserpass for Iridium browser, system-wide |
|
||||
| `sudo make hosts-vivaldi` | Configure browserpass for Vivaldi browser, system-wide |
|
||||
| `sudo make hosts-slimjet` | Configure browserpass for Slimjet browser, system-wide |
|
||||
| Command | Description |
|
||||
| --------------------------- | ------------------------------------------------------------------------------------ |
|
||||
| `make hosts-chromium-user` | Configure browserpass for Chromium browser, for the current user only |
|
||||
| `make hosts-firefox-user` | Configure browserpass for Firefox browser, for the current user only |
|
||||
| `make hosts-librewolf-user` | Configure browserpass for Librewolf browser, for the current user only |
|
||||
| `make hosts-chrome-user` | Configure browserpass for Google Chrome or Opera browsers, for the current user only |
|
||||
| `make hosts-edge-user` | Configure browserpass for Microsoft Edge browser, for the current user only |
|
||||
| `make hosts-brave-user` | Configure browserpass for Brave browser, for the current user only |
|
||||
| `make hosts-iridium-user` | Configure browserpass for Iridium browser, for the current user only |
|
||||
| `make hosts-vivaldi-user` | Configure browserpass for Vivaldi browser, for the current user only |
|
||||
| `make hosts-yandex-user` | Configure browserpass for Yandex browser, for the current user only |
|
||||
| `make hosts-slimjet-user` | Configure browserpass for Slimjet browser, for the current user only |
|
||||
| `sudo make hosts-chromium` | Configure browserpass for Chromium browser, system-wide |
|
||||
| `sudo make hosts-firefox` | Configure browserpass for Firefox browser, system-wide |
|
||||
| `sudo make hosts-librewolf` | Configure browserpass for Librewolf browser, system-wide |
|
||||
| `sudo make hosts-chrome` | Configure browserpass for Google Chrome or Opera browsers, system-wide |
|
||||
| `sudo make hosts-edge` | Configure browserpass for Microsoft Edge browser, system-wide |
|
||||
| `sudo make hosts-brave` | Configure browserpass for Brave browser, system-wide |
|
||||
| `sudo make hosts-iridium` | Configure browserpass for Iridium browser, system-wide |
|
||||
| `sudo make hosts-vivaldi` | Configure browserpass for Vivaldi browser, system-wide |
|
||||
| `sudo make hosts-yandex` | Configure browserpass for Yandex browser, system-wide |
|
||||
| `sudo make hosts-slimjet` | Configure browserpass for Slimjet browser, system-wide |
|
||||
|
||||
In addition, Chromium-based browsers support the following `make` goals:
|
||||
|
||||
@@ -193,6 +195,7 @@ In addition, Chromium-based browsers support the following `make` goals:
|
||||
| `make policies-iridium-user` | Automatically install browser extension from Web Store for Iridium browser, for the current user only |
|
||||
| `make policies-slimjet-user` | Automatically install browser extension from Web Store for Slimjet browser, for the current user only |
|
||||
| `make policies-vivaldi-user` | Automatically install browser extension from Web Store for Vivaldi browser, for the current user only |
|
||||
| `make policies-yandex-user` | Automatically install browser extension from Web Store for Yandex browser, for the current user only |
|
||||
| `sudo make policies-chromium` | Automatically install browser extension from Web Store for Chromium browser, system-wide |
|
||||
| `sudo make policies-chrome` | Automatically install browser extension from Web Store for Google Chrome browser, system-wide |
|
||||
| `sudo make policies-edge` | Automatically install browser extension from Web Store for Microsoft Edge browser, system-wide |
|
||||
@@ -200,6 +203,7 @@ In addition, Chromium-based browsers support the following `make` goals:
|
||||
| `sudo make policies-iridium` | Automatically install browser extension from Web Store for Iridium browser, system-wide |
|
||||
| `sudo make policies-slimjet` | Automatically install browser extension from Web Store for Slimjet browser, system-wide |
|
||||
| `sudo make policies-vivaldi` | Automatically install browser extension from Web Store for Vivaldi browser, system-wide |
|
||||
| `sudo make policies-yandex` | Automatically install browser extension from Web Store for Yandex browser, system-wide |
|
||||
|
||||
## Building the app
|
||||
|
||||
|
@@ -10,21 +10,29 @@ type Code int
|
||||
// Error codes that are sent to the browser extension and used as exit codes in the app.
|
||||
// DO NOT MODIFY THE VALUES, always append new error codes to the bottom.
|
||||
const (
|
||||
CodeParseRequestLength Code = 10
|
||||
CodeParseRequest Code = 11
|
||||
CodeInvalidRequestAction Code = 12
|
||||
CodeInaccessiblePasswordStore Code = 13
|
||||
CodeInaccessibleDefaultPasswordStore Code = 14
|
||||
CodeUnknownDefaultPasswordStoreLocation Code = 15
|
||||
CodeUnreadablePasswordStoreDefaultSettings Code = 16
|
||||
CodeUnreadableDefaultPasswordStoreDefaultSettings Code = 17
|
||||
CodeUnableToListFilesInPasswordStore Code = 18
|
||||
CodeUnableToDetermineRelativeFilePathInPasswordStore Code = 19
|
||||
CodeInvalidPasswordStore Code = 20
|
||||
CodeInvalidGpgPath Code = 21
|
||||
CodeUnableToDetectGpgPath Code = 22
|
||||
CodeInvalidPasswordFileExtension Code = 23
|
||||
CodeUnableToDecryptPasswordFile Code = 24
|
||||
CodeParseRequestLength Code = 10
|
||||
CodeParseRequest Code = 11
|
||||
CodeInvalidRequestAction Code = 12
|
||||
CodeInaccessiblePasswordStore Code = 13
|
||||
CodeInaccessibleDefaultPasswordStore Code = 14
|
||||
CodeUnknownDefaultPasswordStoreLocation Code = 15
|
||||
CodeUnreadablePasswordStoreDefaultSettings Code = 16
|
||||
CodeUnreadableDefaultPasswordStoreDefaultSettings Code = 17
|
||||
CodeUnableToListFilesInPasswordStore Code = 18
|
||||
CodeUnableToDetermineRelativeFilePathInPasswordStore Code = 19
|
||||
CodeInvalidPasswordStore Code = 20
|
||||
CodeInvalidGpgPath Code = 21
|
||||
CodeUnableToDetectGpgPath Code = 22
|
||||
CodeInvalidPasswordFileExtension Code = 23
|
||||
CodeUnableToDecryptPasswordFile Code = 24
|
||||
CodeUnableToListDirectoriesInPasswordStore Code = 25
|
||||
CodeUnableToDetermineRelativeDirectoryPathInPasswordStore Code = 26
|
||||
CodeEmptyContents Code = 27
|
||||
CodeUnableToDetermineGpgRecipients Code = 28
|
||||
CodeUnableToEncryptPasswordFile Code = 29
|
||||
CodeUnableToDeletePasswordFile Code = 30
|
||||
CodeUnableToDetermineIsDirectoryEmpty Code = 31
|
||||
CodeUnableToDeleteEmptyDirectory Code = 32
|
||||
)
|
||||
|
||||
// Field extra field in the error response params
|
||||
@@ -40,6 +48,7 @@ const (
|
||||
FieldStoreName Field = "storeName"
|
||||
FieldStorePath Field = "storePath"
|
||||
FieldFile Field = "file"
|
||||
FieldDirectory Field = "directory"
|
||||
FieldGpgPath Field = "gpgPath"
|
||||
)
|
||||
|
||||
|
42
flake.lock
generated
Normal file
42
flake.lock
generated
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1666610816,
|
||||
"narHash": "sha256-q4F2VNe5bpxXOvp16DyLwE1SgNZMbNO29ZQJPIomedg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6107f97012a0c134c5848125b5aa1b149b76d2c9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-22.05",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
68
flake.nix
Normal file
68
flake.nix
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
description = "TODO";
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-22.05";
|
||||
flake-utils.url = github:numtide/flake-utils;
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
with flake-utils.lib; eachSystem allSystems (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
lib = pkgs.lib;
|
||||
nativeBuildInputs = with pkgs; [ makeWrapper ];
|
||||
in rec {
|
||||
packages = {
|
||||
browserpass = pkgs.buildGoModule rec {
|
||||
# this is mostly excerpted from <nixpkgs/pkgs/tools/security/browserpass/default.nix>
|
||||
pname = "browserpass";
|
||||
version = "3.0.10-next-20221026";
|
||||
|
||||
src = ./.;
|
||||
|
||||
inherit nativeBuildInputs;
|
||||
|
||||
vendorSha256 = "gWXcYyIp86b/Pn6vj7qBj/VZS9rTr4weVw0YWmg+36c=";
|
||||
|
||||
doCheck = false;
|
||||
postPatch = ''
|
||||
# Because this Makefile will be installed to be used by the user, patch
|
||||
# variables to be valid by default
|
||||
substituteInPlace Makefile \
|
||||
--replace "PREFIX ?= /usr" ""
|
||||
sed -i -e 's/SED =.*/SED = sed/' Makefile
|
||||
sed -i -e 's/INSTALL =.*/INSTALL = install/' Makefile
|
||||
'';
|
||||
|
||||
DESTDIR = placeholder "out";
|
||||
|
||||
postConfigure = ''
|
||||
make configure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
make
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
make install
|
||||
|
||||
wrapProgram $out/bin/browserpass \
|
||||
--suffix PATH : ${lib.makeBinPath [ pkgs.gnupg ]}
|
||||
|
||||
# This path is used by our firefox wrapper for finding native messaging hosts
|
||||
mkdir -p $out/lib/mozilla/native-messaging-hosts
|
||||
ln -s $out/lib/browserpass/hosts/firefox/*.json $out/lib/mozilla/native-messaging-hosts
|
||||
'';
|
||||
};
|
||||
};
|
||||
defaultPackage = packages.browserpass;
|
||||
|
||||
devShells.default = with pkgs; mkShell {
|
||||
buildInputs = nativeBuildInputs ++ [ go ];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
9
go.mod
9
go.mod
@@ -1,11 +1,10 @@
|
||||
module github.com/browserpass/browserpass-native
|
||||
|
||||
go 1.14
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/mattn/go-zglob v0.0.3
|
||||
github.com/mattn/go-zglob v0.0.4
|
||||
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/stretchr/testify v1.3.0 // indirect
|
||||
golang.org/x/sys v0.0.0-20220207234003-57398862261d
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
golang.org/x/sys v0.5.0
|
||||
)
|
||||
|
22
go.sum
22
go.sum
@@ -1,18 +1,20 @@
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/mattn/go-zglob v0.0.3 h1:6Ry4EYsScDyt5di4OI6xw1bYhOqfE5S33Z1OPy+d+To=
|
||||
github.com/mattn/go-zglob v0.0.3/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo=
|
||||
github.com/mattn/go-zglob v0.0.4 h1:LQi2iOm0/fGgu80AioIJ/1j9w9Oh+9DZ39J4VAGzHQM=
|
||||
github.com/mattn/go-zglob v0.0.4/go.mod h1:MxxjyoXXnMxfIpxTK2GAkw1w8glPsQILx3N5wrKakiY=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 h1:mZHayPoR0lNmnHyvtYjDeq0zlVHn9K/ZXoy17ylucdo=
|
||||
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5/go.mod h1:GEXHk5HgEKCvEIIrSpFI3ozzG5xOKA2DVlEX/gGnewM=
|
||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220207234003-57398862261d h1:Bm7BNOQt2Qv7ZqysjeLjgCBanX+88Z/OtdvsrEv1Djc=
|
||||
golang.org/x/sys v0.0.0-20220207234003-57398862261d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
115
helpers/helpers.go
Normal file
115
helpers/helpers.go
Normal file
@@ -0,0 +1,115 @@
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func DetectGpgBinary() (string, error) {
|
||||
// Look in $PATH first, then check common locations - the first successful result wins
|
||||
gpgBinaryPriorityList := []string{
|
||||
"gpg2", "gpg",
|
||||
"/bin/gpg2", "/usr/bin/gpg2", "/usr/local/bin/gpg2",
|
||||
"/bin/gpg", "/usr/bin/gpg", "/usr/local/bin/gpg",
|
||||
}
|
||||
|
||||
for _, binary := range gpgBinaryPriorityList {
|
||||
err := ValidateGpgBinary(binary)
|
||||
if err == nil {
|
||||
return binary, nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("Unable to detect the location of the gpg binary to use")
|
||||
}
|
||||
|
||||
func ValidateGpgBinary(gpgPath string) error {
|
||||
return exec.Command(gpgPath, "--version").Run()
|
||||
}
|
||||
|
||||
func GpgDecryptFile(filePath string, gpgPath string) (string, error) {
|
||||
filePath = strings.TrimSuffix(filePath, ".gpg"); // browserpass-extension forcibly adds the .gpg extension
|
||||
passwordFile, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var stdout, stderr bytes.Buffer
|
||||
gpgOptions := []string{"--decrypt", "--yes", "--quiet", "--batch", "-"}
|
||||
|
||||
cmd := exec.Command(gpgPath, gpgOptions...)
|
||||
cmd.Stdin = passwordFile
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
return "", fmt.Errorf("Error: %s, Stderr: %s", err.Error(), stderr.String())
|
||||
}
|
||||
|
||||
return stdout.String(), nil
|
||||
}
|
||||
|
||||
func GpgEncryptFile(filePath string, contents string, recipients []string, gpgPath string) error {
|
||||
err := os.MkdirAll(filepath.Dir(filePath), 0755)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to create directory structure: %s", err.Error())
|
||||
}
|
||||
|
||||
var stdout, stderr bytes.Buffer
|
||||
gpgOptions := []string{"--encrypt", "--yes", "--quiet", "--batch", "--output", filePath}
|
||||
for _, recipient := range recipients {
|
||||
gpgOptions = append(gpgOptions, "--recipient", recipient)
|
||||
}
|
||||
|
||||
cmd := exec.Command(gpgPath, gpgOptions...)
|
||||
cmd.Stdin = strings.NewReader(contents)
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
|
||||
if err = cmd.Run(); err != nil {
|
||||
return fmt.Errorf("Error: %s, Stderr: %s", err.Error(), stderr.String())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func DetectGpgRecipients(filePath string) ([]string, error) {
|
||||
dir := filepath.Dir(filePath)
|
||||
for {
|
||||
file, err := ioutil.ReadFile(filepath.Join(dir, ".gpg-id"))
|
||||
if err == nil {
|
||||
return strings.Split(strings.ReplaceAll(strings.TrimSpace(string(file)), "\r\n", "\n"), "\n"), nil
|
||||
}
|
||||
|
||||
if !os.IsNotExist(err) {
|
||||
return nil, fmt.Errorf("Unable to open `.gpg-id` file: %s", err.Error())
|
||||
}
|
||||
|
||||
parentDir := filepath.Dir(dir)
|
||||
if parentDir == dir {
|
||||
return nil, fmt.Errorf("Unable to find '.gpg-id' file")
|
||||
}
|
||||
|
||||
dir = parentDir
|
||||
}
|
||||
}
|
||||
|
||||
func IsDirectoryEmpty(dirPath string) (bool, error) {
|
||||
f, err := os.Open(dirPath)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
_, err = f.Readdirnames(1)
|
||||
if err == io.EOF {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, err
|
||||
}
|
@@ -7,6 +7,7 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/browserpass/browserpass-native/errors"
|
||||
"github.com/browserpass/browserpass-native/helpers"
|
||||
"github.com/browserpass/browserpass-native/response"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -16,7 +17,7 @@ func configure(request *request) {
|
||||
|
||||
// User configured gpgPath in the browser, check if it is a valid binary to use
|
||||
if request.Settings.GpgPath != "" {
|
||||
err := validateGpgBinary(request.Settings.GpgPath)
|
||||
err := helpers.ValidateGpgBinary(request.Settings.GpgPath)
|
||||
if err != nil {
|
||||
log.Errorf(
|
||||
"The provided gpg binary path '%v' is invalid: %+v",
|
||||
|
132
request/delete.go
Normal file
132
request/delete.go
Normal file
@@ -0,0 +1,132 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/browserpass/browserpass-native/errors"
|
||||
"github.com/browserpass/browserpass-native/helpers"
|
||||
"github.com/browserpass/browserpass-native/response"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func deleteFile(request *request) {
|
||||
responseData := response.MakeDeleteResponse()
|
||||
|
||||
if !strings.HasSuffix(request.File, ".gpg") {
|
||||
log.Errorf("The requested password file '%v' does not have the expected '.gpg' extension", request.File)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeInvalidPasswordFileExtension,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "The requested password file does not have the expected '.gpg' extension",
|
||||
errors.FieldAction: "delete",
|
||||
errors.FieldFile: request.File,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
store, ok := request.Settings.Stores[request.StoreID]
|
||||
if !ok {
|
||||
log.Errorf(
|
||||
"The password store with ID '%v' is not present in the list of stores '%+v'",
|
||||
request.StoreID, request.Settings.Stores,
|
||||
)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeInvalidPasswordStore,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "The password store is not present in the list of stores",
|
||||
errors.FieldAction: "delete",
|
||||
errors.FieldStoreID: request.StoreID,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
normalizedStorePath, err := normalizePasswordStorePath(store.Path)
|
||||
if err != nil {
|
||||
log.Errorf(
|
||||
"The password store '%+v' is not accessible at its location: %+v",
|
||||
store, err,
|
||||
)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeInaccessiblePasswordStore,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "The password store is not accessible",
|
||||
errors.FieldAction: "delete",
|
||||
errors.FieldError: err.Error(),
|
||||
errors.FieldStoreID: store.ID,
|
||||
errors.FieldStoreName: store.Name,
|
||||
errors.FieldStorePath: store.Path,
|
||||
},
|
||||
)
|
||||
}
|
||||
store.Path = normalizedStorePath
|
||||
|
||||
filePath := filepath.Join(store.Path, request.File)
|
||||
|
||||
err = os.Remove(filePath)
|
||||
if err != nil {
|
||||
log.Error("Unable to delete the password file: ", err)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeUnableToDeletePasswordFile,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "Unable to delete the password file",
|
||||
errors.FieldAction: "delete",
|
||||
errors.FieldError: err.Error(),
|
||||
errors.FieldFile: request.File,
|
||||
errors.FieldStoreID: store.ID,
|
||||
errors.FieldStoreName: store.Name,
|
||||
errors.FieldStorePath: store.Path,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
parentDir := filepath.Dir(filePath)
|
||||
for {
|
||||
if parentDir == store.Path {
|
||||
break
|
||||
}
|
||||
|
||||
isEmpty, err := helpers.IsDirectoryEmpty(parentDir)
|
||||
if err != nil {
|
||||
log.Error("Unable to determine if directory is empty and can be deleted: ", err)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeUnableToDetermineIsDirectoryEmpty,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "Unable to determine if directory is empty and can be deleted",
|
||||
errors.FieldAction: "delete",
|
||||
errors.FieldError: err.Error(),
|
||||
errors.FieldDirectory: parentDir,
|
||||
errors.FieldStoreID: store.ID,
|
||||
errors.FieldStoreName: store.Name,
|
||||
errors.FieldStorePath: store.Path,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
if !isEmpty {
|
||||
break
|
||||
}
|
||||
|
||||
err = os.Remove(parentDir)
|
||||
if err != nil {
|
||||
log.Error("Unable to delete the empty directory: ", err)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeUnableToDeleteEmptyDirectory,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "Unable to delete the empty directory",
|
||||
errors.FieldAction: "delete",
|
||||
errors.FieldError: err.Error(),
|
||||
errors.FieldDirectory: parentDir,
|
||||
errors.FieldStoreID: store.ID,
|
||||
errors.FieldStoreName: store.Name,
|
||||
errors.FieldStorePath: store.Path,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
parentDir = filepath.Dir(parentDir)
|
||||
}
|
||||
|
||||
response.SendOk(responseData)
|
||||
}
|
@@ -1,14 +1,10 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/browserpass/browserpass-native/errors"
|
||||
"github.com/browserpass/browserpass-native/helpers"
|
||||
"github.com/browserpass/browserpass-native/response"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -16,18 +12,6 @@ import (
|
||||
func fetchDecryptedContents(request *request) {
|
||||
responseData := response.MakeFetchResponse()
|
||||
|
||||
if !strings.HasSuffix(request.File, ".gpg") {
|
||||
log.Errorf("The requested password file '%v' does not have the expected '.gpg' extension", request.File)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeInvalidPasswordFileExtension,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "The requested password file does not have the expected '.gpg' extension",
|
||||
errors.FieldAction: "fetch",
|
||||
errors.FieldFile: request.File,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
store, ok := request.Settings.Stores[request.StoreID]
|
||||
if !ok {
|
||||
log.Errorf(
|
||||
@@ -71,7 +55,7 @@ func fetchDecryptedContents(request *request) {
|
||||
} else {
|
||||
gpgPath = store.Settings.GpgPath
|
||||
}
|
||||
err = validateGpgBinary(gpgPath)
|
||||
err = helpers.ValidateGpgBinary(gpgPath)
|
||||
if err != nil {
|
||||
log.Errorf(
|
||||
"The provided gpg binary path '%v' is invalid: %+v",
|
||||
@@ -88,7 +72,7 @@ func fetchDecryptedContents(request *request) {
|
||||
)
|
||||
}
|
||||
} else {
|
||||
gpgPath, err = detectGpgBinary()
|
||||
gpgPath, err = helpers.DetectGpgBinary()
|
||||
if err != nil {
|
||||
log.Error("Unable to detect the location of the gpg binary: ", err)
|
||||
response.SendErrorAndExit(
|
||||
@@ -102,7 +86,7 @@ func fetchDecryptedContents(request *request) {
|
||||
}
|
||||
}
|
||||
|
||||
responseData.Contents, err = decryptFile(&store, request.File, gpgPath)
|
||||
responseData.Contents, err = helpers.GpgDecryptFile(filepath.Join(store.Path, request.File), gpgPath)
|
||||
if err != nil {
|
||||
log.Errorf(
|
||||
"Unable to decrypt the password file '%v' in the password store '%+v': %+v",
|
||||
@@ -124,46 +108,3 @@ func fetchDecryptedContents(request *request) {
|
||||
|
||||
response.SendOk(responseData)
|
||||
}
|
||||
|
||||
func detectGpgBinary() (string, error) {
|
||||
// Look in $PATH first, then check common locations - the first successful result wins
|
||||
gpgBinaryPriorityList := []string{
|
||||
"gpg2", "gpg",
|
||||
"/bin/gpg2", "/usr/bin/gpg2", "/usr/local/bin/gpg2",
|
||||
"/bin/gpg", "/usr/bin/gpg", "/usr/local/bin/gpg",
|
||||
}
|
||||
|
||||
for _, binary := range gpgBinaryPriorityList {
|
||||
err := validateGpgBinary(binary)
|
||||
if err == nil {
|
||||
return binary, nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("Unable to detect the location of the gpg binary to use")
|
||||
}
|
||||
|
||||
func validateGpgBinary(gpgPath string) error {
|
||||
return exec.Command(gpgPath, "--version").Run()
|
||||
}
|
||||
|
||||
func decryptFile(store *store, file string, gpgPath string) (string, error) {
|
||||
passwordFilePath := filepath.Join(store.Path, file)
|
||||
passwordFile, err := os.Open(passwordFilePath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var stdout, stderr bytes.Buffer
|
||||
gpgOptions := []string{"--decrypt", "--yes", "--quiet", "--batch", "-"}
|
||||
|
||||
cmd := exec.Command(gpgPath, gpgOptions...)
|
||||
cmd.Stdin = passwordFile
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
return "", fmt.Errorf("Error: %s, Stderr: %s", err.Error(), stderr.String())
|
||||
}
|
||||
|
||||
return stdout.String(), nil
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ func listFiles(request *request) {
|
||||
|
||||
store.Path = normalizedStorePath
|
||||
|
||||
files, err := zglob.GlobFollowSymlinks(filepath.Join(store.Path, "/**/*.gpg"))
|
||||
files, err := zglob.GlobFollowSymlinks(filepath.Join(store.Path, "/**/*"))
|
||||
if err != nil {
|
||||
log.Errorf(
|
||||
"Unable to list the files in the password store '%+v' at its location: %+v",
|
||||
|
@@ -31,6 +31,7 @@ type request struct {
|
||||
Action string `json:"action"`
|
||||
Settings settings `json:"settings"`
|
||||
File string `json:"file"`
|
||||
Contents string `json:"contents"`
|
||||
StoreID string `json:"storeId"`
|
||||
EchoResponse interface{} `json:"echoResponse"`
|
||||
}
|
||||
@@ -66,8 +67,14 @@ func Process() {
|
||||
configure(request)
|
||||
case "list":
|
||||
listFiles(request)
|
||||
case "tree":
|
||||
listDirectories(request)
|
||||
case "fetch":
|
||||
fetchDecryptedContents(request)
|
||||
case "save":
|
||||
saveEncryptedContents(request)
|
||||
case "delete":
|
||||
deleteFile(request)
|
||||
case "echo":
|
||||
response.SendRaw(request.EchoResponse)
|
||||
default:
|
||||
|
153
request/save.go
Normal file
153
request/save.go
Normal file
@@ -0,0 +1,153 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/browserpass/browserpass-native/errors"
|
||||
"github.com/browserpass/browserpass-native/helpers"
|
||||
"github.com/browserpass/browserpass-native/response"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func saveEncryptedContents(request *request) {
|
||||
responseData := response.MakeSaveResponse()
|
||||
|
||||
if !strings.HasSuffix(request.File, ".gpg") {
|
||||
log.Errorf("The requested password file '%v' does not have the expected '.gpg' extension", request.File)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeInvalidPasswordFileExtension,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "The requested password file does not have the expected '.gpg' extension",
|
||||
errors.FieldAction: "save",
|
||||
errors.FieldFile: request.File,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
if request.Contents == "" {
|
||||
log.Errorf("The entry contents is missing")
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeEmptyContents,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "The entry contents is missing",
|
||||
errors.FieldAction: "save",
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
store, ok := request.Settings.Stores[request.StoreID]
|
||||
if !ok {
|
||||
log.Errorf(
|
||||
"The password store with ID '%v' is not present in the list of stores '%+v'",
|
||||
request.StoreID, request.Settings.Stores,
|
||||
)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeInvalidPasswordStore,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "The password store is not present in the list of stores",
|
||||
errors.FieldAction: "save",
|
||||
errors.FieldStoreID: request.StoreID,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
normalizedStorePath, err := normalizePasswordStorePath(store.Path)
|
||||
if err != nil {
|
||||
log.Errorf(
|
||||
"The password store '%+v' is not accessible at its location: %+v",
|
||||
store, err,
|
||||
)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeInaccessiblePasswordStore,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "The password store is not accessible",
|
||||
errors.FieldAction: "save",
|
||||
errors.FieldError: err.Error(),
|
||||
errors.FieldStoreID: store.ID,
|
||||
errors.FieldStoreName: store.Name,
|
||||
errors.FieldStorePath: store.Path,
|
||||
},
|
||||
)
|
||||
}
|
||||
store.Path = normalizedStorePath
|
||||
|
||||
var gpgPath string
|
||||
if request.Settings.GpgPath != "" || store.Settings.GpgPath != "" {
|
||||
if request.Settings.GpgPath != "" {
|
||||
gpgPath = request.Settings.GpgPath
|
||||
} else {
|
||||
gpgPath = store.Settings.GpgPath
|
||||
}
|
||||
err = helpers.ValidateGpgBinary(gpgPath)
|
||||
if err != nil {
|
||||
log.Errorf(
|
||||
"The provided gpg binary path '%v' is invalid: %+v",
|
||||
gpgPath, err,
|
||||
)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeInvalidGpgPath,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "The provided gpg binary path is invalid",
|
||||
errors.FieldAction: "save",
|
||||
errors.FieldError: err.Error(),
|
||||
errors.FieldGpgPath: gpgPath,
|
||||
},
|
||||
)
|
||||
}
|
||||
} else {
|
||||
gpgPath, err = helpers.DetectGpgBinary()
|
||||
if err != nil {
|
||||
log.Error("Unable to detect the location of the gpg binary: ", err)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeUnableToDetectGpgPath,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "Unable to detect the location of the gpg binary",
|
||||
errors.FieldAction: "save",
|
||||
errors.FieldError: err.Error(),
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
filePath := filepath.Join(store.Path, request.File)
|
||||
|
||||
recipients, err := helpers.DetectGpgRecipients(filePath)
|
||||
if err != nil {
|
||||
log.Error("Unable to determine recipients for the gpg encryption: ", err)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeUnableToDetermineGpgRecipients,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "Unable to determine recipients for the gpg encryption",
|
||||
errors.FieldAction: "save",
|
||||
errors.FieldError: err.Error(),
|
||||
errors.FieldFile: request.File,
|
||||
errors.FieldStoreID: store.ID,
|
||||
errors.FieldStoreName: store.Name,
|
||||
errors.FieldStorePath: store.Path,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
err = helpers.GpgEncryptFile(filePath, request.Contents, recipients, gpgPath)
|
||||
if err != nil {
|
||||
log.Errorf(
|
||||
"Unable to encrypt the password file '%v' in the password store '%+v': %+v",
|
||||
request.File, store, err,
|
||||
)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeUnableToEncryptPasswordFile,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "Unable to encrypt the password file",
|
||||
errors.FieldAction: "save",
|
||||
errors.FieldError: err.Error(),
|
||||
errors.FieldFile: request.File,
|
||||
errors.FieldStoreID: store.ID,
|
||||
errors.FieldStoreName: store.Name,
|
||||
errors.FieldStorePath: store.Path,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
response.SendOk(responseData)
|
||||
}
|
112
request/tree.go
Normal file
112
request/tree.go
Normal file
@@ -0,0 +1,112 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/browserpass/browserpass-native/errors"
|
||||
"github.com/browserpass/browserpass-native/response"
|
||||
"github.com/mattn/go-zglob/fastwalk"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func listDirectories(request *request) {
|
||||
responseData := response.MakeTreeResponse()
|
||||
|
||||
for _, store := range request.Settings.Stores {
|
||||
normalizedStorePath, err := normalizePasswordStorePath(store.Path)
|
||||
if err != nil {
|
||||
log.Errorf(
|
||||
"The password store '%+v' is not accessible at its location: %+v",
|
||||
store, err,
|
||||
)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeInaccessiblePasswordStore,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "The password store is not accessible",
|
||||
errors.FieldAction: "tree",
|
||||
errors.FieldError: err.Error(),
|
||||
errors.FieldStoreID: store.ID,
|
||||
errors.FieldStoreName: store.Name,
|
||||
errors.FieldStorePath: store.Path,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
store.Path = normalizedStorePath
|
||||
|
||||
var mu sync.Mutex
|
||||
directories := []string{}
|
||||
err = fastwalk.FastWalk(store.Path, func(path string, typ os.FileMode) error {
|
||||
if typ == os.ModeSymlink {
|
||||
followedPath, err := filepath.EvalSymlinks(path)
|
||||
if err == nil {
|
||||
fi, err := os.Lstat(followedPath)
|
||||
if err == nil && fi.IsDir() {
|
||||
return fastwalk.TraverseLink
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if typ.IsDir() && path != store.Path {
|
||||
if filepath.Base(path) == ".git" {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
mu.Lock()
|
||||
directories = append(directories, path)
|
||||
mu.Unlock()
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
log.Errorf(
|
||||
"Unable to list the directory tree in the password store '%+v' at its location: %+v",
|
||||
store, err,
|
||||
)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeUnableToListDirectoriesInPasswordStore,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "Unable to list the directory tree in the password store",
|
||||
errors.FieldAction: "tree",
|
||||
errors.FieldError: err.Error(),
|
||||
errors.FieldStoreID: store.ID,
|
||||
errors.FieldStoreName: store.Name,
|
||||
errors.FieldStorePath: store.Path,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
for i, directory := range directories {
|
||||
relativePath, err := filepath.Rel(store.Path, directory)
|
||||
if err != nil {
|
||||
log.Errorf(
|
||||
"Unable to determine the relative path for a file '%v' in the password store '%+v': %+v",
|
||||
directory, store, err,
|
||||
)
|
||||
response.SendErrorAndExit(
|
||||
errors.CodeUnableToDetermineRelativeDirectoryPathInPasswordStore,
|
||||
&map[errors.Field]string{
|
||||
errors.FieldMessage: "Unable to determine the relative path for a directory in the password store",
|
||||
errors.FieldAction: "tree",
|
||||
errors.FieldError: err.Error(),
|
||||
errors.FieldDirectory: directory,
|
||||
errors.FieldStoreID: store.ID,
|
||||
errors.FieldStoreName: store.Name,
|
||||
errors.FieldStorePath: store.Path,
|
||||
},
|
||||
)
|
||||
}
|
||||
directories[i] = strings.Replace(relativePath, "\\", "/", -1) // normalize Windows paths
|
||||
}
|
||||
|
||||
sort.Strings(directories)
|
||||
responseData.Directories[store.ID] = directories
|
||||
}
|
||||
|
||||
response.SendOk(responseData)
|
||||
}
|
@@ -52,6 +52,18 @@ func MakeListResponse() *ListResponse {
|
||||
}
|
||||
}
|
||||
|
||||
// TreeResponse a response format for the "tree" request
|
||||
type TreeResponse struct {
|
||||
Directories map[string][]string `json:"directories"`
|
||||
}
|
||||
|
||||
// MakeTreeResponse initializes an empty tree response
|
||||
func MakeTreeResponse() *TreeResponse {
|
||||
return &TreeResponse{
|
||||
Directories: make(map[string][]string),
|
||||
}
|
||||
}
|
||||
|
||||
// FetchResponse a response format for the "fetch" request
|
||||
type FetchResponse struct {
|
||||
Contents string `json:"contents"`
|
||||
@@ -62,6 +74,24 @@ func MakeFetchResponse() *FetchResponse {
|
||||
return &FetchResponse{}
|
||||
}
|
||||
|
||||
// SaveResponse a response format for the "save" request
|
||||
type SaveResponse struct {
|
||||
}
|
||||
|
||||
// MakeSaveResponse initializes an empty save response
|
||||
func MakeSaveResponse() *SaveResponse {
|
||||
return &SaveResponse{}
|
||||
}
|
||||
|
||||
// DeleteResponse a response format for the "delete" request
|
||||
type DeleteResponse struct {
|
||||
}
|
||||
|
||||
// MakeDeleteResponse initializes an empty delete response
|
||||
func MakeDeleteResponse() *DeleteResponse {
|
||||
return &DeleteResponse{}
|
||||
}
|
||||
|
||||
// SendOk sends a success response to the browser extension in the predefined json format
|
||||
func SendOk(data interface{}) {
|
||||
SendRaw(&okResponse{
|
||||
|
@@ -3,8 +3,8 @@ package version
|
||||
import "fmt"
|
||||
|
||||
const major = 3
|
||||
const minor = 0
|
||||
const patch = 10
|
||||
const minor = 1
|
||||
const patch = 0
|
||||
|
||||
// Code version as integer
|
||||
const Code = major*1000000 + minor*1000 + patch
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='windows-1252'?>
|
||||
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
|
||||
<Product Name='Browserpass' Id='ABCDDCBA-86C7-4D14-AEC0-86416A69ABDE' UpgradeCode='ABCDDCBA-7349-453F-94F6-BCB5110BA4FD' Language='1033' Codepage='1252' Version='3.0.10' Manufacturer='Browserpass'>
|
||||
<Product Name='Browserpass' Id='ABCDDCBA-86C7-4D14-AEC0-86416A69ABDE' UpgradeCode='ABCDDCBA-7349-453F-94F6-BCB5110BA4FD' Language='1033' Codepage='1252' Version='3.1.0' Manufacturer='Browserpass'>
|
||||
|
||||
<Package Id='*' Keywords='Installer' Manufacturer='Browserpass' InstallerVersion='200' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
|
||||
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
|
||||
|
Reference in New Issue
Block a user