forked from gane5hvarma/panther
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom certificate CFN resource (#857)
- Loading branch information
Austin Byers
authored
May 8, 2020
1 parent
669d6d0
commit 21c1623
Showing
22 changed files
with
573 additions
and
384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package main | ||
|
||
/** | ||
* Panther is a Cloud-Native SIEM for the Modern Security Team. | ||
* Copyright (C) 2020 Panther Labs Inc | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/aws/aws-lambda-go/cfn" | ||
"github.com/aws/aws-lambda-go/lambda" | ||
"go.uber.org/zap" | ||
|
||
"github.com/panther-labs/panther/internal/core/custom_resources/resources" | ||
"github.com/panther-labs/panther/pkg/lambdalogger" | ||
) | ||
|
||
// Returns physicalResourceID and outputs | ||
func customResourceHandler(ctx context.Context, event cfn.Event) (string, map[string]interface{}, error) { | ||
_, logger := lambdalogger.ConfigureGlobal(ctx, map[string]interface{}{ | ||
"requestType": event.RequestType, | ||
"resourceType": event.ResourceType, | ||
"physicalResourceId": event.PhysicalResourceID, | ||
}) | ||
logger.Info("received custom resource request", zap.Any("event", event)) | ||
|
||
handler, ok := resources.CustomResources[event.ResourceType] | ||
if !ok { | ||
return "", nil, fmt.Errorf("unsupported resource type: %s", event.ResourceType) | ||
} | ||
|
||
return handler(ctx, event) | ||
} | ||
|
||
func main() { | ||
lambda.Start(cfn.LambdaWrap(customResourceHandler)) | ||
} |
Oops, something went wrong.