diff --git a/auth_from_http_remote_user/res_users.py b/auth_from_http_remote_user/res_users.py index 638179405..4989e3fac 100644 --- a/auth_from_http_remote_user/res_users.py +++ b/auth_from_http_remote_user/res_users.py @@ -34,10 +34,10 @@ class res_users(orm.Model): readonly=True), } - def copy(self, cr, uid, rid, defaults=None, context=None): - defaults = defaults or {} - defaults['sso_key'] = False - return super(res_users, self).copy(cr, uid, rid, defaults, context) + def copy(self, cr, uid, id, default=None, context=None): + default = default = {} if default is None else default + default['sso_key'] = False + return super(res_users, self).copy(cr, uid, id, default, context) def check_credentials(self, cr, uid, password): try: diff --git a/log_forwarded_for_ip/README.rst b/log_forwarded_for_ip/README.rst new file mode 100644 index 000000000..498cbdf80 --- /dev/null +++ b/log_forwarded_for_ip/README.rst @@ -0,0 +1,76 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +======================== +Forwarded-for IPs in log +======================== + +This module makes werkzeug messages in the log show the IP the requests come from instead of the reverse proxy one. + + +Installation +============ + +Only install the module in the database. + + + +Configuration +============= + +You should be running Odoo with *--proxy-mode* or *proxy_mode = True* in your configuration file and have your reverse proxy set the XFF header. + +This can be achieved with nginx adding the following in your site configuration: + + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + + +Usage +===== + +If everything is well configured, you will see the IPs the requests come from in the log instead of the proxy one. + + + +Known issues / Roadmap +====================== + +* None + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback `here `_. + + +Credits +======= + +Contributors +------------ + +* Pablo Cayuela + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/log_forwarded_for_ip/__init__.py b/log_forwarded_for_ip/__init__.py new file mode 100644 index 000000000..3fd00f7a2 --- /dev/null +++ b/log_forwarded_for_ip/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# © 2015 Aserti Global Solutions +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from werkzeug.serving import WSGIRequestHandler + + +def address_string(self): + forwarded_for = self.headers.get('X-Forwarded-For', '').split(',') + if forwarded_for and forwarded_for[0]: + return forwarded_for[0] + else: + return self.client_address[0] + +WSGIRequestHandler.address_string = address_string diff --git a/log_forwarded_for_ip/__openerp__.py b/log_forwarded_for_ip/__openerp__.py new file mode 100644 index 000000000..18b02bb4a --- /dev/null +++ b/log_forwarded_for_ip/__openerp__.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# © 2015 Aserti Global Solutions +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "X-Forwarded-For IPs in log", + "summary": "Displays source IPs in log when behind a reverse proxy", + "version": "8.0.1.0.0", + "category": "Tools", + "website": "https://odoo-community.org/", + "author": "Aserti Global Solutions, Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + "base", + ], +} diff --git a/log_forwarded_for_ip/static/description/icon.png b/log_forwarded_for_ip/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/log_forwarded_for_ip/static/description/icon.png differ diff --git a/log_forwarded_for_ip/static/description/icon.svg b/log_forwarded_for_ip/static/description/icon.svg new file mode 100644 index 000000000..a7a26d093 --- /dev/null +++ b/log_forwarded_for_ip/static/description/icon.svg @@ -0,0 +1,79 @@ + + + + + + + + image/svg+xml + + + + + + + + + + +