Skip to content

Commit

Permalink
add ssl decrypt exclude certificate entry support
Browse files Browse the repository at this point in the history
  • Loading branch information
shinmog committed Sep 26, 2022
1 parent 31ef6b0 commit e0ca6ed
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dev/ssldecrypt/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ type sdec struct {
}

type sdecEntry struct {
Name string `xml:"name,attr"`
Description string `xml:"description,omitempty"`
Exclude string `xml:"exclude"`
XMLName xml.Name `xml:"entry"`
Name string `xml:"name,attr"`
Description string `xml:"description,omitempty"`
Exclude string `xml:"exclude"`
}

func specify_v1(e Config) interface{} {
Expand Down
34 changes: 34 additions & 0 deletions dev/ssldecrypt/fw.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,40 @@ func (c *Firewall) DeleteTrustedRootCa(vsys, name string) error {
return err
}

// SetSslDecryptExcludeCertificate adds a SSL decrypt exclude certificate.
func (c *Firewall) SetSslDecryptExcludeCertificate(vsys string, e SslDecryptExcludeCertificate) error {
c.ns.Client.LogAction("(set) %s ssl decrypt exclude certificate: %s", singular, e.Name)

path, err := c.xpath(vsys)
if err != nil {
return err
}
path = append(path, "ssl-exclude-cert")

ei := sdecEntry{
Name: e.Name,
Description: e.Description,
Exclude: util.YesNo(e.Exclude),
}

_, err = c.ns.Client.Set(path, ei, nil, nil)
return err
}

// DeleteSslDecryptExcludeCertificate removes a SSL decrypt exclude certificate.
func (c *Firewall) DeleteSslDecryptExcludeCertificate(vsys, name string) error {
c.ns.Client.LogAction("(delete) %s ssl decrypt exclude certificate: %s", singular, name)

path, err := c.xpath(vsys)
if err != nil {
return err
}
path = append(path, "ssl-exclude-cert", util.AsEntryXpath([]string{name}))

_, err = c.ns.Client.Delete(path, nil, nil)
return err
}

// Get performs GET to retrieve configuration for the given object.
func (c *Firewall) Get(vsys string) (Config, error) {
ans := c.container()
Expand Down
34 changes: 34 additions & 0 deletions dev/ssldecrypt/pano.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,40 @@ func (c *Panorama) DeleteTrustedRootCa(tmpl, ts, vsys, name string) error {
return err
}

// SetSslDecryptExcludeCertificate adds a SSL decrypt exclude certificate.
func (c *Panorama) SetSslDecryptExcludeCertificate(tmpl, ts, vsys string, e SslDecryptExcludeCertificate) error {
c.ns.Client.LogAction("(set) %s ssl decrypt exclude certificate: %s", singular, e.Name)

path, err := c.xpath(tmpl, ts, vsys)
if err != nil {
return err
}
path = append(path, "ssl-exclude-cert")

ei := sdecEntry{
Name: e.Name,
Description: e.Description,
Exclude: util.YesNo(e.Exclude),
}

_, err = c.ns.Client.Set(path, ei, nil, nil)
return err
}

// DeleteSslDecryptExcludeCertificate removes a SSL decrypt exclude certificate.
func (c *Panorama) DeleteSslDecryptExcludeCertificate(tmpl, ts, vsys, name string) error {
c.ns.Client.LogAction("(delete) %s ssl decrypt exclude certificate: %s", singular, name)

path, err := c.xpath(tmpl, ts, vsys)
if err != nil {
return err
}
path = append(path, "ssl-exclude-cert", util.AsEntryXpath([]string{name}))

_, err = c.ns.Client.Delete(path, nil, nil)
return err
}

// Get performs GET to retrieve configuration for the given object.
func (c *Panorama) Get(tmpl, ts, vsys string) (Config, error) {
ans := c.container()
Expand Down

0 comments on commit e0ca6ed

Please sign in to comment.