Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Tested with Go 1.25 on Linux and Windows, AMD64 and ARM
| FMSG_MAX_CONCURRENT_SEND | 1024 | Maximum number of concurrent outbound message deliveries. |
| FMSG_SKIP_DOMAIN_IP_CHECK | false | Set to "true" to skip verifying this host's external IP is in the fmsg DNS authorised IP set on startup. |
| FMSG_SKIP_AUTHORISED_IPS | false | Set to "true" to skip verifying remote hosts IP is in the fmsg DNS authorised IP set during message exchange. WARNING setting this true effectively disables sender verification. |
| FMSG_CHALLENGE_MODE | ALWAYS | When to issue an automatic CHALLENGE to the sending host. `ALWAYS` (default): always challenge. `HAS_NOT_PARTICIPATED`: challenge only when the message has no pid, or no message in the thread is from this host's domain. `NEVER`: never challenge. |
| FMSG_CHALLENGE_MODE | HAS_NOT_PARTICIPATED | When to issue an automatic CHALLENGE to the sending host. `HAS_NOT_PARTICIPATED` (default): challenge only when the message has no pid, or no message in the thread is from this host's domain. `ALWAYS`: always challenge. `NEVER`: never challenge. |



Expand Down
12 changes: 6 additions & 6 deletions cmd/fmsgd/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ var MaxMessageSize = uint32(1024 * 10)
var MaxExpandedSize = uint32(1024 * 10)
var SkipAuthorisedIPs = false
var TLSInsecureSkipVerify = false
var ChallengeMode = ChallengeModeAlways
var ChallengeMode = ChallengeModeHasNotParticipated
var DataDir = "got on startup"
var Domain = "got on startup"
var IDURI = "got on startup"
Expand Down Expand Up @@ -165,14 +165,14 @@ func buildClientTLSConfig(serverName string) *tls.Config {
}
}

// parseChallengeMode normalises FMSG_CHALLENGE_MODE. Empty defaults to ALWAYS.
// HAVE_NOT_PARTICIPATED is accepted as an alias of HAS_NOT_PARTICIPATED.
// parseChallengeMode normalises FMSG_CHALLENGE_MODE. Empty defaults to
// HAS_NOT_PARTICIPATED. HAVE_NOT_PARTICIPATED is accepted as an alias.
func parseChallengeMode(s string) (string, error) {
switch strings.ToUpper(strings.TrimSpace(s)) {
case "", ChallengeModeAlways:
return ChallengeModeAlways, nil
case ChallengeModeHasNotParticipated, "HAVE_NOT_PARTICIPATED":
case "", ChallengeModeHasNotParticipated, "HAVE_NOT_PARTICIPATED":
return ChallengeModeHasNotParticipated, nil
case ChallengeModeAlways:
return ChallengeModeAlways, nil
case ChallengeModeNever:
return ChallengeModeNever, nil
default:
Expand Down
3 changes: 2 additions & 1 deletion cmd/fmsgd/host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,13 +518,14 @@ func TestParseChallengeMode(t *testing.T) {
want string
wantErr bool
}{
{"", ChallengeModeAlways, false},
{"", ChallengeModeHasNotParticipated, false},
{"ALWAYS", ChallengeModeAlways, false},
{"always", ChallengeModeAlways, false},
{" Always ", ChallengeModeAlways, false},
{"HAS_NOT_PARTICIPATED", ChallengeModeHasNotParticipated, false},
{"has_not_participated", ChallengeModeHasNotParticipated, false},
{"HAVE_NOT_PARTICIPATED", ChallengeModeHasNotParticipated, false},
{" Has_Not_Participated ", ChallengeModeHasNotParticipated, false},
{"NEVER", ChallengeModeNever, false},
{"never", ChallengeModeNever, false},
{"SOMETIMES", "", true},
Expand Down
Loading