Skip to content

luci-app-acme: improve UI for inexperienced users #7147

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

stokito
Copy link
Contributor

@stokito stokito commented Jun 1, 2024

Maintainer: @tohojo

  1. A cleanup of translations.
  2. Autodetect of domain when adding
  3. Import domains from DDNS
  4. Logging tab

luci-app-acme screenshot

CC @hgl @stangri @systemcrash

@stokito stokito changed the title Luci app acme luci-app-acme: improve UI for inexperienced users Jun 1, 2024
Copy link
Contributor

@tohojo tohojo left a comment

Choose a reason for hiding this comment

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

I generally applaud the effort to make things more user friendly, but have some comments, see below.

Also a general one: You're adding new reads to the file system but not updating the acl config accordingly. So will things actually work correctly? How did you test all the permutations?

o.value('standalone', _('Standalone'));
o.value('webroot', _('Webroot'));
o.value('dns', _('DNS'));
o.default = 'webroot';
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change? I personally consider the validation method an "advanced" setting, it should be possible for a user to just specify the domain and have everything work without caring about the validation method, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A user must at least check the validation method if the DNS is used. Only for the DNS we allow wildcards.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, but the domain is still the primary input, and the validation method is a detail for special cases (I don't think wildcard certificates are terribly common).

Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't think we should swap these; please drop this commit.

@stokito stokito requested a review from tohojo June 3, 2024 11:20
@stokito
Copy link
Contributor Author

stokito commented Jun 3, 2024

Please squash before merging, I made many commits to just simplify the review.

@stokito stokito requested review from tohojo, dannil and systemcrash June 7, 2024 08:04
@stokito
Copy link
Contributor Author

stokito commented Jun 7, 2024 via email

@tohojo
Copy link
Contributor

tohojo commented Jun 10, 2024

Chrome console:
_isFqdn('0a.net')
true _isFqdn('0a')

Right, but:
_isFqdn("a0.net")
false

Maybe something like:

function _isIP(str) {
  return /^[0-9\.]+$/.test(str) || /[\[\]:]/.test(str);
}

function _isFqdn(str) {
  return !_isIP(str) && /\./.test(str);
}

@@ -648,7 +648,7 @@ function _collectDdnsDomains() {
if (credentials.length > 0) {
ddnsDomains.push({
sectionId: ddnsService['.name'],
domains: [ddnsService['domain']],
domains: [ddnsService['domain'], '*.' + ddnsService['domain']],
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? I don't think we should be encouraging people to randomly issue wildcard certs...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This import functionality is intended for non experienced users.
The DDNS is most likely used for personal and home usage so wildcard is not that risky. People may want to use subdomains for separate home services like HomeAssistant.my.ddns.test or NextCloud.my.ddns.test. The wildcard will significantly simplify things. If someone is paranoid they are free to edit manually the generated config.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a big assumption; those services may not even be running on the router. I don't think we should be doing the less secure thing by default. Add a note about it, sure, but don't just add the *.

@stokito
Copy link
Contributor Author

stokito commented Jun 10, 2024 via email

@stokito
Copy link
Contributor Author

stokito commented Jun 10, 2024 via email

@stokito
Copy link
Contributor Author

stokito commented Jun 10, 2024 via email

@tohojo
Copy link
Contributor

tohojo commented Jun 10, 2024 via email

@tohojo
Copy link
Contributor

tohojo commented Jun 10, 2024 via email

@systemcrash
Copy link
Contributor

systemcrash commented Jun 10, 2024 via email

@systemcrash systemcrash marked this pull request as draft June 24, 2024 12:21
@systemcrash
Copy link
Contributor

Please remove alert and sync i18n.

@systemcrash
Copy link
Contributor

ping @stokito

stokito added 4 commits July 8, 2025 21:30
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
The article is "Get a free HTTPS certificate from LetsEncrypt for OpenWrt with ACME.sh"

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
stokito added 8 commits July 8, 2025 21:31
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
A user must specify the validation_method first.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
In the 585df1d I changed the validation_method to webroot by mistake because I thought this is a default in the acme.sh.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
We can't just use the datatype = "list(hostname)" because a domain may have a wildcard.
So check the domain by a simple regexp.
Check that DNS mode is used for wildcard.
Make the wildcard allowed only the beginning.
Add lowercase requirement.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
…S mode is used

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
Check if the hostname is FQDN (e.g. has least one dot).
Check if the domain in the browser is not an IP and FQDN.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
Many users already have a DDNS configured e.g. DuckDNS.org or Cloudflare.
We can import the configurations to simplify configurations and avoid mistakes.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
@stokito stokito marked this pull request as ready for review July 8, 2025 21:01
@stokito
Copy link
Contributor Author

stokito commented Jul 8, 2025

Please re-review the PR. Now it doesn't contains changes in stings to make it easier to review and merge. I'll send another small PR for them.

)
);
o.depends('acme_server', '');
o.depends('acme_server', 'letsencrypt');
Copy link
Contributor

Choose a reason for hiding this comment

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

This won't work - the acmesh script has this logic:

	if [ "$acme_server" ]; then
		set -- "$@" --server "$acme_server"
	# default to letsencrypt because the upstream default may change
	elif [ "$staging" = 1 ]; then
		set -- "$@" --server letsencrypt_test
	else
		set -- "$@" --server letsencrypt
	fi

So if acme_server is set to letsencrypt, the staging field won't actually do anything.

o.value('standalone', _('Standalone'));
o.value('webroot', _('Webroot'));
o.value('dns', _('DNS'));
o.default = 'webroot';
Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't think we should swap these; please drop this commit.

@@ -16,11 +16,13 @@ return view.extend({
}
return certs;
}),
L.resolveDefault(fs.stat('/usr/lib/acme/client/dnsapi'), null),
Copy link
Contributor

Choose a reason for hiding this comment

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

You're not adding this to the ACL file

function _isFqdn(domain) {
// Is not an IP i.e. starts from alphanumeric and has least one dot
return /[a-z0-9-]\..*$/.test(domain) && !/[0-9-]\..*$/.test(domain);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This test doesn't work:

_isFqdn("a1.com")
false 

@@ -18,6 +19,7 @@ return view.extend({
}),
L.resolveDefault(fs.stat('/usr/lib/acme/client/dnsapi'), null),
L.resolveDefault(fs.lines('/proc/sys/kernel/hostname'), ''),
L.resolveDefault(uci.load('ddns')),
Copy link
Contributor

Choose a reason for hiding this comment

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

...nor this

@@ -648,7 +648,7 @@ function _collectDdnsDomains() {
if (credentials.length > 0) {
ddnsDomains.push({
sectionId: ddnsService['.name'],
domains: [ddnsService['domain']],
domains: [ddnsService['domain'], '*.' + ddnsService['domain']],
Copy link
Contributor

Choose a reason for hiding this comment

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

That's a big assumption; those services may not even be running on the router. I don't think we should be doing the less secure thing by default. Add a note about it, sure, but don't just add the *.

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.

4 participants