-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathso-elastic-airgap-save
executable file
·69 lines (56 loc) · 1.34 KB
/
so-elastic-airgap-save
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
DIR="."
REPO="securityonionsolutions"
DESTINATION=""
#########################################
# Options
#########################################
usage()
{
cat <<EOF
Security Onion Docker Airgap Save
Options:
-h This message
-d Specify destination directory
EOF
}
#########################################
# Call functions
#########################################
# Check to see if the user provided a destination directory for the Docker images.
while getopts "hd:y:" OPTION
do
case $OPTION in
h)
usage
exit 0
;;
d)
DESTINATION="$OPTARG"
;;
esac
done
if [ "$DESTINATION" != "" ]; then
DIR=$DESTINATION
fi
# Create a directory for our Docker images
if [ -d $DIR/images ]; then
:
else
mkdir $DIR/images
fi
DIR="$DIR/images"
# Save Docker images to destination directory
echo "Saving Docker images to $DIR..."
if [ -d $DIR/images.tar ]; then
:
else
tar cvf $DIR/images.tar --files-from /dev/null
fi
# Pull down docker images and save to .tar files
for i in so-elasticsearch so-kibana so-logstash so-elastalert so-freqserver so-domainstats so-curator; do
docker pull --disable-content-trust=false $REPO/$i
docker save $REPO/$i > $DIR/$i.tar
tar -rvf $DIR/images.tar $DIR/$i.tar
rm -f $DIR/$i.tar
done