From 4ac6224e8bfc5ae0d8ddcffb953f020331e873b1 Mon Sep 17 00:00:00 2001
From: Frederik Lindenaar <frederik@lindenaar.nl>
Date: Thu, 24 Oct 2019 09:52:58 +0200
Subject: [PATCH] changed extension of example config file and updated all references accordingly

---
 README.md         |  8 ++++----
 duo_api.conf.dist | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 duo_api.py        | 10 +++++-----
 duo_api.tmpl      | 56 --------------------------------------------------------
 4 files changed, 65 insertions(+), 65 deletions(-)
 create mode 100644 duo_api.conf.dist
 delete mode 100644 duo_api.tmpl

diff --git a/README.md b/README.md
index 8f03760..59cdd97 100644
--- a/README.md
+++ b/README.md
@@ -38,10 +38,10 @@ point / template to implement you own custom logic directly. It contains a
 number of examples of the implemented direct and config-based method to start.
 
 To run the config-file implementation of the client create a config file named
-`duo_api.conf` in the same directory as the script using the provided template
-`duo_api.tmpl` and configure it for your environment  and run it. To use it
-without config file, comment out the settings and code provided for that, set
-the configuration values for your environment and run it.
+`duo_api.conf` in the same directory as the script using the provided example
+`duo_api.conf.dist` and configure it for your environment  and run it. To use
+it without config file, comment out the settings and code provided for that,
+set the configuration values for your environment and run it.
 
 
 <a name=duo_library>duo_library.py</a>
diff --git a/duo_api.conf.dist b/duo_api.conf.dist
new file mode 100644
index 0000000..8fb2308
--- /dev/null
+++ b/duo_api.conf.dist
@@ -0,0 +1,56 @@
+#
+# duo_api.conf.dist - example config for duo_api.py, a pure python3 DUO client
+#
+# Version 1.0, latest version, documentation and bugtracker available at:
+#		https://gitlab.lindenaar.net/scripts/duo
+#
+# Copyright (c) 2019 Frederik Lindenaar
+#
+# This file is free software: you can redistribute and/or modify it under the
+# terms of version 3 of the GNU General Public License as published by the Free
+# Software Foundation, or (at your option) any later version of the license.
+#
+# This script 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, visit <http://www.gnu.org/licenses/> to download it.
+#
+
+# To use this file with duo_api.py, rename it to duo_api.conf and update it for
+# your DUO environment. For documentation, please run: pydoc duo_api
+
+# The API section should reflect the DUO '3rd party API' Application to be used
+[API]
+host=api-XXXXXXXX.duosecurity.com
+ikey=XXXXXXXXXXXXXXXXXXXX
+skey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+path=/auth/v2/
+
+# The remainder of this file defines each DUO API request to be issued in a
+# separate section. Multiple sections can be configured for the same request by
+# appending a suffix starting with an underscore ('_').
+# See https://duo.com/docs/authapi and https://duo.com/docs/adminapi for the
+# available endpoints, parameters and responses.
+
+# Example for a fixed-value 'auth' request for DUO authorization
+[auth]
+username=username
+factor=push
+device=auto
+type=Network Access
+display_username=Test User
+# pushinfo must be URL encoded, see also https://duo.com/docs/authapi#/auth
+pushinfo=explanation=Text+section(s)+shown+to+the+user&mode=TEST
+
+# Example for a dynamic 'auth' request for DUO authorization, %(..)s instances
+# are replaced by the code for values passed at runtime, this allows configuring
+# the request in the config and only passing the dynamic values at runtime
+[auth_dynamic]
+username=%(login)s
+factor=push
+device=auto
+type=%(banner)s
+display_username=%(name)s
+
diff --git a/duo_api.py b/duo_api.py
index 2ea97ee..b4913d0 100755
--- a/duo_api.py
+++ b/duo_api.py
@@ -33,9 +33,9 @@
     method to get you started.
 
     To run the config-file implementation of the client, simply create a config
-    file (duo_api.conf) from the template (duo_api.tmpl) and configure it for
-    your environment in the same directory as this script and run it. To use it
-    without config file, comment out the code below and provide your values.
+    file (duo_api.conf) from the example (duo_api.conf.dist) and configure it
+    for your environment in the same directory as this script and run it. To use
+    it without config file, comment out the code below and provide your values.
 
     See https://duo.com/docs/authapi and https://duo.com/docs/adminapi for the
     available endpoints, parameters and responses.
@@ -96,7 +96,7 @@ def duo_api_config(config, req, vars=None):
         Returns: the API response (JSON Object)
 
         To pass parameters with the request, provide a dict (section) with a key
-        equal to req. Below sample ConfigParser config file for an auth request:
+        equal to req. Below a ConfigParser config file for an auth request:
 
             [API]
             host=api-XXXXXXXX.duosecurity.com
@@ -154,7 +154,7 @@ if __name__ == '__main__':
         # print('Access', response['result'])
 
         # Same example as above, now using a config file, for this to work copy
-        # the file duo_api.tmpl to duo_api.conf and update for your environment
+        # duo_api.conf.dist to duo_api.conf and update for your environment
         config = ConfigParser()
         if not config.read(splitext(argv[0])[0] + '.conf'):
             print("Missing/unreadable config file",splitext(argv[0])[0]+'.conf')
diff --git a/duo_api.tmpl b/duo_api.tmpl
deleted file mode 100644
index 087a481..0000000
--- a/duo_api.tmpl
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# duo_api.tmpl - config template for duo_api.py, a pure python3 DUO API client
-#
-# Version 1.0, latest version, documentation and bugtracker available at:
-#		https://gitlab.lindenaar.net/scripts/duo
-#
-# Copyright (c) 2019 Frederik Lindenaar
-#
-# This file is free software: you can redistribute and/or modify it under the
-# terms of version 3 of the GNU General Public License as published by the Free
-# Software Foundation, or (at your option) any later version of the license.
-#
-# This script 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, visit <http://www.gnu.org/licenses/> to download it.
-#
-
-# To use this file with duo_api.py, rename it to duo_api.conf and update it for
-# your DUO environment. For documentation, please run: pydoc duo_api
-
-# The API section should reflect the DUO '3rd party API' Application to be used
-[API]
-host=api-XXXXXXXX.duosecurity.com
-ikey=XXXXXXXXXXXXXXXXXXXX
-skey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-path=/auth/v2/
-
-# The remainder of this file defines each DUO API request to be issued in a
-# separate section. Multiple sections can be configured for the same request by
-# appending a suffix starting with an underscore ('_').
-# See https://duo.com/docs/authapi and https://duo.com/docs/adminapi for the
-# available endpoints, parameters and responses.
-
-# Example for a fixed-value 'auth' request for DUO authorization
-[auth]
-username=username
-factor=push
-device=auto
-type=Network Access
-display_username=Test User
-# pushinfo must be URL encoded, see also https://duo.com/docs/authapi#/auth
-pushinfo=explanation=Text+section(s)+shown+to+the+user&mode=TEST
-
-# Example for a dynamic 'auth' request for DUO authorization, %(..)s instances
-# are replaced by the code for values passed at runtime, this allows configuring
-# the request in the config and only passing the dynamic values at runtime
-[auth_dynamic]
-username=%(login)s
-factor=push
-device=auto
-type=%(banner)s
-display_username=%(name)s
-
--
libgit2 0.22.2