Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d59172c403 | ||
|
|
240255b2ff |
No files matched your search
@@ -109,7 +109,9 @@ exists. Users are changed by `cn=user-manager,ou=services`, whose ACLs allow wri
|
||||
and setting passwords (`=wx`) but not reading them. Passwords are hashed with ARGON2, and the
|
||||
ppolicy overlay locks a disabled user (`pwdAccountLockedTime`, effective with `pwdLockout`).
|
||||
slapd listens on the local socket only. Provisioning checks every step before changing it, so it
|
||||
runs at every start of `linux-manager-setup`.
|
||||
runs at every start of `linux-manager-setup`. The database's `olcDbMaxSize` is 1 GiB, as the
|
||||
default of slapd-mdb, 10 MB, is small for a database that holds the users and every certificate
|
||||
issued, which is never deleted; a larger limit is left as it is.
|
||||
|
||||
Consequences: The package depends on `slapd`, `python3-ldap`, `openvpn` and
|
||||
`openvpn-auth-ldap`, and `linux-manager-setup` and `linux-manager-user` import `python3-ldap`. The
|
||||
@@ -833,7 +835,9 @@ enabled, then the Manager's port, which always exists. The files are DER, copied
|
||||
them. The CRLs of the issuing CAs are valid for `pki.crl_days`, a week by default, signed again at
|
||||
every revocation and by a daily timer once half their validity has passed; the root CRL has its own
|
||||
`pki.root_crl_days`, half a year by default, so an offline root needs its CRL signed twice a year,
|
||||
not weekly.
|
||||
not weekly. A revocation and its CRL are separate writes to the directory, so the timer and setup
|
||||
also sign a CRL again that lacks a revoked certificate that has not expired, for the CAs whose key
|
||||
is on the server.
|
||||
|
||||
Consequences: A client that caches a CRL sees a revocation within a week. A client tries the URLs
|
||||
in order, so one that cannot reach the status port falls back to the Manager's. The files are
|
||||
@@ -928,7 +932,8 @@ retired CA keeps its entry, renamed, so its certificates stay in the inventory.
|
||||
from outside, by cloud-init or by hand, is placed as files before the first setup with a platform,
|
||||
which imports and removes them. strongSwan, OpenVPN, Caddy and the system's trust store read files,
|
||||
so setup and every revocation write them from the directory. Setup provisions the directory before
|
||||
the PKI; without the directory it leaves the PKI and its files as they are and configures the rest.
|
||||
the PKI; without the directory it leaves the PKI and its files as they are and configures the rest,
|
||||
Caddy with the copies it has of the certificates and keys.
|
||||
|
||||
Consequences: `slapcat` writes the users and the PKI into every backup in one consistent copy, and a
|
||||
restore brings both back together. The PKI depends on slapd, as the users already do, and not on
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
# Changelog
|
||||
|
||||
## 0.45.3 - 2026-12-03 23:03:55 +0100
|
||||
|
||||
fix: the directory holds up to 1 GiB, a revocation missing from its CRL is signed into it, and a
|
||||
setup without the directory keeps the certificates Caddy serves.
|
||||
|
||||
- The directory's database holds up to 1 GiB instead of slapd's default of 10 MB;
|
||||
linux-manager-setup also raises the limit of an existing database.
|
||||
- linux-manager-ca maintain, which the daily timer runs, and linux-manager-setup sign a CRL again
|
||||
that lacks a revoked certificate that has not expired, as after a revocation that was interrupted.
|
||||
- A run of linux-manager-setup that cannot read the directory keeps the certificates and keys copied
|
||||
for Caddy and goes on serving the HTTPS sites, the ACME servers and the sites of issuing CAs with
|
||||
them; it leaves out only what has no copy.
|
||||
|
||||
## 0.45.2 - 2026-11-24 20:41:04 +0100
|
||||
|
||||
fix: the copy icons of the Manager are shown only on a page opened over HTTPS, where the browser
|
||||
offers the clipboard.
|
||||
|
||||
- The copy icons of the Addresses panel, the Remote access page and the Web Sites page, and the Copy
|
||||
button of a WireGuard configuration, are left out on a page opened over plain HTTP, where they
|
||||
did nothing.
|
||||
|
||||
## 0.45.1 - 2026-11-24 19:57:53 +0100
|
||||
|
||||
update: the development VM of lm-dev-vm.py keeps plain HTTP by name.
|
||||
|
||||
@@ -656,8 +656,9 @@ extensions are left out.
|
||||
|
||||
The CRLs of the issuing CAs are valid for `pki.crl_days`, and the root CRL, when the server signs
|
||||
it, for `pki.root_crl_days`. A CRL is signed again at every revocation and, once half of its
|
||||
validity has passed, by `linux-manager-pki.timer`, which runs `linux-manager-ca maintain` daily; it also
|
||||
has `linux-manager-setup` renew the server's certificates when they are due. OpenVPN checks the CRL
|
||||
validity has passed or when it lacks a revoked certificate that has not expired, by
|
||||
`linux-manager-pki.timer`, which runs `linux-manager-ca maintain` daily; it also has
|
||||
`linux-manager-setup` renew the server's certificates when they are due. OpenVPN checks the CRL
|
||||
of every CA of a client's chain, the root's included, and refuses every client while one has
|
||||
expired.
|
||||
|
||||
@@ -792,7 +793,7 @@ is switched on:
|
||||
|
||||
- its own database, `dc=linux-manager,dc=local` in `/var/lib/ldap/linux-manager`, next to the one the
|
||||
slapd package creates; root manages it through the local socket, with no administrator
|
||||
password;
|
||||
password; its size limit (`olcDbMaxSize`) is 1 GiB, to which setup raises a smaller one;
|
||||
- `ou=users` holds one entry per user, named by `uid`: an `inetOrgPerson` for a VPN user, an
|
||||
`account` for a Manager-only account (see Managing users);
|
||||
- the package's own schema under the OID `1.3.6.1.4.1.67380.10.1.2`, listed in
|
||||
@@ -1708,7 +1709,9 @@ HTTPS certificate row makes the CSR and imports the certificates, and `/https` c
|
||||
`/usr/lib/systemd/system/caddy.service.d/linux-manager.conf` makes `caddy.service` read;
|
||||
`caddy.service` does not start before the file exists, and `/etc/caddy/Caddyfile` is not used.
|
||||
Setup starts Caddy once the server is configured (`general.platform` other than `none`) and
|
||||
reloads it when the file changes.
|
||||
reloads it when the file changes. While the directory cannot be read, Caddy keeps serving the
|
||||
certificates and keys an earlier run of setup copied for it, those of the HTTPS names and of the
|
||||
issuing CAs; what has no copy is left out.
|
||||
|
||||
Caddy listens on every address, and the firewall decides who reaches it: `web.port` is open on the
|
||||
interfaces `web.listen` names, the Manager's port on those of its `listen`, and `metrics.port` on
|
||||
|
||||
@@ -86,6 +86,9 @@ TOTP_WINDOW = 1
|
||||
#: The value of pwdAccountLockedTime that disables a user until it is enabled again.
|
||||
DISABLED = '000001010000Z'
|
||||
|
||||
#: The largest size of the database, in bytes: slapd-mdb's olcDbMaxSize.
|
||||
DB_MAX_SIZE = 1024 ** 3
|
||||
|
||||
#: The indexes of the database.
|
||||
INDEXES = ('objectClass eq', 'uid eq', 'uidNumber eq', 'linuxManagerConsoleLogin eq', 'linuxManagerCertificateName eq')
|
||||
|
||||
@@ -190,9 +193,10 @@ def _ensure_password_hash(connection):
|
||||
|
||||
|
||||
def _ensure_database(connection):
|
||||
"""The DN of the package's database in cn=config, created when missing; its ACLs are kept as ACCESS, and the
|
||||
indexes of INDEXES it lacks are added, which slapd builds online."""
|
||||
found = connection.search_s('cn=config', ldap.SCOPE_ONELEVEL, f'(olcSuffix={BASE})', ['olcAccess', 'olcDbIndex'])
|
||||
"""The DN of the package's database in cn=config, created when missing; its ACLs are kept as ACCESS, a largest size
|
||||
below DB_MAX_SIZE is raised to it, and the indexes of INDEXES it lacks are added, which slapd builds online."""
|
||||
wanted = ['olcAccess', 'olcDbIndex', 'olcDbMaxSize']
|
||||
found = connection.search_s('cn=config', ldap.SCOPE_ONELEVEL, f'(olcSuffix={BASE})', wanted)
|
||||
if not found:
|
||||
DB_DIRECTORY.mkdir(mode=0o700, parents=True, exist_ok=True)
|
||||
openldap = pwd.getpwnam('openldap')
|
||||
@@ -203,11 +207,14 @@ def _ensure_database(connection):
|
||||
'olcSuffix': [BASE.encode()],
|
||||
'olcDbDirectory': [str(DB_DIRECTORY).encode()],
|
||||
'olcRootDN': [ROOT.encode()],
|
||||
'olcDbMaxSize': [str(DB_MAX_SIZE).encode()],
|
||||
'olcDbIndex': [index.encode() for index in INDEXES],
|
||||
'olcAccess': [f'{{{index}}}{rule}'.encode() for index, rule in enumerate(ACCESS)],
|
||||
}))
|
||||
found = connection.search_s('cn=config', ldap.SCOPE_ONELEVEL, f'(olcSuffix={BASE})', ['olcAccess', 'olcDbIndex'])
|
||||
found = connection.search_s('cn=config', ldap.SCOPE_ONELEVEL, f'(olcSuffix={BASE})', wanted)
|
||||
dn, attributes = found[0]
|
||||
if int(attributes.get('olcDbMaxSize', [b'0'])[0]) < DB_MAX_SIZE:
|
||||
connection.modify_s(dn, [(ldap.MOD_REPLACE, 'olcDbMaxSize', [str(DB_MAX_SIZE).encode()])])
|
||||
if unordered(attributes.get('olcAccess', [])) != list(ACCESS):
|
||||
connection.modify_s(dn, [(ldap.MOD_REPLACE, 'olcAccess', [f'{{{index}}}{rule}'.encode() for index, rule in enumerate(ACCESS)])])
|
||||
present = [value.decode() for value in attributes.get('olcDbIndex', [])]
|
||||
|
||||
@@ -523,6 +523,12 @@ def check_subject(kind, subject):
|
||||
return subject.lower() if kind == 'dns' else subject
|
||||
|
||||
|
||||
def revoked_unexpired(connection, name, moment):
|
||||
"""The entries of the certificates the CA revoked that have not expired at moment, which its CRL lists."""
|
||||
return [entry for entry in certificate_entries(connection, authority_dn(name), '(linuxManagerRevoked=*)')
|
||||
if not entry['expires'] or entry['expires'] > iso(moment)]
|
||||
|
||||
|
||||
def sign_crl(connection, cfg, name):
|
||||
"""Sign a new CRL of the CA with the certificates it revoked that have not expired, valid for pki.root_crl_days for
|
||||
the root and pki.crl_days for an issuing CA."""
|
||||
@@ -537,9 +543,7 @@ def sign_crl(connection, cfg, name):
|
||||
.next_update(moment + datetime.timedelta(days=days))
|
||||
.add_extension(x509.CRLNumber(number), False)
|
||||
.add_extension(authority_key_id(cert), False))
|
||||
for revoked_entry in certificate_entries(connection, authority_dn(name), '(linuxManagerRevoked=*)'):
|
||||
if revoked_entry['expires'] and revoked_entry['expires'] <= iso(moment):
|
||||
continue
|
||||
for revoked_entry in revoked_unexpired(connection, name, moment):
|
||||
revoked = (x509.RevokedCertificateBuilder()
|
||||
.serial_number(int(revoked_entry['serial'], 16))
|
||||
.revocation_date(datetime.datetime.strptime(revoked_entry['revoked'], '%Y-%m-%dT%H:%M:%SZ')
|
||||
@@ -569,10 +573,13 @@ def ready(name):
|
||||
|
||||
|
||||
def refresh_crls(connection, cfg, force=()):
|
||||
"""Sign a new CRL for each CA with its key on the server whose CRL is stale, or that force names."""
|
||||
"""Sign a new CRL for each CA with its key on the server whose CRL is stale or lacks a revoked certificate that
|
||||
has not expired, or that force names."""
|
||||
for name in ['root', *issuing(connection)]:
|
||||
entry = authority(connection, name)
|
||||
if entry and entry['key'] and entry['cert'] and (name in force or crl_stale(entry['crl'])):
|
||||
if entry and entry['key'] and entry['cert'] and (name in force or crl_stale(entry['crl']) or any(
|
||||
entry['crl'].get_revoked_certificate_by_serial_number(int(revoked['serial'], 16)) is None
|
||||
for revoked in revoked_unexpired(connection, name, now()))):
|
||||
sign_crl(connection, cfg, name)
|
||||
|
||||
|
||||
@@ -1582,9 +1589,9 @@ def import_root_crl(cfg, data):
|
||||
|
||||
|
||||
def maintain(cfg):
|
||||
"""Sign the stale CRLs again or, with simple-ca, fetch them, publish and install them; the notices, and True when
|
||||
one of the server's certificates is due for renewal, the HTTPS certificate among them while the server issues it,
|
||||
or, with simple-ca, an issuing CA waits for Simple CA, which linux-manager-setup does."""
|
||||
"""Sign the CRLs of refresh_crls again and, with simple-ca, fetch the stale ones, publish and install them; the
|
||||
notices, and True when one of the server's certificates is due for renewal, the HTTPS certificate among them while
|
||||
the server issues it, or, with simple-ca, an issuing CA waits for Simple CA, which linux-manager-setup does."""
|
||||
with directory() as connection:
|
||||
refresh_crls(connection, cfg)
|
||||
notices = fetch_crls(connection) if cfg['pki']['root'] == 'simple-ca' else []
|
||||
|
||||
@@ -739,6 +739,12 @@ def manage_resolver(changed):
|
||||
run(['systemctl', 'restart', RESOLVER_UNIT], check=False)
|
||||
|
||||
|
||||
def caddy_copies(folder):
|
||||
"""The certificate and key copied to folder for Caddy, cert.pem and key.pem; None when it has not both."""
|
||||
files = (folder / 'cert.pem', folder / 'key.pem')
|
||||
return tuple(file.read_bytes() for file in files) if all(file.is_file() for file in files) else None
|
||||
|
||||
|
||||
def manage_caddy(cfg, ctx):
|
||||
"""Run Caddy, a dependency of the package, which serves every HTTP and HTTPS port of the server's services and the
|
||||
web sites; the services listen on loopback only.
|
||||
@@ -753,15 +759,16 @@ def manage_caddy(cfg, ctx):
|
||||
names; a client without SNI gets the certificate of the first HTTPS name. Every site calls
|
||||
its service on its loopback port. The certificate comes from the ACME CA of https.acme_provider, the global issuer,
|
||||
with https.certificate acme, and otherwise is the one linuxmanager_pki.https_files gives, written to
|
||||
CADDY_HTTPS_DIR; while that cannot be read, the HTTPS sites are left out, so that no ACME CA is asked for it. It
|
||||
CADDY_HTTPS_DIR; while there is none, the HTTPS sites are left out, so that no ACME CA is asked for it. It
|
||||
also serves the CA files of linuxmanager_pki.PUBLISH_DIR at /pki/ on web.port, the Manager's port, https.web_port
|
||||
and https.manager_port, ahead of the redirect to HTTPS, and an ACME server at /acme/<name>/ on https.web_port for
|
||||
each issuing CA with acme and a certificate.
|
||||
|
||||
It serves each site of ctx's sites from its folder, with the TLS of the site: an issuing CA of tls ca issues its
|
||||
certificates, and the certificate and key of tls file are written to CADDY_SITES_DIR/<name>. The certificates and
|
||||
keys of the issuing CAs of both are copied to CADDY_PKI_DIR. While the sites cannot be read (ctx's sites is None),
|
||||
the Caddyfile is left as it is.
|
||||
keys of the issuing CAs of both are copied to CADDY_PKI_DIR. While the directory cannot be read, the copies in
|
||||
CADDY_HTTPS_DIR and CADDY_PKI_DIR are served and kept, and what has none is left out. While the sites cannot be
|
||||
read (ctx's sites is None), the Caddyfile is left as it is.
|
||||
"""
|
||||
sites = ctx['sites']
|
||||
if shutil.which('caddy') is None:
|
||||
@@ -777,15 +784,19 @@ def manage_caddy(cfg, ctx):
|
||||
fail(f'the group {CADDY_GROUP} does not exist; is the caddy package installed?')
|
||||
https = True
|
||||
own = None
|
||||
if https and cfg['https']['certificate'] != 'acme':
|
||||
unread = False
|
||||
if cfg['https']['certificate'] != 'acme':
|
||||
try:
|
||||
own = linuxmanager_pki.https_files(cfg)
|
||||
except ldap.LDAPError as exc:
|
||||
warn(f'the HTTPS sites are left out: the HTTPS certificate cannot be read: {exc}')
|
||||
https = False
|
||||
if https and own is None:
|
||||
warn('the HTTPS sites are left out: the server has no HTTPS certificate yet')
|
||||
https = False
|
||||
unread = True
|
||||
own = caddy_copies(CADDY_HTTPS_DIR)
|
||||
outcome = 'the HTTPS sites are left out' if own is None else 'the HTTPS sites keep its copy'
|
||||
warn(f'the HTTPS certificate cannot be read, so {outcome}: {exc}')
|
||||
else:
|
||||
if own is None:
|
||||
warn('the HTTPS sites are left out: the server has no HTTPS certificate yet')
|
||||
https = own is not None
|
||||
copied = False
|
||||
if own is None:
|
||||
if CADDY_HTTPS_DIR.is_dir():
|
||||
@@ -801,14 +812,16 @@ def manage_caddy(cfg, ctx):
|
||||
try:
|
||||
credentials = {name: linuxmanager_pki.authority_files(name) for name in wanted}
|
||||
except ldap.LDAPError as exc:
|
||||
warn(f'the ACME servers and the sites of issuing CAs are left out: the PKI cannot be read: {exc}')
|
||||
credentials = {}
|
||||
unread = True
|
||||
warn(f'the PKI cannot be read, so the ACME servers and the sites of issuing CAs keep its copies, and those '
|
||||
f'without one are left out: {exc}')
|
||||
credentials = {name: caddy_copies(CADDY_PKI_DIR / name) for name in wanted}
|
||||
authorities = [name for name, files in credentials.items() if files is not None]
|
||||
for site in sites:
|
||||
if site['tls'] == 'ca' and site['ca'] not in authorities:
|
||||
warn(f'site {site["name"]} is left out: issuing CA {site["ca"]} has no certificate')
|
||||
sites = [site for site in sites if site['tls'] != 'ca' or site['ca'] in authorities]
|
||||
for folder in (CADDY_PKI_DIR.iterdir() if CADDY_PKI_DIR.is_dir() else []):
|
||||
for folder in (CADDY_PKI_DIR.iterdir() if CADDY_PKI_DIR.is_dir() and not unread else []):
|
||||
if folder.name not in authorities:
|
||||
shutil.rmtree(folder)
|
||||
for name in authorities:
|
||||
|
||||
@@ -39,7 +39,8 @@ their password and, when enrolled, the code.
|
||||
- The eye opens the device's configuration; the download gives `<user>-<n>.conf`, with a
|
||||
placeholder for the device's private key, which the server never has.
|
||||
- The remove button removes a peer after a confirmation.
|
||||
- **Server:** the server's public key with a copy icon, the endpoint and the allowed IPs a device
|
||||
needs; **Show config** opens a device configuration with placeholders.
|
||||
- **Server:** the server's public key with a copy icon on a page opened over HTTPS, the endpoint
|
||||
and the allowed IPs a device needs; **Show config** opens a device configuration with
|
||||
placeholders, with a Copy button over HTTPS.
|
||||
- In the configuration dialogs a switch leaves out the `[Interface]` and `PrivateKey` lines, which
|
||||
WireGuard for Windows fills in for a new empty tunnel.
|
||||
+5
-3
@@ -11,9 +11,11 @@ The Overview tab shows the state of the server, read every 10 seconds by default
|
||||
IKEv2, OpenVPN and WireGuard; and the status web service and its port.
|
||||
- **Services:** the state of each of the server's systemd services and of Caddy; the chip on the
|
||||
title bar tells whether the server's services are active.
|
||||
- **Addresses:** links to the status page over HTTPS and over plain HTTP, and to the
|
||||
Manager over HTTPS, each opening in a new tab; and the issuer and the discovery URL of the
|
||||
server's OpenID Provider, each with a copy icon, or off while the provider is disabled (see
|
||||
- **Addresses:** links to the status page and the Manager over HTTPS for the server's names (and
|
||||
its addresses with `https.ip_sans`), and over plain HTTP: the status page by address, and both
|
||||
by name and the Manager by address too while the redirect to HTTPS is off; each opens in a new
|
||||
tab. Then the issuer and the discovery URL of the server's OpenID Provider, each with a copy
|
||||
icon over HTTPS, or off while the provider is disabled (see
|
||||
[Service accounts](service-accounts.md#openid-provider)).
|
||||
- **Backup:** the result of the last run, the next run and Run now (see [Backup](backup.md)).
|
||||
- **PostgreSQL:** each cluster with its main settings and its databases with their sizes.
|
||||
|
||||
@@ -23,9 +23,9 @@ Collector reading the server's metrics. They cannot sign in to the Manager.
|
||||
## OpenID Provider
|
||||
|
||||
The server can sign its users in to other systems with OpenID Connect. Its issuer and discovery
|
||||
URL are on the Addresses panel of the [Overview](router.md), each with a copy icon, and while it is
|
||||
enabled the title of the list has the number of its clients. It is turned on on the server as
|
||||
root:
|
||||
URL are on the Addresses panel of the [Overview](router.md), each with a copy icon on a page
|
||||
opened over HTTPS, and while it is enabled the title of the list has the number of its clients.
|
||||
It is turned on on the server as root:
|
||||
|
||||
```sh
|
||||
linux-manager-config-edit set --restart oidc.enabled true
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ and the name server of their domain on the [DNS](dns.md) page.
|
||||
|
||||
- **State:** whether the sites are served.
|
||||
- **Largest upload:** the largest file or zip archive the Files tab and the server's API take.
|
||||
- **WebDAV:** whether the folders are served over WebDAV, and its URL with a copy icon. WebDAV is
|
||||
switched on the [System](system.md) tab, which installs rclone.
|
||||
- **WebDAV:** whether the folders are served over WebDAV, and its URL with a copy icon over HTTPS.
|
||||
WebDAV is switched on the [System](system.md) tab, which installs rclone.
|
||||
|
||||
**Settings** edits the state, the largest upload and the WebDAV port.
|
||||
|
||||
|
||||
+11
-6
@@ -404,16 +404,21 @@ export function Pairs(props: { rows: [string, string | ReactNode][] }) {
|
||||
)
|
||||
}
|
||||
|
||||
/** A value in monospace for Pairs with an action icon that puts it on the clipboard; label names it in the tooltip. */
|
||||
/**
|
||||
* A value in monospace for Pairs with an action icon that puts it on the clipboard, shown only on a page served over
|
||||
* HTTPS, where the browser offers the clipboard; label names it in the tooltip.
|
||||
*/
|
||||
export function Copyable(props: { value: string; label: string }) {
|
||||
return (
|
||||
<Stack direction="row" sx={{ alignItems: 'center', gap: 1 }}>
|
||||
<Box component="span" sx={{ fontFamily: 'monospace', fontSize: 13, wordBreak: 'break-all' }}>{props.value}</Box>
|
||||
<Tooltip title={`Copy the ${props.label}`}>
|
||||
<IconButton size="small" aria-label={`copy the ${props.label}`} onClick={() => void navigator.clipboard.writeText(props.value)}>
|
||||
<ContentCopy fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
{window.isSecureContext && (
|
||||
<Tooltip title={`Copy the ${props.label}`}>
|
||||
<IconButton size="small" aria-label={`copy the ${props.label}`} onClick={() => void navigator.clipboard.writeText(props.value)}>
|
||||
<ContentCopy fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
)}
|
||||
</Stack>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@ const PREFILLED_LINES = 2
|
||||
* device's address, its peer's IPs, or a placeholder without them (ips null). The device's private key is a
|
||||
* placeholder, which the server never has; a switch leaves out the [Interface] and PrivateKey lines, which a client such
|
||||
* as WireGuard for Windows fills in for a new empty tunnel, and keeps its position in the browser's settings. Copy
|
||||
* puts the configuration as shown on the clipboard.
|
||||
* puts the configuration as shown on the clipboard; it is shown only on a page served over HTTPS, where the browser
|
||||
* offers the clipboard.
|
||||
*/
|
||||
export default function WireGuardConfigDialog(props: { title: string; server: WireGuardServer; ips: string[] | null; onClose: () => void }) {
|
||||
const [copied, setCopied] = useState(false)
|
||||
@@ -43,9 +44,11 @@ export default function WireGuardConfigDialog(props: { title: string; server: Wi
|
||||
</Box>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button startIcon={copied ? <Check /> : <ContentCopy />} onClick={() => void navigator.clipboard.writeText(text).then(() => setCopied(true))}>
|
||||
{copied ? 'Copied' : 'Copy'}
|
||||
</Button>
|
||||
{window.isSecureContext && (
|
||||
<Button startIcon={copied ? <Check /> : <ContentCopy />} onClick={() => void navigator.clipboard.writeText(text).then(() => setCopied(true))}>
|
||||
{copied ? 'Copied' : 'Copy'}
|
||||
</Button>
|
||||
)}
|
||||
<Button variant="contained" onClick={props.onClose}>Close</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
|
||||
Reference in new issue
Block a user