add unplug command
This commit is contained in:
parent
eb3ea156a6
commit
ac0d310c92
|
@ -2,6 +2,8 @@ changelog
|
||||||
|
|
||||||
-- next
|
-- next
|
||||||
|
|
||||||
|
+ Add unplug command for servers that have dropped off the net.
|
||||||
|
|
||||||
+ Add notes field to honkers to document their downfall.
|
+ Add notes field to honkers to document their downfall.
|
||||||
|
|
||||||
+ Add notes field to filters for record keeping.
|
+ Add notes field to filters for record keeping.
|
||||||
|
|
|
@ -133,6 +133,12 @@ file which is important to backup and restore.
|
||||||
The current version of the honk binary may be printed with the
|
The current version of the honk binary may be printed with the
|
||||||
.Ic version
|
.Ic version
|
||||||
command.
|
command.
|
||||||
|
.Ss unplug
|
||||||
|
Sometimes servers simply disappear, resulting in many errors trying to deliver
|
||||||
|
undeliverable messages.
|
||||||
|
Running
|
||||||
|
.Ic unplug Ar hostname
|
||||||
|
will delete all subscriptions and pending deliveries.
|
||||||
.Ss Security
|
.Ss Security
|
||||||
.Nm
|
.Nm
|
||||||
is not currently hardened against SSRF, server side request forgery.
|
is not currently hardened against SSRF, server side request forgery.
|
||||||
|
|
14
honk.go
14
honk.go
|
@ -210,6 +210,13 @@ var loginMsg template.HTML
|
||||||
func ElaborateUnitTests() {
|
func ElaborateUnitTests() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func unplugserver(hostname string) {
|
||||||
|
db := opendatabase()
|
||||||
|
xid := fmt.Sprintf("%%https://%s/%%", hostname)
|
||||||
|
db.Exec("delete from honkers where xid like ? and flavor = 'dub'", xid)
|
||||||
|
db.Exec("delete from doovers where rcpt like ?", xid)
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.StringVar(&dataDir, "datadir", dataDir, "data directory")
|
flag.StringVar(&dataDir, "datadir", dataDir, "data directory")
|
||||||
flag.StringVar(&viewDir, "viewdir", viewDir, "view directory")
|
flag.StringVar(&viewDir, "viewdir", viewDir, "view directory")
|
||||||
|
@ -271,6 +278,13 @@ func main() {
|
||||||
arg = args[1]
|
arg = args[1]
|
||||||
}
|
}
|
||||||
cleanupdb(arg)
|
cleanupdb(arg)
|
||||||
|
case "unplug":
|
||||||
|
if len(args) < 2 {
|
||||||
|
fmt.Printf("usage: honk unplug servername\n")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
name := args[1]
|
||||||
|
unplugserver(name)
|
||||||
case "ping":
|
case "ping":
|
||||||
if len(args) < 3 {
|
if len(args) < 3 {
|
||||||
fmt.Printf("usage: honk ping from to\n")
|
fmt.Printf("usage: honk ping from to\n")
|
||||||
|
|
Loading…
Reference in New Issue