Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.26.0 #3201

Merged
merged 8 commits into from
Nov 12, 2024
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
4 changes: 2 additions & 2 deletions controllers/ext_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
extclient.IngressGatewayID = nodeid
extclient.Network = node.Network
extclient.Tags = make(map[models.TagID]struct{})
extclient.Tags[models.TagID(fmt.Sprintf("%s.%s", extclient.Network,
models.RemoteAccessTagName))] = struct{}{}
// extclient.Tags[models.TagID(fmt.Sprintf("%s.%s", extclient.Network,
// models.RemoteAccessTagName))] = struct{}{}
// set extclient dns to ingressdns if extclient dns is not explicitly set
if (extclient.DNS == "") && (node.IngressDNS != "") {
extclient.DNS = node.IngressDNS
Expand Down
28 changes: 14 additions & 14 deletions controllers/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,26 @@ func getStatus(w http.ResponseWriter, r *http.Request) {
if servercfg.ErrLicenseValidation != nil {
licenseErr = servercfg.ErrLicenseValidation.Error()
}
var trialEndDate time.Time
var err error
isOnTrial := false
if servercfg.IsPro &&
(servercfg.GetLicenseKey() == "" || servercfg.GetNetmakerTenantID() == "") {
trialEndDate, err = logic.GetTrialEndDate()
if err != nil {
slog.Error("failed to get trial end date", "error", err)
} else {
isOnTrial = true
}
}
//var trialEndDate time.Time
//var err error
// isOnTrial := false
// if servercfg.IsPro &&
// (servercfg.GetLicenseKey() == "" || servercfg.GetNetmakerTenantID() == "") {
// trialEndDate, err = logic.GetTrialEndDate()
// if err != nil {
// slog.Error("failed to get trial end date", "error", err)
// } else {
// isOnTrial = true
// }
// }
currentServerStatus := status{
DB: database.IsConnected(),
Broker: mq.IsConnected(),
IsBrokerConnOpen: mq.IsConnectionOpen(),
LicenseError: licenseErr,
IsPro: servercfg.IsPro,
TrialEndDate: trialEndDate,
IsOnTrialLicense: isOnTrial,
//TrialEndDate: trialEndDate,
//IsOnTrialLicense: isOnTrial,
}

w.Header().Set("Content-Type", "application/json")
Expand Down
1 change: 1 addition & 0 deletions logic/extpeers.go
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ func GetStaticNodesByNetwork(network models.NetworkID, onlyWg bool) (staticNode
if err != nil {
return
}
SortExtClient(extClients[:])
for _, extI := range extClients {
if extI.Network == network.String() {
if onlyWg && extI.RemoteAccessClientID != "" {
Expand Down
10 changes: 10 additions & 0 deletions logic/peers.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N
} else if host.EndpointIPv6 != nil && peerHost.EndpointIPv6 != nil {
peerEndpoint = peerHost.EndpointIPv6
}
if host.EndpointIP == nil && peerEndpoint == nil {
if peerHost.EndpointIP != nil {
peerEndpoint = peerHost.EndpointIP
}
}
if host.EndpointIPv6 == nil && peerEndpoint == nil {
if peerHost.EndpointIPv6 != nil {
peerEndpoint = peerHost.EndpointIPv6
}
}

peerConfig.Endpoint = &net.UDPAddr{
IP: peerEndpoint,
Expand Down
12 changes: 0 additions & 12 deletions migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,6 @@ func updateNodes() {
}
}
}
extclients, _ := logic.GetAllExtClients()
for _, extclient := range extclients {
tagID := models.TagID(fmt.Sprintf("%s.%s", extclient.Network,
models.RemoteAccessTagName))
if extclient.Tags == nil {
extclient.Tags = make(map[models.TagID]struct{})
}
if _, ok := extclient.Tags[tagID]; !ok {
extclient.Tags[tagID] = struct{}{}
logic.SaveExtClient(&extclient)
}
}
}

func removeInterGw(egressRanges []string) ([]string, bool) {
Expand Down
3 changes: 2 additions & 1 deletion models/user_mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ const (
AllUserRsrcID RsrcID = "all_user"
AllDnsRsrcID RsrcID = "all_dns"
AllFailOverRsrcID RsrcID = "all_fail_over"
AllAclsRsrcID RsrcID = "all_acls"
AllAclsRsrcID RsrcID = "all_acl"
AllTagsRsrcID RsrcID = "all_tag"
)

// Pre-Defined User Roles
Expand Down
4 changes: 2 additions & 2 deletions pro/controllers/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -1006,8 +1006,8 @@ func getRemoteAccessGatewayConf(w http.ResponseWriter, r *http.Request) {
userConf.Enabled = parentNetwork.DefaultACL == "yes"
}
userConf.Tags = make(map[models.TagID]struct{})
userConf.Tags[models.TagID(fmt.Sprintf("%s.%s", userConf.Network,
models.RemoteAccessTagName))] = struct{}{}
// userConf.Tags[models.TagID(fmt.Sprintf("%s.%s", userConf.Network,
// models.RemoteAccessTagName))] = struct{}{}
if err = logic.CreateExtClient(&userConf); err != nil {
slog.Error(
"failed to create extclient",
Expand Down
60 changes: 60 additions & 0 deletions pro/logic/user_mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,36 @@ var NetworkUserAllPermissionTemplate = models.UserRolePermissionTemplate{
SelfOnly: true,
},
},
models.DnsRsrc: {
models.AllDnsRsrcID: models.RsrcPermissionScope{
Read: true,
},
},
models.AclRsrc: {
models.AllAclsRsrcID: models.RsrcPermissionScope{
Read: true,
},
},
models.EgressGwRsrc: {
models.AllEgressGwRsrcID: models.RsrcPermissionScope{
Read: true,
},
},
models.InetGwRsrc: {
models.AllInetGwRsrcID: models.RsrcPermissionScope{
Read: true,
},
},
models.RelayRsrc: {
models.AllRelayRsrcID: models.RsrcPermissionScope{
Read: true,
},
},
models.TagRsrc: {
models.AllTagsRsrcID: models.RsrcPermissionScope{
Read: true,
},
},
},
}

Expand Down Expand Up @@ -147,6 +177,36 @@ func CreateDefaultNetworkRolesAndGroups(netID models.NetworkID) {
SelfOnly: true,
},
},
models.DnsRsrc: {
models.AllDnsRsrcID: models.RsrcPermissionScope{
Read: true,
},
},
models.AclRsrc: {
models.AllAclsRsrcID: models.RsrcPermissionScope{
Read: true,
},
},
models.EgressGwRsrc: {
models.AllEgressGwRsrcID: models.RsrcPermissionScope{
Read: true,
},
},
models.InetGwRsrc: {
models.AllInetGwRsrcID: models.RsrcPermissionScope{
Read: true,
},
},
models.RelayRsrc: {
models.AllRelayRsrcID: models.RsrcPermissionScope{
Read: true,
},
},
models.TagRsrc: {
models.AllTagsRsrcID: models.RsrcPermissionScope{
Read: true,
},
},
},
}
d, _ := json.Marshal(NetworkAdminPermissionTemplate)
Expand Down