-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
49 lines (39 loc) · 1.53 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env groovy
// Define Variables
def NEXPOSE_ENDPOINT
def EXCEPTIONS_LIST_URL
def ASSET_IP
def SITE_NAME
node {
checkout scm
// ------------------------------- Set Variables ------------------------------------------------
NEXPOSE_ENDPOINT = "18.222.122.198"
// EXCEPTIONS_LIST_URL = "https://gist.github.com/abdelsfane/9dab45201be6f8e7a942a27ac48ffaf1"
ASSET_IP = "3.17.145.188"
SITE_NAME = "Nexpose_Runner_${BUILD_NUMBER}"
// ------------------------------- Use Jenkins Credential Store ------------------------------------------------
withCredentials([
[
$class : 'UsernamePasswordMultiBinding',
credentialsId : 'NEXPOSE_CREDS',
passwordVariable: 'PASSWORD',
usernameVariable: 'USERNAME'
]]){
// -------------------------------------------------------------------------------------------------------------
withEnv(['HOME=.']) {
env.NEXPOSE_ENDPOINT = NEXPOSE_ENDPOINT
env.EXCEPTIONS_LIST_URL = EXCEPTIONS_LIST_URL
env.ASSET_IP = ASSET_IP
env.SITE_NAME = SITE_NAME
// ------------------------------- Scan Stage ------------------------------------------------------------------
stage("Run Nexpose Scan") {
sh '''
scan --connection ${NEXPOSE_ENDPOINT} --exceptions_list_url Exclusions.txt --username ${USERNAME} --password ${PASSWORD} --port 3780 --site-name ${SITE_NAME} --ip-addresses ${ASSET_IP} --scan-template full-audit
'''
}
stage("Cleaning Worksapce") {
cleanWs()
}
}
}
}