# 使用 Homebrew, apk, dnf, MacPorts, Nix, zypper, apt, pacman 安装 knock

查看 knock 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:knock
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install knock
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install knock
```

  证据: MacPorts ports tree: net/knock/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add knock
```

  证据: Alpine Linux edge package indexes: knock from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz

- dnf (92%):

```sh
sudo dnf install knock
```

  证据: Fedora Rawhide package metadata: knock from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#knock
```

  证据: nixpkgs package indexes: pkgs/by-name/kn/knock/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- zypper (92%):

```sh
sudo zypper install knock
```

  证据: openSUSE Tumbleweed package metadata: knock from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

- Debian apt (92%):

```sh
sudo apt install knockd
```

  证据: Debian stable package indexes: knockd from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- pacman (92%):

```sh
sudo pacman -S knockd
```

  证据: Arch Linux sync databases: knockd from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

## 软件包事实

- **软件包键:** brew:knock
- **软件包管理器:** Homebrew
- **版本:** 0.8
- **来源摘要:** Port-knock server
- **主页:** <https://github.com/jvinet/knock>
- **仓库:** <https://github.com/jvinet/knock>
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- knock (别名)
- knock_helper_ipt.sh (别名)
- knockd (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 0.8
## 项目历史与用法

knock is Judd Vinet's port-knocking server and client. It watches network traffic with libpcap for a configured sequence of port hits and runs commands, commonly firewall changes, when the sequence matches.

### 项目历史

The README carries a 2004 copyright notice and describes the core design that still defines the package: closed ports can receive a secret sequence because knockd sniffs link-layer traffic rather than listening on those ports. The bundled ChangeLog lists 0.1 as the initial release and shows later work adding TCP flag handling, reload behavior, timeouts, kernel-space BPF filtering, one-time sequences, interface selection, and IPv6 support.

Version 0.8 was published on 2021-04-24 with multiple fixes and IPv6 support. The GitHub repository retained a small C codebase, an example `knockd.conf`, and manpage documentation rather than growing into a larger access-control framework.

### 采用历史

knock spread through Unix-like distributions because it solved a specific sysadmin problem with a small daemon and client. Package names vary between `knock`, `knockd`, and distribution-specific formula names, but the underlying model stayed close to the original README example: a knock sequence opens SSH, and another sequence closes it.

### 使用方式

A server runs `knockd` with a configuration file such as `/etc/knockd.conf`; a client runs `knock` to send TCP or UDP packets to the configured sequence. Commands usually add or remove firewall rules, so the tool is operationally simple but security-sensitive: the sequence should be treated like a shared secret and firewall commands must be written carefully.

### 为什么软件包爱好者会关心

knock is a memorable package because it embodies a whole security pattern in a tiny Unix daemon. It is also a reminder of the early-2000s sysadmin style: libpcap, iptables commands, config files, and a tiny client were enough to make a practical layer around SSH exposure.

### 时间线

- 2004: README copyright identifies Judd Vinet's original project era.
- 0.1: ChangeLog records the initial release.
- 0.3: ChangeLog added PPP support, command timeout directives, SIGHUP config reloads, and per-port protocols.
- 0.5: ChangeLog added one-time sequences, interface selection, BPF filtering, and security fixes.
- 0.7: ChangeLog documented the target directive and consolidated OS-specific networking code.
- 2021-04-24: v0.8 release published with fixes and IPv6 support.

### Related projects

- knock is related to other port-knocking and single-packet-authorization tools, firewall managers such as iptables, packet crafting tools such as sendip, and SSH hardening workflows.

### 来源

- <https://github.com/jvinet/knock>
- <https://github.com/jvinet/knock/blob/master/ChangeLog>
- <https://github.com/jvinet/knock/releases/tag/v0.8>
- <https://raw.githubusercontent.com/jvinet/knock/master/knockd.conf>


## 安全说明

broad file, network, media, or database tool signal.

- **Geiger 风险:** blue / 中
- broad file, network, media, or database tool signal


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: /etc/knockd.conf
## 其他软件包管理器记录

- Nix - knock: normalized package name match | nixpkgs package indexes: pkgs/by-name/kn/knock/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - knock - 0.8.2-r2: normalized package name match | Alpine Linux edge package indexes: knock from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | A simple port-knocking daemon | https://github.com/TDFKAOlli/knock
- apk - knock-doc - 0.8.2-r2: normalized package name match | Alpine Linux edge package indexes: knock-doc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | A simple port-knocking daemon (documentation) | https://github.com/TDFKAOlli/knock
- apk - knock-openrc - 0.8.2-r2: normalized package name match | Alpine Linux edge package indexes: knock-openrc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | A simple port-knocking daemon (OpenRC init scripts) | https://github.com/TDFKAOlli/knock
- dnf - knock - 0.8-14.fc45: normalized package name match | Fedora Rawhide package metadata: knock from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | A port-knocking server/client | http://www.zeroflux.org/projects/knock
- dnf - knock-server - 0.8-14.fc45: normalized package name match | Fedora Rawhide package metadata: knock-server from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | A port-knocking server/client | http://www.zeroflux.org/projects/knock
- zypper - knock - 0.8-4.6: normalized package name match | openSUSE Tumbleweed package metadata: knock from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | A Port-Knocking Client | http://www.zeroflux.org/knock/
- zypper - knockd - 0.8-4.6: normalized package name match | openSUSE Tumbleweed package metadata: knockd from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | A port-knocking server | http://www.zeroflux.org/knock/
- MacPorts - knock: normalized package name match | MacPorts ports tree: net/knock/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Debian apt - knockd - 0.8-2+b6: installed executable or alias match | Debian stable package indexes: knockd from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | small port-knock daemon | http://www.zeroflux.org/projects/knock
- Ubuntu apt - knockd - 0.8-2build2: installed executable or alias match | Ubuntu 24.04 LTS package indexes: knockd from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | small port-knock daemon | http://www.zeroflux.org/projects/knock
- pacman - knockd - 0.8-2: installed executable or alias match | Arch Linux sync databases: knockd from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | A simple port-knocking daemon | https://github.com/jvinet/knock


## Combined YAML source

View the package source record on GitHub. [combined/knock.yml](https://github.com/mxcl/pkgdb/blob/main/combined/knock.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
