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

https: T5902: remove virtual-host configuration #2773

Merged
merged 3 commits into from Jan 9, 2024

Conversation

c-po
Copy link
Member

@c-po c-po commented Jan 8, 2024

Change Summary

We have not seen the adoption of the https virtual-host CLI option.

What it did?

  • Create multiple webservers each listening on a different IP/port (but in the same VRF)
  • All webservers shared one common document root
  • All webservers shared the same SSL certificates
  • All webservers could have had individual allow-client configurations
  • API could be enabled for a particular virtual-host but was always enabled on the default host

This configuration tried to provide a full webserver via the CLI but VyOS is a router and the Webserver is there for an API or to serve files for a local-ui.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

Component(s) name

  • pki
  • https

Proposed changes

Remove support for virtual-hosts as it's an incomplete and thus mostly useless

How to test

Update from VyOS 1.4.0-rc1 to custom ISO using this PR

set pki ca isrgrootx1 certificate 'MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygch77ct984kIxuPOZXoHj3dcKi/vVqbvYAT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oq7hHwg=='
set service https certificates certbot domain-name 'lr5.wue4.mybll.net'
set service https certificates certbot email 'foo@barrr.com'
set service https virtual-host le allow-client address '0.0.0.0/1'
set service https virtual-host le server-name 'lr5.wue4.mybll.net'

After the upgrade, the https certificate is loaded into PKI

cpo@LR5.wue4:~$ show pki
Certificate Authorities:
Name             Subject                                                  Issuer CN        Issued               Expiry               Private Key    Parent
---------------  -------------------------------------------------------  ---------------  -------------------  -------------------  -------------  ----------
isrgrootx1       CN=ISRG Root X1,O=Internet Security Research Group,C=US  CN=ISRG Root X1  2015-06-04 11:04:38  2035-06-04 11:04:38  No             N/A
lets-encrypt-r3  CN=R3,O=Let's Encrypt,C=US                               CN=ISRG Root X1  2020-09-04 00:00:00  2025-09-15 16:00:00  No             isrgrootx1

Certificates:
Name                Type    Subject CN             Issuer CN    Issued               Expiry               Revoked    Private Key    CA Present
------------------  ------  ---------------------  -----------  -------------------  -------------------  ---------  -------------  ---------------------
lr5.wue4.mybll.net  Server  CN=lr5.wue4.mybll.net  CN=R3        2024-01-08 06:33:55  2024-04-07 06:33:54  No         Yes            Yes (lets-encrypt-r3)

Smoketest result

The smoketests now also contain test-cases for T5911

cpo@LR1.wue3:~$ /usr/libexec/vyos/tests/smoke/cli/test_pki.py
test_certificate_eapol_update (__main__.TestPKI.test_certificate_eapol_update) ... ok
test_certificate_https_update (__main__.TestPKI.test_certificate_https_update) ... ok
test_certificate_in_use (__main__.TestPKI.test_certificate_in_use) ... ok
test_invalid_ca_valid_certificate (__main__.TestPKI.test_invalid_ca_valid_certificate) ... ok
test_valid_pki (__main__.TestPKI.test_valid_pki) ... ok

----------------------------------------------------------------------
Ran 5 tests in 29.678s

OK
cpo@LR1.wue3:~$ /usr/libexec/vyos/tests/smoke/cli/test_service_https.py
test_api_add_delete (__main__.TestHTTPSService.test_api_add_delete) ... ok
test_api_auth (__main__.TestHTTPSService.test_api_auth) ... ok
test_api_config_file (__main__.TestHTTPSService.test_api_config_file) ... ok
test_api_config_file_load_http (__main__.TestHTTPSService.test_api_config_file_load_http) ... ok
test_api_configure (__main__.TestHTTPSService.test_api_configure) ... ok
test_api_generate (__main__.TestHTTPSService.test_api_generate) ... ok
test_api_incomplete_key (__main__.TestHTTPSService.test_api_incomplete_key) ... ok
test_api_missing_keys (__main__.TestHTTPSService.test_api_missing_keys) ... ok
test_api_reset (__main__.TestHTTPSService.test_api_reset) ... ok
test_api_show (__main__.TestHTTPSService.test_api_show) ... ok
test_certificate (__main__.TestHTTPSService.test_certificate) ... ok

----------------------------------------------------------------------
Ran 11 tests in 83.539s

OK

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@vyosbot vyosbot requested review from a team, dmbaturin, sarthurdev, zdc, jestabro and sever-sever and removed request for a team January 8, 2024 19:46
We have not seen the adoption of the https virtual-host CLI option.

What it did?
* Create multiple webservers each listening on a different IP/port
  (but in the same VRF)
* All webservers shared one common document root
* All webservers shared the same SSL certificates
* All webservers could have had individual allow-client configurations
* API could be enabled for a particular virtual-host but was always enabled on
  the default host

This configuration tried to provide a full webserver via the CLI but VyOS is a
router and the Webserver is there for an API or to serve files for a local-ui.

Changes

Remove support for virtual-hosts as it's an incomplete and thus mostly useless
"thing". Migrate all allow-client statements to one top-level allow statement.
… a hyphen (-)

When testing for changed PKI certificates using node_changed(), we should not
use key_mangling=('-', '_'), as this will make certificate updates with a hypen
not possible.
This extends commit 86d1291 ("[boot-config-loader] T1622: Add failsafe
and back trace") and adds missing groups to the vyos user. Without this
change the vyos user will only have operator (vyos@vyos>) privileges,
even if this level is discontinued.

One could hack himself up as the user has sudo rights, but rather place
the user in the right groups from the beginning.

NOTE: This user is only added if booted with "vyos-config-debug" and
an error when the configuration can not be loaded at all.
Copy link
Member

@dmbaturin dmbaturin left a comment

Choose a reason for hiding this comment

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

I'm inclined to agree.

@c-po c-po merged commit 10f6eac into vyos:current Jan 9, 2024
6 of 7 checks passed
@c-po c-po deleted the https-rework-t5766 branch January 9, 2024 18:28
@c-po
Copy link
Member Author

c-po commented Jan 10, 2024

@Mergifyio backport sagitta

Copy link

mergify bot commented Jan 10, 2024

backport sagitta

✅ Backports have been created

c-po added a commit that referenced this pull request Jan 10, 2024
https: T5902: remove virtual-host configuration (backport #2773)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants