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
|
#!/bin/sh -e
CONFIGFILE=/etc/default/wflogs
. /usr/share/debconf/confmodule
if [ -e $CONFIGFILE ]; then
. $CONFIGFILE || true
db_set wflogs/report_generate $REPORT_GENERATE
db_set wflogs/email_send $EMAIL_SEND
db_set wflogs/email_address $EMAIL_ADDRESS
db_set wflogs/email_configuration $EMAIL_CONFIGURATION
db_set wflogs/input_file $INPUT_FILE
db_set wflogs/input_type $INPUT_TYPE
db_set wflogs/report_output_type $REPORT_OUTPUT_TYPE
db_set wflogs/report_permissions $REPORT_PERMISSIONS
db_set wflogs/report_obfuscate $REPORT_OBFUSCATE
db_set wflogs/email_obfuscate $EMAIL_OBFUSCATE
db_set wflogs/report_sort $REPORT_SORT
db_set wflogs/email_sort $EMAIL_SORT
db_set wflogs/report_sort_options $REPORT_SORT_OPTIONS
db_set wflogs/email_sort_options $EMAIL_SORT_OPTIONS
db_set wflogs/report_output_summary $REPORT_OUTPUT_SUMMARY
db_set wflogs/email_output_summary $EMAIL_OUTPUT_SUMMARY
db_set wflogs/report_output_whois $REPORT_OUTPUT_WHOIS
db_set wflogs/email_output_whois $EMAIL_OUTPUT_WHOIS
db_set wflogs/report_output_mac_vendor $REPORT_OUTPUT_MAC_VENDOR
db_set wflogs/email_output_mac_vendor $EMAIL_OUTPUT_MAC_VENDOR
db_set wflogs/report_output_mac $REPORT_OUTPUT_MAC
db_set wflogs/email_output_mac $EMAIL_OUTPUT_MAC
db_set wflogs/report_output_src_mac $REPORT_OUTPUT_SRC_MAC
db_set wflogs/email_output_src_mac $EMAIL_OUTPUT_SRC_MAC
db_set wflogs/report_output_duration $REPORT_OUTPUT_DURATION
db_set wflogs/email_output_duration $EMAIL_OUTPUT_DURATION
fi
output_non_log() {
db_input low wflogs/"$1"_output_whois || true
db_go
}
output_non_log_or_xml() {
db_input low wflogs/"$1"_output_duration || true
db_go
db_input low wflogs/"$1"_output_mac || true
db_go
}
get_config() {
db_input low wflogs/"$1"_obfuscate || true
db_go
db_input low wflogs/"$1"_sort || true
db_go
db_get wflogs/"$1"_sort || true; SORT=$RET
if [ "$SORT" = "Yes custom order" ]; then
db_input low wflogs/"$1"_sort_options || true
db_go
fi
db_input low wflogs/"$1"_output_summary ||true
db_go
if [ "$1" = "report" ]; then
case "$REPORT_OUTPUT_TYPE" in
html|text|human|xml)
output_non_log "$1"
if [ "$REPORT_OUTPUT_TYPE" != "xml" ]; then
output_non_log_or_xml "report"
fi
db_input low wflogs/report_output_mac_vendor || true
db_go
;;
esac
else
output_non_log "email"
output_non_log_or_xml "email"
db_input low wflogs/email_output_mac_vendor || true
db_go
fi
}
EMAIL_SEND="false"
REPORT_GENERATE="true"
db_input medium wflogs/report_generate || true
db_go
db_get wflogs/report_generate || true; REPORT_GENERATE=$RET
db_go
db_input medium wflogs/email_send || true
db_go
db_get wflogs/email_send || true; EMAIL_SEND=$RET
db_go
if [ "$EMAIL_SEND" = "true" -a "$REPORT_GENERATE" = "true" ]; then
db_input high wflogs/presentation || true
db_go
fi
if [ "$EMAIL_SEND" = "true" ]; then
# Ask for an address if we want mail.
db_input medium wflogs/email_address || true
db_go
fi
if [ "$EMAIL_SEND" = "true" -o "$REPORT_GENERATE" = "true" ]; then
db_input medium wflogs/input_file ||true
db_go
db_input medium wflogs/input_type ||true
db_go
fi
if [ "$REPORT_GENERATE" = "true" ]; then
db_input high wflogs/report_output_type ||true
db_go
db_get wflogs/report_output_type || true; REPORT_OUTPUT_TYPE=$RET
db_go
if [ "$REPORT_OUTPUT_TYPE" = "html" -o "$REPORT_OUTPUT_TYPE" = "xml" ]; then
db_input high wflogs/report_permissions ||true
db_go
fi
get_config "report"
fi
if [ "$EMAIL_SEND" = "true" -a "$REPORT_GENERATE" = "true" ]; then
db_input low wflogs/email_configuration || true
db_go
db_get wflogs/email_configuration ||true; EMAIL_CONFIGURATION=$RET
if [ "$EMAIL_CONFIGURATION" = "true" ]; then
if [ "$REPORT_OUTPUT_TYPE" != "html" -a "$REPORT_OUTPUT_TYPE" != "text" -a "$REPORT_OUTPUT_TYPE" != "human" ]; then
db_input low wflogs/email_more_questions || true
db_go
fi
db_get wflogs/report_obfuscate || true; REPORT_OBFUSCATE=$RET
db_get wflogs/report_sort || true; REPORT_SORT=$RET
db_get wflogs/report_sort_options || true; REPORT_SORT_OPTIONS=$RET
db_get wflogs/report_output_summary || true; REPORT_OUTPUT_SUMMARY=$RET
db_set wflogs/email_obfuscate $REPORT_OBFUSCATE
db_set wflogs/email_sort $REPORT_SORT
db_set wflogs/email_sort_options $REPORT_SORT_OPTIONS
db_set wflogs/email_output_summary $REPORT_OUTPUT_SUMMARY
db_fset wflogs/email_obfuscate seen true
db_fset wflogs/email_sort seen true
db_fset wflogs/email_sort_options seen true
db_fset wflogs/email_output_summary seen true
if [ "$REPORT_OUTPUT_TYPE" != "netfilter" -a "$REPORT_OUTPUT_TYPE" != "ipchains" -a "$REPORT_OUTPUT_TYPE" != "ipfilter" ]; then
db_get wflogs/report_output_whois || true; REPORT_OUTPUT_WHOIS=$RET
db_get wflogs/report_output_mac_vendor || true; REPORT_OUTPUT_MAC_VENDOR=$RET
db_set wflogs/email_output_whois $REPORT_OUTPUT_WHOIS
db_set wflogs/email_output_mac_vendor $REPORT_OUTPUT_MAC_VENDOR
db_fset wflogs/email_output_whois seen true
db_fset wflogs/email_output_mac_vendor seen true
if [ "$REPORT_OUTPUT_TYPE" != "xml" ]; then
db_get wflogs/report_output_duration || true; REPORT_OUTPUT_DURATION=$RET
db_get wflogs/report_output_mac || true; REPORT_OUTPUT_MAC=$RET
db_set wflogs/email_output_duration $REPORT_OUTPUT_DURATION
db_set wflogs/email_output_mac $REPORT_OUTPUT_MAC
db_fset wflogs/email_output_duration seen true
db_fset wflogs/email_output_mac seen true
else
output_non_log_or_xml "email"
fi
else
output_non_log "email"
output_non_log_or_xml "email"
db_input low wflogs/email_output_mac_vendor || true
db_go
fi
else
get_config "email"
fi
fi
if [ "$EMAIL_SEND" = "true" -a "$REPORT_GENERATE" = "false" ]; then
get_config "email"
fi
|