Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[x509] Fix certificates without organization assigned #34 #61

Merged
merged 1 commit into from
Nov 19, 2018

Conversation

shashwat1002
Copy link
Contributor

This code effectively, overrides the save() function of Cert to check for a corresponding device every time a Certificate is created and then checks for the organization of that device and updates the cert object accordingly and saves it.

@coveralls
Copy link

coveralls commented Nov 13, 2018

Coverage Status

Coverage remained the same at 99.588% when pulling 9ac2ea2 on shashwat1002:issue#34_autgen_cert into 36663df on openwisp:master.

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test is missing.

This is not the right place where to put this code, you can delete it entirely.
Write a test failing first that replicates the issue I described in #34.

You have to dig deeper and find where the auto-cert feature is written in django-netjsonconfig, override that method here and solve the issue.

Keep in mind the commit message must explicitly say Closes #34 at the end of the commit message to use the auto-close feature of github, so please adhere strictly to our commit guidelines.

@shashwat1002 shashwat1002 force-pushed the issue#34_autgen_cert branch 4 times, most recently from 0a10d7c to 67c39d9 Compare November 14, 2018 18:38
Copy link
Member

@atb00ker atb00ker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this for the commit head?
[x509] Auto-generated cert for object without org
Inside the square brackets, we usually want to classify the pull request ! 😄

@shashwat1002 shashwat1002 force-pushed the issue#34_autgen_cert branch 2 times, most recently from 8116b4f to 18e7250 Compare November 15, 2018 12:20
@nemesifier nemesifier changed the title solves #34 [x509] Fix certificates without organization assigned #34 Nov 16, 2018
Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shashwat1002 great progress! 👍

I tested to ensure the test fails without your fix and it does, so that's good!

I need to ask you some final adjustments before I'm able to merge:

  • the commit message is too complicated and long, please change it to the following:
[vpn-client] Fixed auto-certificates without organization #34 

This bug happened only with shared VPNs and shared VPN-client templates.
Fixes #34
  • see my other inline comment below

from ..models import Ca, Cert


class TestModels(TestCase, TestPkiMixin, TestOrganizationMixin):
class TestModels(TestCase, TestVpnX509Mixin, TestOrganizationMixin, CreateConfigTemplateMixin):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to learn the concept of modules and how they interact otherwise you will never understand openwisp.

The PKI app of openwisp-controller (which handles certification authorities and certificates) is not aware of the internal logic of the Config app (which handles device configurations), so adding this test in the PKI app is a violation of this concept.

I think the best place to put this test is here: https://github.com/openwisp/openwisp-controller/blob/master/openwisp_controller/config/tests/test_template.py

(the Config app instead is aware of the PKI app because it needs it as a dependency so that's fine)

@shashwat1002 shashwat1002 force-pushed the issue#34_autgen_cert branch 11 times, most recently from 36b4107 to 77c99df Compare November 19, 2018 17:17
This bug happened only with shared VPNs and shared VPN-client templates.
Fixes openwisp#34
@@ -39,7 +39,7 @@ install:
- pipenv install $DJANGO
# fix issues with travis
- pipenv install --skip-lock "attrs>=17.4.0"
- pipenv install --skip-lock "six>=1.11.0"
- pipenv install --skip-lock "six"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is travis failing with "six>=1.11.0" ?

Copy link
Member

@nemesifier nemesifier Nov 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be, these kind of builds are weird sometimes, I'll accept it

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job! 👍

@nemesifier nemesifier merged commit 75077b0 into openwisp:master Nov 19, 2018
@shashwat1002
Copy link
Contributor Author

@nemesisdesign, @atb00ker thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants