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

Issue with enable ssl_redirect via API Domain.update #756

Closed
kionez opened this issue Nov 14, 2019 · 2 comments
Closed

Issue with enable ssl_redirect via API Domain.update #756

kionez opened this issue Nov 14, 2019 · 2 comments
Assignees
Projects
Milestone

Comments

@kionez
Copy link
Contributor

kionez commented Nov 14, 2019

I'm trying to write a simple script to enable SSL redirect for my domains, but I noticed that resets some settings and cause an inconsistent state in DB:

Here an example:

        $data = [
            'domainname' => $domainname
            'ssl_redirect' => TRUE,
        ];
        $fapi->request('Domains.update', $data);

This request gives no error but, resets many settings such as HTTP2 and so on (see lib/Froxlor/Api/Commands/Domains.php lines 458:477), i think is because it checks for ssl_ipandport in the request, even if is correctly configured before.

Furthermore, if I try to fix with another request:

        $ipports_ssl = array('HERE IS MY IP ID');
        $data = [
            'domainname' => $domainname,
            'ssl_ipandport' => $ipports_ssl,
            'ssl_redirect' => TRUE,
            'http2' => TRUE,
            'include_specialsettings' => TRUE,
        ];
        $fapi->request('Domains.update', $data);

it gives me error 1 Error: [500] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '14-2' for key 'PRIMARY', because the table panel_domaintoip weren't update when it wrongly removes SSL settings.

@d00p
Copy link
Member

d00p commented Nov 14, 2019

when setting ssl_redirect to true and no ssl-ip/port is given, it's set to -1 leading to ssl_redirect and letsencrypt (if set) being set to 0 - hence your integrity contraint violation, the ip/port is still connected to the domain.

I understand that this is not a good way to handle this, the update() method should default to the already defined IPs - but then again, we need something to distinguish the cases "i want to fallback to the current values if nothing is set" and "i set this to an empty value on purpose to remove (ssl)ips"

@d00p d00p self-assigned this Nov 14, 2019
@d00p d00p added this to To do in 0.10.x via automation Nov 14, 2019
@kionez
Copy link
Contributor Author

kionez commented Nov 14, 2019

I reported this in a hurry, I'll try to find a way to manage this situations (i.e.: enable just ssl_redirect, remove ips,... ) and if I find something useful, I'll make a PR.

I thought it was better to report the problem as soon as possible :)

@d00p d00p added this to the 0.10.7 milestone Nov 15, 2019
@d00p d00p closed this as completed in 1a3cc52 Nov 15, 2019
0.10.x automation moved this from To do to Done Nov 15, 2019
@d00p d00p modified the milestones: 0.10.7, 0.10.6 Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
0.10.x
  
Done
Development

No branches or pull requests

2 participants