aboutsummaryrefslogtreecommitdiff
path: root/connector/irc
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-05-04 18:46:25 +0200
committerAlex Auvolat <alex@adnab.me>2020-05-04 18:46:25 +0200
commit73fa488402494c69acf5b82a4d101dd49ce00eef (patch)
treefd70ab2babba713520eb8033e15be8958458a2d9 /connector/irc
parentaa6c5628e9b48303826ee0fa5fbb826e2c6cf54f (diff)
downloadeasybridge-73fa488402494c69acf5b82a4d101dd49ce00eef.tar.gz
easybridge-73fa488402494c69acf5b82a4d101dd49ce00eef.zip
Add password authentication to IRC
Diffstat (limited to 'connector/irc')
-rw-r--r--connector/irc/config.go14
-rw-r--r--connector/irc/irc.go22
2 files changed, 32 insertions, 4 deletions
diff --git a/connector/irc/config.go b/connector/irc/config.go
index 0b36473..b95ea25 100644
--- a/connector/irc/config.go
+++ b/connector/irc/config.go
@@ -32,6 +32,20 @@ func init() {
IsBoolean: true,
Default: "false",
},
+ &ConfigEntry{
+ Name: "server_pass",
+ Description: "Server password (authenticate with PASS command)",
+ IsPassword: true,
+ },
+ &ConfigEntry{
+ Name: "sasl_user",
+ Description: "Username for SASL authentication",
+ },
+ &ConfigEntry{
+ Name: "sasl_pass",
+ Description: "Password for SASL authentication",
+ IsPassword: true,
+ },
},
})
}
diff --git a/connector/irc/irc.go b/connector/irc/irc.go
index bee2bca..19e73fc 100644
--- a/connector/irc/irc.go
+++ b/connector/irc/irc.go
@@ -62,11 +62,25 @@ func (irc *IRC) Configure(c Configuration) error {
return err
}
+ server_pass, _ := c.GetString("server_pass", "")
+ sasl_user, _ := c.GetString("sasl_user", "")
+ sasl_pass, _ := c.GetString("sasl_pass", "")
+
+ var sasl girc.SASLMech
+ if sasl_user != "" && sasl_pass != "" {
+ sasl = &girc.SASLPlain{
+ User: sasl_user,
+ Pass: sasl_pass,
+ }
+ }
+
client := girc.New(girc.Config{
- Server: irc.server,
- Port: port,
- Nick: irc.nick,
- User: irc.nick,
+ Server: irc.server,
+ ServerPass: server_pass,
+ Port: port,
+ Nick: irc.nick,
+ User: irc.nick,
+ SASL: sasl,
//Out: os.Stderr,
SSL: ssl,
})