forked from aluzzardi/pam_usb
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This adds a pinentry application. Requirements: [ ] File `~/.pamusb/.pinentry.env` containing the following: [ ] PINENTRY_PASSWORD=yourGpgKeyPassword [ ] PINENTRY_FALLBACK_APP=/path/to/fallback/pinentry (eg /usr/bin/pinentry-gnome3 or whatever you're using right now) [ ] Configure GPG to use this application by setting it in ~/.gnupg/gpg-agent.conf. To do so add pinentry-program /path/to/pamusb-pinentry
- Loading branch information
Showing
5 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ Ben Ferreri <[email protected]> | |
Chris Dituri <[email protected]> | ||
Contarino Rosario <[email protected]> | ||
Dane Finlay <[email protected]> | ||
Dhruva Sambrani <[email protected]> | ||
Francisco Javier Tsao Santín <[email protected]> | ||
Gabriel Owczarski <gabriel@asus.(none)> | ||
Georg Hopp <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright (c) 2024 Dhruva Sambrani <[email protected]> | ||
# | ||
# This file is part of the pam_usb project. pam_usb is free software; | ||
# you can redistribute it and/or modify it under the terms of the GNU General | ||
# Public License version 2, as published by the Free Software Foundation. | ||
# | ||
# pam_usb is distributed in the hope that it will be useful, but WITHOUT ANY | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin | ||
# Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
|
||
import os | ||
import subprocess | ||
import getpass | ||
from dotenv import load_dotenv | ||
load_dotenv(os.path.expanduser("~/.pamusb/.pinentry.env")) | ||
|
||
pinentryPassword = os.getenv('PINENTRY_PASSWORD') | ||
fallbackPinentryApp = os.getenv('PINENTRY_FALLBACK_APP') | ||
|
||
isAuthenticated = subprocess.run(["pamusb-check", getpass.getuser()], capture_output=True) | ||
if (isAuthenticated.returncode == 0): | ||
print("OK Pleased to meet you") | ||
while True: | ||
line = input().split() | ||
if line[0] == "GETPIN": | ||
print("D %s" % pinentryPassword) | ||
elif line[0] == "BYE": | ||
exit() | ||
print("OK") | ||
else: | ||
subprocess.run(fallbackPinentryApp) |