mirror of
https://github.com/morten-olsen/homelab-nuclei-operator.git
synced 2026-02-08 02:16:23 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6969f13fa7 | ||
|
|
7c014b9898 | ||
|
|
707f0dcaad |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -87,7 +87,7 @@ jobs:
|
|||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
# platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ USER 65532:65532
|
|||||||
|
|
||||||
# Environment variables for nuclei
|
# Environment variables for nuclei
|
||||||
ENV NUCLEI_TEMPLATES_PATH=/nuclei-templates
|
ENV NUCLEI_TEMPLATES_PATH=/nuclei-templates
|
||||||
|
ENV NUCLEI_BINARY_PATH=/usr/local/bin/nuclei
|
||||||
ENV HOME=/home/nonroot
|
ENV HOME=/home/nonroot
|
||||||
|
|
||||||
ENTRYPOINT ["/manager"]
|
ENTRYPOINT ["/manager"]
|
||||||
|
|||||||
@@ -122,13 +122,23 @@ func (s *NucleiScanner) Scan(ctx context.Context, targets []string, options Scan
|
|||||||
logger.Info("Targets file created", "targetsFile", targetsFile, "targetCount", len(targets))
|
logger.Info("Targets file created", "targetsFile", targetsFile, "targetCount", len(targets))
|
||||||
|
|
||||||
// Check if nuclei binary exists and is executable
|
// Check if nuclei binary exists and is executable
|
||||||
|
// First try the exact path
|
||||||
if _, err := os.Stat(s.nucleiBinaryPath); os.IsNotExist(err) {
|
if _, err := os.Stat(s.nucleiBinaryPath); os.IsNotExist(err) {
|
||||||
return nil, fmt.Errorf("nuclei binary not found at %s", s.nucleiBinaryPath)
|
// If not found at exact path, try to find it in PATH
|
||||||
|
if path, err := exec.LookPath(s.nucleiBinaryPath); err == nil {
|
||||||
|
logger.Info("Found nuclei binary in PATH", "path", path, "originalPath", s.nucleiBinaryPath)
|
||||||
|
s.nucleiBinaryPath = path
|
||||||
|
} else {
|
||||||
|
return nil, fmt.Errorf("nuclei binary not found at %s and not in PATH: %w", s.nucleiBinaryPath, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify nuclei is executable
|
// Verify nuclei is executable by running version command
|
||||||
if err := exec.Command(s.nucleiBinaryPath, "-version").Run(); err != nil {
|
if err := exec.Command(s.nucleiBinaryPath, "-version").Run(); err != nil {
|
||||||
logger.Error(err, "Failed to execute nuclei -version, nuclei may not be properly installed")
|
logger.Error(err, "Failed to execute nuclei -version, nuclei may not be properly installed", "path", s.nucleiBinaryPath)
|
||||||
|
// Don't fail here, just log - the actual scan will fail if nuclei is truly broken
|
||||||
|
} else {
|
||||||
|
logger.Info("Nuclei binary verified", "path", s.nucleiBinaryPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check templates availability if templates path is set
|
// Check templates availability if templates path is set
|
||||||
|
|||||||
Reference in New Issue
Block a user