# Network Tools

---

# Network Utility Compatibility

_Peios / Using Peios / Network Tools_

> Native authority, output protection, and supported-mode boundaries of Peios network utility ports.

These contracts describe the Peios package recipes, not a promise that every
image contains each utility. Use the installed manual for exact options.
Begin diagnosis with [Checking Connectivity](/peios/using-peios/network-configuration/checking-connectivity.md).
The tools retain the invoking native token; installing one grants no extra
privilege, port reservation, or packet-policy exception.

## Probe and inspect

| Tool | Purpose | Boundary |
|---|---|---|
| `ping` | ICMP echo | Ordinary IPv4/IPv6 echo uses datagram sockets; raw modes have separate authority checks. |
| `tracepath`, `traceroute`, `mtr` | Route, path MTU, and latency evidence | Ordinary UDP and echo-datagram modes need no raw-socket privilege; other modes can require it. |
| `ss` | Socket inspection | Numeric UIDs are compatibility projections, not native owner identities. |
| `dig` | Query a chosen DNS server | Direct queries do not change resolvd configuration. |
| `nc` | TCP/UDP communication | OpenBSD implementation with Debian portability patches; optional TLS mode is not built. |
| `tcpdump` | Live capture or saved-capture decoding | Live packet access needs native authority; ordinary file read access suffices for saved captures. |
| `arping` | Local-link ARP probes | Uses packet authority and does not trace routed paths. |
| `nmap` | Targeted host/service inspection | Connect mode and raw-packet modes have different authority requirements. |

Ordinary echo does not use a POSIX group-range setting to authorize callers.
PNP still evaluates its traffic. Raw and packet sockets require enabled
`SeTcbPrivilege`; a tool's behavior-selection flag cannot confer it. MTR can
fall back to echo datagrams when raw sockets are unavailable.

Nmap selects probing behavior using native privilege rather than projected
UID zero. `-sT -Pn` requests TCP connect probing without raw host discovery;
`--privileged` and `NMAP_PRIVILEGED` only select behavior. Its scripts retain
the caller's authority. User data lookup uses an absolute `$HOME/.nmap` with
normal FACS checks. Ncat and Nping are not included by this recipe.

tcpdump rejects Unix `-Z` identity dropping because a numeric UID change does
not reduce native authority. Launch it with the intended native token.
Capture filters select observations, not allowed traffic, and a captured
frame can still be rejected elsewhere in the stack.

Named libpcap savefiles and Nmap logs are created with protected owner-only
native descriptors. Existing destinations must be regular, singly linked,
owned by the effective principal, and provably protected for that owner.
Rotation follows the same creation rule. Streams supplied by a caller,
stdout, shell redirection, and script-owned file operations instead follow
their own destination policy. A private file does not protect its directory
entry from a principal authorized to replace it.

## Transfer and relay

curl uses OpenSSL's system trust paths. Cookie, HSTS, and Alt-Svc saved state
receives a private descriptor for the effective principal at creation, with
no fallback to Unix mode bits. Equal projected UIDs do not confer access.
State output requires a regular writable destination; ordinary downloads
use normal destination policy. `wcurl` uses curl for file downloads.

socat supports TCP, UDP, Unix sockets, files, PTYs, process execution, and
OpenSSL TLS. It starts only explicitly requested listeners or children, under
the caller's token. Unix ownership, mode, umask, identity-switch, chroot, and
network-namespace options are rejected rather than presented as native
isolation. TUN, POSIX message queues, readline, and libwrap are excluded.
Regular relay output uses ordinary FACS policy. Select the expected TLS
identity and anchors for a private service explicitly.

For synchronized contents and private cryptographic output, use
[Copying Contents and Checking TLS](/peios/using-peios/network-tools/transfers-and-tls.md).

## Registration and throughput

`whois` follows registration-server queries and referrals under normal PNP
rules. Its recipe excludes `mkpasswd` and IDN conversion: supply ASCII or
already converted punycode. `/etc/whois.conf` can override server selection.

For a measurement between cooperating hosts, start `iperf3 -s` on the
receiver and `iperf3 -c HOST` on the sender. UDP, reverse direction, and
parallel streams use `-u`, `-R`, and `-P`. The default port is 5201; the
server
needs native bind authority and policy for control and test traffic.
Installation starts no measurement service.

