MyGit

gamalan/caddy-tlsredis

Fork: 31 Star: 95 (更新于 2024-11-12 22:15:21)

license: Apache-2.0

Language: Go .

Redis Storage using for Caddy TLS Data

最后发布版本: v0.3.1 ( 2023-11-06 11:58:27)

GitHub网址

ARCHIVED

Please refer to pberkel/caddy-storage-redis for updated version

Reason: work reason, and having outside hobby than code

Caddy Cluster / Certmagic TLS cluster support for Redis

This plugin is based on similar plugin using Consul. Most of the aspect is also similar, I pretty much copy the crypto implementation. The reason I use Redis is because it easier to setup.

For now, this will support redis as single instance, or with replica, but NOT the cluster. This plugin utilize go-redis/redis for its client access and redislock for it's locking mechanism. See distlock for the lock algorithm.

This plugin currently work with versions of Caddy v2, for the previous version of Caddy use caddy-v1 branch.

Configuration

You enable Redis storage with Caddy by setting the storage module used, for example

{
	//all value is optional, here is the default
    storage redis {
        host          "127.0.0.1"
        port          6379
        address       "127.0.0.1:6379" // no default, but is build from host+":"+port, if set, then host and port is ignored
        username      ""
        password      ""
        db            1
        key_prefix    "caddytls"
        value_prefix  "caddy-storage-redis"
        timeout       5
        tls_enabled   "false"
        tls_insecure  "true"
        aes_key       "redistls-01234567890-caddytls-32" // optional, but must have 32 length
    }
    // because the option are set using env, there are no need for additional option value
}

:443 {

}

JSON example

{
    "admin": {
        "listen": "0.0.0.0:2019"
    },
    "storage": {
        "address": "redis:6379",
        "aes_key": "redistls-01234567890-caddytls-32",
        "db": 1,
        "host": "redis",
        "key_prefix": "caddytls",
        "module": "redis",
        "password": "",
        "port": "6379",
        "timeout": 5,
        "tls_enabled": false,
        "tls_insecure": true,
        "value_prefix": "caddy-storage-redis"
    }
}

There are additional environment variable for this plugin:

  • CADDY_CLUSTERING_REDIS_HOST defines Redis Host, default is 127.0.0.1
  • CADDY_CLUSTERING_REDIS_PORT defines Redis Port, default is 6379
  • CADDY_CLUSTERING_REDIS_USERNAME defines Redis username, default is empty
  • CADDY_CLUSTERING_REDIS_PASSWORD defines Redis password, default is empty
  • CADDY_CLUSTERING_REDIS_DB defines Redis DB, default is 0
  • CADDY_CLUSTERING_REDIS_TIMEOUT defines Redis Dial,Read,Write timeout, default is set to 5 for 5 seconds
  • CADDY_CLUSTERING_REDIS_AESKEY defines your personal AES key to use when encrypting data. It needs to be 32 characters long.
  • CADDY_CLUSTERING_REDIS_KEYPREFIX defines the prefix for the keys. Default is caddytls
  • CADDY_CLUSTERING_REDIS_VALUEPREFIX defines the prefix for the values. Default is caddy-storage-redis
  • CADDY_CLUSTERING_REDIS_TLS defines whether use Redis TLS Connection or not
  • CADDY_CLUSTERING_REDIS_TLS_INSECURE defines whether verify Redis TLS Connection or not

TODO

  • Add Redis Cluster or Sentinel support (probably need to update the distlock implementation first)

最近版本更新:(数据更新于 2024-08-29 18:09:31)

2023-11-06 11:58:27 v0.3.1

2023-10-25 08:37:12 v0.3.0

2022-04-27 08:58:56 v0.2.9

2022-03-10 06:38:21 v0.2.8

2021-09-02 09:36:18 v0.2.7

2021-01-28 10:57:22 v0.2.6

2020-12-13 05:12:54 v0.2.5

2020-10-16 10:56:34 v0.2.4

2020-10-13 05:36:04 v0.2.3

2020-06-16 07:47:41 v0.2.2

gamalan/caddy-tlsredis同语言 Go最近更新仓库

2024-11-21 22:49:20 containerd/containerd

2024-11-21 13:50:50 XTLS/Xray-core

2024-11-21 07:36:18 kubernetes/kubernetes

2024-11-21 06:27:30 ollama/ollama

2024-11-21 05:17:55 Melkeydev/go-blueprint

2024-11-21 04:04:03 dolthub/dolt