-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpecificationINSTALL.txt
186 lines (133 loc) · 7.44 KB
/
SpecificationINSTALL.txt
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
Specification: INSTALL
Assumptions for install:
OS: CentOS 6.6 Working DNS server that allows hostname resolution on the local network You will secure the program installation (Permissions 755 by default)
Program is installed for the same user on all machines (with sudo).
All machines are on the same local network.
To deploy project:
Download the "host_installer" folder and place in the HOME DIRECTORY of your server
To automate the installation, CD into "host_installer" and run "host_install.sh"
Once the installation completes a new folder should appear in "host_installer" called "client_installer"
You should now be able to view the web dashboard by navigating to the address below on your server: http://localhost/template.html
Take this folder and place it in the HOME DIRECTORY of any client machine you wish to add
CD into "client_installer" and run "client_install.sh" completing any required prompts
Refresh the web dashboard and you should see your new client machinein the monitored list.
Upon refreshing the web dashboard on the server you should see your new client machine and be able to see packages that needs updating.
***The description below explains what the automated host/client installation scripts do step by step.***
The INSTALL should provide instructions on how to set up an environment for your project from scratch.
At a minumum, it should include:
1. A description of what OS(es) to use and which package(s) to install, how.
For example, yum install <list of packages>
OS:
CentOS 6.x minimal install
List of packages to be installed on host machine:
yum -y install nmap
yum -y install httpd
yum -y install perl
yum -y install openssh-clients
yum -y install openssh-server
yum -y install gcc
yum -y install php-devel
yum -y install php-pear
yum -y install libssh2
yum -y install libssh2-devel
yum -y install make
List of packages to be installed on client machines:
yum -y install nmap
yum -y install perl
yum -y install openssh-clients
yum -y install openssh-server
2. A description of any configuration file modifications that need to be made
for the project to operate properly.
#1.Host: Modify html configuration file as appropriate
sed -i "s/#ServerName www.example.com:80/#ServerName www.example.com:80\n\nServerName localhost:80/g" /etc/httpd/conf/httpd.conf
3. A list of any commands that need to be run in order to make the project work.
For example, generating SSH keys for remote computer access.
#1.Host:Install ssh2 extension for php
yes '' | pecl install -f ssh2
touch /etc/php.d/ssh2.ini
echo extension=ssh2.so > /etc/php.d/ssh2.ini
#2.Need to generate ssh keys for the authentication between client and host machines:
1) Create SSH directory and set permissions for all client and master machines
mkdir ~/.ssh
chmod 700 ~/.ssh
2) Host: Generate SSH keys to appropriate location for master machines
host_id=`hostname`
host_ip=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
ssh-keygen -q -f "$host_id" -N ""
mv ./$host_id ~/.ssh
mv ./$host_id.pub ~/.ssh
3) Copy public key to use in client installer
mkdir ./host/client_gen/client/keys
cp ~/.ssh/$host_id.pub ./host/client_gen/client/keys
4) Client: Generate SSH keys to appropriate location for client machines
client_ip=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
client_id=`hostname`
replacement_string="$client_id\": [\n\t\t\"$client_ip\"\n\t],\n\t\"comment"
ssh-keygen -q -f "$client_id" -N ""
mv ./$client_id ~/.ssh
mv ./$client_id.pub ~/.ssh
#3.Make and move the necessary directories and scripts
Host:
mkdir /var/www/html/sccm
chmod -R 777 /var/www/html/sccm
Client:
mkdir /etc/sccm
chmod -R 777 /etc/sccm
Host:Install web interface to appropriate location
cp -a ./host/web_interface/* /var/www/html
chmod -R 755 /var/www/html
Host:Copy program files
mkdir /var/www/html/sccm
cp -a ./host/program_files/* /var/www/html/sccm
chmod -R 755 /var/www/html/sccm
#4.Host: Add host machine IP and hostname to required areas in client scripts
sed -i "s/GENERATED_HOST_IP/$host_ip/g" ./host/client_gen/client_install.sh
sed -i "s/GENERATED_HOST_ID/$host_id/g" ./host/client_gen/client_install.sh
sed -i "s/GENERATED_HOST_ID/$host_id/g" ./host/client_gen/client/program_files/*
#5. Host: Copy public key to use in client installer
mkdir ./host/client_gen/client/keys
cp ~/.ssh/$host_id.pub ./host/client_gen/client/keys
#6. Host: Create and populate client installer directory
mkdir ./client_installer
cp -a ./host/client_gen/* ./client_installer
A new folder should appear in "host_installer" called "client_installer"
Take this folder and place it in the HOME DIRECTORY of any client machine you wish to add
#7. Client:Copy program files
mkdir /etc/sccm
cp -a ./client/program_files/* /etc/sccm
chmod -R 755 /etc/sccm
#8. Client: Allow hostname resolution client -> host (Only needed if no DNS)
echo GENERATED_HOST_IP GENERATED_HOST_ID >> /etc/hosts
Set up client -> host connection
cat ~/.ssh/$client_id.pub | ssh root@GENERATED_HOST_ID "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
#9. Client: Allow hostname resolution host -> client (Only needed if no DNS)
ssh root@GENERATED_HOST_ID -t -i ~/.ssh/$client_id "echo $client_ip $client_id >> /etc/hosts"
#10.Client: Set up host -> client connection and add client to list of monitored machines
cat ./client/keys/*.pub >> ~/.ssh/authorized_keys
ssh root@GENERATED_HOST_ID -t -i ~/.ssh/$client_id "ssh root@$client_id -t -i ~/.ssh/GENERATED_HOST_ID "exit""
#11.Client: Add client to list of monitored clients on host machine
scp -i ~/.ssh/$client_id root@GENERATED_HOST_ID:/var/www/html/sccm/clients.json .
sed -i "s/"comment"/$replacement_string/g" ./clients.json
scp -i ~/.ssh/$client_id ./clients.json root@GENERATED_HOST_ID:/var/www/html/sccm/clients.json
#12.Client: Add Get Logdata to cron on local machine
crontab -l > mycron || true
echo "* * * * * /etc/sccm/getlogdata.pl" >> mycron
echo "* * * * * /etc/sccm/getpkgdata.pl" >> mycron
crontab mycron
rm mycron
#13.Client: Do first run of scripts so we have some data
/etc/sccm/getlogdata.pl
/etc/sccm/getpkgdata.pl
#14.Host: Start apache and configure to run automatically at boot for host
service httpd start
chkconfig httpd on
4. If there are any further steps (for example, either downloading or compiling
code, or setting up a user to access the administrative webpage for the project),
a description of those steps.
#1. Host: Need to download the 'host_installer' from:
https://github.com/badavis/183Project
5. A description of how the user who set up the project will know that it's
working correctly.
You should now be able to view the web dashboard by navigating to the address below on your server: http://localhost/template.html
You can add any arbituary number of client machines by moving "client_installer" into those machines and running "client_install.sh".
There should be a table entry for each added client, and the corresponding options to update, rollback, remove packages on these machines.