Add a warning when run by root.

v0.10
Martin Dosch 2 months ago
parent 606ca8cc18
commit 1574e2f4df
No known key found for this signature in database
GPG Key ID: 52A57CFCE13D657D

@ -1,6 +1,8 @@
# Changelog
## UNRELEASED
### Added
- Add a warning when run by the user *root*.
## [v0.9.0] 2024-03-28
### Changed

@ -15,6 +15,7 @@ import (
"net"
"os"
"os/signal"
osUser "os/user"
"runtime"
"strings"
"time"
@ -171,6 +172,19 @@ func main() {
log.Fatal("Can't use message type headline for groupchat messages.")
}
// Get the current user.
currUser, err := osUser.Current()
if err != nil {
log.Fatal("Failed to get current user: ", err)
}
if currUser.Username == "root" {
fmt.Println("WARNING: It seems you are running go-sendxmpp as root user.\n" +
"This is is not recommended as go-sendxmpp does not require root " +
"privileges. Please consider using a less privileged user. For an " +
"example how to do this with sudo please consult the manpage chapter " +
"TIPS.")
}
switch *flagSCRAMPinning {
case "", "SCRAM-SHA-1", "SCRAM-SHA-1-PLUS", "SCRAM-SHA-256", "SCRAM-SHA-256-PLUS",
"SCRAM-SHA-512", "SCRAM-SHA-512-PLUS":

Loading…
Cancel
Save