-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #205 from tayler6000/docs/Issue-204
Update docs for 2.0.0
- Loading branch information
Showing
11 changed files
with
497 additions
and
368 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
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,28 @@ | ||
Credentials | ||
########### | ||
|
||
Since SIP requests can traverse multiple servers and can receive multiple challenges, the Credentials Manager was made to store multiple passwords and pyVoIP will use the appropriate password upon request. | ||
|
||
Per `RFC 3261 Section 22.1 <https://www.rfc-editor.org/rfc/rfc3261.html#section-22.1>`_, SIP uses authentication similar to HTTP authentication (:RFC:`2617`), with the main difference being ``The realm string alone defines the protection domain.``. However, some services always use the same domain. For example, if you need to authenticate with two seperate Asterisk servers, the realm will almost certainly be ``asterisk`` for both, despite being otherwise unrelated servers. For that reason, the Credentials Manager also supports server filtering. | ||
|
||
.. _CredentialsManager: | ||
|
||
CredentialsManager | ||
================== | ||
|
||
*class* pyVoIP.credentials.\ **CredentialsManager**\ () | ||
**add**\ (username: str, password: str, server: Optional[str] = None, realm: Optional[str] = None, user: Optional[str] = None) -> None | ||
This method registers a username and password combination with the Credentials Manager. | ||
|
||
The *username* argument is the username that will be used in the Authentication header and digest calculation. | ||
|
||
The *password* argument is the password that will be used in the Authentication header digest calculation. | ||
|
||
The *server* argument is used to determine the correct credentials when challenged for authentication. If *server* is left as ``None``, the credentials may be selected with any server. | ||
|
||
The *realm* argument is used to determine the correct credentials when challenged for authentication. If *realm* is left as ``None``, the credentials may be selected with any realm. | ||
|
||
The *user* argument is used to determine the correct credentials when challenged for authentication. If *user* is left as ``None``, the credentials may be selected with any user. The *user* argument is the user in the SIP URI, **not** the username used in authentication. | ||
|
||
**get**\ (server: str, realm: str, user: str) -> Dict[str, str] | ||
Looks for credentials that match the server, realm, and user in that order. If no matchng credentials are found, this will return anonymous credentials as a server MAY accept them per `RFC 3261 Section 22.1 <https://www.rfc-editor.org/rfc/rfc3261.html#section-22.1>`_. |
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 |
---|---|---|
@@ -1,10 +1,48 @@ | ||
Globals | ||
####### | ||
|
||
Global Variables | ||
######## | ||
**************** | ||
|
||
There are a few global variables that may assist you if you're having problems with the library. | ||
|
||
pyVoIP.\ **DEBUG** = False | ||
If set to true, pyVoIP will print debug messages that may be useful if you need to open a GitHub issue. Otherwise, does nothing. | ||
If set to true, pyVoIP will print debug messages that may be useful if you need to troubleshoot or open a GitHub issue. | ||
|
||
pyVoIP.\ **TRANSMIT_DELAY_REDUCTION** = 0.0 | ||
The higher this variable is, the more often RTP packets are sent. This *should* only ever need to be 0.0. However, when testing on Windows, there has sometimes been jittering, setting this to 0.75 fixed this in testing, but you may need to tinker with this number on a per-system basis. | ||
|
||
pyVoIP.\ **ALLOW_BASIC_AUTH** = False | ||
Controls whether Basic authentication (:RFC:`7617`) is allowed for SIP authentication. Basic authentication is deprecated as it will send your password in plain-text, likely in the clear (unencrypted) as well. As such this is disabled be default. | ||
|
||
pyVoIP.\ **ALLOW_MD5_AUTH** = True | ||
MD5 Digest authentication is deprecated per `RFC 8760 Section 3 <https://tools.ietf.org/html/rfc8760#section-3>`_ as it a weak hash. However, it is still used often so it is enabled by default. | ||
|
||
pyVoIP.\ **REGISTER_FAILURE_THRESHOLD** = 3 | ||
If registration fails this many times, VoIPPhone's status will be set to FAILED and the phone will stop. | ||
|
||
pyVoIP.\ **ALLOW_TLS_FALLBACK** = False | ||
If this is set to True TLS will fall back to TCP if the TLS handshake fails. This is off by default, as it would be irresponsible to have a security feature disabled by default. | ||
|
||
This feature is currently not implemented. | ||
|
||
pyVoIP.\ **TLS_CHECK_HOSTNAME** = True | ||
Is used to create SSLContexts. See Python's documentation on `check_hostname <https://docs.python.org/3/library/ssl.html#ssl.SSLContext.check_hostname>`_ for more details. | ||
|
||
You should use the :ref:`set_tls_security <set_tls_security>` function to change this variable. | ||
|
||
pyVoIP.\ **TLS_VERIFY_MODE** = True | ||
Is used to create SSLContexts. See Python's documentation on `verify_mode <https://docs.python.org/3/library/ssl.html#ssl.SSLContext.verify_mode>`_ for more details. | ||
|
||
You should use the :ref:`set_tls_security <set_tls_security>` function to change this variable. | ||
|
||
pyVoIP.\ **SIP_STATE_DB_LOCATION** = ":memory:" | ||
This variable allows you to save the SIP message state database to a file instead of storing it in memory which is the default. This is useful for debugging, however pyVoIP does not delete the database afterwards which will cause an Exception upon restarting pyVoIP. For this reason, we recommend you do not change this variable in production. | ||
|
||
Global Functions | ||
**************** | ||
|
||
.. _set_tls_security: | ||
|
||
pyVoIP.\ **set_tls_security**\ (verify_mode: `VerifyMode <https://docs.python.org/3/library/ssl.html?highlight=ssl#ssl.VerifyMode>`_) -> None | ||
This method ensures that TLS_CHECK_HOSTNAME and TLS_VERIFY_MODE are set correctly depending on the TLS certificate verification settings you want to use. |
Oops, something went wrong.