acme-redirect-0.8.1/.cargo_vcs_info.json0000644000000001361046102023000135700ustar { "git": { "sha1": "d27d36b3971fa9d772f310e323abb1c766e05ad1" }, "path_in_vcs": "" }acme-redirect-0.8.1/.dockerignore000064400000000000000000000000721046102023000150110ustar 00000000000000Dockerfile .dockerignore .git .gitignore target/ contrib/ acme-redirect-0.8.1/.github/FUNDING.yml000064400000000000000000000000211046102023000155040ustar 00000000000000github: [kpcyrd] acme-redirect-0.8.1/.github/workflows/debian.yml000064400000000000000000000007501046102023000177020ustar 00000000000000name: Debian pkg on: push: branches: [ main ] pull_request: branches: [ main ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Build package run: contrib/debian/build.sh - name: Rename package run: mv target/debian/acme-redirect*.deb acme-redirect.deb - name: Archive package uses: actions/upload-artifact@v4 with: name: acme-redirect-debian-amd64 path: acme-redirect.deb acme-redirect-0.8.1/.github/workflows/docker.yml000064400000000000000000000027561046102023000177370ustar 00000000000000name: Docker Image CI on: push: branches: [ "main" ] tags: [ "v*.*.*" ] pull_request: branches: [ "main" ] jobs: build: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - uses: docker/setup-buildx-action@v2 - name: Build Docker image uses: docker/build-push-action@v3 with: tags: acme-redirect load: true cache-from: type=gha cache-to: type=gha,mode=max - name: Test the Docker image run: docker run --rm acme-redirect --help - name: Login to github container registry if: github.event_name != 'pull_request' uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Push the image to `edge` if: github.event_name == 'push' && github.ref_name == 'main' run: | docker tag acme-redirect ghcr.io/${{ github.repository }}:edge docker push ghcr.io/${{ github.repository }}:edge - name: Push the image to `${{ github.ref_name }}` if: github.ref_type == 'tag' run: | docker tag acme-redirect ghcr.io/${{ github.repository }}:${{ github.ref_name }} docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }} - name: Push the image to `latest` if: github.ref_type == 'tag' run: | docker tag acme-redirect ghcr.io/${{ github.repository }}:latest docker push ghcr.io/${{ github.repository }}:latest acme-redirect-0.8.1/.github/workflows/rust.yml000064400000000000000000000032601046102023000174540ustar 00000000000000name: Rust on: push: branches: [ "main" ] pull_request: branches: [ "main" ] schedule: - cron: '0 9 * * 1' env: CARGO_TERM_COLOR: always jobs: build: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - name: Set up cargo cache uses: actions/cache@v4 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ runner.os }}-cargo-release- - name: Install repro-env run: sudo apt-get update && sudo apt-get install -y repro-env - name: Build run: make - name: Print sha256 of binary run: sha256sum target/x86_64-unknown-linux-musl/release/acme-redirect - name: Upload binary uses: actions/upload-artifact@v4 with: name: bin path: target/x86_64-unknown-linux-musl/release/acme-redirect unit-test: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - name: Set up cargo cache uses: actions/cache@v4 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ runner.os }}-cargo-debug- - name: Run clippy run: cargo clippy -- -D warnings - name: Run tests run: cargo test --verbose fmt: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - name: Run cargo fmt run: cargo fmt --all -- --check acme-redirect-0.8.1/.gitignore000064400000000000000000000000611046102023000143230ustar 00000000000000/target /tmp /contrib/docs/*.1 /contrib/docs/*.5 acme-redirect-0.8.1/Cargo.lock0000644000002037331046102023000115530ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 4 [[package]] name = "acme-micro" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0843093fe4772017e9299d87a1b64c4d945a6924afced9550643c5b3fa12fe9a" dependencies = [ "anyhow", "base64 0.22.1", "chrono", "log", "openssl", "serde", "serde_json", "ureq", ] [[package]] name = "acme-redirect" version = "0.8.1" dependencies = [ "acme-micro", "actix-web", "anyhow", "boxxy", "caps", "clap 4.6.1", "clap_complete", "colored", "config", "env_logger", "log", "nix 0.31.3", "pem", "rand", "serde", "serde_json", "time", "toml", "ureq", "uzers", "x509-parser", ] [[package]] name = "actix-codec" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" dependencies = [ "bitflags 2.11.1", "bytes", "futures-core", "futures-sink", "memchr", "pin-project-lite", "tokio", "tokio-util", "tracing", ] [[package]] name = "actix-http" version = "3.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93acb4a42f64936f9b8cae4a433b237599dd6eb6ed06124eb67132ef8cc90662" dependencies = [ "actix-codec", "actix-rt", "actix-service", "actix-utils", "bitflags 2.11.1", "bytes", "bytestring", "derive_more", "encoding_rs", "foldhash", "futures-core", "http 0.2.12", "httparse", "httpdate", "itoa", "language-tags", "mime", "percent-encoding", "pin-project-lite", "smallvec", "tokio", "tokio-util", "tracing", ] [[package]] name = "actix-macros" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", "syn 2.0.117", ] [[package]] name = "actix-router" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14f8c75c51892f18d9c46150c5ac7beb81c95f78c8b83a634d49f4ca32551fe7" dependencies = [ "bytestring", "cfg-if", "http 0.2.12", "regex", "regex-lite", "serde", "tracing", ] [[package]] name = "actix-rt" version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92589714878ca59a7626ea19734f0e07a6a875197eec751bb5d3f99e64998c63" dependencies = [ "futures-core", "tokio", ] [[package]] name = "actix-server" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a65064ea4a457eaf07f2fba30b4c695bf43b721790e9530d26cb6f9019ff7502" dependencies = [ "actix-rt", "actix-service", "actix-utils", "futures-core", "futures-util", "mio", "socket2 0.5.10", "tokio", "tracing", ] [[package]] name = "actix-service" version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e46f36bf0e5af44bdc4bdb36fbbd421aa98c79a9bce724e1edeb3894e10dc7f" dependencies = [ "futures-core", "pin-project-lite", ] [[package]] name = "actix-utils" version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88a1dcdff1466e3c2488e1cb5c36a71822750ad43839937f85d2f4d9f8b705d8" dependencies = [ "local-waker", "pin-project-lite", ] [[package]] name = "actix-web" version = "4.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff87453bc3b56e9b2b23c1cc0b1be8797184accf51d2abe0f8a33ec275d316bf" dependencies = [ "actix-codec", "actix-http", "actix-macros", "actix-router", "actix-rt", "actix-server", "actix-service", "actix-utils", "actix-web-codegen", "bytes", "bytestring", "cfg-if", "derive_more", "encoding_rs", "foldhash", "futures-core", "futures-util", "impl-more", "itoa", "language-tags", "log", "mime", "once_cell", "pin-project-lite", "regex", "regex-lite", "serde", "serde_json", "serde_urlencoded", "smallvec", "socket2 0.6.3", "time", "tracing", "url", ] [[package]] name = "actix-web-codegen" version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f591380e2e68490b5dfaf1dd1aa0ebe78d84ba7067078512b4ea6e4492d622b8" dependencies = [ "actix-router", "proc-macro2", "quote", "syn 2.0.117", ] [[package]] name = "adler2" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "aho-corasick" version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] [[package]] name = "android_system_properties" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" dependencies = [ "libc", ] [[package]] name = "anstream" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" [[package]] name = "anstyle-parse" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ "windows-sys 0.61.2", ] [[package]] name = "anstyle-wincon" version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", "windows-sys 0.61.2", ] [[package]] name = "anyhow" version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "asn1-rs" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56624a96882bb8c26d61312ae18cb45868e5a9992ea73c58e45c3101e56a1e60" dependencies = [ "asn1-rs-derive", "asn1-rs-impl", "displaydoc", "nom", "num-traits", "rusticata-macros", "thiserror", "time", ] [[package]] name = "asn1-rs-derive" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3109e49b1e4909e9db6515a30c633684d68cdeaa252f215214cb4fa1a5bfee2c" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", "synstructure", ] [[package]] name = "asn1-rs-impl" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", ] [[package]] name = "autocfg" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "base64" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" [[package]] name = "boxxy" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7836069261ce289b9f70193a44a62c84c64d021aa92884258f610b4b3f3c85a1" dependencies = [ "anyhow", "base64 0.13.1", "bufstream", "caps", "cfg-if", "clap 3.2.25", "close_fds", "errno", "libc", "log", "nix 0.29.0", "pledge", "regex", "rustyline", ] [[package]] name = "bufstream" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8" [[package]] name = "bumpalo" version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" [[package]] name = "bytes" version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "bytestring" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86566c496f2f47d9b8147a4c8b02ffdb69c919fe0c2b2e7195d22cbba0e635c9" dependencies = [ "bytes", ] [[package]] name = "caps" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd1ddba47aba30b6a889298ad0109c3b8dcb0e8fc993b459daa7067d46f865e0" dependencies = [ "libc", ] [[package]] name = "cc" version = "1.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98" dependencies = [ "find-msvc-tools", "shlex", ] [[package]] name = "cfg-if" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cfg_aliases" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chacha20" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" dependencies = [ "cfg-if", "cpufeatures", "rand_core", ] [[package]] name = "chrono" version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" dependencies = [ "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", "windows-link", ] [[package]] name = "clap" version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "bitflags 1.3.2", "clap_derive 3.2.25", "clap_lex 0.2.4", "indexmap 1.9.3", "once_cell", "textwrap", ] [[package]] name = "clap" version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" dependencies = [ "clap_builder", "clap_derive 4.6.1", ] [[package]] name = "clap_builder" version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" dependencies = [ "anstream", "anstyle", "clap_lex 1.1.0", "strsim", ] [[package]] name = "clap_complete" version = "4.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0a7a9bfdb35811f9e59832f0f05975114d2251b415fb534108e6f34060fd772" dependencies = [ "clap 4.6.1", ] [[package]] name = "clap_derive" version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" dependencies = [ "heck 0.4.1", "proc-macro-error", "proc-macro2", "quote", "syn 1.0.109", ] [[package]] name = "clap_derive" version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", "syn 2.0.117", ] [[package]] name = "clap_lex" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" dependencies = [ "os_str_bytes", ] [[package]] name = "clap_lex" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "clipboard-win" version = "5.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" dependencies = [ "error-code", ] [[package]] name = "close_fds" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bc416f33de9d59e79e57560f450d21ff8393adcf1cdfc3e6d8fb93d5f88a2ed" dependencies = [ "cfg-if", "libc", ] [[package]] name = "colorchoice" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" [[package]] name = "colored" version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" dependencies = [ "windows-sys 0.61.2", ] [[package]] name = "config" version = "0.15.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f316c6237b2d38be61949ecd15268a4c6ca32570079394a2444d9ce2c72a72d8" dependencies = [ "pathdiff", "serde_core", "toml", "winnow", ] [[package]] name = "convert_case" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" dependencies = [ "unicode-segmentation", ] [[package]] name = "core-foundation-sys" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" dependencies = [ "libc", ] [[package]] name = "crc32fast" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ "cfg-if", ] [[package]] name = "data-encoding" version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4ae5f15dda3c708c0ade84bfee31ccab44a3da4f88015ed22f63732abe300c8" [[package]] name = "der-parser" version = "10.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07da5016415d5a3c4dd39b11ed26f915f52fc4e0dc197d87908bc916e51bc1a6" dependencies = [ "asn1-rs", "displaydoc", "nom", "num-bigint", "num-traits", "rusticata-macros", ] [[package]] name = "deranged" version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ "powerfmt", ] [[package]] name = "derive_more" version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ "convert_case", "proc-macro2", "quote", "rustc_version", "syn 2.0.117", "unicode-xid", ] [[package]] name = "displaydoc" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", ] [[package]] name = "encoding_rs" version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] [[package]] name = "endian-type" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" [[package]] name = "env_filter" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32e90c2accc4b07a8456ea0debdc2e7587bdd890680d71173a15d4ae604f6eef" dependencies = [ "log", "regex", ] [[package]] name = "env_logger" version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0621c04f2196ac3f488dd583365b9c09be011a4ab8b9f37248ffcc8f6198b56a" dependencies = [ "anstream", "anstyle", "env_filter", "jiff", "log", ] [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", "windows-sys 0.61.2", ] [[package]] name = "error-code" version = "3.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59" [[package]] name = "fd-lock" version = "4.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" dependencies = [ "cfg-if", "rustix", "windows-sys 0.59.0", ] [[package]] name = "find-msvc-tools" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "flate2" version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" dependencies = [ "crc32fast", "miniz_oxide", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldhash" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "foreign-types" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ "foreign-types-shared", ] [[package]] name = "foreign-types-shared" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" dependencies = [ "percent-encoding", ] [[package]] name = "futures-core" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-sink" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" [[package]] name = "futures-task" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" [[package]] name = "futures-util" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ "futures-core", "futures-task", "pin-project-lite", "slab", ] [[package]] name = "getrandom" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "libc", "wasi", ] [[package]] name = "getrandom" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" dependencies = [ "cfg-if", "libc", "r-efi", "rand_core", "wasip2", "wasip3", ] [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ "foldhash", ] [[package]] name = "hashbrown" version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" [[package]] name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "home" version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" dependencies = [ "windows-sys 0.61.2", ] [[package]] name = "http" version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", "itoa", ] [[package]] name = "http" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" dependencies = [ "bytes", "itoa", ] [[package]] name = "httparse" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "httpdate" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "iana-time-zone" version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "log", "wasm-bindgen", "windows-core", ] [[package]] name = "iana-time-zone-haiku" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ "cc", ] [[package]] name = "icu_collections" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" dependencies = [ "displaydoc", "potential_utf", "utf8_iter", "yoke", "zerofrom", "zerovec", ] [[package]] name = "icu_locale_core" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" dependencies = [ "displaydoc", "litemap", "tinystr", "writeable", "zerovec", ] [[package]] name = "icu_normalizer" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" dependencies = [ "icu_collections", "icu_normalizer_data", "icu_properties", "icu_provider", "smallvec", "zerovec", ] [[package]] name = "icu_normalizer_data" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" [[package]] name = "icu_properties" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" dependencies = [ "icu_collections", "icu_locale_core", "icu_properties_data", "icu_provider", "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" [[package]] name = "icu_provider" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" dependencies = [ "displaydoc", "icu_locale_core", "writeable", "yoke", "zerofrom", "zerotrie", "zerovec", ] [[package]] name = "id-arena" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" [[package]] name = "idna" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" dependencies = [ "idna_adapter", "smallvec", "utf8_iter", ] [[package]] name = "idna_adapter" version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" dependencies = [ "icu_normalizer", "icu_properties", ] [[package]] name = "impl-more" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8a5a9a0ff0086c7a148acb942baaabeadf9504d10400b5a05645853729b9cd2" [[package]] name = "indexmap" version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", ] [[package]] name = "indexmap" version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", "hashbrown 0.17.1", "serde", "serde_core", ] [[package]] name = "is_terminal_polyfill" version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "itoa" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "jiff" version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f00b5dbd620d61dfdcb6007c9c1f6054ebd75319f163d886a9055cec1155073d" dependencies = [ "jiff-static", "log", "portable-atomic", "portable-atomic-util", "serde_core", ] [[package]] name = "jiff-static" version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e000de030ff8022ea1da3f466fbb0f3a809f5e51ed31f6dd931c35181ad8e6d7" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", ] [[package]] name = "js-sys" version = "0.3.98" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67df7112613f8bfd9150013a0314e196f4800d3201ae742489d999db2f979f08" dependencies = [ "cfg-if", "futures-util", "once_cell", "wasm-bindgen", ] [[package]] name = "language-tags" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" [[package]] name = "lazy_static" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "leb128fmt" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" [[package]] name = "linux-raw-sys" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" [[package]] name = "local-waker" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" [[package]] name = "lock_api" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ "scopeguard", ] [[package]] name = "log" version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "memchr" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "mime" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "minimal-lexical" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", "simd-adler32", ] [[package]] name = "mio" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" dependencies = [ "libc", "log", "wasi", "windows-sys 0.61.2", ] [[package]] name = "nibble_vec" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" dependencies = [ "smallvec", ] [[package]] name = "nix" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ "bitflags 2.11.1", "cfg-if", "cfg_aliases", "libc", ] [[package]] name = "nix" version = "0.31.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" dependencies = [ "bitflags 2.11.1", "cfg-if", "cfg_aliases", "libc", ] [[package]] name = "nom" version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", ] [[package]] name = "num-bigint" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", ] [[package]] name = "num-conv" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" [[package]] name = "num-integer" version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ "num-traits", ] [[package]] name = "num-traits" version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "oid-registry" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12f40cff3dde1b6087cc5d5f5d4d65712f34016a03ed60e9c08dcc392736b5b7" dependencies = [ "asn1-rs", ] [[package]] name = "once_cell" version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "once_cell_polyfill" version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "openssl" version = "0.10.80" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a45fa2aa886c42762255da344f0a0d313e254066c46aad76f300c3d3da62d967" dependencies = [ "bitflags 2.11.1", "cfg-if", "foreign-types", "libc", "openssl-macros", "openssl-sys", ] [[package]] name = "openssl-macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", ] [[package]] name = "openssl-src" version = "300.6.0+3.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8e8cbfd3a4a8c8f089147fd7aaa33cf8c7450c4d09f8f80698a0cf093abeff4" dependencies = [ "cc", ] [[package]] name = "openssl-sys" version = "0.9.116" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f28a22dc7140cda5f096e5e7724a6962ca81a7f8bfd2979f9b18c11af56318c4" dependencies = [ "cc", "libc", "openssl-src", "pkg-config", "vcpkg", ] [[package]] name = "os_str_bytes" version = "6.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" [[package]] name = "parking_lot" version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", "parking_lot_core", ] [[package]] name = "parking_lot_core" version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", "windows-link", ] [[package]] name = "pathdiff" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" [[package]] name = "pem" version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be" dependencies = [ "base64 0.22.1", "serde_core", ] [[package]] name = "percent-encoding" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pin-project-lite" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pkg-config" version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" [[package]] name = "pledge" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "252599417b7d9a43b7fdc63dd790b0848666a8910b2ebe1a25118309c3c981e5" dependencies = [ "libc", ] [[package]] name = "portable-atomic" version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "portable-atomic-util" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618" dependencies = [ "portable-atomic", ] [[package]] name = "potential_utf" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" dependencies = [ "zerovec", ] [[package]] name = "powerfmt" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "prettyplease" version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", "syn 2.0.117", ] [[package]] name = "proc-macro-error" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", "syn 1.0.109", "version_check", ] [[package]] name = "proc-macro-error-attr" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ "proc-macro2", "quote", "version_check", ] [[package]] name = "proc-macro2" version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] [[package]] name = "r-efi" version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] name = "radix_trie" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" dependencies = [ "endian-type", "nibble_vec", ] [[package]] name = "rand" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" dependencies = [ "chacha20", "getrandom 0.4.2", "rand_core", ] [[package]] name = "rand_core" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" [[package]] name = "redox_syscall" version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ "bitflags 2.11.1", ] [[package]] name = "regex" version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", "regex-automata", "regex-syntax", ] [[package]] name = "regex-automata" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", "regex-syntax", ] [[package]] name = "regex-lite" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973" [[package]] name = "regex-syntax" version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "ring" version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", "getrandom 0.2.17", "libc", "untrusted", "windows-sys 0.52.0", ] [[package]] name = "rustc_version" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "rusticata-macros" version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" dependencies = [ "nom", ] [[package]] name = "rustix" version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ "bitflags 2.11.1", "errno", "libc", "linux-raw-sys", "windows-sys 0.61.2", ] [[package]] name = "rustls" version = "0.23.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef86cd5876211988985292b91c96a8f2d298df24e75989a43a3c73f2d4d8168b" dependencies = [ "log", "once_cell", "ring", "rustls-pki-types", "rustls-webpki", "subtle", "zeroize", ] [[package]] name = "rustls-pki-types" version = "1.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9" dependencies = [ "zeroize", ] [[package]] name = "rustls-webpki" version = "0.103.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" dependencies = [ "ring", "rustls-pki-types", "untrusted", ] [[package]] name = "rustversion" version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "rustyline" version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ee1e066dc922e513bda599c6ccb5f3bb2b0ea5870a579448f2622993f0a9a2f" dependencies = [ "bitflags 2.11.1", "cfg-if", "clipboard-win", "fd-lock", "home", "libc", "log", "memchr", "nix 0.29.0", "radix_trie", "unicode-segmentation", "unicode-width", "utf8parse", "windows-sys 0.59.0", ] [[package]] name = "ryu" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "semver" version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" [[package]] name = "serde" version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ "serde_core", "serde_derive", ] [[package]] name = "serde_core" version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", ] [[package]] name = "serde_json" version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ "itoa", "memchr", "serde", "serde_core", "zmij", ] [[package]] name = "serde_spanned" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" dependencies = [ "serde_core", ] [[package]] name = "serde_urlencoded" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", "itoa", "ryu", "serde", ] [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ "errno", "libc", ] [[package]] name = "simd-adler32" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" [[package]] name = "slab" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "socket2" version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" dependencies = [ "libc", "windows-sys 0.52.0", ] [[package]] name = "socket2" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", "windows-sys 0.61.2", ] [[package]] name = "stable_deref_trait" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "syn" version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "synstructure" version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", ] [[package]] name = "textwrap" version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" [[package]] name = "thiserror" version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", ] [[package]] name = "time" version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", "itoa", "num-conv", "powerfmt", "serde_core", "time-core", "time-macros", ] [[package]] name = "time-core" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" dependencies = [ "num-conv", "time-core", ] [[package]] name = "tinystr" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" dependencies = [ "displaydoc", "zerovec", ] [[package]] name = "tokio" version = "1.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" dependencies = [ "bytes", "libc", "mio", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2 0.6.3", "windows-sys 0.61.2", ] [[package]] name = "tokio-util" version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", ] [[package]] name = "toml" version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" dependencies = [ "indexmap 2.14.0", "serde_core", "serde_spanned", "toml_datetime", "toml_parser", "toml_writer", "winnow", ] [[package]] name = "toml_datetime" version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" dependencies = [ "serde_core", ] [[package]] name = "toml_parser" version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" dependencies = [ "winnow", ] [[package]] name = "toml_writer" version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" [[package]] name = "tracing" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "log", "pin-project-lite", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", ] [[package]] name = "tracing-core" version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", ] [[package]] name = "unicode-ident" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-segmentation" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" [[package]] name = "unicode-width" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" [[package]] name = "unicode-xid" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "untrusted" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dea7109cdcd5864d4eeb1b58a1648dc9bf520360d7af16ec26d0a9354bafcfc0" dependencies = [ "base64 0.22.1", "flate2", "log", "percent-encoding", "rustls", "rustls-pki-types", "ureq-proto", "utf8-zero", "webpki-roots", ] [[package]] name = "ureq-proto" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e994ba84b0bd1b1b0cf92878b7ef898a5c1760108fe7b6010327e274917a808c" dependencies = [ "base64 0.22.1", "http 1.4.0", "httparse", "log", ] [[package]] name = "url" version = "2.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" dependencies = [ "form_urlencoded", "idna", "percent-encoding", "serde", ] [[package]] name = "utf8-zero" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" [[package]] name = "utf8_iter" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uzers" version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b8275fb1afee25b4111d2dc8b5c505dbbc4afd0b990cb96deb2d88bff8be18d" dependencies = [ "libc", "log", ] [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasip2" version = "1.0.3+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" dependencies = [ "wit-bindgen 0.57.1", ] [[package]] name = "wasip3" version = "0.4.0+wasi-0.3.0-rc-2026-01-06" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" dependencies = [ "wit-bindgen 0.51.0", ] [[package]] name = "wasm-bindgen" version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578" dependencies = [ "quote", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2" dependencies = [ "bumpalo", "proc-macro2", "quote", "syn 2.0.117", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441" dependencies = [ "unicode-ident", ] [[package]] name = "wasm-encoder" version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" dependencies = [ "leb128fmt", "wasmparser", ] [[package]] name = "wasm-metadata" version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" dependencies = [ "anyhow", "indexmap 2.14.0", "wasm-encoder", "wasmparser", ] [[package]] name = "wasmparser" version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ "bitflags 2.11.1", "hashbrown 0.15.5", "indexmap 2.14.0", "semver", ] [[package]] name = "webpki-roots" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d" dependencies = [ "rustls-pki-types", ] [[package]] name = "windows-core" version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", "windows-link", "windows-result", "windows-strings", ] [[package]] name = "windows-implement" version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", ] [[package]] name = "windows-interface" version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", ] [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-result" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ "windows-link", ] [[package]] name = "windows-strings" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ "windows-link", ] [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ "windows-targets", ] [[package]] name = "windows-sys" version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ "windows-targets", ] [[package]] name = "windows-sys" version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ "windows-link", ] [[package]] name = "windows-targets" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" dependencies = [ "memchr", ] [[package]] name = "wit-bindgen" version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" dependencies = [ "wit-bindgen-rust-macro", ] [[package]] name = "wit-bindgen" version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] name = "wit-bindgen-core" version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" dependencies = [ "anyhow", "heck 0.5.0", "wit-parser", ] [[package]] name = "wit-bindgen-rust" version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" dependencies = [ "anyhow", "heck 0.5.0", "indexmap 2.14.0", "prettyplease", "syn 2.0.117", "wasm-metadata", "wit-bindgen-core", "wit-component", ] [[package]] name = "wit-bindgen-rust-macro" version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" dependencies = [ "anyhow", "prettyplease", "proc-macro2", "quote", "syn 2.0.117", "wit-bindgen-core", "wit-bindgen-rust", ] [[package]] name = "wit-component" version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" dependencies = [ "anyhow", "bitflags 2.11.1", "indexmap 2.14.0", "log", "serde", "serde_derive", "serde_json", "wasm-encoder", "wasm-metadata", "wasmparser", "wit-parser", ] [[package]] name = "wit-parser" version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" dependencies = [ "anyhow", "id-arena", "indexmap 2.14.0", "log", "semver", "serde", "serde_derive", "serde_json", "unicode-xid", "wasmparser", ] [[package]] name = "writeable" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" [[package]] name = "x509-parser" version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d43b0f71ce057da06bc0851b23ee24f3f86190b07203dd8f567d0b706a185202" dependencies = [ "asn1-rs", "data-encoding", "der-parser", "lazy_static", "nom", "oid-registry", "rusticata-macros", "thiserror", "time", ] [[package]] name = "yoke" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" dependencies = [ "stable_deref_trait", "yoke-derive", "zerofrom", ] [[package]] name = "yoke-derive" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", "synstructure", ] [[package]] name = "zerofrom" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", "synstructure", ] [[package]] name = "zeroize" version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" [[package]] name = "zerotrie" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" dependencies = [ "displaydoc", "yoke", "zerofrom", ] [[package]] name = "zerovec" version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" dependencies = [ "yoke", "zerofrom", "zerovec-derive", ] [[package]] name = "zerovec-derive" version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" dependencies = [ "proc-macro2", "quote", "syn 2.0.117", ] [[package]] name = "zmij" version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" acme-redirect-0.8.1/Cargo.toml0000644000000065061046102023000115750ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2024" name = "acme-redirect" version = "0.8.1" authors = ["kpcyrd "] build = false autolib = false autobins = false autoexamples = false autotests = false autobenches = false description = "Tiny http daemon that answers acme challenges and redirects everything else to https" readme = "README.md" license = "GPL-3.0-or-later" repository = "https://github.com/kpcyrd/acme-redirect" [package.metadata.deb] extended-description = """ acme-redirect is a tiny http server that implements the ACME (Automated Certificate Management Environment) protocol and redirects everything else to https. It can run directly on port 80 and supports automatic issuance and renew of certificates out of the box with minimal configuration.""" section = "web" priority = "optional" maintainer-scripts = "debian" assets = [ [ "target/release/acme-redirect", "usr/bin/", "755", ], [ "contrib/confs/acme-redirect.conf", "etc/", "644", ], [ "contrib/confs/certs.d/example.com.conf", "etc/acme-redirect.d/example.com.conf.sample", "644", ], [ "contrib/systemd/acme-redirect-renew.service", "usr/lib/systemd/system/", "644", ], [ "contrib/systemd/acme-redirect-renew.timer", "usr/lib/systemd/system/", "644", ], [ "contrib/systemd/acme-redirect.service", "usr/lib/systemd/system/", "644", ], [ "contrib/systemd/acme-redirect.sysusers", "usr/lib/sysusers.d/acme-redirect.conf", "644", ], [ "contrib/systemd/acme-redirect.tmpfiles", "usr/lib/tmpfiles.d/acme-redirect.conf", "644", ], ] [features] vendored = ["acme-micro/vendored"] [lib] name = "acme_redirect" path = "src/lib.rs" [[bin]] name = "acme-redirect" path = "src/main.rs" [[example]] name = "boxxy" path = "examples/boxxy.rs" [dependencies.acme-micro] version = "0.14" [dependencies.actix-web] version = "4" features = [ "macros", "unicode", ] default-features = false [dependencies.anyhow] version = "1.0.28" [dependencies.clap] version = "4.0.32" features = [ "derive", "env", ] [dependencies.clap_complete] version = "4.0.7" [dependencies.colored] version = "3" [dependencies.config] version = "0.15" features = ["toml"] default-features = false [dependencies.env_logger] version = "0.11" [dependencies.log] version = "0.4.8" [dependencies.nix] version = "0.31" features = [ "fs", "user", ] [dependencies.pem] version = "3" [dependencies.rand] version = "0.10" [dependencies.serde] version = "1.0.106" [dependencies.serde_json] version = "1" [dependencies.time] version = "0.3" features = [ "formatting", "macros", ] [dependencies.toml] version = "1" [dependencies.ureq] version = "3" [dependencies.uzers] version = "0.12" [dependencies.x509-parser] version = "0.18" [dev-dependencies.boxxy] version = "0.14" [target.'cfg(target_os="linux")'.dependencies.caps] version = "0.5" acme-redirect-0.8.1/Cargo.toml.orig000064400000000000000000000041201046102023000152220ustar 00000000000000[package] name = "acme-redirect" version = "0.8.1" description = "Tiny http daemon that answers acme challenges and redirects everything else to https" authors = ["kpcyrd "] license = "GPL-3.0-or-later" repository = "https://github.com/kpcyrd/acme-redirect" readme = "README.md" edition = "2024" [package.metadata.deb] extended-description = """\ acme-redirect is a tiny http server that implements the ACME (Automated Certificate Management Environment) protocol and redirects everything else to https. It can run directly on port 80 and supports automatic issuance and renew of certificates out of the box with minimal configuration.""" section = "web" priority = "optional" maintainer-scripts = "debian" assets = [ ["target/release/acme-redirect", "usr/bin/", "755"], ["contrib/confs/acme-redirect.conf", "etc/", "644"], ["contrib/confs/certs.d/example.com.conf", "etc/acme-redirect.d/example.com.conf.sample", "644"], ["contrib/systemd/acme-redirect-renew.service", "usr/lib/systemd/system/", "644"], ["contrib/systemd/acme-redirect-renew.timer", "usr/lib/systemd/system/", "644"], ["contrib/systemd/acme-redirect.service", "usr/lib/systemd/system/", "644"], ["contrib/systemd/acme-redirect.sysusers", "usr/lib/sysusers.d/acme-redirect.conf", "644"], ["contrib/systemd/acme-redirect.tmpfiles", "usr/lib/tmpfiles.d/acme-redirect.conf", "644"], ] [features] vendored = ["acme-micro/vendored"] [dependencies] acme-micro = "0.14" actix-web = { version = "4", default-features = false, features = ["macros", "unicode"] } anyhow = "1.0.28" clap = { version = "4.0.32", features = ["derive", "env"] } clap_complete = "4.0.7" colored = "3" config = { version = "0.15", default-features = false, features = ["toml"] } env_logger = "0.11" log = "0.4.8" nix = { version = "0.31", features = ["fs", "user"] } pem = "3" rand = "0.10" serde = "1.0.106" serde_json = "1" time = { version = "0.3", features = ["formatting", "macros"] } toml = "1" ureq = "3" uzers = "0.12" x509-parser = "0.18" [target.'cfg(target_os="linux")'.dependencies] caps = "0.5" [dev-dependencies] boxxy = "0.14" acme-redirect-0.8.1/Dockerfile000064400000000000000000000010221046102023000143230ustar 00000000000000FROM rust:alpine3.21 ENV RUSTFLAGS="-C target-feature=-crt-static" WORKDIR /app RUN apk add --no-cache musl-dev openssl-dev COPY . . RUN --mount=type=cache,target=/var/cache/buildkit \ CARGO_HOME=/var/cache/buildkit/cargo \ CARGO_TARGET_DIR=/var/cache/buildkit/target \ cargo build --release --locked && \ cp -v /var/cache/buildkit/target/release/acme-redirect . RUN strip acme-redirect FROM alpine:3.21 RUN apk add --no-cache libgcc openssl COPY --from=0 /app/acme-redirect /usr/bin ENTRYPOINT ["acme-redirect"] acme-redirect-0.8.1/LICENSE000064400000000000000000001045061046102023000133510ustar 00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. {one line to give the program's name and a brief idea of what it does.} Copyright (C) {year} {name of author} This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: {project} Copyright (C) {year} {fullname} This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . acme-redirect-0.8.1/Makefile000064400000000000000000000005131046102023000137750ustar 00000000000000build: repro-env build -- sh -c ' \ RUSTFLAGS="-C strip=symbols" \ cargo build --target x86_64-unknown-linux-musl --release --locked --features vendored' docs: contrib/docs/acme-redirect.1 contrib/docs/acme-redirect.d.5 contrib/docs/acme-redirect.conf.5 contrib/docs/%: contrib/docs/%.scd scdoc < $^ > $@ .PHONY: build docs acme-redirect-0.8.1/PKGBUILD000064400000000000000000000037771046102023000135000ustar 00000000000000# Maintainer: kpcyrd pkgname=acme-redirect pkgver=0.0.0 pkgrel=1 pkgdesc='Tiny http daemon that answers acme challenges and redirects everything else to https' url='https://github.com/kpcyrd/acme-redirect' arch=('x86_64') license=('GPL3') depends=('openssl') makedepends=('cargo' 'scdoc') backup=('etc/acme-redirect.conf') build() { cd .. cargo build --release --locked make docs } package() { cd .. install -Dm 755 -t "${pkgdir}/usr/bin" \ target/release/acme-redirect # install completions install -d "${pkgdir}/usr/share/bash-completion/completions" \ "${pkgdir}/usr/share/zsh/site-functions" \ "${pkgdir}/usr/share/fish/vendor_completions.d" "${pkgdir}/usr/bin/acme-redirect" completions bash > "${pkgdir}/usr/share/bash-completion/completions/acme-redirect" "${pkgdir}/usr/bin/acme-redirect" completions zsh > "${pkgdir}/usr/share/zsh/site-functions/_acme-redirect" "${pkgdir}/usr/bin/acme-redirect" completions fish > "${pkgdir}/usr/share/fish/vendor_completions.d/acme-redirect.fish" # install configs install -Dm 644 contrib/confs/acme-redirect.conf -t "${pkgdir}/etc" install -Dm 644 contrib/confs/certs.d/example.com.conf "${pkgdir}/etc/acme-redirect.d/example.com.conf.sample" # install systemd configs install -Dm 644 -t "${pkgdir}/usr/lib/systemd/system" \ contrib/systemd/acme-redirect-renew.service \ contrib/systemd/acme-redirect-renew.timer \ contrib/systemd/acme-redirect.service install -Dm 644 contrib/systemd/acme-redirect.sysusers "${pkgdir}/usr/lib/sysusers.d/acme-redirect.conf" install -Dm 644 contrib/systemd/acme-redirect.tmpfiles "${pkgdir}/usr/lib/tmpfiles.d/acme-redirect.conf" # install docs install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}" install -Dm 644 -t "${pkgdir}/usr/share/man/man1" \ contrib/docs/acme-redirect.1 install -Dm 644 -t "${pkgdir}/usr/share/man/man5" \ contrib/docs/acme-redirect.conf.5 \ contrib/docs/acme-redirect.d.5 } # vim: ts=2 sw=2 et: acme-redirect-0.8.1/README.md000064400000000000000000000124651046102023000136250ustar 00000000000000# acme-redirect(1) A tiny http daemon that answers acme challenges and redirects everything else to https. A minimal configuration looks like this: ```toml # cat /etc/acme-redirect.d/example.com.conf [cert] name = "example.com" dns_names = [ "example.com", "www.example.com", ] exec = [ "systemctl reload nginx", ] ``` You don't need to edit anything else. Start the acme-redirect daemon: ```bash systemctl enable --now acme-redirect ``` Ensure the service is running correctly and the redirect works as expected. Ensure your A and AAAA records point to the right server and check everything is working correctly by fetching a random proof from our local daemon. ```bash acme-redirect check ``` If `OK` is displayed for every name you can request a real certificates: ```bash acme-redirect renew ``` If this succeeded you should setup automatic renew: ```bash systemctl enable --now acme-redirect-renew.timer ``` The certificate is located here: ``` /var/lib/acme-redirect/live/example.com/fullchain /var/lib/acme-redirect/live/example.com/privkey ``` Example configuration looks like this: ## nginx ```nginx server { listen 443 ssl http2; listen [::]:443 ssl http2; ssl_certificate /var/lib/acme-redirect/live/example.com/fullchain; ssl_certificate_key /var/lib/acme-redirect/live/example.com/privkey; ssl_session_timeout 1d; ssl_session_cache shared:MozSSL:10m; # about 40000 sessions ssl_session_tickets off; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; ssl_prefer_server_ciphers off; add_header Strict-Transport-Security "max-age=63072000" always; ssl_stapling on; ssl_stapling_verify on; ssl_trusted_certificate /var/lib/acme-redirect/live/example.com/chain; resolver 127.0.0.1; # ... } ``` ## apache ```apache SSLEngine on SSLCertificateFile /var/lib/acme-redirect/live/example.com/fullchain SSLCertificateKeyFile /var/lib/acme-redirect/live/example.com/privkey Protocols h2 http/1.1 Header always set Strict-Transport-Security "max-age=63072000" SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1 SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 SSLHonorCipherOrder off SSLSessionTickets off SSLUseStapling On SSLStaplingCache "shmcb:logs/ssl_stapling(32768)" ``` ## lighttpd ``` server.modules += ("mod_openssl") $SERVER["socket"] == "0.0.0.0:443" { ssl.engine = "enable" ssl.privkey= "/var/lib/acme-redirect/live/example.com/privkey" ssl.pemfile= "/var/lib/acme-redirect/live/example.com/fullchain" ssl.openssl.ssl-conf-cmd = ("MinProtocol" => "TLSv1.2") #ssl.ca-file= "/var/lib/acme-redirect/live/example.com/chain" # (needed in $SERVER["socket"] before lighttpd 1.4.56 if ssl.pemfile in $HTTP["host"]) } ``` # Installation Packaging status ## Arch Linux ```bash pacman -S acme-redirect ``` ## Debian based Currently supported: bookworm ```bash apt install debian-keyring gpg --export --keyring /usr/share/keyrings/debian-maintainers.gpg git@rxv.cc | tee /etc/apt/trusted.gpg.d/apt-vulns-xyz.gpg > /dev/null echo deb https://apt.vulns.xyz stable main >> /etc/apt/sources.list.d/apt-vulns-xyz.list apt update && apt install acme-redirect ``` ## Build from source ```bash git clone https://github.com/kpcyrd/acme-redirect.git cd acme-redirect/ cargo build --release install -Dm 755 -t /usr/bin \ target/release/acme-redirect install -Dm 644 contrib/confs/acme-redirect.conf -t /etc install -Dm 644 contrib/confs/certs.d/example.com.conf /etc/acme-redirect.d/example.com.conf.sample install -Dm 644 -t /etc/systemd/system \ contrib/systemd/acme-redirect-renew.service \ contrib/systemd/acme-redirect-renew.timer \ contrib/systemd/acme-redirect.service install -Dm 644 contrib/systemd/acme-redirect.sysusers /etc/sysusers.d/acme-redirect.conf install -Dm 644 contrib/systemd/acme-redirect.tmpfiles /etc/tmpfiles.d/acme-redirect.conf sudo systemd-sysusers sudo systemd-tmpfiles --create ``` # Status I'm using this in production since summer 2020 (northern hemisphere, around May). # Development ```bash mkdir -vp tmp/challs export ACME_CONFIG="$PWD/contrib/confs/acme-redirect.conf" export ACME_CONFIG_DIR="$PWD/contrib/confs/certs.d/" export ACME_CHALL_DIR="$PWD/tmp/" export ACME_DATA_DIR="$PWD/tmp/" cargo run -- status cargo run -- daemon -B '[::]:8080' -v ``` # boxxy acme-redirect uses setuid, chroot and afterwards clears the [capability(7)](https://man7.org/linux/man-pages/man7/capabilities.7.html) sets to lock down the process and drop privileges before accepting requests. This can be inspected with [boxxy][1]. ```bash mkdir -vp tmp/web sudo chown root. tmp/web cargo build --examples (cd tmp/web && sudo ../../target/debug/examples/boxxy) ``` [1]: https://github.com/kpcyrd/boxxy-rs # License GPLv3+ acme-redirect-0.8.1/contrib/confs/acme-redirect.conf000064400000000000000000000006151046102023000204630ustar 00000000000000[acme] #acme_email = "nobody@example.com" #acme_url = "https://acme-staging-v02.api.letsencrypt.org/directory" #renew_if_days_left = 30 [system] ## The address to bind to #addr = "[::]:80" ## Default hooks of the certificate config doesn't define any #exec = [ # "systemctl reload nginx" #] ## Execute these hooks globally for all certificates #exec_extra = [ # "systemctl reload nginx" #] acme-redirect-0.8.1/contrib/confs/certs.d/example.com.conf000064400000000000000000000001771046102023000215340ustar 00000000000000[cert] name = "example.com" dns_names = [ "example.com", "www.example.com", ] exec = [ "systemctl reload nginx", ] acme-redirect-0.8.1/contrib/cron/acme-redirect.cron000064400000000000000000000002571046102023000203320ustar 00000000000000#!/bin/sh /usr/bin/acme-redirect renew -q EXITVALUE=$? if [ $EXITVALUE != 0 ]; then /usr/bin/logger -t acme-redirect "ALERT exited abnormally with [$EXITVALUE]" fi exit 0 acme-redirect-0.8.1/contrib/debian/Dockerfile000064400000000000000000000001651046102023000172140ustar 00000000000000FROM rust RUN apt-get update && apt-get install -y build-essential pkg-config libssl-dev RUN cargo install cargo-deb acme-redirect-0.8.1/contrib/debian/build.sh000075500000000000000000000004631046102023000166610ustar 00000000000000#!/bin/sh set -ex docker build -t pkg-debian-acme-redirect-build contrib/debian/ docker run --rm \ -v "$PWD:/src" \ -w /src \ pkg-debian-acme-redirect-build \ cargo deb docker run --rm \ -v "$PWD:/src" \ pkg-debian-acme-redirect-build \ chown -vR "$(id -u):$(id -g)" /src/target acme-redirect-0.8.1/contrib/docs/acme-redirect.1.scd000064400000000000000000000036671046102023000203000ustar 00000000000000acme-redirect(1) # NAME acme-redirect - Tiny http daemon that answers acme challenges and redirects everything else to https # SYNOPSIS *acme-redirect* \ [-v|--verbose] \ [-c /etc/acme-redirect.conf] \ [--config-dir /etc/acme-redirect.d] \ [--acme-email ] \ [--acme-url https://acme-v02.api.letsencrypt.org/directory] \ [--chall-dir /run/acme-redirect] \ [--data-dir /var/lib/acme-redirect] \ # DESCRIPTION acme-redirect is a tiny http server that implements the ACME (Automated Certificate Management Environment) protocol and redirects everything else to https. It can run directly on port 80 and supports automatic issuance and renew of certificates out of the box with minimal configuration. # DAEMON Runs the http daemon. *-B , --bind-addr * The address to listen on. Default is *[::]:80*. *--chroot* Chroot into the challenge directory. *--user * Drop from root to this user. *acme-redirect daemon* # RENEW Renew certificates that are about to expire and run the given commands to trigger a certificate reload. *-n, --dry-run* Do not actually do anything, just show what would happen. *--force-renew* Renew certificates even if they are not about to expire. *--skip-cleanup* Don't clean up old certs that are not live anymore. *--skip-restarts* Do not execute the configured *exec* commands. ** Only renew specific certs. If no certificate is selected explicitly, renew all certificates. *acme-redirect renew* # STATUS Shows the certificates currently available and their expiry status. *acme-redirect status* # AUTOMATIC RENEW You can simply run *acme-redirect renew* periodically. If you're using systemd you can use the systemd timer with: *systemctl enable --now acme-redirect-renew.timer* # SEE ALSO *acme-redirect.conf*(5), *acme-redirect.d*(5). # AUTHORS acme-redirect was originally written by kpcyrd and is hosted at https://github.com/kpcyrd/acme-redirect acme-redirect-0.8.1/contrib/docs/acme-redirect.conf.5.scd000064400000000000000000000031471046102023000212210ustar 00000000000000acme-redirect.conf(5) # NAME acme-redirect.conf - *acme-redirect* configuration files # SYNOPSIS /etc/acme-redirect.conf # DESCRIPTION This file configures general settings for *acme-redirect*. To configure certificates have a look at *acme-redirect.d*(5). # OPTIONS ([acme]) _acme_email=_ The contact email for your acme provider to reach out to you. They are usually going to notify you if your automatic renew doesn't seem to be working, or if the acme protocol is going to be updated. _acme_url=_ The acme endpoint to use. The default is LetsEncrypt production. _renew_if_days_left=_ Renew the certificate if the number of days is *equal or lower*. You are going to run into issues if you set it lower than 1. The default is 30. # OPTIONS ([system]) _exec=_ A list of global fallback hooks that are executed if the certificate config didn't specify any hooks. The hooks are expected to be shell commands. _exec_extra=_ A list of global hooks that are executed after any certificate is renewed and its hooks have been executed. The hooks are expected to be shell commands. # EXAMPLE ``` [acme] acme_email = "nobody@example.com" acme_url = "https://acme-staging-v02.api.letsencrypt.org/directory" renew_if_days_left = 30 [system] ## Default hooks if the certificate config doesn't define any exec = [ "systemctl reload nginx", ] ## Execute these hooks globally for all certificates exec_extra = [ "systemctl reload dovecot", ] ``` # SEE ALSO *acme-redirect*(1), *acme-redirect.d*(5). # AUTHORS acme-redirect was originally written by kpcyrd and is hosted at https://github.com/kpcyrd/acme-redirect acme-redirect-0.8.1/contrib/docs/acme-redirect.d.5.scd000064400000000000000000000016001046102023000205070ustar 00000000000000acme-redirect.d(5) # NAME acme-redirect.d - *acme-redirect* certificate configuration # SYNOPSIS /etc/acme-redirect.d/\*.conf # DESCRIPTION These files configure the certificates that should be requested and renewed by *acme-redirect*. # OPTIONS _name=_ The name to identify this certificate. The certificate is not going to be valid for this name unless it's also listed in *dns_names*. _dns_names=_ The list of names this certificate should be valid for. _exec=_ The list of commands that should be executed. You can use this to trigger certificate reloads. # EXAMPLE ``` [cert] name = "example.com" dns_names = [ "example.com", "www.example.com", ] exec = [ "systemctl reload nginx", ] ``` # SEE ALSO *acme-redirect*(1), *acme-redirect.conf*(5). # AUTHORS acme-redirect was originally written by kpcyrd and is hosted at https://github.com/kpcyrd/acme-redirect acme-redirect-0.8.1/contrib/openrc/acme-redirect.initd000064400000000000000000000006551046102023000210270ustar 00000000000000#!/sbin/openrc-run name=$RC_SVCNAME command="/usr/bin/acme-redirect" command_args="daemon --chroot --user acme-redirect" start_stop_daemon_args='--chdir /run/acme-redirect' pidfile="/run/$RC_SVCNAME.pid" command_background="yes" depend() { need net after firewall } start_pre() { checkpath --directory --owner root:acme-redirect --mode 0750 \ /run/acme-redirect \ /run/acme-redirect/challs \ /var/lib/acme-redirect } acme-redirect-0.8.1/contrib/systemd/acme-redirect-renew.service000064400000000000000000000001551046102023000226730ustar 00000000000000[Unit] Description=acme-redirect: renew certs if necessary [Service] ExecStart=/usr/bin/acme-redirect renew acme-redirect-0.8.1/contrib/systemd/acme-redirect-renew.timer000064400000000000000000000002101046102023000223430ustar 00000000000000[Unit] Description=acme-redirect: renew certs if necessary [Timer] OnBootSec=1min OnUnitActiveSec=1h [Install] WantedBy=timers.target acme-redirect-0.8.1/contrib/systemd/acme-redirect.service000064400000000000000000000014051046102023000215540ustar 00000000000000[Unit] Description=acme-redirect: http redirector with acme support After=network.target network-online.target [Service] User=acme-redirect ExecStart=/usr/bin/acme-redirect daemon --chroot WorkingDirectory=/run/acme-redirect AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_SYS_CHROOT CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_SYS_CHROOT LockPersonality=yes MemoryDenyWriteExecute=yes NoNewPrivileges=yes PrivateDevices=yes PrivateTmp=yes ProtectControlGroups=yes ProtectHome=yes ProtectHostname=yes ProtectKernelLogs=yes ProtectKernelModules=yes ProtectKernelTunables=yes ProtectSystem=strict RemoveIPC=yes RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 RestrictNamespaces=yes RestrictSUIDSGID=yes Restart=always RestartSec=2s [Install] WantedBy=multi-user.target acme-redirect-0.8.1/contrib/systemd/acme-redirect.sysusers000064400000000000000000000000761046102023000220170ustar 00000000000000u! acme-redirect - "acme-redirect daemon" g acme-redirect - - acme-redirect-0.8.1/contrib/systemd/acme-redirect.tmpfiles000064400000000000000000000002361046102023000217400ustar 00000000000000d /run/acme-redirect 0750 root acme-redirect - - d /run/acme-redirect/challs 0750 root acme-redirect - - d /var/lib/acme-redirect 0750 root acme-redirect - - acme-redirect-0.8.1/examples/boxxy.rs000064400000000000000000000011501046102023000156700ustar 00000000000000use acme_redirect::args::DaemonArgs; use boxxy::shprintln; fn stage1(sh: &mut boxxy::Shell, _args: Vec) -> Result<(), boxxy::Error> { shprintln!(sh, "[*] starting stage1"); acme_redirect::sandbox::init(&DaemonArgs { bind_addr: Some("[::]:80".to_string()), chroot: true, user: Some("nobody".to_string()), }) .unwrap(); shprintln!(sh, "[+] activated!"); Ok(()) } fn main() { env_logger::init(); println!("stage1 activate sandbox"); let toolbox = boxxy::Toolbox::new().with(vec![("stage1", stage1)]); boxxy::Shell::new(toolbox).run() } acme-redirect-0.8.1/repro-env.lock000064400000000000000000000377601046102023000151420ustar 00000000000000[container] image = "docker.io/library/archlinux@sha256:32c78c548c1a3f9db43bc25fb9f47d8bf5efff49a1da3810bb60790b4202d657" [[package]] name = "compiler-rt" version = "22.1.5-1" system = "archlinux" url = "https://archive.archlinux.org/packages/c/compiler-rt/compiler-rt-22.1.5-1-x86_64.pkg.tar.zst" sha256 = "247d72e99e3ebbd46f8e14e162a6d162bdfcedf500af61b5a426aaab668e5320" signature = "iHUEABYKAB0WIQTS6V/sAVzx+RGqqww9TFAIu1yNKQUCafy6uwAKCRA9TFAIu1yNKW0eAQCtpYK/Klh3WdzGiDlzLd9IIQ/JoKHpUSJJWgEw24dXvQD9E9ZycrdYnou5D7fiNRW/QdjhnZasOGOQTLpR5OYcTgA=" [[package]] name = "curl" version = "8.20.0-7" system = "archlinux" url = "https://archive.archlinux.org/packages/c/curl/curl-8.20.0-7-x86_64.pkg.tar.zst" sha256 = "9a09dc5796e83f129d032b1d831a85b276f8fba50f430ba143993a9ed02351c1" signature = "iHUEABYKAB0WIQQhkbiUMbrAqLlt6T0kR0DRfH/Q7AUCagQFsgAKCRAkR0DRfH/Q7OwhAP9B0lR3HVc+slsyqzSpNWbDQm1NthqqC+FLqBHikFtunQD/RpOcbEoR3dziSTCpRd4RLqhVjFwsdoEigyInVd2qNAU=" [[package]] name = "db5.3" version = "5.3.28-7" system = "archlinux" url = "https://archive.archlinux.org/packages/d/db5.3/db5.3-5.3.28-7-x86_64.pkg.tar.zst" sha256 = "abac3474e766fa8a36fcae945f5e8c8e818665fc41a56daff92db81cd176d389" signature = "iNUEABYKAH0WIQQFx3danouXdAf+COadTFqhVCbaCgUCaZIh8l8UgAAAAAAuAChpc3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MDVDNzc3NUE5RThCOTc3NDA3RkUwOEU2OUQ0QzVBQTE1NDI2REEwQQAKCRCdTFqhVCbaClcoAPoDJLZfBd7ejW7ngJgPscbeeGuqCsP9OGH7/uruazjFGQD/YCN82i89aSp4i2p3+T/o6C51GMSrOscJJEL5ptcOmAU=" [[package]] name = "expat" version = "2.8.1-1" system = "archlinux" url = "https://archive.archlinux.org/packages/e/expat/expat-2.8.1-1-x86_64.pkg.tar.zst" sha256 = "6dc98b2806cc8f7cd1e2e02b0ea83c2f209c2823eec1108f726bbf88b37ab563" signature = "iHUEABYKAB0WIQRizHP4hOUpV7L92IObeih9mi7GCAUCagD5WQAKCRCbeih9mi7GCBOOAP92U0uk2Bc/gn1WiEmNSnKALCfmhdEaq0qvWOYF4Gf7FQEAyrljq6VtjMvFDcrDZZKpFi1JA1JchE7X4eVwIhGYxg8=" [[package]] name = "gc" version = "8.2.12-1" system = "archlinux" url = "https://archive.archlinux.org/packages/g/gc/gc-8.2.12-1-x86_64.pkg.tar.zst" sha256 = "f81f6053b8986150529ad125827f00cc8f7652f827cea34fe3f0e97ce078434e" signature = "iNUEABYKAH0WIQQFx3danouXdAf+COadTFqhVCbaCgUCaYTRLF8UgAAAAAAuAChpc3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MDVDNzc3NUE5RThCOTc3NDA3RkUwOEU2OUQ0QzVBQTE1NDI2REEwQQAKCRCdTFqhVCbaCupJAQDxV7Cgb4mT88rVugSSNl0IZXeGsscXl5AdcpEiySPX8AD/TnTBJQ4PaBHMf2yg6MlvOx3UoY0mM7WygHcEp5Eupg4=" [[package]] name = "gcc" version = "16.1.1+r12+g301eb08fa2c5-1" system = "archlinux" url = "https://archive.archlinux.org/packages/g/gcc/gcc-16.1.1+r12+g301eb08fa2c5-1-x86_64.pkg.tar.zst" sha256 = "80ecc89c7ca567a2c1d460803e1efa434040861f824c34d8fe7000bf27ad82c0" signature = "iNUEABYKAH0WIQQFx3danouXdAf+COadTFqhVCbaCgUCafS5tV8UgAAAAAAuAChpc3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MDVDNzc3NUE5RThCOTc3NDA3RkUwOEU2OUQ0QzVBQTE1NDI2REEwQQAKCRCdTFqhVCbaCuUiAQCgvoBNp3cS3853nVXfsTs+d/es9OS4BeQYBmVGWL6r0AEAlA6Udb4ZVS6Bhrn9tDrQRVWgGw/cqRgWi4boE2D3rAA=" [[package]] name = "gnutls" version = "3.8.13-2" system = "archlinux" url = "https://archive.archlinux.org/packages/g/gnutls/gnutls-3.8.13-2-x86_64.pkg.tar.zst" sha256 = "381e8679ec096bba9d25e6bf8de1d186b1f46e892215aa2a63e1582c34a036f1" signature = "iQEzBAABCgAdFiEErcih/MFeAdRTEEGelGV6sg8qCSsFAmnyXAQACgkQlGV6sg8qCSuSmQf/XhEm8evSbwYD2cyGzAO1f0FgQDIjwmsO6GIw4K1aiJM0jaIseyly/2a5JMCPvqyiCTpk4Fu1iKGahPhkqV5d5MML18z8l1BA/K2hbLH/DM50W5klnLGHmR8MzL3fbvtmsIofgvmrLcVwXmm66S/Rp7fHnz9JsESngJ5GYtJLg+vwQ4wXs8q8neoYolAUgnfWoziBXm7LMoLhcvkjsdkIO+On7u1Vv/ra+mMCbRf7oTa6EoNNMv4/0GGHIzqMAnm6/eMLurk2sPjIQipfj8lcwbBGNo9bmXAQPSKrXfWtE5Kfi9xl5uo54d2unv87oeInV5MVdUShgAH3W1d9L0zwMg==" [[package]] name = "guile" version = "3.0.11-1" system = "archlinux" url = "https://archive.archlinux.org/packages/g/guile/guile-3.0.11-1-x86_64.pkg.tar.zst" sha256 = "dbc4c775e0474a5ac8784aab95a77f6fd23ebc930abea34c7a5e0f83dd00873d" signature = "iNUEABYKAH0WIQQFx3danouXdAf+COadTFqhVCbaCgUCaS4I218UgAAAAAAuAChpc3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MDVDNzc3NUE5RThCOTc3NDA3RkUwOEU2OUQ0QzVBQTE1NDI2REEwQQAKCRCdTFqhVCbaCjiKAQCqa5N4msMDL6n3cQiVw8Cs1Jlda8Gtsf2O19E55qxHWQEA/Rl+8nsXY1xsUedEIo1DwVhhaLvCEafsKjFk4d4mMwU=" [[package]] name = "libedit" version = "20251016_3.1-1" system = "archlinux" url = "https://archive.archlinux.org/packages/l/libedit/libedit-20251016_3.1-1-x86_64.pkg.tar.zst" sha256 = "62fd156cc247c3feb8a750efdfbf5842d9a7c07327890339d4342095d6c86f51" signature = "iQIzBAABCgAdFiEEtZcfLFwQqaCMYAMPeGxj8zDXy5IFAmmnYnMACgkQeGxj8zDXy5IRKw/+M9+I0lNV6GAHsqFT85ZxcO1HhZux3sdo1/PZsT81Tana8kud9jHGjDfS7zOItz6a0pJ7Q/7CL5BKUd7T6TKLjhFeuiZeBfREiiHqXoXnFopZZzEiXGLu0qDjS1Q8jPfs3BydLIa7niUx6uCjDBegULZkJgyEg+zeUc60tzywrb8/Ii6/MKazq7dmMVU6F+ZQH4Nv/jovsnT6RWS0YexKF0qMZzDRaUCZs7pHkllQJCWPa2O3OdUEhTopKxqWn5UeeMmdeIyyqy7cBhGKmQbbK7wxhQkIpK3Q2By7fLldeXOsrqD64xHXL7dupuXqI+6U/uO8KsNhbJRY2JRI2nUsqDwM8qxoR9OTpjJuBbFX6PzpgluB9c0WD/ISO60o/bcd4iXdkfCb66Tk+Oav6dr5tRVj7ifFzrmmV4Av6UMwtajKiebckOc4WXmgAd4Rd8uMAecFS+Mz7ZIKwaJkFRHGa7L57FpLAh0ox58cILYdqXJdUcwT4vTQvKEXO3ZIvcKmQBc8PhD/iSjEln5KcQy/2B3+e2n3gsVbggykMYHhFY6ae1x2b5Knt17NqCLTj/ITbgAdsrBFikkRCUKHMKthz8YcSYL/tUkrSd0AmxVMteSZUO19bqj0ZTwrU2eI2zqPon4j2rhAEEpohfpfvPDoOvronFeObj0S+nF4IGbmzp8=" [[package]] name = "libelf" version = "0.195-1" system = "archlinux" url = "https://archive.archlinux.org/packages/l/libelf/libelf-0.195-1-x86_64.pkg.tar.zst" sha256 = "e7faf9dc2d9dab8975a4a95ce0804c45b3fe69c1551ccb4c05c52003cb2e75c1" signature = "iQJLBAABCAA1FiEEwQA0ZnZjToDJQPuenAL/QZ/svhYFAmnjfU0XHGZveGJvcm9uQGFyY2hsaW51eC5vcmcACgkQnAL/QZ/svhbxqg/8DGBgcos38yvljfVizgfic9tpeMU2aFipOy0szxl0drQsC1SNO9LoYimjK0zzyQCPtqrkAFjoCgStV9gq6xn8zry2NfvqYuDXYcshlbZ+ey5zNzjtMwsPyXtONSeexP4KI2EzKy9LhUQeF2SMs/W4inS2r1dxlLnfBvZhJghdO3e28Wz08zw+KbizhIr1b/dtD9W8+kSL3flKvFj+4WDWdf+4vWPJIqUy2VEl8gkvrZpRPMimrog+9PvMA778PqCTCoX6EenIhno9rhx8MFgFWHIP2xW3PKPgmhjOCtH6s1zxCN5zYS1i8UCfXmGj1Rp4KAUstphXFOKuLjmMHxllftlvI0HvMhdEC0N/8fHM/wa0XqxBs/xn0ysqBSoRp2fI/A3z5D4KOZCIPYFeL02wzgolK6bl65vZK80/HCToyyNxv4rH9r4Ka5+Hr1nEd3CDwKmjDMISJ7JTBzv//qpQwuqLP08I2ZbqaP6XCN6i5e0CSNMpG6/OTynn1zQ0NDTpBTGByVQtowko0VqmHdgkly4GPKqCV7IrP6R+tJmpbnFVwkRgs3up9xlDnphp1oSM4jLSUNPMlQqMyyCNzz0lGpBMmshhfgVFN9iePfe6ZFUh64OinzikJxjEyWvHkfbz15gB5j986DwYbhkA0Td8HEOWU1sLfdYB3SfI+FcOJJM=" [[package]] name = "libgit2" version = "1:1.9.3-1" system = "archlinux" url = "https://archive.archlinux.org/packages/l/libgit2/libgit2-1:1.9.3-1-x86_64.pkg.tar.zst" sha256 = "676caaf7c963aedc46db0a3475064344d9eea74fe0d8429c6c6aa438b5d00a7e" signature = "iHUEABYKAB0WIQQEKYl95fO9rFN6MGltQr3RFuAGjwUCafl5IgAKCRBtQr3RFuAGj5YOAP460nYsYISWcglMsp+ZuvB1buTRmP3N2GpNDO88QKnhLQD/WONQLtk1BqMrG09NepuDz4/3AVnri64jDURi+t6i7Q0=" [[package]] name = "libisl" version = "0.27-1" system = "archlinux" url = "https://archive.archlinux.org/packages/l/libisl/libisl-0.27-1-x86_64.pkg.tar.zst" sha256 = "55a36e8195e6d9ce2efeb4276c60df6b6e7d94812fa36f8423d5ce664a5d34df" signature = "iNUEABYKAH0WIQQFx3danouXdAf+COadTFqhVCbaCgUCZtWJeV8UgAAAAAAuAChpc3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MDVDNzc3NUE5RThCOTc3NDA3RkUwOEU2OUQ0QzVBQTE1NDI2REEwQQAKCRCdTFqhVCbaCgPbAP9GNpnE0ra4qZOGYyJtfnyG42f8Z9dLpX21F/sY/a2UCgD/dz8x7harwjTofWctVHyyCacJsLhSq2jvSfrvvL4H/w8=" [[package]] name = "libksba" version = "1.8.0-1" system = "archlinux" url = "https://archive.archlinux.org/packages/l/libksba/libksba-1.8.0-1-x86_64.pkg.tar.zst" sha256 = "9f0edb97199189416356d1902be4ca605b5bc71525f1604cffbc5d6b28894f3c" signature = "iQEzBAABCgAdFiEEW34/txt/EDKaHAOrdx32Yn7faB8FAmoEdioACgkQdx32Yn7faB8v7Qf+MBPlZW/IiyHhGPPNRXtTHBsRmnmVVJKAffMslsO9VGEA7Aldgj4f7oaWiEiuLB+iT5rw31dEKueDAmOvLbpd+pMUcSwQKY7OpC0Zy3GErM4USFHMjC88v/c0AXAYBcAr99lHSLZG6IIfXnMmfr5p7NMwlJVidTFl8yqkPgLYjG1mG/P5tKlkqocWxwS+I+/CJrfEQAqBrZ20AUsrMhUQPivKUU8SUeUIOSF4c6ior8pxuujt9C+3VGkmdmIPyA7MJzikSzelkQMoau/kTGJBjkbd8D8kBiRyz67WNxXVdkcYUrd34Jiry0RZy0wZZfl80z6VlBh8KBoOnenrKQhUJA==" [[package]] name = "libmpc" version = "1.4.1-1" system = "archlinux" url = "https://archive.archlinux.org/packages/l/libmpc/libmpc-1.4.1-1-x86_64.pkg.tar.zst" sha256 = "880bdba957ebe5136449c7b61821e92628d7bdd43f370e5a0818d229372d3851" signature = "iQEzBAABCgAdFiEEFRnVq6Zb9vwrc8dWek52CV2KUuQFAmnhAlsACgkQek52CV2KUuSBcgf9E61NpAV+F+wHPlOgZOT9yurZAhQwUNd4SRQkNEFrbyMJ1C3Bu9vUayr05Q+MxeQ8/J0W5aACrWSOEAtvYlu9vfmzbn7/S9rHtH9fmvmj46hZemo48cVTq9YTQA1Doe5e9j3DTOWdEsWv7XCMSIXGI2RdIXYB+TH1DLNi7B95EwDySH7SpznjH+SGv9ttVMsmAChRbGR3fIVi6hz6OgSGErFJJmTI5jwt06U6L7Yhl/4ybvYXuh1DGhdFpNhJBGLcYmQhBhv3OGa2dwj051fEjneL2PK80u4nmc+3dP7cOW3pY8jBDpOVfRvnAwiY/NuJMK1YK3iFd3YbYQnuu1D2cQ==" [[package]] name = "libnsl" version = "2.0.1-2" system = "archlinux" url = "https://archive.archlinux.org/packages/l/libnsl/libnsl-2.0.1-2-x86_64.pkg.tar.zst" sha256 = "4ba7b85b42fbda5a1f07e15b8f91c60faa4c5f9168cc27d49fcd20e3a3be8bd8" signature = "iHUEABYKAB0WIQRizHP4hOUpV7L92IObeih9mi7GCAUCagTnhQAKCRCbeih9mi7GCDN3AP0Yw8i2ltzdbfDWBI7G8PkupBsWbdPVgtk4iMzM2X2e1AEA/ZaCdHasuRDn/iXGiHAMv2Po//LZy1L7h1gLDeRW7Ag=" [[package]] name = "libunistring" version = "1.4.2-1" system = "archlinux" url = "https://archive.archlinux.org/packages/l/libunistring/libunistring-1.4.2-1-x86_64.pkg.tar.zst" sha256 = "582625bc02e710b587f4ed319e5c7ad29fd5d4d424b6384f125fc094f07ce590" signature = "iQIzBAABCgAdFiEEtZcfLFwQqaCMYAMPeGxj8zDXy5IFAmnepI4ACgkQeGxj8zDXy5KkoBAApeAeAynFec4onsAgAhXLh5Ru3mhefS9/Fqd776JQu0TRz+NfdgXx2+SaoTL4KgQdFpb9TQWP1WizTRiDWVJOjEXU6EshOYkCgZZan7icD9FvlzJSW+9k9aQHanDO9OVKeW+sINsAbuMY4IjUV8MfZwWqTkYDoOV3t8E8Exsg2OUIg+gmLQuJc5GI8P0ISPEa5tFOCi9H1O3x8e3fsesdfNak7YT/DRQhyQeyZwlsrRfGQR/1+vksmsiNC8x3677/HKADvfhgAXVxexHP+gTyxoyQ70KZswK9WLF4fLHYb1z9e2rl0OIt3PdQkFtgWw4U9UV4dnqgJi8P9fareJhVv6k8P8lOrsV5CLnbBVZ1hHAaSfmDpCDEa+ceuHHPJSciLD3O9nUX16il2UzrT2tDLZA/wkVMAHzChgXPikdmFc7lwNAEhd4ug7+qMBBFiDDp++cG8WQFfe6JInnBwSo39I+9NCHWq6OKx+Wavdo8WvzgST29B2V5xJgt0jN90a0aQioesA2ujnjKzNe55msNJ3TSz49QQbk4xUumXiHym3CGQ6LuZIDdNbFEiRMf5IU97BWdJ0loM3VW/7JLQEVZKAhYrr0T6GhXHB7Tr6wNywDot/P/lvUVNSr5u5S95ENOZgbysc0Lq12v5Jt+TDnyvEFm9/32UEN39DLLEnhdeAo=" [[package]] name = "lld" version = "22.1.5-3" system = "archlinux" url = "https://archive.archlinux.org/packages/l/lld/lld-22.1.5-3-x86_64.pkg.tar.zst" sha256 = "63ee376649e81e82896557965aea3b580cfc586bb0aff9ea7e1323df60b79b62" signature = "iHUEABYKAB0WIQTS6V/sAVzx+RGqqww9TFAIu1yNKQUCaf8l5wAKCRA9TFAIu1yNKZIZAP9x47L46/b1+pD/kAX3GSy4S6AKKFeOMzPkmCNiuIv6cQD9GUHaZjFuVBcQOYu6LcoQpD9ZxRXz+yvYN7mYxwDwvw8=" [[package]] name = "llhttp" version = "9.3.1-1" system = "archlinux" url = "https://archive.archlinux.org/packages/l/llhttp/llhttp-9.3.1-1-x86_64.pkg.tar.zst" sha256 = "e93332a577aacebdef11d0626df9a4f45dd6468187309693ccaa8de1547dc71c" signature = "iQIzBAABCgAdFiEEsNZSlUdmBrcfDG+CqF6BHrTKLggFAmmQzoAACgkQqF6BHrTKLgjUNw/+KlDsMf3ITF8QKgoEMWg57td+bZVbLijaRgOWlbJozcO76Ri8mOhCOv+mIpT/H44upsBeCHkooYi1YmV48m7vLbtBPcqKpr5d1+ccfh3BTzPZXZacw5jUASifAD84M2w4g2GrvrfUn4lFvy8WAYWUmYLEKdMIXVR9abV0M+B8yrNxgeyPzbHHlleJ9tGHHVuTV99GbRsA5HktkrknfoLKZnzMt+jk1uqhqLAPZaSJ41oFwhRyEkCXqOUb2kEqlSJo6Y94n/ipy50pk04RjiB5D75VTm/lJHPBFOIH/bA20K/G15EBH7ql7D9M/tFWaBWaErlTSKf/hT+x8NIf913dcnCxzDBwinMUnrsiJJyp4gSa+dRKgu6BOuF5z35neZVLYHNtyhQmWGzMc0J6w0mhLFqglhEFen+G9NMTfhu9agvxHAZKgA3hnZEsBs09F6XvgZN5jA23pNUKL+lw0hBd6zgPM5yILHVXsBPgGuwr7NjvfBKx10z/uHRz+Jtvm0r5KSTlq4pwz1sWNoSwKQN/2Hb8YdEw1DLoxYXSpDcDtPhUGqZz4wExfFoC+Qo2M1hp7zRTRrRkwf9S8Lnx7IxEX9Qv0miqoJTEkB0TnIsLlg2sT9AISOMHbB6eMyPLscS/PYB3QzJ4uv5RMQx1zJ7GuY7XahJGYY0moYFfcrWFoSw=" [[package]] name = "llvm-libs" version = "22.1.5-1" system = "archlinux" url = "https://archive.archlinux.org/packages/l/llvm-libs/llvm-libs-22.1.5-1-x86_64.pkg.tar.zst" sha256 = "4694118dbf5704a482c82bd0ea292f891068ef36935f897bea73743187bc3482" signature = "iHUEABYKAB0WIQTS6V/sAVzx+RGqqww9TFAIu1yNKQUCafy4/AAKCRA9TFAIu1yNKdU1AP9hn3ew7dYYkgFxQ6Q6rgETUJuASDqZmiBdG4kQMamFXAEA5dNjMQIMAAzyugJHR0bMzNjJeJ4kz3jN4mG43qcttww=" [[package]] name = "make" version = "4.4.1-3" system = "archlinux" url = "https://archive.archlinux.org/packages/m/make/make-4.4.1-3-x86_64.pkg.tar.zst" sha256 = "b03efac9175b986a5f29302336fb1271874464644de3191e6a40079eb8cc5276" signature = "iQIzBAABCgAdFiEELjbYYgIhSC/EXLfyqRdkdZMmtEAFAmnaRRkACgkQqRdkdZMmtEDRLA/7BjiS9bh2OQqIhpLnFJSSPNtxSHbFHBoKPsIkXrEj7zSBZ/CX2ze1PlDMs6su0PQ4BYMtsq31c+UnUxO8Ux20a8VWwywpZcLzLgOsLLqAuDmsBr8VavsrIzNIo78S/ua2qnQ0nYNp/N/YXH+dHBcPTvuypqt6gRWWmm9UrG2co4GI3qIqBLR2ZKimrrIA6zqNcllmxJXPycRF006ovr3tikcBy6mh7AONXncyYPFqk+u3/+W49VEtY2XEK+Nu4+fSdU5+Z2STFu61yPXZbBz7b3Mt7TTVTlGmyBbPXCeyy6LaN6xnbzZDuySOdGg9jLKxs5OgYiDhh4rODRZmk6HhYFkl/uQjWU+zdKAuHARHLmzlwdVZUDm3NP0vWNvEeqxtDLPGmp8S6aOJPvwA17cyMx69jGtBtab7dcJem5EmO0GkGsTmu/tU/7XVu6dzK3TmentSKAH+dBJNg23R37diIddGuLZQjxeMMsjp9F9cD7kSWQTbuVKPBsjv95jfhlNPYirCGL/l2iMz9XO7W2f6HQlXingZVAynSnPeGkW2crEMyIdlOmFZZvi/fArhQWtWyFa08MjbcTPxEuVJKFLEbYA6Es86hnxkD8Cy4G/pUY0gwgUA9i88kHEEVmC5VCutO/y51ogFJvV6zpEIkSjVrYwJ2lx7vIlN9IdRspA1Xe0=" [[package]] name = "musl" version = "1.2.6-1" system = "archlinux" url = "https://archive.archlinux.org/packages/m/musl/musl-1.2.6-1-x86_64.pkg.tar.zst" sha256 = "193b040c7174637ebcb7449914017e4b300089884a659d00bce59888744dc184" signature = "iQJLBAABCgA1FiEEiee5MxxK59f699MFwTIpOVS75K0FAmm/In4XHHNwdXB5a2luQGFyY2hsaW51eC5vcmcACgkQwTIpOVS75K11JBAAtrp8Ovvj6VJOhuR/QKfUDDCpWbcvh+wyqSwXIgRGBR3+m5+HcHkaTUGxtodWpCjiEJeM303SGTgPVsSKlUpNzK/emqhRpKX6pETNvFCjGYZGplvBhdh/LNRf/OMzU2Ld16woc4RUYKciV1LDohB1XVMHpG//QkTHcLOJT4G57NJoS9t0JumxPdZUwEbVrYG56wEMIIVABfY2zb2iFCrjkr1N8GlTCnI8HXpsq0E4yMkhIZ/a1dkFEDmWgFX8g+7JaVVbMFGDaJMGBIM/9bI7Ydc9JtXFbC6aRizF86ZfZdlK3xj0/WAFaqDoj1/O3aToaTqYic/qgPeOqo/nBOyyMxPU9dpz3RBOD9poSiLhjvhERyMSGwuGeAt8D2EGsrUjhJvydF84WfF0ZhlIZIWh1pW+Rf/CPzMeeM3eipLv58HTj5v70JSJuinTM0oIHWoIhsyZPz39dW0UJ+Qqi455f8h8Nj3a/UZfwElNqwLFkV4Qjt9qSRy8twaBNlQuh04PpRhSktRiXNKqc4Ldvcuo/9rhxdByORyfaelYL7OvyX5DyZqmlr1MmtREu4mHU2wN0znRfGinGdVNcqFtFScaABM2tnG8ZE1fOngHg6+P7cFzYYNN8PRaNUHGmSEmbHOoC3k236GmWbCTbDfcZcLauORmJg5GxxoW64PO53CdBRs=" [[package]] name = "nettle" version = "4.0-1" system = "archlinux" url = "https://archive.archlinux.org/packages/n/nettle/nettle-4.0-1-x86_64.pkg.tar.zst" sha256 = "679138a8405ca383aba7836d54fdc282db9394b7dc23c097b8965f70119adf13" signature = "iQEzBAABCgAdFiEErcih/MFeAdRTEEGelGV6sg8qCSsFAmnyWiAACgkQlGV6sg8qCStpDAgAo5ldL6CUnrLyJdgSJpTvyVbXyHpEHzBKgB6dFclj0rkgOG+RkT8yfXtnnSOM2KDLAayjnlc2YhcvgS6KHQU4Mk44CDzZIR9ino3PkpktB+F5IHiLPPrvZmfUs9kMM2OQqsFhSwEDV8AmRbub7rRL/sUZ+gCAWqcI7c/0wNd21nbgzrTdZvQD8oX6Ce9e3r9yvbyzxwea8jDwt+jTX4BdTr3XuCHv1W/oaqSMY9xw6tedxkwoNG2FJWxxb3zOvF5ujPnGSlKikGGYkkqXip/ikeHwRSd7LRu64rSwvdS6Q89qSaXvn88A8GhaDM8GlprfYy08JwuQyMlMHGHuR0s0CA==" [[package]] name = "perl" version = "5.42.2-1" system = "archlinux" url = "https://archive.archlinux.org/packages/p/perl/perl-5.42.2-1-x86_64.pkg.tar.zst" sha256 = "a324d4c08853ba0dd0062dd7b5f0a3ae15868200fb65e837b332adbb81605cdc" signature = "iQIzBAABCgAdFiEEtZcfLFwQqaCMYAMPeGxj8zDXy5IFAmnOHXgACgkQeGxj8zDXy5IJUhAAm3NcDjH5PW4FvSNSch7TdYtFHXNNuAxuy/YGiSpaB1U3MCaCdptNFfEp0k/HrKKAXTRd4lm3Egdy9SzB/VWx9eGHd7bjcKZbjshFfYjCnWT+0ClyKMMu+k3Cc3Cm8/EbQHTsTHrnqRIVSFOxIjxnn4gXAAcbhtF0aMWGVYC91soiU+RULBWw2HwEwu0KTLK/u76jgxIOq7riZdOAJE1ssIbcHu0IvKSXVVlKdKbE3R14IUPhZnvvsjeUMcj3GGUUMWW9vI6DtQsIm+y6WhTh/lffg3WKfba1VSeBUddHxx0NN68oDGBMVodGRXEwNwfUjk69ecp1pm1DH5aeiFBdWcwaabOCWKBHgq/YsQSWKq3zBeHVzrfuihsxBnjZLEGHxCQ3hyQjqIXEICexp0LCzxI4K1cYfA2/hDjlmbzPxxJycfgfzpLUjJ63h3aRCo+qDgHaVSIxN2polXYwsoeYZOjUJOACiTDFtd1NulSfLu3HJClL6pfhvezRgQoR0t71EyyVZhJX5aUCE8kdk+ZqFc3wVbZ9YJwngjTD4pRea/SEDaIB+BanTHcBh1QdejJZUeB8kieCZ0mzNPu0SGCQKbN9YpVQsRODpngwr3Y8xGZ4exLlTpV+4A7gHnc5TkXhdgEg6IZJHhcXHznXu/+vVQi6YS53dCj2a3xqlcwiaNA=" [[package]] name = "rust" version = "1:1.95.0-1" system = "archlinux" url = "https://archive.archlinux.org/packages/r/rust/rust-1:1.95.0-1-x86_64.pkg.tar.zst" sha256 = "7fb944fe7316c4b56946e97629c1c274c7dd477301f72ff38665e516a961cf61" signature = "iHUEABYKAB0WIQSDvIiJNRtd67toQW64rAhgDxCM3wUCaeD+JwAKCRC4rAhgDxCM3+a+AQDYqAJgf84M0ML7M7irZpz+lqnDUPOWdv1f2Ncndw5ilQD/Y5IQ3hhescVkc3Qq957lfwEtFF4JHwVgHDUYSb7NXgM=" [[package]] name = "rust-musl" version = "1:1.95.0-1" system = "archlinux" url = "https://archive.archlinux.org/packages/r/rust-musl/rust-musl-1:1.95.0-1-x86_64.pkg.tar.zst" sha256 = "362af945af3da46608036f094f73124694d816001810872d728a34fe8af5f683" signature = "iHUEABYKAB0WIQSDvIiJNRtd67toQW64rAhgDxCM3wUCaeD+KQAKCRC4rAhgDxCM39dFAP4jpCK0BwjQlfA9DIICUNe81RSMq3dC1LwoGny1v6pYggD8CmDX4Y2TizyqFq53J6i+lTe1jhW6qjtDTxw/MSpO9wQ=" acme-redirect-0.8.1/repro-env.toml000064400000000000000000000002101046102023000151410ustar 00000000000000[container] image = "docker.io/library/archlinux" [packages] system = "archlinux" dependencies = ["make", "musl", "perl", "rust-musl"] acme-redirect-0.8.1/src/acme.rs000064400000000000000000000101421046102023000143760ustar 00000000000000use crate::chall::Challenge; use crate::errors::*; use crate::persist::FilePersist; use acme_micro::create_p384_key; use acme_micro::{Directory, DirectoryUrl}; use std::time::Duration; #[derive(Debug)] pub struct Request<'a> { pub acme_url: &'a str, pub account_email: Option<&'a str>, pub primary_name: &'a str, pub alt_names: &'a [String], } pub fn request(persist: FilePersist, challenge: &mut Challenge, req: &Request) -> Result<()> { let url = DirectoryUrl::Other(req.acme_url); let dir = Directory::from_url(url)?; let contact = if let Some(email) = req.account_email { vec![format!("mailto:{email}")] } else { vec![] }; let acc = if let Some(acc) = persist.load_acc_privkey()? { info!("authenticating with existing account"); dir.load_account(&acc, contact)? } else { info!("registering account"); let acc = dir.register_account(contact)?; info!("successfully created account, saving private key"); persist.store_acc_privkey(&acc.acme_private_key_pem()?)?; acc }; // Order a new TLS certificate for a domain. let alt_names = req.alt_names.iter().map(AsRef::as_ref).collect::>(); info!("sending certificate order"); let mut ord_new = acc.new_order(req.primary_name, &alt_names)?; // If the ownership of the domain(s) have already been // authorized in a previous order, you might be able to // skip validation. The ACME API provider decides. let ord_csr = loop { // are we done? if let Some(ord_csr) = ord_new.confirm_validations() { info!("order has been confirmed"); break ord_csr; } // Get the possible authorizations (for a single domain // this will only be one element). info!("fetch necessary authentications"); let auths = ord_new.authorizations()?; // For HTTP, the challenge is a text file that needs to // be placed in your web server's root: // // /var/www/.well-known/acme-challenge/ // // The important thing is that it's accessible over the // web for the domain(s) you are trying to get a // certificate for: // // http://mydomain.io/.well-known/acme-challenge/ for auth in &auths { let chall = auth .http_challenge() .ok_or_else(|| anyhow!("acme server didn't offer http challenge"))?; // The token is the filename. let token = chall.http_token(); // The proof is the contents of the file let proof = chall.http_proof()?; // Place the proof challenge.write(token, &proof)?; // After the file is accessible from the web, the calls // this to tell the ACME API to start checking the // existence of the proof. // // The order at ACME will change status to either // confirm ownership of the domain, or fail due to the // not finding the proof. To see the change, we poll // the API with 5000 milliseconds wait between. chall.validate(Duration::from_millis(5000))?; } // Update the state against the ACME API. ord_new.refresh()?; }; // Ownership is proven. Create a private key for // the certificate. These are provided for convenience, you // can provide your own keypair instead if you want. let pkey_pri = create_p384_key()?; // Submit the CSR. This causes the ACME provider to enter a // state of "processing" that must be polled until the // certificate is either issued or rejected. Again we poll // for the status change. let ord_cert = ord_csr.finalize_pkey(pkey_pri, Duration::from_millis(5000))?; // Now download the certificate. Also stores the cert in // the persistence. info!("downloading certificate"); let cert = ord_cert.download_cert()?; info!("storing certificate"); persist .store_cert(req.primary_name, &cert) .context("Failed to store certificate")?; Ok(()) } acme-redirect-0.8.1/src/args.rs000064400000000000000000000061721046102023000144350ustar 00000000000000use crate::errors::*; use clap::{ArgAction, CommandFactory, Parser}; use clap_complete::Shell; use std::io::stdout; #[derive(Debug, Parser)] #[command(version)] pub struct Args { /// Verbose logging output (Can be set multiple times) #[arg(short, long, global = true, action = ArgAction::Count)] pub verbose: u8, /// Silent output (except errors) #[arg(short, long, global = true)] pub quiet: bool, #[arg( short, long, value_name = "path", default_value = "/etc/acme-redirect.conf", env = "ACME_CONFIG" )] pub config: String, #[arg( long, value_name = "path", default_value = "/etc/acme-redirect.d", env = "ACME_CONFIG_DIR" )] pub config_dir: String, #[arg(long, value_name = "path", env = "ACME_CHALL_DIR")] pub chall_dir: Option, #[arg(long, value_name = "path", env = "ACME_DATA_DIR")] pub data_dir: Option, #[arg(long, env = "ACME_URL")] pub acme_url: Option, #[arg(long, env = "ACME_EMAIL")] pub acme_email: Option, #[clap(subcommand)] pub subcommand: SubCommand, } #[derive(Debug, Clone, Parser)] pub enum SubCommand { #[clap(flatten)] Cmds(Cmd), /// Generate shell completions Completions(Completions), } #[derive(Debug, Clone, Parser)] pub enum Cmd { /// Run the redirect daemon Daemon(DaemonArgs), /// Show the status of our certificates Status, /// Request new certificates if needed Renew(RenewArgs), /// Check if the challenges could be completed Check(CheckArgs), /// Load the configuration and dump it to stdout as json DumpConfig, } #[derive(Debug, Clone, Parser)] pub struct DaemonArgs { /// The address to listen on #[arg(short = 'B', long, env = "ACME_BIND_ADDR")] pub bind_addr: Option, /// Drop from root to this user #[arg(long)] pub user: Option, /// Chroot into the challenge directory #[arg(long)] pub chroot: bool, } #[derive(Debug, Clone, Parser)] pub struct RenewArgs { /// Do not actually do anything, just show what would happen #[arg(short = 'n', long)] pub dry_run: bool, /// Renew certificates even if they are not about to expire #[arg(long)] pub force_renew: bool, // TODO: add code to check if the cert actually fulfills the dns_names in the config /// Do not execute the configured exec commands #[arg(long)] pub skip_restarts: bool, /// Don't clean up old certs that are not live anymore #[arg(long)] pub skip_cleanup: bool, /// Only execute hooks without actually renewing certs #[arg(long)] pub hooks_only: bool, /// Only renew specific certs pub certs: Vec, } #[derive(Debug, Clone, Parser)] pub struct CheckArgs { /// Only check specific certs pub certs: Vec, } #[derive(Debug, Clone, Parser)] pub struct Completions { pub shell: Shell, } pub fn gen_completions(args: &Completions) -> Result<()> { clap_complete::generate( args.shell, &mut Args::command(), "acme-redirect", &mut stdout(), ); Ok(()) } acme-redirect-0.8.1/src/cert.rs000064400000000000000000000106211046102023000144300ustar 00000000000000use crate::errors::*; #[derive(Debug, PartialEq)] pub struct CertInfo { pub not_before: String, pub expires: time::OffsetDateTime, } impl CertInfo { pub fn from_pem(certificate: &[u8]) -> Result { let pem = pem::parse(certificate).context("Failed to parse pem file")?; let (_, certificate) = x509_parser::parse_x509_certificate(pem.contents()) .context("Failed to parse certificate")?; let validity = certificate.validity(); Ok(CertInfo { not_before: validity.not_before.to_string(), expires: validity.not_after.to_datetime(), }) } fn days_left_from(&self, now: time::OffsetDateTime) -> i64 { let dur = self.expires - now; dur.whole_days() } pub fn days_left(&self) -> i64 { self.days_left_from(time::OffsetDateTime::now_utc()) } } #[cfg(test)] mod tests { use super::*; use time::Month; fn datetime( year: i32, month: Month, day: u8, hour: u8, minute: u8, second: u8, ) -> time::OffsetDateTime { time::OffsetDateTime::new_utc( time::Date::from_calendar_date(year, month, day).unwrap(), time::Time::from_hms(hour, minute, second).unwrap(), ) } #[test] fn test_parse_sh4d0wup_pem() { let cert = r#" -----BEGIN CERTIFICATE----- MIIBXDCCAQKgAwIBAgIUZtwYFW2Db5tjmbrDav1DzGwb6LEwCgYIKoZIzj0EAwIw LTErMCkGA1UEAwwiZmxvd2VycyBhcmUgYmxvb21pbmcgaW4gYW50YXJjdGljYTAg Fw03NTAxMDEwMDAwMDBaGA80MDk2MDEwMTAwMDAwMFowLTErMCkGA1UEAwwiZmxv d2VycyBhcmUgYmxvb21pbmcgaW4gYW50YXJjdGljYTBZMBMGByqGSM49AgEGCCqG SM49AwEHA0IABNbW5jkPKJWJDAy8+SYtM/9LXETga3KmGYyyUP71nNehbLsQjbyd bn6+BWsCwbIuvTTH/FcbzRFq1v0L9PqZuocwCgYIKoZIzj0EAwIDSAAwRQIgWJrx gIXowJ9kQEp/x8JLbieAQsyLebruy7FNCfl5OQACIQD9I0/iP7JasLIXjM6/BwJ0 m9Iy/v8ftvQCp2l/qlk1/A== -----END CERTIFICATE----- "#; let cert = CertInfo::from_pem(cert.as_bytes()).unwrap(); assert_eq!( cert, CertInfo { not_before: "Jan 1 00:00:00 1975 +00:00".to_string(), expires: datetime(4096, Month::January, 1, 0, 0, 0), } ); assert_eq!( cert.days_left_from(datetime(2026, Month::May, 15, 16, 20, 0)), 755917 ); } #[test] fn test_letsencrypt_pem() { let cert = r#" -----BEGIN CERTIFICATE----- MIIEQjCCA8igAwIBAgISBRirJMSMrHnDgH6LMSv04ZwQMAoGCCqGSM49BAMDMDIx CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQDEwJF NzAeFw0yNjA1MDcxNjE0MzdaFw0yNjA4MDUxNjE0MzZaMBoxGDAWBgNVBAMTD2xl dHNlbmNyeXB0Lm9yZzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABES9iPUkeXDT TfBhAuKX4XFyRcGaBBjny62Mt9qT0p4tD16QxO5nMfmGGUK5XEW9JiHI+1r/V3r/ ugNSSmddGkOjggLUMIIC0DAOBgNVHQ8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VIDNQ9IZBVfUfHHpoTgqF8qxrVB8a0/PSz7K5TDkDQP/Bfec= -----END CERTIFICATE----- "#; let cert = CertInfo::from_pem(cert.as_bytes()).unwrap(); assert_eq!( cert, CertInfo { not_before: "May 7 16:14:37 2026 +00:00".to_string(), expires: datetime(2026, Month::August, 5, 16, 14, 36), } ); assert_eq!( cert.days_left_from(datetime(2026, Month::May, 15, 16, 00, 0)), 82 ); assert_eq!( cert.days_left_from(datetime(2026, Month::May, 15, 16, 20, 0)), 81 ); } } acme-redirect-0.8.1/src/chall.rs000064400000000000000000000037431046102023000145650ustar 00000000000000use crate::config::Config; use crate::errors::*; use rand::distr::slice::Choose; use rand::prelude::*; use std::fs; use std::path::{Path, PathBuf}; // URL-safe base64 alphabet const VALID_CHARS: &str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; #[inline] pub fn valid_token(t: &str) -> bool { t.chars().all(|c| VALID_CHARS.contains(c)) } pub struct Challenge { path: PathBuf, written: Vec, } impl Challenge { pub fn new(config: &Config) -> Challenge { let chall_dir = Path::new(&config.system.chall_dir); // TODO: consider creating the directory Challenge { path: chall_dir.join("challs"), written: Vec::new(), } } pub fn write(&mut self, token: &str, proof: &str) -> Result<()> { if !valid_token(token) { bail!("ACME server sent us malicious token") } let path = self.path.join(token); debug!("Writing challenge proof to {:?}", path); fs::write(&path, proof).context("Failed to write challenge proof")?; self.written.push(path); Ok(()) } // Generate a random token, used to test if acme-redirect httpd works correctly pub fn random(&mut self) -> Result { const TOKEN_LEN: usize = 16; let mut rng = rand::rng(); let Ok(chars) = Choose::new(VALID_CHARS.as_bytes()) else { // This code should never be reached though, as VALID_CHARS is hard-coded bail!("Challenge token alphabet must not be empty"); }; let random = (&mut rng) .sample_iter(chars) .take(TOKEN_LEN) .map(|b| *b as char) .collect::(); self.write(&random, &random)?; Ok(random) } pub fn cleanup(&mut self) -> Result<()> { for path in self.written.drain(..) { debug!("Deleting old challenge proof: {:?}", path); fs::remove_file(path)?; } Ok(()) } } acme-redirect-0.8.1/src/check.rs000064400000000000000000000027361046102023000145600ustar 00000000000000use crate::args::CheckArgs; use crate::chall::Challenge; use crate::config::Config; use crate::errors::*; use std::collections::HashSet; use std::time::Duration; const REQUEST_TIMEOUT: Duration = Duration::from_secs(30); pub fn check(name: &str, token: &str) -> Result<()> { let url = format!("http://{name}/.well-known/acme-challenge/{token}"); let mut r = ureq::get(&url) .config() .timeout_global(Some(REQUEST_TIMEOUT)) .http_status_as_error(false) .build() .call()?; let status = r.status(); if status != 200 { bail!( "response status code is wrong (expected 200, got {})", status ); } let body = r.body_mut().read_to_string()?; if body != token { bail!("response body didn't match expected token"); } Ok(()) } pub fn run(config: Config, mut args: CheckArgs) -> Result<()> { let mut chall = Challenge::new(&config); let token = chall.random()?; let filter = args.certs.drain(..).collect::>(); for cert in config.filter_certs(&filter) { for dns_name in &cert.dns_names { if let Err(err) = check(dns_name, &token) { error!( "Check failed ({:?} -> {:?}): {:#}", cert.name, dns_name, err ); } else { info!("Verified {:?} -> {:?}: OK", cert.name, dns_name); } } } chall.cleanup()?; Ok(()) } acme-redirect-0.8.1/src/config.rs000064400000000000000000000107771046102023000147540ustar 00000000000000use crate::args::Args; use crate::errors::*; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; use std::collections::HashSet; use std::ffi::OsStr; use std::fs; use std::path::{Path, PathBuf}; const LETSENCRYPT: &str = "https://acme-v02.api.letsencrypt.org/directory"; // const LETSENCRYPT_STAGING: &str = "https://acme-staging-v02.api.letsencrypt.org/directory"; pub const DEFAULT_RENEW_IF_DAYS_LEFT: i64 = 30; pub const BIND_ALL_PORT_80: &str = "[::]:80"; #[derive(Debug, PartialEq, Eq, Deserialize)] pub struct ConfigFile { #[serde(default)] pub acme: AcmeConfig, #[serde(default)] pub system: SystemConfig, } #[derive(Debug, Default, PartialEq, Eq, Serialize, Deserialize)] pub struct AcmeConfig { pub acme_email: Option, pub acme_url: String, pub renew_if_days_left: i64, } #[derive(Debug, Default, PartialEq, Eq, Serialize, Deserialize)] pub struct SystemConfig { pub addr: Option, pub data_dir: PathBuf, pub chall_dir: PathBuf, #[serde(default)] pub exec: Vec, #[serde(default)] pub exec_extra: Vec, } #[derive(Debug, PartialEq, Eq, Deserialize)] pub struct CertConfigFile { cert: CertConfig, } fn load_str(s: &str) -> Result { let conf = toml::from_str(s).context("Failed to load config")?; Ok(conf) } fn load_file, T: DeserializeOwned>(path: P) -> Result { let buf = fs::read_to_string(path.as_ref()).context("Failed to read file")?; load_str(&buf) } fn load_from_folder>(path: P) -> Result> { let mut configs = Vec::new(); let iter = fs::read_dir(path.as_ref()) .with_context(|| anyhow!("Failed to list directory: {:?}", path.as_ref()))?; for file in iter { let file = file?; let path = file.path(); if path.extension() == Some(OsStr::new("conf")) { let c = load_file(&path) .with_context(|| anyhow!("Failed to load config file {:?}", path))?; configs.push(c); } else { debug!("skipping non-config file {:?}", path); } } Ok(configs) } #[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] pub struct CertConfig { pub name: String, pub dns_names: Vec, #[serde(default)] pub must_staple: bool, #[serde(default)] pub exec: Vec, } #[derive(Debug, Serialize, Deserialize)] pub struct Config { pub certs: Vec, pub acme: AcmeConfig, pub system: SystemConfig, } impl Config { pub fn filter_certs<'a>( &'a self, filter: &'a HashSet, ) -> impl Iterator { self.certs .iter() .filter(move |cert| filter.is_empty() || filter.contains(&cert.name)) } } pub fn load(args: Args) -> Result { let settings = config::Config::builder() .set_default("acme.acme_url", LETSENCRYPT)? .set_default("acme.renew_if_days_left", DEFAULT_RENEW_IF_DAYS_LEFT)? .set_default("system.data_dir", "/var/lib/acme-redirect")? .set_default("system.chall_dir", "/run/acme-redirect")? .add_source(config::File::new(&args.config, config::FileFormat::Toml)) .set_override_option("acme.acme_email", args.acme_email)? .set_override_option("acme.acme_url", args.acme_url)? .set_override_option("system.data_dir", args.data_dir)? .set_override_option("system.chall_dir", args.chall_dir)? .build() .context("Failed to load config")?; let config = settings .try_deserialize::() .context("Failed to parse config")?; let certs = load_from_folder(&args.config_dir)? .into_iter() .map(|c| c.cert) .collect(); Ok(Config { certs, acme: config.acme, system: config.system, }) } #[cfg(test)] mod tests { use super::*; #[test] fn minimal_cert_conf() { let conf = load_str::( r#" [cert] name = "example.com" dns_names = ["example.com", "www.example.com"] "#, ) .unwrap(); assert_eq!( conf, CertConfigFile { cert: CertConfig { name: "example.com".to_string(), dns_names: vec!["example.com".to_string(), "www.example.com".to_string(),], must_staple: false, exec: vec![], }, } ); } } acme-redirect-0.8.1/src/daemon.rs000064400000000000000000000052271046102023000147440ustar 00000000000000use crate::args::DaemonArgs; use crate::chall; use crate::config::{BIND_ALL_PORT_80, Config}; use crate::errors::*; use crate::http_responses::*; use crate::sandbox; use actix_web::{App, HttpServer, middleware}; use actix_web::{HttpRequest, HttpResponse, Responder, get, web}; use std::env; use std::fs; use std::net::TcpListener; use std::path::Path; fn get_host(req: &HttpRequest) -> Option<&str> { let host = req.headers().get("Host")?; host.to_str().ok() } #[inline] fn bad_request() -> HttpResponse { HttpResponse::BadRequest().body(BAD_REQUEST) } #[inline] fn not_found() -> HttpResponse { HttpResponse::NotFound().body(NOT_FOUND) } #[get("/{p:.*}")] async fn redirect(req: HttpRequest) -> impl Responder { debug!("REQ: {:?}", req); let host = if let Some(host) = get_host(&req) { host } else { return bad_request(); }; debug!("host: {:?}", host); let path = req.uri(); debug!("path: {:?}", path); let url = format!("https://{host}{path}"); if url.chars().any(|c| c == '\n' || c == '\r') { return bad_request(); } HttpResponse::MovedPermanently() .append_header(("Location", url)) .body(REDIRECT) } #[get("/.well-known/acme-challenge/{chall}")] async fn acme(token: web::Path, req: HttpRequest) -> impl Responder { debug!("REQ: {:?}", req); info!("acme: {:?}", token); if !chall::valid_token(&token) { return bad_request(); } let path = Path::new("challs").join(token.as_ref()); debug!("Reading challenge proof: {:?}", path); if let Ok(proof) = fs::read(path) { HttpResponse::Ok().body(proof) } else { not_found() } } #[actix_web::main] pub async fn spawn(socket: TcpListener) -> Result<()> { HttpServer::new(move || { App::new() // enable logger .wrap(middleware::Logger::default()) .service(acme) .service(redirect) }) .listen(socket) .context("Failed to bind socket")? .run() .await .context("Failed to start http daemon")?; Ok(()) } pub fn run(config: Config, args: DaemonArgs) -> Result<()> { env::set_current_dir(&config.system.chall_dir).with_context(|| { anyhow!( "Failed to change to challenge directory at {:?}", config.system.chall_dir ) })?; let addr = args .bind_addr .as_deref() .or(config.system.addr.as_deref()) .unwrap_or(BIND_ALL_PORT_80); let socket = TcpListener::bind(addr).with_context(|| anyhow!("Failed to bind socket: {addr}"))?; sandbox::init(&args).context("Failed to drop privileges")?; spawn(socket) } acme-redirect-0.8.1/src/errors.rs000064400000000000000000000001501046102023000150030ustar 00000000000000pub use anyhow::{Context, Error, Result, anyhow, bail}; pub use log::{debug, error, info, trace, warn}; acme-redirect-0.8.1/src/http_responses.rs000064400000000000000000000007201046102023000165520ustar 00000000000000pub const REDIRECT: &str = r#" 301 Moved Permanently

301 Moved Permanently

"#; pub const BAD_REQUEST: &str = r#" 400 Bad Request

400 Bad Request

"#; pub const NOT_FOUND: &str = r#" 404 Not Found

404 Not Found

"#; acme-redirect-0.8.1/src/lib.rs000064400000000000000000000003211046102023000142350ustar 00000000000000pub mod acme; pub mod args; pub mod cert; pub mod chall; pub mod check; pub mod config; pub mod daemon; pub mod errors; pub mod http_responses; pub mod persist; pub mod renew; pub mod sandbox; pub mod status; acme-redirect-0.8.1/src/main.rs000064400000000000000000000025751046102023000144300ustar 00000000000000use acme_redirect::args::{self, Args, Cmd, SubCommand}; use acme_redirect::check; use acme_redirect::config; use acme_redirect::daemon; use acme_redirect::errors::*; use acme_redirect::renew; use acme_redirect::status; use clap::Parser; use env_logger::Env; use std::io; fn main() -> Result<()> { let args = Args::parse(); let logging = match (args.quiet, args.verbose) { (true, _) => "warn", (false, 0) => "info", (false, 1) => "info,acme_redirect=debug", (false, 2) => "debug", (false, _) => "debug,acme_redirect=trace", }; env_logger::init_from_env(Env::default().default_filter_or(logging)); match args.subcommand.clone() { SubCommand::Cmds(subcommand) => { let config = config::load(args)?; trace!("Loaded runtime config: {:?}", config); match subcommand { Cmd::Daemon(args) => daemon::run(config, args)?, Cmd::Status => status::run(config)?, Cmd::Renew(args) => renew::run(config, args)?, Cmd::Check(args) => check::run(config, args)?, Cmd::DumpConfig => { serde_json::to_writer_pretty(io::stdout(), &config)?; println!(); } } } SubCommand::Completions(completions) => args::gen_completions(&completions)?, } Ok(()) } acme-redirect-0.8.1/src/persist.rs000064400000000000000000000712361046102023000151750ustar 00000000000000use crate::cert::CertInfo; use crate::config::Config; use crate::errors::*; use acme_micro::Certificate; use std::collections::HashMap; use std::ffi::OsStr; use std::fs; use std::fs::{DirEntry, File, OpenOptions}; use std::io::ErrorKind; use std::io::prelude::*; use std::os::unix::fs::OpenOptionsExt; use std::os::unix::fs::symlink; use std::path::Path; use std::path::PathBuf; use time::OffsetDateTime; #[derive(Clone)] pub struct FilePersist { path: PathBuf, } impl FilePersist { pub fn new(config: &Config) -> FilePersist { FilePersist { path: PathBuf::from(&config.system.data_dir), } } fn acc_privkey_path(&self) -> PathBuf { self.path.join("acc.key") } pub fn load_acc_privkey(&self) -> Result> { let path = self.acc_privkey_path(); if path.exists() { let buf = fs::read_to_string(&path)?; Ok(Some(buf)) } else { Ok(None) } } fn certstore_entry(entry: &DirEntry) -> Result<(PathBuf, String, CertInfo)> { let cert_path = entry.path().join("fullchain"); let name = entry .file_name() .into_string() .map_err(|_| anyhow!("Filename contains invalid utf8"))?; let buf = fs::read(cert_path)?; let cert = CertInfo::from_pem(&buf)?; Ok((entry.path(), name, cert)) } pub fn list_certs(&self) -> Result> { let path = self.path.join("certs"); let mut certs = Vec::new(); if path.exists() { for entry in fs::read_dir(path)? { let entry = entry?; match Self::certstore_entry(&entry) { Ok(entry) => certs.push(entry), Err(err) => error!("Failed to read {:?}: {:#}", entry.path(), err), } } } Ok(certs) } pub fn list_live_certs(&self) -> Result> { let path = self.path.join("live"); let mut live = HashMap::new(); if path.exists() { for entry in fs::read_dir(path)? { let entry = entry?; let path = entry.path(); if let Some(Some(name)) = path.file_name().map(OsStr::to_str) && let Ok(link) = fs::read_link(&path) && let Some(Some(version)) = link.file_name().map(OsStr::to_str) { live.insert(version.to_string(), name.to_string()); } } } Ok(live) } pub fn load_cert_info(&self, name: &str) -> Result> { let mut path = self.path.join("live"); path.push(name); path.push("fullchain"); if path.exists() { let buf = fs::read(&path)?; let cert = CertInfo::from_pem(&buf)?; Ok(Some(cert)) } else { Ok(None) } } pub fn store_acc_privkey(&self, key: &str) -> Result<()> { let path = self.acc_privkey_path(); let mut file = OpenOptions::new() .write(true) .create(true) .truncate(true) .mode(0o600) .open(path)?; file.write_all(key.as_bytes())?; Ok(()) } fn format_date(datetime: &OffsetDateTime) -> Result { let date = datetime.format(&time::macros::format_description!("[year][month][day]"))?; Ok(date) } pub fn store_cert(&self, name: &str, fullcert: &Certificate) -> Result<()> { let now = Self::format_date(&OffsetDateTime::now_utc())?; let path = self.path.join("certs"); debug!("creating folder: {:?}", path); fs::create_dir_all(&path) .with_context(|| anyhow!("Failed to create folder: {:?}", &path))?; let mut i = 0; let path = loop { let mut folder = format!("{now}-{name}"); if i > 0 { folder.push_str(&format!("-{i}")); } let path = path.join(folder); debug!("try atomically claiming folder: {:?}", path); let err = fs::create_dir(&path); match err { Err(e) if e.kind() == ErrorKind::AlreadyExists => (), Err(_) => { err.with_context(|| anyhow!("Failed to create folder: {:?}", &path))?; } Ok(_) => break path, } i += 1; }; debug!("splitting chain from cert"); let (chain, cert) = split_chain(fullcert.certificate())?; let bundle = format!("{}{}", fullcert.private_key(), cert); let full_bundle = format!("{}{}", fullcert.private_key(), fullcert.certificate()); debug!("writing privkey"); let privkey_path = path.join("privkey"); write(&privkey_path, 0o440, fullcert.private_key().as_bytes())?; debug!("writing full cert with intermediates"); let fullkey_path = path.join("fullchain"); write(&fullkey_path, 0o444, fullcert.certificate().as_bytes())?; debug!("writing chain"); let chain_path = path.join("chain"); write(&chain_path, 0o444, chain.as_bytes())?; debug!("writing single cert"); let cert_path = path.join("cert"); write(&cert_path, 0o444, cert.as_bytes())?; debug!("writing bundle"); let bundle_path = path.join("bundle"); write(&bundle_path, 0o440, bundle.as_bytes())?; debug!("writing full bundle with intermediates"); let fullbundle_path = path.join("fullbundle"); write(&fullbundle_path, 0o440, full_bundle.as_bytes())?; info!("marking cert live"); let live = self.path.join("live"); fs::create_dir_all(&live) .with_context(|| anyhow!("Failed to create folder: {:?}", &live))?; let live = live.join(name); // TODO: this should be atomic (ln -sf) // https://github.com/coreutils/coreutils/blob/2ed7c2867974ccf7abc61c34ad7bf9565489c18e/src/force-link.c#L142-L182 if live.exists() { fs::remove_file(&live).context("Failed to delete old symlink")?; } symlink(&path, &live) .with_context(|| anyhow!("Failed to create symlink: {:?} -> {:?}", path, live))?; Ok(()) } } fn create(path: &Path, mode: u32) -> Result { OpenOptions::new() .write(true) .create(true) .truncate(true) .mode(mode) .open(path) .map_err(Error::from) } fn write(path: &Path, mode: u32, data: &[u8]) -> Result<()> { let mut f = create(path, mode)?; f.write_all(data)?; Ok(()) } fn split_chain(fullchain: &str) -> Result<(String, String)> { let pems = pem::parse_many(fullchain).context("Failed to parse fullchain as pem")?; if pems.is_empty() { bail!("Input has no certificates"); } let cert = pem::encode(&pems[0]); let chain = pem::encode_many(&pems[1..]); Ok((chain, cert)) } #[cfg(test)] mod tests { use super::*; #[test] fn test_split_none() { let r = split_chain(""); assert!(r.is_err()); } #[test] fn test_split_one() { let (chain, cert) = split_chain( "-----BEGIN CERTIFICATE----- MIIE1DCCA7ygAwIBAgISA22Gkmt31e1mitao+ENL+sr3MA0GCSqGSIb3DQEBCwUA MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0yMDA0MjgyMzMxMjdaFw0y MDA3MjcyMzMxMjdaMCUxIzA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c7EHQ7Myb7f3eE9cE6wLu/JLCCUotgafi08\r\n\ aJ6TSPxS0YlSBhKYNbOUI7R8ZbjAJe/vI1IcYYhMaIW0kAzo4nxEmg==\r\n\ -----END CERTIFICATE-----\r\n" ); } #[test] fn test_split_two() { let (chain, cert) = split_chain( "-----BEGIN CERTIFICATE----- MIIE1DCCA7ygAwIBAgISA22Gkmt31e1mitao+ENL+sr3MA0GCSqGSIb3DQEBCwUA MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0yMDA0MjgyMzMxMjdaFw0y MDA3MjcyMzMxMjdaMCUxIzAhBgNVBAMTGmNhY2hlLnJlYnVpbGRlci5menlsYWIu bmV0MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETyu5fNMOS/Lm/CwddSGEBH/XznHo +nzPGVWxRDRl6UayntgPnTxBRi4HzUj91249mL0Q+/bYLWJdWueAJomi7CRVU3jo E8oDVR6f528TRna2qoi0KTs8vJgMETy80yy7o4IChTCCAoEwDgYDVR0PAQH/BAQD AgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAMBgNVHRMBAf8EAjAA MB0GA1UdDgQWBBREiBvysibRSVuw2Ur0qygxYaGtADAfBgNVHSMEGDAWgBSoSmpj BH3duubRObemRWXv86jsoTBvBggrBgEFBQcBAQRjMGEwLgYIKwYBBQUHMAGGImh0 dHA6Ly9vY3NwLmludC14My5sZXRzZW5jcnlwdC5vcmcwLwYIKwYBBQUHMAKGI2h0 dHA6Ly9jZXJ0LmludC14My5sZXRzZW5jcnlwdC5vcmcvMDsGA1UdEQQ0MDKCGmNh Y2hlLnJlYnVpbGRlci5menlsYWIubmV0ghRyZWJ1aWxkZXIuZnp5bGFiLm5ldDBM BgNVHSAERTBDMAgGBmeBDAECATA3BgsrBgEEAYLfEwEBATAoMCYGCCsGAQUFBwIB FhpodH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yGf\r\n\ gdi3bgjXhtspUqkKKcA/HLS7YXiwtu3hnc8SAHcAsh4FzIuizYogTodm+Su5iiUg\r\n\ Z2va+nDnsklTLe+LkF4AAAFxw1h6owAABAMASDBGAiEAsQkiJ6UNE//GvhIyoJVs\r\n\ Ah2ad7w+zPW2gVmYQFeVOJACIQDUhFc8FYzFDo3mIhHoY6+ODjLK4l6ruR28606D\r\n\ X1WLbzANBgkqhkiG9w0BAQsFAAOCAQEAV/xkamOUFhtjyy6MPPBfT7nBYSBjTo7h\r\n\ nlIuj5QZ5dHYM2eOZg77VOGpSgD5mlj0pqyspDMCkhsHVrmGFOcFKWgvwN5W6WF/\r\n\ l7VHipzyxsPctUQK8pPRfOR8l2iMBj9+qpKmLx6v/BRN5ycj2giMuw6pbIoB3n6T\r\n\ nXq0uZRfAm2kmQ64WusLvkvgpS61J0m70JI2mXdr+epeXwKdWcmnZJ4CCOiSYdv/\r\n\ AxdDRttRGfpNyAxuMiyCccwXW2rNfc7EHQ7Myb7f3eE9cE6wLu/JLCCUotgafi08\r\n\ aJ6TSPxS0YlSBhKYNbOUI7R8ZbjAJe/vI1IcYYhMaIW0kAzo4nxEmg==\r\n\ -----END CERTIFICATE-----\r\n" ); } #[test] fn test_split_three() { let (chain, cert) = split_chain( "-----BEGIN CERTIFICATE----- MIIE1DCCA7ygAwIBAgISA22Gkmt31e1mitao+ENL+sr3MA0GCSqGSIb3DQEBCwUA MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0yMDA0MjgyMzMxMjdaFw0y MDA3MjcyMzMxMjdaMCUxIzAhBgNVBAMTGmNhY2hlLnJlYnVpbGRlci5menlsYWIu bmV0MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETyu5fNMOS/Lm/CwddSGEBH/XznHo +nzPGVWxRDRl6UayntgPnTxBRi4HzUj91249mL0Q+/bYLWJ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6v/BRN5ycj2giMuw6pbIoB3n6T\r\n\ nXq0uZRfAm2kmQ64WusLvkvgpS61J0m70JI2mXdr+epeXwKdWcmnZJ4CCOiSYdv/\r\n\ AxdDRttRGfpNyAxuMiyCccwXW2rNfc7EHQ7Myb7f3eE9cE6wLu/JLCCUotgafi08\r\n\ aJ6TSPxS0YlSBhKYNbOUI7R8ZbjAJe/vI1IcYYhMaIW0kAzo4nxEmg==\r\n\ -----END CERTIFICATE-----\r\n" ); } #[test] fn test_format_datetime() { let date = FilePersist::format_date(&time::macros::datetime!( 2024-10-04 19:00:00 +00:00 )) .unwrap(); assert_eq!(date, "20241004"); } } acme-redirect-0.8.1/src/renew.rs000064400000000000000000000107211046102023000146140ustar 00000000000000use crate::acme; use crate::args::RenewArgs; use crate::chall::Challenge; use crate::config::CertConfig; use crate::config::Config; use crate::errors::*; use crate::persist::FilePersist; use std::collections::HashSet; use std::fs; use std::process::Command; fn should_request_cert( args: &RenewArgs, config: &Config, persist: &FilePersist, cert: &CertConfig, ) -> Result { if args.force_renew { info!("{:?}: force renewing", cert.name); Ok(true) } else if let Some(existing) = persist.load_cert_info(&cert.name)? { let days_left = existing.days_left(); if days_left <= config.acme.renew_if_days_left { info!("{:?}: existing cert is below threshold", cert.name); Ok(true) } else { info!("{:?}: cert already satisfied", cert.name); Ok(false) } } else { info!("{:?}: creating new cert", cert.name); Ok(true) } } fn execute_hooks(hooks: &[String], dry_run: bool) -> Result<()> { for exec in hooks { if dry_run { info!("executing hook: {:?} (dry run)", exec); } else { info!("executing hook: {:?}", exec); let status = Command::new("sh") .arg("-c") .arg(exec) .status() .context("Failed to spawn shell for hook")?; if !status.success() { error!("Failed to execute hook: {:?}", exec); } } } Ok(()) } fn renew_cert( args: &RenewArgs, config: &Config, persist: &FilePersist, cert: &CertConfig, ) -> Result<()> { let mut challenge = Challenge::new(config); if !should_request_cert(args, config, persist, cert)? { debug!("Not requesting a certificate for {:?}", cert.name); return Ok(()); } if args.dry_run || args.hooks_only { info!("renewing {:?} (dry run)", cert.name); } else { info!("renewing {:?}", cert.name); acme::request( persist.clone(), &mut challenge, &acme::Request { account_email: config.acme.acme_email.as_deref(), acme_url: &config.acme.acme_url, primary_name: &cert.name, alt_names: &cert.dns_names, }, ) .with_context(|| anyhow!("Fail to get certificate {:?}", cert.name))?; challenge.cleanup()?; } if !args.skip_restarts { if !cert.exec.is_empty() { debug!("Executing hooks for this certificate"); execute_hooks(&cert.exec, args.dry_run)?; } else { debug!("Executing global default hooks"); execute_hooks(&config.system.exec, args.dry_run)?; } debug!("Executing global exec_extra hooks"); execute_hooks(&config.system.exec_extra, args.dry_run)?; } Ok(()) } fn cleanup_certs(persist: &FilePersist, dry_run: bool) -> Result<()> { let live = persist .list_live_certs() .context("Failed to list live certificates")?; for (version, name) in &live { debug!("cert used in live: {:?} -> {:?}", name, version); } let cert_list = persist .list_certs() .context("Failed to list certificates")?; for (path, name, cert) in cert_list { if cert.days_left() >= 0 { debug!("cert {:?} is still valid, keeping it around", name); } else { if live.contains_key(&name) { debug!("cert {:?} is expired by still live, skipping", name); continue; } if dry_run { debug!( "cert {:?} is expired, would delete but dry run is enabled", name ); } else { info!("cert {:?} is expired, deleting...", name); if let Err(err) = fs::remove_dir_all(path) { error!("Failed to delete {:?}: {:#}", name, err); } } } } Ok(()) } pub fn run(config: Config, mut args: RenewArgs) -> Result<()> { let persist = FilePersist::new(&config); let filter = args.certs.drain(..).collect::>(); for cert in config.filter_certs(&filter) { if let Err(err) = renew_cert(&args, &config, &persist, cert) { error!("Failed to renew ({:?}): {:#}", cert.name, err); } } cleanup_certs(&persist, args.dry_run).context("Failed to cleanup old certs")?; Ok(()) } acme-redirect-0.8.1/src/sandbox.rs000064400000000000000000000042541046102023000151360ustar 00000000000000use crate::args::DaemonArgs; use crate::errors::*; use nix::unistd::{Gid, Uid}; use std::env; use std::fs; use std::os::unix::fs::MetadataExt; use std::path::Path; fn chroot(path: &Path) -> Result<()> { let metadata = fs::metadata(path)?; if !metadata.is_dir() { bail!("chroot target is no directory"); } if metadata.uid() != 0 { bail!("chroot target isn't owned by root"); } if metadata.mode() & 0o22 != 0 { bail!("chroot is writable by group or world"); } nix::unistd::chroot(path)?; env::set_current_dir("/")?; Ok(()) } fn drop_caps() -> Result<()> { #[cfg(target_os = "linux")] { use caps::CapSet; debug!("Permanently clearing capability sets"); caps::clear(None, CapSet::Effective) .map_err(|err| anyhow!("Failed to clear effective capability set: {}", err))?; caps::clear(None, CapSet::Permitted) .map_err(|err| anyhow!("Failed to clear permitted capability set: {}", err))?; } Ok(()) } pub fn init(args: &DaemonArgs) -> Result<()> { let user = if let Some(name) = &args.user { debug!("Resolving uid for {:?}", name); let user = uzers::get_user_by_name(&name) .ok_or_else(|| anyhow!("Failed to look up user: {:?}", name))?; let uid = Uid::from_raw(user.uid()); let gid = Gid::from_raw(user.primary_group_id()); debug!("Resolved {:?} => {}:{}", name, uid, gid); Some((uid, gid)) } else { None }; if args.chroot { let path = env::current_dir().context("Failed to determine current directory")?; debug!("Chrooting into {:?}", path); chroot(&path).context("Failed to chroot")?; } if let Some((uid, gid)) = user { debug!("Dropping uid:gid to {}:{}", uid, gid); // Remove the `cfg(...)` after this lands: https://github.com/nix-rust/nix/pull/2793 #[cfg(not(target_os = "macos"))] nix::unistd::setgroups(&[]).context("Failed to clear supplementary groups")?; nix::unistd::setgid(gid).context("Failed to drop gid")?; nix::unistd::setuid(uid).context("Failed to drop uid")?; } drop_caps()?; Ok(()) } acme-redirect-0.8.1/src/services.rs000064400000000000000000000000001046102023000153040ustar 00000000000000acme-redirect-0.8.1/src/status.rs000064400000000000000000000021211046102023000150120ustar 00000000000000use crate::config::Config; use crate::errors::*; use crate::persist::FilePersist; use colored::Colorize; use nix::unistd::AccessFlags; use std::path::Path; pub fn run(config: Config) -> Result<()> { let persist = FilePersist::new(&config); let data_dir = Path::new(&config.system.data_dir); nix::unistd::access(data_dir, AccessFlags::X_OK) .with_context(|| anyhow!("Detected insufficient permissions to access {:?}", data_dir))?; for cert in config.certs { let name = cert.name; // TODO: also show alt names? if let Some(cert) = persist.load_cert_info(&name)? { let days_left = cert.days_left(); let status = format!("{days_left} days left"); let status = if days_left > config.acme.renew_if_days_left { status.green() } else if days_left > 0 { status.yellow() } else { status.red() }; println!("{:50} {}", name.bold(), status); } else { println!("{:50} -", name.bold()); } } Ok(()) }