File tree 3 files changed +64
-0
lines changed
3 files changed +64
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ DYNHOST=$1
4
+ DYNHOST=${DYNHOST: 0: 28}
5
+ DYNIP=$( host $DYNHOST | grep -iE " [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | cut -f4 -d' ' | head -n 1)
6
+
7
+ # Exit if invalid IP address is returned
8
+ case $DYNIP in
9
+ 0.0.0.0 )
10
+ exit 1 ;;
11
+ 255.255.255.255 )
12
+ exit 1 ;;
13
+ esac
14
+
15
+ # Exit if IP address not in proper format
16
+ if ! [[ $DYNIP =~ (( [0 - 9 ]| [1 - 9 ][0 - 9 ]| 1 [0 - 9 ]{2 }| 2 [0 - 4 ][0 - 9 ]| 25 [0 - 5 ])\.){3 }([0 - 9 ]| [1 - 9 ][0 - 9 ]| 1 [0 - 9 ]{2 }| 2 [0 - 4 ][0 - 9 ]| 25 [0 - 5 ]) ]]; then
17
+ exit 1
18
+ fi
19
+
20
+ # If chain for remote doesn't exist, create it
21
+ if ! /sbin/iptables -L $DYNHOST -n >/dev/null 2 >&1 ; then
22
+ /sbin/iptables -N $DYNHOST >/dev/null 2 >&1
23
+ fi
24
+
25
+ # Check IP address to see if the chain matches first; skip rest of script if update is not needed
26
+ if ! /sbin/iptables -n -L $DYNHOST | grep -iE " $DYNIP " >/dev/null 2 >&1 ; then
27
+
28
+ # Flush old rules, and add new
29
+ /sbin/iptables -F $DYNHOST >/dev/null 2 >&1
30
+ /sbin/iptables -I $DYNHOST -s $DYNIP -j ACCEPT
31
+
32
+ # Add chain to INPUT filter if it doesn't exist
33
+ if ! /sbin/iptables -C INPUT -t filter -j $DYNHOST >/dev/null 2 >&1 ; then
34
+ /sbin/iptables -t filter -I INPUT -j $DYNHOST
35
+ fi
36
+
37
+ fi
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Make a new user and group, node.
4
+ getent group node || groupadd node
5
+ id -u node & > /dev/null || useradd node -g node
6
+ # Put the current user in the node group.
7
+ usermod -aG node austin
8
+ # Own node application folder.
9
+ mkdir -p /var/opt/node
10
+ chown -R node:node /var/opt/node
11
+ chmod -R 775 /var/opt/
12
+ # Own global NPM modules.
13
+ mkdir -p /var/local/lib/node_modules
14
+ chown -R node:node /usr/local/lib/node_modules
15
+ chmod -R 775 /usr/local/lib/node_modules
16
+ # Own NVM folder.
17
+ mkdir -p /usr/local/nvm
18
+ chown -R node:node /usr/local/nvm
19
+ chmod -R 775 /usr/local/nvm
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Install NVM
3
+ NVM_VERSION=0.33.1
4
+ NODE_VERSION=6.10.2
5
+ NVM_DIR=/usr/local/nvm
6
+ touch $HOME /.profile
7
+ curl -o- https://raw.githubusercontent.com/creationix/nvm/v$NVM_VERSION /install.sh | bash
8
+ npm install pm2
You can’t perform that action at this time.
0 commit comments