quiet
This commit is contained in:
parent
d235c8dbe4
commit
04e18d65c7
|
@ -229,7 +229,7 @@ do
|
|||
done
|
||||
|
||||
if [ -f /etc/nginx/.htpasswd ]; then
|
||||
if ! grep "${ADD_USERNAME}:" /etc/nginx/.htpasswd; then
|
||||
if ! grep -q "${ADD_USERNAME}:" /etc/nginx/.htpasswd; then
|
||||
echo "$NEW_USER_PASSWORD" | htpasswd -i -s /etc/nginx/.htpasswd $ADD_USERNAME
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -67,7 +67,7 @@ function change_password_dokuwiki {
|
|||
new_user_password="$2"
|
||||
|
||||
DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
|
||||
if grep "$curr_username:" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php; then
|
||||
if grep -q "$curr_username:" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php; then
|
||||
HASHED_DOKUWIKI_PASSWORD=$(echo -n "$new_user_password" | md5sum | awk -F ' ' '{print $1}')
|
||||
existing_user=$(cat /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php | grep "$curr_username:" | hean -n 1)
|
||||
if [[ "$existing_user" == *":admin,"* ]]; then
|
||||
|
@ -99,7 +99,7 @@ function remove_user_dokuwiki {
|
|||
remove_username="$1"
|
||||
|
||||
read_config_param "DOKUWIKI_DOMAIN_NAME"
|
||||
if grep "$remove_username:" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php; then
|
||||
if grep -q "$remove_username:" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php; then
|
||||
sed -i "/$remove_username:/d" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
|
||||
sed -i "/$remove_username:/d" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users.auth.php
|
||||
${PROJECT_NAME}-pass -u "$remove_username" --rmapp dokuwiki
|
||||
|
|
|
@ -62,7 +62,7 @@ function change_password_etherpad {
|
|||
|
||||
read_config_param ETHERPAD_DOMAIN_NAME
|
||||
|
||||
if grep "\"$change_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
|
||||
if grep -q "\"$change_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
|
||||
user_line=$(cat /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json | grep "\"$change_username\": {")
|
||||
if [[ "$user_line" == *"\"is_admin\": true"* ]]; then
|
||||
sed -i "s|\"$change_username\": {.*|\"$change_username\": { \"hash\": \"$new_user_password\", \"is_admin\": true }|g" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
||||
|
|
|
@ -544,7 +544,7 @@ function install_irc_server {
|
|||
else
|
||||
sed -i 's|;SSLConnect.*|SSLConnect = no|g'
|
||||
# comment out the second Ports entry
|
||||
if ! grep ";Ports =" /etc/ngircd/ngircd.conf; then
|
||||
if ! grep -q ";Ports =" /etc/ngircd/ngircd.conf; then
|
||||
sed -i '0,/Ports =/! s/Ports =/;Ports =/' /etc/ngircd/ngircd.conf
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -56,19 +56,19 @@ function jitsi_disable_google_spyware {
|
|||
# an obvious security problem. This should disable it.
|
||||
sed -i "s|Google Analytics|Google Spyware deactivated|g" /usr/share/jitsi-meet/analytics.js
|
||||
sed -i "s|www.google-analytics.com|${JITSI_DOMAIN_NAME}|g" /usr/share/jitsi-meet/analytics.js
|
||||
if ! grep '//ga(' /usr/share/jitsi-meet/analytics.js; then
|
||||
if ! grep -q '//ga(' /usr/share/jitsi-meet/analytics.js; then
|
||||
sed -i 's|ga(|//ga(|g' /usr/share/jitsi-meet/analytics.js
|
||||
fi
|
||||
if ! grep '//action +' /usr/share/jitsi-meet/analytics.js; then
|
||||
if ! grep -q '//action +' /usr/share/jitsi-meet/analytics.js; then
|
||||
sed -i 's|action +|//action +|g' /usr/share/jitsi-meet/analytics.js
|
||||
fi
|
||||
|
||||
sed -i "s|Google Analytics|Google Spyware deactivated|g" /usr/share/jitsi-meet/libs/analytics.js
|
||||
sed -i "s|www.google-analytics.com|${JITSI_DOMAIN_NAME}|g" /usr/share/jitsi-meet/libs/analytics.js
|
||||
if ! grep '//ga(' /usr/share/jitsi-meet/libs/analytics.js; then
|
||||
if ! grep -q '//ga(' /usr/share/jitsi-meet/libs/analytics.js; then
|
||||
sed -i 's|ga(|//ga(|g' /usr/share/jitsi-meet/libs/analytics.js
|
||||
fi
|
||||
if ! grep '//action +' /usr/share/jitsi-meet/libs/analytics.js; then
|
||||
if ! grep -q '//action +' /usr/share/jitsi-meet/libs/analytics.js; then
|
||||
sed -i 's|action +|//action +|g' /usr/share/jitsi-meet/libs/analytics.js
|
||||
fi
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ function install_jitsi {
|
|||
remove_nodejs jitsi
|
||||
exit 638352
|
||||
fi
|
||||
if ! grep "jitsi" /etc/apt/sources.list; then
|
||||
if ! grep -q "jitsi" /etc/apt/sources.list; then
|
||||
echo "deb http://download.jitsi.org/nightly/deb ${jitsi_deb_repo}/" >> /etc/apt/sources.list
|
||||
fi
|
||||
wget -qO - https://download.jitsi.org/nightly/deb/${jitsi_deb_repo}/archive.key | apt-key add -
|
||||
|
|
|
@ -60,7 +60,7 @@ function mediagoblin_fix_email {
|
|||
echo $'Unable to fix email sending'
|
||||
exit 792532
|
||||
fi
|
||||
if ! grep 'import os' $mgfile; then
|
||||
if ! grep -q 'import os' $mgfile; then
|
||||
sed -i '/import sys/a import os' $mgfile
|
||||
fi
|
||||
sed -i "s|return mhost.sendmail(from_addr, to_addrs, message.as_string())|return os.system(\"echo '\" + message_body + \"' \| mail -s '\" + message['Subject'] + \"' \" + message['To'])|g" $mgfile
|
||||
|
@ -481,7 +481,7 @@ function install_mediagoblin {
|
|||
|
||||
sed -i 's|allow_reporting.*|allow_reporting = false|g' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
|
||||
|
||||
if ! grep '[[[skip_transcode]]]' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini; then
|
||||
if ! grep -q '[[[skip_transcode]]]' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini; then
|
||||
echo '[[[skip_transcode]]]' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
|
||||
echo 'mime_types = video/webm, video/ogg, video/mp4, audio/ogg, application/ogg, application/x-annodex' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
|
||||
echo 'container_formats = Matroska, Ogg, ISO MP4/M4A' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
|
||||
|
|
|
@ -950,7 +950,7 @@ function install_searx {
|
|||
echo '}' >> /etc/nginx/sites-available/searx
|
||||
|
||||
# replace the secret key
|
||||
if ! grep "searx key" $COMPLETION_FILE; then
|
||||
if ! grep -q "searx key" $COMPLETION_FILE; then
|
||||
SEARX_SECRET_KEY="$(create_password 30)"
|
||||
set_completion_param "searx key" "${SEARX_SECRET_KEY}"
|
||||
fi
|
||||
|
|
|
@ -90,7 +90,7 @@ function install_interactive_turtl {
|
|||
}
|
||||
|
||||
function turtl_disable_registrations {
|
||||
if grep "$TURTL_SIGNUP_STRING" $turtl_users_file; then
|
||||
if grep -q "$TURTL_SIGNUP_STRING" $turtl_users_file; then
|
||||
if [ -f $turtl_users_file ]; then
|
||||
cp $turtl_users_file $TURTL_BASE_DIR/.users.lisp
|
||||
sed -i '/(route (:post "\/users") (req res)/,/(send-json res user))))/{//!d}' $turtl_users_file
|
||||
|
@ -102,7 +102,7 @@ function turtl_disable_registrations {
|
|||
}
|
||||
|
||||
function turtl_enable_registrations {
|
||||
if ! grep "$TURTL_SIGNUP_STRING" $turtl_users_file; then
|
||||
if ! grep -q "$TURTL_SIGNUP_STRING" $turtl_users_file; then
|
||||
if [ -f $TURTL_BASE_DIR/.users.lisp ]; then
|
||||
cp $TURTL_BASE_DIR/.users.lisp $turtl_users_file
|
||||
rm $TURTL_BASE_DIR/.users.lisp
|
||||
|
|
|
@ -334,7 +334,7 @@ function update_prosody_modules {
|
|||
fi
|
||||
|
||||
# change to using pep rather than profile modules
|
||||
if grep '"pep"' /etc/prosody/prosody.cfg.lua; then
|
||||
if grep -q '"pep"' /etc/prosody/prosody.cfg.lua; then
|
||||
# This strange dance seems to fix occasional breakage of PEP
|
||||
# Is there a better solution?
|
||||
sed -i 's|"pep"|"profile"|g' /etc/prosody/prosody.cfg.lua
|
||||
|
@ -343,7 +343,7 @@ function update_prosody_modules {
|
|||
sed -i 's|"profile"|"pep"|g' /etc/prosody/prosody.cfg.lua
|
||||
systemctl restart prosody
|
||||
fi
|
||||
if ! grep '"vcard"' /etc/prosody/prosody.cfg.lua; then
|
||||
if ! grep -q '"vcard"' /etc/prosody/prosody.cfg.lua; then
|
||||
systemctl stop prosody
|
||||
sed -i '/"pep"/a "vcard";' /etc/prosody/prosody.cfg.lua
|
||||
systemctl start prosody
|
||||
|
|
|
@ -1359,7 +1359,7 @@ function configure_imap {
|
|||
fi
|
||||
|
||||
# Separate logging, otherwise syslog is used
|
||||
if ! grep "# logging" /etc/dovecot/dovecot.conf; then
|
||||
if ! grep -q "# logging" /etc/dovecot/dovecot.conf; then
|
||||
echo '' >> /etc/dovecot/dovecot.conf
|
||||
echo '# logging' >> /etc/dovecot/dovecot.conf
|
||||
echo 'log_path = /var/log/dovecot.log' >> /etc/dovecot/dovecot.conf
|
||||
|
|
|
@ -1797,14 +1797,14 @@ function email_smtp_proxy {
|
|||
|
||||
# change muttrc
|
||||
if [ $SMTP_PROXY_ENABLE != $'no' ]; then
|
||||
if ! grep "set smtp_url" $MUTTRC_FILE; then
|
||||
if ! grep -q "set smtp_url" $MUTTRC_FILE; then
|
||||
echo "set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"" >> $MUTTRC_FILE
|
||||
else
|
||||
sed -i "s|set smtp_url=.*|set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"|g" $MUTTRC_FILE
|
||||
fi
|
||||
sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
|
||||
else
|
||||
if grep "set smtp_url" $MUTTRC_FILE; then
|
||||
if grep -q "set smtp_url" $MUTTRC_FILE; then
|
||||
sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -623,7 +623,7 @@ function smtp_proxy {
|
|||
fi
|
||||
sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
|
||||
else
|
||||
if grep "set smtp_url" $MUTTRC_FILE; then
|
||||
if grep -q "set smtp_url" $MUTTRC_FILE; then
|
||||
sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -1146,14 +1146,14 @@ function image_setup_utils {
|
|||
chroot "$rootdir" cd /root/build/tomb && make install
|
||||
echo "tomb commit:$TOMB_COMMIT" >> $rootdir/root/freedombone-completed.txt
|
||||
|
||||
if ! grep '* hard maxsyslogins' $rootdir/etc/security/limits.conf; then
|
||||
if ! grep -q '* hard maxsyslogins' $rootdir/etc/security/limits.conf; then
|
||||
echo '* hard maxsyslogins 10' >> $rootdir/etc/security/limits.conf
|
||||
else
|
||||
sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' $rootdir/etc/security/limits.conf
|
||||
fi
|
||||
|
||||
# Max logins for each user
|
||||
if ! grep '* hard maxlogins' $rootdir/etc/security/limits.conf; then
|
||||
if ! grep -q '* hard maxlogins' $rootdir/etc/security/limits.conf; then
|
||||
echo '* hard maxlogins 2' >> $rootdir/etc/security/limits.conf
|
||||
else
|
||||
sed -i 's|hard maxlogins.*|hard maxlogins 2|g' $rootdir/etc/security/limits.conf
|
||||
|
|
|
@ -118,7 +118,7 @@ function create_ram_disk {
|
|||
|
||||
function make_root_read_only {
|
||||
if [ ! -d /home/$MY_USERNAME/Desktop ]; then
|
||||
if ! grep 'ro,subvol=@' /etc/fstab; then
|
||||
if ! grep -q 'ro,subvol=@' /etc/fstab; then
|
||||
sed -i 's|subvol=@|ro,subvol=@|g' /etc/fstab
|
||||
echo $'Root filesystem set to read only' >> $INSTALL_LOG
|
||||
fi
|
||||
|
|
|
@ -106,7 +106,7 @@ else
|
|||
fi
|
||||
|
||||
if [ -f /etc/nginx/.htpasswd ]; then
|
||||
if grep "${REMOVE_USERNAME}:" /etc/nginx/.htpasswd; then
|
||||
if grep -q "${REMOVE_USERNAME}:" /etc/nginx/.htpasswd; then
|
||||
htpasswd -D /etc/nginx/.htpasswd $REMOVE_USERNAME
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -566,7 +566,7 @@ function create_letsencrypt {
|
|||
if [ ! -d /var/www/${new_domain} ]; then
|
||||
domain_found=
|
||||
if [ -f /etc/nginx/sites-available/radicale ]; then
|
||||
if grep "${new_domain}" /etc/nginx/sites-available/radicale; then
|
||||
if grep -q "${new_domain}" /etc/nginx/sites-available/radicale; then
|
||||
domain_found=1
|
||||
fi
|
||||
fi
|
||||
|
@ -856,12 +856,12 @@ function remove_tor_bridge {
|
|||
if [ ${#response} -gt 2 ]; then
|
||||
if [[ "${response}" != *" "* ]]; then
|
||||
if [[ "${response}" == *"."* ]]; then
|
||||
if grep "Bridge ${response}" /etc/tor/torrc; then
|
||||
if grep -q "Bridge ${response}" /etc/tor/torrc; then
|
||||
tor_remove_bridge "${response}"
|
||||
bridge_removed=1
|
||||
fi
|
||||
else
|
||||
if grep " $response" /etc/tor/torrc; then
|
||||
if grep -q " $response" /etc/tor/torrc; then
|
||||
tor_remove_bridge "${response}"
|
||||
bridge_removed=1
|
||||
fi
|
||||
|
|
|
@ -64,7 +64,7 @@ if [ $DEVELOPMENT_BRANCH ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if grep "cat /root/dbpass" /usr/bin/backupdatabases; then
|
||||
if grep -q "cat /root/dbpass" /usr/bin/backupdatabases; then
|
||||
# update to using the password manager
|
||||
sed -i "s|cat /root/dbpass|freedombone-pass -u root -a mariadb|g" /usr/bin/backupdatabases
|
||||
fi
|
||||
|
|
|
@ -467,7 +467,7 @@ function firewall_block_domain {
|
|||
# Don't try to block email/microblog addresses
|
||||
return
|
||||
fi
|
||||
if ! grep "$blocked_domain" $FIREWALL_DOMAINS; then
|
||||
if ! grep -q "$blocked_domain" $FIREWALL_DOMAINS; then
|
||||
hexstr=$(domain_to_hex_string $blocked_domain)
|
||||
iptables -C INPUT -p udp --dport 53 -m string --hex-string "$hexstr" --algo bm -j DROP
|
||||
if [ ! "$?" = "0" ]; then
|
||||
|
@ -503,7 +503,7 @@ function firewall_refresh_blocklist {
|
|||
|
||||
function firewall_unblock_domain {
|
||||
unblocked_domain="$1"
|
||||
if grep "${unblocked_domain}" $FIREWALL_DOMAINS; then
|
||||
if grep -q "${unblocked_domain}" $FIREWALL_DOMAINS; then
|
||||
hexstr=$(domain_to_hex_string $unblocked_domain)
|
||||
iptables -D INPUT -p udp --dport 53 -m string --hex-string "$hexstr" --algo bm -j DROP
|
||||
iptables -D INPUT -p tcp --dport 53 -m string --hex-string "$hexstr" --algo bm -j DROP
|
||||
|
|
|
@ -259,14 +259,14 @@ function enable_email_encryption_at_rest {
|
|||
for d in /home/*/ ; do
|
||||
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
||||
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
|
||||
if grep '#| /usr/bin/gpgit.pl' /home/$USERNAME/.procmailrc; then
|
||||
if grep -q '#| /usr/bin/gpgit.pl' /home/$USERNAME/.procmailrc; then
|
||||
sed -i 's@#| /usr/bin/gpgit.pl@| /usr/bin/gpgit.pl@g' /home/$USERNAME/.procmailrc
|
||||
sed -i 's|#:0 f|:0 f|g' /home/$USERNAME/.procmailrc
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if grep '#| /usr/bin/gpgit.pl' /etc/skel/.procmailrc; then
|
||||
if grep -q '#| /usr/bin/gpgit.pl' /etc/skel/.procmailrc; then
|
||||
sed -i 's@#| /usr/bin/gpgit.pl@| /usr/bin/gpgit.pl@g' /etc/skel/.procmailrc
|
||||
sed -i 's|#:0 f|:0 f|g' /etc/skel/.procmailrc
|
||||
fi
|
||||
|
@ -276,14 +276,14 @@ function disable_email_encryption_at_rest {
|
|||
for d in /home/*/ ; do
|
||||
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
||||
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
|
||||
if ! grep '#| /usr/bin/gpgit.pl' /home/$USERNAME/.procmailrc; then
|
||||
if ! grep -q '#| /usr/bin/gpgit.pl' /home/$USERNAME/.procmailrc; then
|
||||
sed -i 's@| /usr/bin/gpgit.pl@#| /usr/bin/gpgit.pl@g' /home/$USERNAME/.procmailrc
|
||||
sed -i 's|:0 f|#:0 f|g' /home/$USERNAME/.procmailrc
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if ! grep '#| /usr/bin/gpgit.pl' /etc/skel/.procmailrc; then
|
||||
if ! grep -q '#| /usr/bin/gpgit.pl' /etc/skel/.procmailrc; then
|
||||
sed -i 's@| /usr/bin/gpgit.pl@#| /usr/bin/gpgit.pl@g' /etc/skel/.procmailrc
|
||||
sed -i 's|:0 f|#:0 f|g' /etc/skel/.procmailrc
|
||||
fi
|
||||
|
|
|
@ -88,7 +88,7 @@ function remove_nodejs {
|
|||
return
|
||||
fi
|
||||
sed -i "/install_${1}/d" $NODEJS_INSTALLED_APPS_FILE
|
||||
if ! grep "install_" $NODEJS_INSTALLED_APPS_FILE; then
|
||||
if ! grep -q "install_" $NODEJS_INSTALLED_APPS_FILE; then
|
||||
apt-get -yq remove --purge nodejs
|
||||
|
||||
if [ -f /usr/bin/nodejs ]; then
|
||||
|
@ -211,7 +211,7 @@ function install_nodejs {
|
|||
fi
|
||||
|
||||
if [ $1 ]; then
|
||||
if ! grep "install_${1}" $NODEJS_INSTALLED_APPS_FILE; then
|
||||
if ! grep -q "install_${1}" $NODEJS_INSTALLED_APPS_FILE; then
|
||||
echo "install_${1}" >> $NODEJS_INSTALLED_APPS_FILE
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -299,7 +299,7 @@ function resolve_dns_via_tor {
|
|||
fi
|
||||
|
||||
# resolve DNS via tor
|
||||
if ! grep 'DNSPort 53' /etc/tor/torrc; then
|
||||
if ! grep -q 'DNSPort 53' /etc/tor/torrc; then
|
||||
echo 'DNSPort 53' >> /etc/tor/torrc
|
||||
echo 'AutomapHostsOnResolve 1' >> /etc/tor/torrc
|
||||
echo 'AutomapHostsSuffixes .exit,.onion' >> /etc/tor/torrc
|
||||
|
|
|
@ -139,19 +139,19 @@ function remove_bluetooth {
|
|||
rmmod -f bnep
|
||||
rmmod -f bluetooth
|
||||
if [ -f /etc/default/bluetooth ]; then
|
||||
if grep "BLUETOOTH_ENABLED=" /etc/default/bluetooth; then
|
||||
if grep -q "BLUETOOTH_ENABLED=" /etc/default/bluetooth; then
|
||||
sed -i 's|BLUETOOTH_ENABLED=.*|BLUETOOTH_ENABLED=0|g' /etc/default/bluetooth
|
||||
else
|
||||
echo "BLUETOOTH_ENABLED=0" >> /etc/default/bluetooth
|
||||
fi
|
||||
fi
|
||||
if ! grep 'blacklist bnep' /etc/modprobe.d/bluetooth.conf; then
|
||||
if ! grep -q 'blacklist bnep' /etc/modprobe.d/bluetooth.conf; then
|
||||
echo 'blacklist bnep' >> /etc/modprobe.d/bluetooth.conf
|
||||
fi
|
||||
if ! grep 'blacklist btusb' /etc/modprobe.d/bluetooth.conf; then
|
||||
if ! grep -q 'blacklist btusb' /etc/modprobe.d/bluetooth.conf; then
|
||||
echo 'blacklist btusb' >> /etc/modprobe.d/bluetooth.conf
|
||||
fi
|
||||
if ! grep 'blacklist bluetooth' /etc/modprobe.d/bluetooth.conf; then
|
||||
if ! grep -q 'blacklist bluetooth' /etc/modprobe.d/bluetooth.conf; then
|
||||
echo 'blacklist bluetooth' >> /etc/modprobe.d/bluetooth.conf
|
||||
fi
|
||||
update-initramfs -u -k `uname -r` -v
|
||||
|
@ -430,13 +430,13 @@ function set_shadow_permissions {
|
|||
function set_max_login_tries {
|
||||
max_tries=$1
|
||||
|
||||
if ! grep ' deny=' /etc/pam.d/common-auth; then
|
||||
if ! grep -q ' deny=' /etc/pam.d/common-auth; then
|
||||
sed -i "/pam_deny.so/a auth required\t\t\tpam_tally.so onerr=fail no_lock_time per_user deny=$max_tries" /etc/pam.d/common-auth
|
||||
else
|
||||
sed -i "s| deny=.*| deny=$max_tries|g" /etc/pam.d/common-auth
|
||||
fi
|
||||
|
||||
if ! grep ' deny=' /etc/pam.d/common-account; then
|
||||
if ! grep -q ' deny=' /etc/pam.d/common-account; then
|
||||
sed -i '/pam_deny.so/a account required\t\t\tpam_tally.so' /etc/pam.d/common-account
|
||||
else
|
||||
sed -i "s| deny=.*| deny=$max_tries|g" /etc/pam.d/common-account
|
||||
|
@ -445,14 +445,14 @@ function set_max_login_tries {
|
|||
|
||||
function limit_user_logins {
|
||||
# overall max logins
|
||||
if ! grep '* hard maxsyslogins' /etc/security/limits.conf; then
|
||||
if ! grep -q '* hard maxsyslogins' /etc/security/limits.conf; then
|
||||
echo '* hard maxsyslogins 10' >> /etc/security/limits.conf
|
||||
else
|
||||
sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' /etc/security/limits.conf
|
||||
fi
|
||||
|
||||
# Max logins for each user
|
||||
if ! grep '* hard maxlogins' /etc/security/limits.conf; then
|
||||
if ! grep -q '* hard maxlogins' /etc/security/limits.conf; then
|
||||
echo '* hard maxlogins 2' >> /etc/security/limits.conf
|
||||
else
|
||||
sed -i 's|hard maxlogins.*|hard maxlogins 2|g' /etc/security/limits.conf
|
||||
|
@ -460,7 +460,7 @@ function limit_user_logins {
|
|||
}
|
||||
|
||||
function remove_serial_logins {
|
||||
if grep 'ttyS' /etc/securetty; then
|
||||
if grep -q 'ttyS' /etc/securetty; then
|
||||
cp /etc/securetty /etc/securetty_old
|
||||
sed -i '/ttyS/d' /etc/securetty
|
||||
fi
|
||||
|
@ -581,7 +581,7 @@ function lockdown_permissions {
|
|||
}
|
||||
|
||||
function disable_core_dumps {
|
||||
if ! grep '* hard core 0' /etc/security/limits.conf; then
|
||||
if ! grep -q '* hard core 0' /etc/security/limits.conf; then
|
||||
echo '* hard core 0' >> /etc/security/limits.conf
|
||||
else
|
||||
sed -i 's|hard core.*|hard core 0|g' /etc/security/limits.conf
|
||||
|
|
Loading…
Reference in New Issue