Skip to content

Commit

Permalink
new: --redis-command parameter to specify ACL protected command
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Oct 30, 2023
1 parent 6bc3e28 commit 12c35f9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/plugins/redis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub(crate) struct Redis {
host: String,
port: u16,
ssl: bool,
command: String,
}

impl Redis {
Expand All @@ -28,6 +29,7 @@ impl Redis {
host: String::new(),
port: 6379,
ssl: false,
command: String::new(),
}
}
}
Expand All @@ -41,6 +43,7 @@ impl Plugin for Redis {
fn setup(&mut self, opts: &Options) -> Result<(), Error> {
(self.host, self.port) = utils::parse_target(opts.target.as_ref(), 6379)?;
self.ssl = opts.redis.redis_ssl;
self.command = opts.redis.redis_command.to_owned();

Ok(())
}
Expand All @@ -62,7 +65,7 @@ impl Plugin for Redis {
.map_err(|e| e.to_string())?
.map_err(|e| e.to_string())?;

redis::cmd("PING")
redis::cmd(&self.command)
.query_async(&mut conn)
.await
.map_err(|e| e.to_string())?;
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/redis/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ pub(crate) struct Options {
#[clap(long, default_value_t = false)]
/// Enable SSL for Redis.
pub redis_ssl: bool,
#[clap(long, default_value = "PING")]
/// Redis command to execute in order to test ACL.
pub redis_command: String,
}
Empty file modified test-servers/redis.sh
100644 → 100755
Empty file.

0 comments on commit 12c35f9

Please sign in to comment.