-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSRV_COS_02_SMB_DEP.sh
executable file
·299 lines (255 loc) · 8.23 KB
/
SRV_COS_02_SMB_DEP.sh
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
#!/bin/bash
echo
echo ##########################
echo # Creado por: gomgardav #
echo # [ David Gómez García ] #
echo ##########################
echo
log=./srv_cos_02_salida.sal
cd ~/samba || exit
source ./00_00_VAR.sh
Menu () {
SalidaMenu=$(whiptail --title "Script 02" \
--menu "Selecciona una Opción" 13 35 5 \
1 "Actualizar" \
2 "Generar History" \
3 "Ejecutar Script" \
4 "Reiniciar" \
0 "Salir" 3>&1 1>&2 2>&3)
EstadoSalidaMenu=$?
}
EstadoSalidaMenu=0
while [ "$EstadoSalidaMenu" = 0 ]; do
Menu
Exit=no
case "$SalidaMenu" in
1 ) yum update -y && ym upgrade -y;;
2 ) HISTFILE=~/.bash_history && set -o history && history > ./srv_cos_02-history_"$(date +%F_%H-%M-%S)".his && history -c && set +o history && HISTFILE="";;
3 )
yum install -y wget acl attr gvfs gvfs-devel dbus dbus-tools dbus-glib-devel dbus-libs dbus-c++-devel quota \
nfs-utils nfs4-acl-tools #ntp ntpdate nfs-kernel-server &&
yum install -y patch python36-markdown python36-iso8601 python36-cryptography python36-pyasn1 python36-asn1crypto \
cups-devel oddjob oddjob-mkhomedir #samba-winbind samba-winbind-clients &&
# libsystemd-dev dnsutils cups cups-ipp-utils cups-bsd
cat << EOF > /etc/nsswitch.conf
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Valid entries include:
#
# nisplus Use NIS+ (NIS version 3)
# nis Use NIS (NIS version 2), also called YP
# dns Use DNS (Domain Name Service)
# files Use the local files
# db Use the local database (.db) files
# compat Use NIS on compat mode
# hesiod Use Hesiod for user lookups
# sss Use sssd (System Security Services Daemon)
# [NOTFOUND=return] Stop searching if not found so far
#
# WARNING: Running nscd with a secondary caching service like sssd may lead to
# unexpected behaviour, especially with how long entries are cached.
# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#
# Example:
#passwd: db files nisplus nis
#shadow: db files nisplus nis
#group: db files nisplus nis
passwd: files sss winbind
shadow: files sss winbind
group: files sss winbind
#initgroups: files sss
#hosts: db files nisplus nis dns
hosts: files dns wins myhostname
# Example - obey only what nisplus tells us...
#services: nisplus [NOTFOUND=return] files
#networks: nisplus [NOTFOUND=return] files
#protocols: nisplus [NOTFOUND=return] files
#rpc: nisplus [NOTFOUND=return] files
#ethers: nisplus [NOTFOUND=return] files
#netmasks: nisplus [NOTFOUND=return] files
bootparams: nisplus [NOTFOUND=return] files
ethers: files
netmasks: files
networks: files
protocols: files
rpc: files
services: files sss
netgroup: nisplus sss
publickey: nisplus
automount: files nisplus sss
aliases: files nisplus
EOF
test -f /etc/pam.d/password-auth.org && cp /etc/pam.d/password-auth /etc/pam.d/password-auth.bak || cp /etc/pam.d/password-auth /etc/pam.d/password-auth.org
#authselect select winbind with-mkhomedir --force
authconfig --enablemkhomedir --update
systemctl enable oddjobd --now
# cat << EOF > /etc/pam.d/password-auth
# #%PAM-1.0
# auth required pam_env.so
# auth sufficient pam_unix.so nullok try_first_pass
# auth requisite pam_succeed_if.so uid >= 1000 quiet_success
# auth sufficient pam_winbind.so use_first_pass
# auth required pam_deny.so
# account required pam_unix.so broken_shadow
# account sufficient pam_localuser.so
# account sufficient pam_succeed_if.so uid < 1000 quiet
# account [default=bad success=ok user_unknown=ignore] pam_winbind.so
# account required pam_permit.so
# password requisite pam_cracklib.so try_first_pass retry=3 type=
# password sufficient pam_unix.so sha512 shadow nullok try_first_pass use_authtok
# password sufficient pam_winbind.so use_authtok
# password required pam_deny.so
# session optional pam_keyinit.so revoke
# session required pam_limits.so
# session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
# session required pam_unix.so
# EOF
# dnf config-manager --set-enabled devel
# dnf config-manager --set-disabled devel
#: [[ CentOS 8 ]] ==>
# dnf -y install docbook-style-xsl gcc gdb gnutls-devel gpgme-devel jansson-devel \
# keyutils-libs-devel krb5-workstation libacl-devel libaio-devel \
# libarchive-devel libattr-devel libblkid-devel libtasn1 libtasn1-tools \
# libxml2-devel libxslt lmdb-devel openldap-devel pam-devel perl \
# perl-ExtUtils-MakeMaker perl-Parse-Yapp popt-devel python3-cryptography \
# python3-dns python3-gpg python36-devel readline-devel systemd-devel \
# tar zlib-devel \
# rpcgen libtirpc-devel rpcsvc-proto-devel acl attr \
# autoconf automake docbook-style-xsl gcc gdb jansson-devel \
# krb5-devel krb5-workstation libacl-devel libarchive-devel \
# libattr-devel libtasn1-tools libxslt lmdb-devel make openldap-devel \
# pam-devel python36-devel &&
#: [[ CentOS 7 ]] ==>
set -xueo pipefail
yum update -y
yum install -y epel-release
yum install -y yum-plugin-copr
yum copr enable -y sergiomb/SambaAD
yum update -y
yum install -y \
"@Development Tools" \
acl \
attr \
autoconf \
avahi-devel \
bind-utils \
binutils \
bison \
ccache \
chrpath \
compat-gnutls34-devel \
cups-devel \
curl \
dbus-devel \
docbook-dtds \
docbook-style-xsl \
flex \
gawk \
gcc \
gdb \
git \
glib2-devel \
glibc-common \
gpgme-devel \
gzip \
hostname \
htop \
jansson-devel \
keyutils-libs-devel \
krb5-devel \
krb5-server \
lcov \
libacl-devel \
libarchive-devel \
libattr-devel \
libblkid-devel \
libbsd-devel \
libcap-devel \
libicu-devel \
libnsl2-devel \
libpcap-devel \
libsemanage-python \
libtasn1-devel \
libtasn1-tools \
libtirpc-devel \
libunwind-devel \
libuuid-devel \
libxslt \
lmdb \
lmdb-devel \
make \
mingw64-gcc \
ncurses-devel \
openldap-devel \
pam-devel \
patch \
perl-Archive-Tar \
perl-ExtUtils-MakeMaker \
perl-JSON-Parse \
perl-Parse-Yapp \
perl-Test-Base \
perl-core \
perl-generators \
perl-interpreter \
pkgconfig \
policycoreutils-python \
popt-devel \
procps-ng \
psmisc \
python36 \
python36-cryptography \
python36-devel \
python36-dns \
python36-markdown \
python36-pyasn1 \
quota-devel \
readline-devel \
redhat-lsb \
rng-tools \
rpcgen \
rsync \
sed \
sudo \
systemd-devel \
tar \
tree \
wget \
which \
xfsprogs-devel \
yum-utils \
zlib-devel
if [ ! -f /usr/bin/python3 ]; then
ln -sf /usr/bin/python3.6 /usr/bin/python3
fi
#dnf -y autoremove
#dnf -y clean all
Enter="Enter"
while [ -n "$Enter" ]; do
echo
read -p "Pulsa Enter para Continuar..." Enter
done
HISTFILE=~/.bash_history && set -o history && history > ./srv_cos_02-history_"$(date +%F_%H-%M-%S)".his && history -c && set +o history && HISTFILE="";;
4 ) reboot; exit;;
0 ) Exit=yes; break;;
* ) echo "Error en el Script !!!";;
esac
done
clear
if [ "$Exit" = "yes" ] && [ "$EstadoSalidaMenu" = "0" ]; then
echo "Has Salido Correctamente !"
elif [ "$EstadoSalidaMenu" = "1" ]; then
echo "Has seleccionado Cancelar !"
else
echo "Ha habido un Error !!!"
fi