-
-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathss-perms-ufw-config.txt
88 lines (66 loc) · 4.66 KB
/
ss-perms-ufw-config.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
#!/bin/bash
####################################################################################################
#### author: SlickStack ############################################################################
#### link: https://slickstack.io ###################################################################
#### mirror: https://mirrors.slickstack.io/bash/ss-perms-ufw-config.txt ############################
#### path: /var/www/ss-perms-ufw-config ############################################################
#### destination: n/a (not a boilerplate) ##########################################################
#### purpose: Resets file and user permissions for UFW module configuration files ##################
#### module version: UFW 0.36 ######################################################################
#### sourced by: ss-perms, ss-install-ufw ##########################################################
#### bash aliases: ss perms ufw ####################################################################
####################################################################################################
## source ss-config ##
source /var/www/ss-config
## source ss-functions ##
source /var/www/ss-functions
## BELOW THIS RELIES ON SS-CONFIG AND SS-FUNCTIONS
####################################################################################################
#### TABLE OF CONTENTS (SS-Perms-UFW-Config) #######################################################
####################################################################################################
## this is a brief summary of the different code snippets you will find in this script ##
## each section should be commented so you understand what is being accomplished ##
## A. Touch Timestamp File
## B. Message (Begin Script)
####################################################################################################
#### A. SS-Perms-UFW-Config: Touch Timestamp File ##################################################
####################################################################################################
## this is a dummy timestamp file that will remember the last time this script was run ##
## it can be useful for developer reference and is sometimes used by SlickStack ##
ss_touch "${TIMESTAMP_SS_PERMS_UFW_CONFIG}"
####################################################################################################
#### B. SS-Perms-UFW-Config: Message (Begin Script) ################################################
####################################################################################################
## this is a simple message that announces to the shell the purpose of this bash script ##
## it will only be seen by sudo users who manually run this script in the shell ##
ss_echo "${COLOR_INFO}Running ss-perms-ufw-config... ${COLOR_RESET}"
####################################################################################################
#### SS-Perms-UFW-Config: Reset Permissions (UFW Config) ###########################################
####################################################################################################
chown root:root /etc/default/ufw
chown root:root /etc/ufw/ufw.conf
chown root:root /etc/ufw/user.rules
chown root:root /etc/ufw/user6.rules
chmod 0664 /etc/default/ufw
chmod 0664 /etc/ufw/ufw.conf
chmod 0664 /etc/ufw/user.rules
chmod 0664 /etc/ufw/user6.rules
####################################################################################################
#### SlickStack: Reset Permissions (SlickStack Scripts) ############################################
####################################################################################################
## we include this permissions reset in all cron jobs and bash scripts for redundancy ##
## chmod 0700 means only the root/sudo users can execute any SlickStack scripts ##
## THIS SNIPPET DOES NOT RELY ON SS-CONFIG OR SS-FUNCTIONS
## SNIPPET: ss bash scripts, ss cron jobs
## UPDATED: 02JUL2022
chown root:root /var/www/ss* ## must be root:root
chown root:root /var/www/crons/*cron* ## must be root:root
chown root:root /var/www/crons/custom/*cron* ## must be root:root
chmod 0700 /var/www/ss* ## 0700 means only root/sudo can execute
chmod 0700 /var/www/crons/*cron* ## 0700 means only root/sudo can execute
chmod 0700 /var/www/crons/custom/*cron* ## 0700 means only root/sudo can execute
####################################################################################################
#### SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ###############
####################################################################################################
## Ref:
## SS_EOF