summaryrefslogtreecommitdiff
path: root/pam
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2022-07-03 05:44:11 -0400
committerSam Chudnick <sam@chudnick.com>2022-07-03 05:44:11 -0400
commit2e580433e66fd785508ab739e7fec188ba3a0761 (patch)
tree04d892007b785efee00b562e9b3c5d6f3eeab9ea /pam
parent5d78a10379454946fa3fee8eb6513054f2266172 (diff)
Renamed PAM python script. Slightly improved error handling
Diffstat (limited to 'pam')
-rwxr-xr-xpam/pam_mfa.py (renamed from pam/pam.py)11
1 files changed, 9 insertions, 2 deletions
diff --git a/pam/pam.py b/pam/pam_mfa.py
index 5cb9f4d..85d0a82 100755
--- a/pam/pam.py
+++ b/pam/pam_mfa.py
@@ -19,6 +19,10 @@ RESPONSE_LENGTH = 1
19PAM_SUCCESS = 0 19PAM_SUCCESS = 0
20PAM_AUTH_ERR = 7 20PAM_AUTH_ERR = 7
21 21
22def die(msg):
23 print(msg)
24 sys.exit(1)
25
22def parse_arguments(): 26def parse_arguments():
23 # Parse command line arguments 27 # Parse command line arguments
24 parser = argparse.ArgumentParser() 28 parser = argparse.ArgumentParser()
@@ -140,10 +144,13 @@ def main():
140 144
141 # Listen for response from MFA server 145 # Listen for response from MFA server
142 # Response will be 0 for authenticated and 1 for denied 146 # Response will be 0 for authenticated and 1 for denied
143 response = int(connection.recv(RESPONSE_LENGTH).decode(FORMAT)) 147 response = connection.recv(RESPONSE_LENGTH).decode(FORMAT)
148 if response == "":
149 # lost connection to server
150 response = 1
144 151
145 # Print success/failure for PAM module 152 # Print success/failure for PAM module
146 print(str(response)) 153 print(response)
147 154
148if __name__ == '__main__': 155if __name__ == '__main__':
149 main() 156 main()