Add option to specify client certificate
This commit is contained in:
parent
3267dc5f2d
commit
83e33b85bc
@ -32,6 +32,8 @@ Usage of ./mumble-discord-bridge:
|
|||||||
MUMBLE_DISABLE_TEXT, disable sending text to mumble, (default false)
|
MUMBLE_DISABLE_TEXT, disable sending text to mumble, (default false)
|
||||||
-mumble-insecure
|
-mumble-insecure
|
||||||
MUMBLE_INSECURE, mumble insecure, optional
|
MUMBLE_INSECURE, mumble insecure, optional
|
||||||
|
-mumble-certificate
|
||||||
|
MUMBLE_CERTIFICATE, mumble client certificate, optional
|
||||||
-mumble-password string
|
-mumble-password string
|
||||||
MUMBLE_PASSWORD, mumble password, optional
|
MUMBLE_PASSWORD, mumble password, optional
|
||||||
-mumble-port int
|
-mumble-port int
|
||||||
@ -93,6 +95,12 @@ Discord GID is a unique ID linked to one Discord Server, also called Guild. CID
|
|||||||
|
|
||||||
Then you can get the GID by right-clicking your server and selecting Copy-ID. Similarly the CID can be found right clicking the voice channel and selecting Copy ID.
|
Then you can get the GID by right-clicking your server and selecting Copy-ID. Similarly the CID can be found right clicking the voice channel and selecting Copy ID.
|
||||||
|
|
||||||
|
### Generating Client Certificate
|
||||||
|
|
||||||
|
If you don't have a client certificate, you can generate one with this command:
|
||||||
|
|
||||||
|
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout cert.pem -out cert.pem -subj "/CN=mumble-discord-bridge"
|
||||||
|
|
||||||
### Binary
|
### Binary
|
||||||
|
|
||||||
Prebuilt binaries are available.
|
Prebuilt binaries are available.
|
||||||
|
14
bridge.go
14
bridge.go
@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -119,6 +120,19 @@ func (b *BridgeState) startBridge() {
|
|||||||
tlsConfig.InsecureSkipVerify = true
|
tlsConfig.InsecureSkipVerify = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if b.BridgeConfig.MumbleCertificate != "" {
|
||||||
|
keyFile := ""
|
||||||
|
if keyFile == "" {
|
||||||
|
keyFile = b.BridgeConfig.MumbleCertificate
|
||||||
|
}
|
||||||
|
if certificate, err := tls.LoadX509KeyPair(b.BridgeConfig.MumbleCertificate, keyFile); err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s: %s\n", os.Args[0], err)
|
||||||
|
os.Exit(1)
|
||||||
|
} else {
|
||||||
|
tlsConfig.Certificates = append(tlsConfig.Certificates, certificate)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log.Println("Attempting to join Mumble")
|
log.Println("Attempting to join Mumble")
|
||||||
b.MumbleClient, err = gumble.DialWithDialer(new(net.Dialer), b.BridgeConfig.MumbleAddr, b.BridgeConfig.MumbleConfig, &tlsConfig)
|
b.MumbleClient, err = gumble.DialWithDialer(new(net.Dialer), b.BridgeConfig.MumbleAddr, b.BridgeConfig.MumbleConfig, &tlsConfig)
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ type BridgeConfig struct {
|
|||||||
MumbleConfig *gumble.Config
|
MumbleConfig *gumble.Config
|
||||||
MumbleAddr string
|
MumbleAddr string
|
||||||
MumbleInsecure bool
|
MumbleInsecure bool
|
||||||
|
MumbleCertificate string
|
||||||
MumbleChannel []string
|
MumbleChannel []string
|
||||||
MumbleDisableText bool
|
MumbleDisableText bool
|
||||||
Command string
|
Command string
|
||||||
|
2
main.go
2
main.go
@ -39,6 +39,7 @@ func main() {
|
|||||||
mumbleUsername := flag.String("mumble-username", lookupEnvOrString("MUMBLE_USERNAME", "Discord"), "MUMBLE_USERNAME, mumble username, (default: discord)")
|
mumbleUsername := flag.String("mumble-username", lookupEnvOrString("MUMBLE_USERNAME", "Discord"), "MUMBLE_USERNAME, mumble username, (default: discord)")
|
||||||
mumblePassword := flag.String("mumble-password", lookupEnvOrString("MUMBLE_PASSWORD", ""), "MUMBLE_PASSWORD, mumble password, optional")
|
mumblePassword := flag.String("mumble-password", lookupEnvOrString("MUMBLE_PASSWORD", ""), "MUMBLE_PASSWORD, mumble password, optional")
|
||||||
mumbleInsecure := flag.Bool("mumble-insecure", lookupEnvOrBool("MUMBLE_INSECURE", false), " MUMBLE_INSECURE, mumble insecure, optional")
|
mumbleInsecure := flag.Bool("mumble-insecure", lookupEnvOrBool("MUMBLE_INSECURE", false), " MUMBLE_INSECURE, mumble insecure, optional")
|
||||||
|
mumbleCertificate := flag.String("mumble-certificate", lookupEnvOrString("MUMBLE_CERTIFICATE", ""), "MUMBLE_CERTIFICATE, client certificate to use when connecting to the Mumble server")
|
||||||
mumbleChannel := flag.String("mumble-channel", lookupEnvOrString("MUMBLE_CHANNEL", ""), "MUMBLE_CHANNEL, mumble channel to start in, using '/' to seperate nested channels, optional")
|
mumbleChannel := flag.String("mumble-channel", lookupEnvOrString("MUMBLE_CHANNEL", ""), "MUMBLE_CHANNEL, mumble channel to start in, using '/' to seperate nested channels, optional")
|
||||||
mumbleDisableText := flag.Bool("mumble-disable-text", lookupEnvOrBool("MUMBLE_DISABLE_TEXT", false), "MUMBLE_DISABLE_TEXT, disable sending text to mumble, (default false)")
|
mumbleDisableText := flag.Bool("mumble-disable-text", lookupEnvOrBool("MUMBLE_DISABLE_TEXT", false), "MUMBLE_DISABLE_TEXT, disable sending text to mumble, (default false)")
|
||||||
discordToken := flag.String("discord-token", lookupEnvOrString("DISCORD_TOKEN", ""), "DISCORD_TOKEN, discord bot token, required")
|
discordToken := flag.String("discord-token", lookupEnvOrString("DISCORD_TOKEN", ""), "DISCORD_TOKEN, discord bot token, required")
|
||||||
@ -101,6 +102,7 @@ func main() {
|
|||||||
// MumbleConfig: config,
|
// MumbleConfig: config,
|
||||||
MumbleAddr: *mumbleAddr + ":" + strconv.Itoa(*mumblePort),
|
MumbleAddr: *mumbleAddr + ":" + strconv.Itoa(*mumblePort),
|
||||||
MumbleInsecure: *mumbleInsecure,
|
MumbleInsecure: *mumbleInsecure,
|
||||||
|
MumbleCertificate: *mumbleCertificate,
|
||||||
MumbleChannel: strings.Split(*mumbleChannel, "/"),
|
MumbleChannel: strings.Split(*mumbleChannel, "/"),
|
||||||
MumbleDisableText: *mumbleDisableText,
|
MumbleDisableText: *mumbleDisableText,
|
||||||
Command: *discordCommand,
|
Command: *discordCommand,
|
||||||
|
Loading…
Reference in New Issue
Block a user