iperf3 uses anonymous in-memory payload buffers. Received `-F` output and PID
files use protected owner-only creation and validate existing regular,
singly linked destinations before truncation. Send-side inputs use ordinary
read checks; logs and redirected output use their destination's policy.
Optional RSA authentication restricts measurement access but neither creates
a Peios logon nor encrypts measured traffic. Protect private keys and the
server's authorized-user file separately.

---

# Copying Contents and Checking TLS

_Peios / Using Peios / Network Tools_

> Use Peios rsync and OpenSSL without mistaking content transfer for security backup or SNI for peer verification.

Choose the intended identity and destination policy before running a transfer
or generating secret output. These instructions apply to the Peios ports;
ordinary upstream builds do not establish the native-file guarantees below.

## Synchronize contents

1. Identify the source and destination. Use a destination directory you
   control and preserve any contents that replacement could discard.
2. For recursive contents, symbolic links, and modification times, adapt:

   ```sh
   rsync -rlt source/ destination/
   rsync -rlt source/ alice@server:destination/
   ```

3. Verify the resulting contents and native descriptor. `-X` additionally
   copies ordinary `user.*` attributes, not descriptors, signatures, or
   other security attributes, even with explicit attribute filters.

New files use destination inheritance; updates retain the destination's
complete descriptor. Unix owner, group, and mode are not native authority.
Archive/security-preservation requests such as `-a`, `-p`, `-o`, `-g`,
`--chmod`, ACL preservation, and `--fake-super` are refused. This is not a
native security backup or restore mechanism.

Ordinary replacement uses an unnamed temporary inode in the destination
filesystem. Publishing requires permission to read and restore the entire
destination descriptor, including audit metadata. Unsupported staging or
insufficient rights fail without silently falling back to in-place writes.
The destination inode/descriptor check and final rename are not one atomic
security transaction; coordinate concurrent permission changes separately.

If the interruption and hardlink tradeoff is appropriate, explicitly choose
`rsync -rlt --inplace source/ destination/`. This retains the inode and its
descriptor but changes its other hardlinks too. Interruption can leave partial
contents. It is not an equivalent retry after a staged update was refused.

Alternate staging, partial/backup modes, delayed updates, hardlink
preservation, basis-directory optimization, special-file preservation,
batch mode, and unsafe symlink traversal are excluded. Replacement that
would delete an object to change its type or link target is refused; deletion
is a separate decision. Daemon serving is disabled, including over a remote
shell, while normal SSH server-side transfers remain available. SSH supplies
the recipient identity. Client password files need protected owner-only
native policy.

## Create private cryptographic output

OpenSSL uses trustd's generated trust paths by default. Per-command CA files,
directories, or environment overrides select different trust without
modifying the machine store. Use `trust` for machine trust; do not rehash its
generated directory independently.

1. Choose a directory you control and the intended effective principal.
2. Use the command's named output option for secret material: for example,
   the applicable `-out`, `-keyout`, `-secret`, `-sess_out`, or `-keylogfile`.
3. Confirm success and inspect the resulting native policy before arranging
   any intentional service sharing.

Private keys, secret-bearing PKCS12 exports, session/key-log files, derived
or random key material, RNG state, and decrypted plaintext use protected
owner-only creation. Mixed exports are treated as potentially secret; public
certificate/key output uses ordinary destination policy. Existing secret
outputs must be regular, singly linked, owned by the effective principal,
and provably protected for that owner. Refusal does not fall back to `0600`.

Shell redirection creates its own destination. `openssl ... > key.pem` does
not obtain the tool's named-output guarantee. Administrative privileges and
mandatory controls still apply to native private files.

## Verify a TLS peer

`openssl s_client` reports certificate errors without necessarily stopping.
For a strict check, require verification success and the intended identity:

```sh
openssl s_client -connect example.org:443 -servername example.org \
  -verify_return_error -verify_hostname example.org
```

Replace the host with the service being tested. For an IP identity, use
`-verify_ip`. SNI alone is not hostname verification. Inspect a failed chain,
name, or trust check rather than disabling verification to obtain success.
A successful certificate check does not grant network access or change
machine trust; listeners and connections remain subject to native policy.
