Skip to content

Simple allow app inbound #27

Description

@Cacsjep

Hey

First thank for these module, could u help me I just want to allow inbound traffic for my app.
It returns no error but i dont see the rule in the firewall gui inbound rules.

A short hint or help would be cool thanks

func AddAppFirewallRule() error {
	session, err := wf.New(&wf.Options{
		Name:    "nvmr session",
		Dynamic: false,
	})
	if err != nil {
		return err
	}
	defer session.Close()
	guid, _ := windows.GenerateGUID()
	execPath, _ := os.Executable()
	appID, _ := wf.AppID(execPath)
	err = session.AddRule(&wf.Rule{
		ID:     wf.RuleID(guid),
		Name:   "NVRM",
		Layer:  wf.LayerALEAuthRecvAcceptV4,
		Weight: 800,
		Conditions: []*wf.Match{
			{
				Field: wf.FieldALEAppID,
				Op:    wf.MatchTypeEqual,
				Value: appID,
			},
		},
		Action: wf.ActionPermit,
	})

	if err != nil {
		return err
	}
	return nil
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions