Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enhancement: manual IP specification duringserver:ca:install command#584

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ramity wants to merge9 commits intosymfony-cli:main
base:main
Choose a base branch
Loading
fromramity:patch-1

Conversation

@ramity
Copy link

Hi, all.

I hit a bit of an admittedly fringe issue during some dev work and needed to be able to add a local IP to the list of ips added to the cert generated during theserver:ca:install go script. I extended the go script with an additional StringFlag with a default value matching the current hardcoded value to preserve the current functionality.

@ramityramity marked this pull request as ready for reviewMarch 13, 2025 05:58
@ramityramity marked this pull request as draftMarch 13, 2025 21:39
@ramity
Copy link
Author

Just got around to testing locally. I downloaded the most recent release artifact from my PR locally and instead of running the following in my dockerfile:

RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.deb.sh' | bashRUN apt install -y symfony-cli

I substituted it with:

COPY data/core-backend/custom-symfony-binary.zip /tmp/custom-symfony-binary.zipRUN cd /tmp && unzip /tmp/custom-symfony-binary.zip -d /tmpRUN cd /tmp && tar -xvzf /tmp/symfony-cli_linux_amd64.tar.gzRUN mv /tmp/symfony /usr/local/bin/symfony

With the custom binary installed, I ran:

symfony server:ca:install --ips="192.168.1.4,localhost,127.0.0.1,::1"

Which produced a certificate with the 4 IPs listed correctly:

image

I tested without the ips flag specified and got an error, so marking as draft while I figure that out.

… arrayWhen running without --ips="..." flag, ips is "" rather than being sourced by the DefaultText attribute as previously thought. I restored the previous hardcoded string array and use the ips value if it evaluates to as truthy.
Look away my lack of go experience is showing
@ramity
Copy link
Author

ramity commentedMar 13, 2025
edited
Loading

Ready for review but could use an additional test, see remaining section below

I resolved the issue and repeated my build process to generate a cert without the flag being set and produced the following cert:

image

Use case

My use case for this mostly stems from using a separate devices to host and access my dev environments. I'm exploring progressive web app related work, so the baked in path for https in a single command was very nice. Only issue is that accessing the site from an external client instead of localhost will generate a cert error since it's not being served over a valid ip. With this PR, I can add the additional IP to resolve the cert error to simply a cert authority error, which can be resolved with adding the cert locally.

I'm unsure if this functionality is really applicable to many or best practice. Some conversation on that wouldn't hurt, but this achieves what I need it to.

Remaining

I'm a little unfamiliar with go, but if someone could point me to where theserver:ca:install command is being tested during the release runner, I could add an additional test case to test with the ips flag set.

@ramityramity marked this pull request as ready for reviewMarch 13, 2025 22:32
@ramity
Copy link
Author

The fruits of my labor - a valid service worker served over https from another computer local on the network running a docker container running symfony server.

image

@tucksaun
Copy link
Member

I’m not sure I would recommend adding the certificates we generate on another system that the local system where it has been generated.

Also, thedefault.p12 certificate is used by default for all instances of the Symfony CLI so removinglocalhost and127.0.0.1 can lead to unexpected issues.

Additionally, the remote IP can change at any time, with this implementation it means we need to make possible to regenerate it when needed.

Finally, supporting this inserver:ca:install means it also needs to be supported inlocal:server:start.

IF we follow this path I think I would rather generate a certificate on the fly based on the listenIP to avoid any conflicts or user errors.

However, I might have a solution for you: the HTTPS proxy usage seems to cover your use case as it’s reachable on other IPs and the certificate generation based on DNS names means no issue with IP change. would that work for you?

@tucksaun
Copy link
Member

@ramity did you happen to have time to consider the alternative I mentioned last?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@ramity@tucksaun

[8]ページ先頭

©2009-2025 Movatter.jp