Git Product home page Git Product logo

xmlrpcssl's Introduction

Documentation Status

image

Code Health

image

xmlrpcssl

xmlprcssl is a Python library that provides secure communication (TLS) beetween clients and servers through xmlrpc protocol. It supports plugable handlers to provide user authentication. For now, it has as an example a ldap based authentication handler.

Server configuration

>>> from xmlrpcssl import SecureAuthenticatedXMLRPCServer
>>> from xmlrpcssl.handlers import LdapVerifyingRequestHandler
>>> from datetime import datetime
>>> KEY_SSL = '/tmp/server.key'
>>> CRT_SSL = '/tmp/server.crt'
>>> TCP_PORT = 433
>>> SERVER_IP = '10.0.0.1'
>>> LDAP_HOST = 'ldapHost' # User must have access granted to this host in ldap
>>> LDAP_SERVER = 'ldapServer' # ip or name of ldap server
>>> GIDNUMBER = 111 # User must be in this group in order to be authenticated
>>> IS_MASTER_USER = False # True if the user has write permissions in the ldap server
>>> BASE_USR_LOGIN_DN = 'o=Organization,c=US' # user base DN to perform login in
 # the ldap server
>>> BASE_SEARCH_DN = 'o=Organization,c=US' # search base DN to perform a search in
 # the ldap server base
>>> RequestHandler = LdapVerifyingRequestHandler # a handler that inherits from
 # BaseRequestHandler and performs user authentication
>>> OPT_ARGS = {'isMasterUser': IS_MASTER_USER, 'baseUsrLoginDn': BASE_USR_LOGIN_DN,
...  'ldapServer': LDAP_SERVER, 'gidNumber': GIDNUMBER, 'baseSearchDn': BASE_SEARCH_DN,
...  'host': LDAP_HOST, 'RequestHandler': RequestHandler}
>>> server_ssl = SecureAuthenticatedXMLRPCServer((SERVER_IP, TCP_PORT), KEY_SSL,CRT_SSL,
...  **OPT_ARGS)
>>> def test():
...  # toy test function
...  return datetime.now().strftime("%H:%M:%S")
>>> server_ssl.register_function(test)
>>> server_ssl.serve_forever()

Client configuration

>>> import ssl
>>> from xmlrpclib import ServerProxy
>>> USERNAME = 'ldapUser'
>>> PASSWORD = 'ldapUserPassword'
>>> TCP_PORT = 433
>>> SERVER_IP = '10.0.0.1'
>>> client_xml = ServerProxy('https://'+USERNAME+':'+PASSWORD+'@'+SERVER_IP+':'+str(TCP_PORT),
    context=ssl.SSLContext(ssl.PROTOCOL_TLSv1))
>>> response = client_xml.test()
>>> print·response

Installation

To install xmlrpcssl, simply run:

$ pip install xmlrpcssl

xmlrpcssl is compatible with Python 2.6+

Documentation

https://xmlrpcssl.readthedocs.io

Source Code

Feel free to fork, evaluate and contribute to this project.

Source: https://github.com/jonDel/xmlrpcssl

License

GPLv3 licensed.

Credits

Credits go to http://code.activestate.com/recipes/496786-simple-xml-rpc-server-over-https and https://github.com/nosmo/python-xmlrpcssl for inspiration.

xmlrpcssl's People

Contributors

jondel avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

dramasamy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.