|
@@ -108,6 +108,95 @@ function any_key {
|
108
|
108
|
read -n1 -r -p $"Press any key to continue..." key
|
109
|
109
|
}
|
110
|
110
|
|
|
111
|
+function passwords_select_user {
|
|
112
|
+ SELECTED_USERNAME=
|
|
113
|
+
|
|
114
|
+ users_array=($(ls /home))
|
|
115
|
+
|
|
116
|
+ delete=(mirrors git)
|
|
117
|
+ for del in ${delete[@]}
|
|
118
|
+ do
|
|
119
|
+ users_array=(${users_array[@]/$del})
|
|
120
|
+ done
|
|
121
|
+
|
|
122
|
+ i=0
|
|
123
|
+ W=()
|
|
124
|
+ name=()
|
|
125
|
+ for u in ${users_array[@]}
|
|
126
|
+ do
|
|
127
|
+ if [[ $(is_valid_user "$u") == "1" ]]; then
|
|
128
|
+ i=$((i+1))
|
|
129
|
+ W+=($i "$u")
|
|
130
|
+ name+=("$u")
|
|
131
|
+ fi
|
|
132
|
+ done
|
|
133
|
+
|
|
134
|
+ if [ $i -eq 1 ]; then
|
|
135
|
+ SELECTED_USERNAME="${name[0]}"
|
|
136
|
+ else
|
|
137
|
+ user_index=$(dialog --backtitle $"Freedombone Control Panel" --title $"Select User" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3)
|
|
138
|
+
|
|
139
|
+ if [ $? -eq 0 ]; then
|
|
140
|
+ SELECTED_USERNAME="${name[$((user_index-1))]}"
|
|
141
|
+ fi
|
|
142
|
+ fi
|
|
143
|
+}
|
|
144
|
+
|
|
145
|
+function passwords_show_apps {
|
|
146
|
+ SELECTED_APP=
|
|
147
|
+ select_all_apps=$1
|
|
148
|
+ applist=""
|
|
149
|
+ n=1
|
|
150
|
+ app_index=0
|
|
151
|
+ for a in "${APPS_AVAILABLE[@]}"
|
|
152
|
+ do
|
|
153
|
+ applist="$applist $n $a off"
|
|
154
|
+ n=$[n+1]
|
|
155
|
+ app_index=$[app_index+1]
|
|
156
|
+ done
|
|
157
|
+
|
|
158
|
+ selected_app_index=$(dialog --backtitle $"Freedombone Control Panel" --title $"Select App" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3)
|
|
159
|
+
|
|
160
|
+ if [ $? -eq 0 ]; then
|
|
161
|
+ SELECTED_APP="${name[$((selected_app_index-1))]}"
|
|
162
|
+ fi
|
|
163
|
+}
|
|
164
|
+
|
|
165
|
+function view_or_change_passwords {
|
|
166
|
+ passwords_select_user
|
|
167
|
+ if [ ! $SELECTED_USER ]; then
|
|
168
|
+ return
|
|
169
|
+ fi
|
|
170
|
+ detect_installed_apps
|
|
171
|
+ passwords_show_apps
|
|
172
|
+ if [ ! $SELECTED_APP ]; then
|
|
173
|
+ return
|
|
174
|
+ fi
|
|
175
|
+
|
|
176
|
+ CURR_PASSWORD=$(${PROJECT_NAME}-pass -u ${SELECTED_USER} -a ${SELECTED_APP})
|
|
177
|
+
|
|
178
|
+ data=$(tempfile 2>/dev/null)
|
|
179
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
180
|
+ dialog --title $"View or Change Password" \
|
|
181
|
+ --backtitle $"Freedombone Control Panel" \
|
|
182
|
+ --inputbox $"${SELECTED_APP} password for ${SELECTED_USER}. Copy or change it if you wish." 8 60 "$CURR_PASSWORD" 2>$data
|
|
183
|
+ sel=$?
|
|
184
|
+ case $sel in
|
|
185
|
+ 0)
|
|
186
|
+ CURR_PASSWORD=$(<$data)
|
|
187
|
+ if [ ${#CURR_PASSWORD} -gt 8 ]; then
|
|
188
|
+ if [[ $(function_exists change_password_${SELECTED_APP}) == "1" ]]; then
|
|
189
|
+ ${PROJECT_NAME}-pass -u ${SELECTED_USER} -a ${SELECTED_APP} -p ${CURR_PASSWORD}
|
|
190
|
+ change_password_${SELECTED_APP} ${SELECTED_USER} "${CURR_PASSWORD}"
|
|
191
|
+ dialog --title $"Change password" \
|
|
192
|
+ --msgbox $"The password was changed" 6 40
|
|
193
|
+ fi
|
|
194
|
+ fi
|
|
195
|
+ ;;
|
|
196
|
+ esac
|
|
197
|
+
|
|
198
|
+}
|
|
199
|
+
|
111
|
200
|
function check_for_updates {
|
112
|
201
|
if [ ! -f /etc/cron.weekly/$UPGRADE_SCRIPT_NAME ]; then
|
113
|
202
|
dialog --title $"Check for updates" \
|
|
@@ -1809,26 +1898,27 @@ function menu_top_level {
|
1809
|
1898
|
trap "rm -f $data" 0 1 2 5 15
|
1810
|
1899
|
dialog --backtitle $"Freedombone Control Panel" \
|
1811
|
1900
|
--title $"Control Panel" \
|
1812
|
|
- --radiolist $"Choose an operation:" 27 70 20 \
|
|
1901
|
+ --radiolist $"Choose an operation:" 28 70 21 \
|
1813
|
1902
|
1 $"About this system" off \
|
1814
|
|
- 2 $"Backup and Restore" off \
|
1815
|
|
- 3 $"Show Firewall" off \
|
1816
|
|
- 4 $"Reset Tripwire" off \
|
1817
|
|
- 5 $"App Settings" off \
|
1818
|
|
- 6 $"Add/Remove Apps" off \
|
1819
|
|
- 7 $"Logging on/off" off \
|
1820
|
|
- 8 $"Ping enable/disable" off \
|
1821
|
|
- 9 $"Manage Users" off \
|
1822
|
|
- 10 $"Email Menu" off \
|
1823
|
|
- 11 $"Security Settings" off \
|
1824
|
|
- 12 $"Set the main repository (repo mirrors)" off \
|
1825
|
|
- 13 $"Change the name of this system" off \
|
1826
|
|
- 14 $"Set a static local IP address" off \
|
1827
|
|
- 15 $"Wifi menu" off \
|
1828
|
|
- 16 $"Check for updates" off \
|
1829
|
|
- 17 $"Power off the system" off \
|
1830
|
|
- 18 $"Restart the system" off \
|
1831
|
|
- 19 $"Exit" on 2> $data
|
|
1903
|
+ 2 $"Passwords" off \
|
|
1904
|
+ 3 $"Backup and Restore" off \
|
|
1905
|
+ 4 $"Show Firewall" off \
|
|
1906
|
+ 5 $"Reset Tripwire" off \
|
|
1907
|
+ 6 $"App Settings" off \
|
|
1908
|
+ 7 $"Add/Remove Apps" off \
|
|
1909
|
+ 8 $"Logging on/off" off \
|
|
1910
|
+ 9 $"Ping enable/disable" off \
|
|
1911
|
+ 10 $"Manage Users" off \
|
|
1912
|
+ 11 $"Email Menu" off \
|
|
1913
|
+ 12 $"Security Settings" off \
|
|
1914
|
+ 13 $"Set the main repository (repo mirrors)" off \
|
|
1915
|
+ 14 $"Change the name of this system" off \
|
|
1916
|
+ 15 $"Set a static local IP address" off \
|
|
1917
|
+ 16 $"Wifi menu" off \
|
|
1918
|
+ 17 $"Check for updates" off \
|
|
1919
|
+ 18 $"Power off the system" off \
|
|
1920
|
+ 19 $"Restart the system" off \
|
|
1921
|
+ 20 $"Exit" on 2> $data
|
1832
|
1922
|
sel=$?
|
1833
|
1923
|
case $sel in
|
1834
|
1924
|
1) exit 1;;
|
|
@@ -1836,24 +1926,25 @@ function menu_top_level {
|
1836
|
1926
|
esac
|
1837
|
1927
|
case $(cat $data) in
|
1838
|
1928
|
1) show_about;;
|
1839
|
|
- 2) menu_backup_restore;;
|
1840
|
|
- 3) show_firewall;;
|
1841
|
|
- 4) reset_tripwire;;
|
1842
|
|
- 5) menu_app_settings;;
|
1843
|
|
- 6) ${PROJECT_NAME}-addremove;;
|
1844
|
|
- 7) logging_on_off;;
|
1845
|
|
- 8) ping_enable_disable;;
|
1846
|
|
- 9) menu_users;;
|
1847
|
|
- 10) menu_email;;
|
1848
|
|
- 11) security_settings;;
|
1849
|
|
- 12) set_main_repo;;
|
1850
|
|
- 13) change_system_name;;
|
1851
|
|
- 14) set_static_IP;;
|
1852
|
|
- 15) menu_wifi;;
|
1853
|
|
- 16) check_for_updates;;
|
1854
|
|
- 17) shut_down_system;;
|
1855
|
|
- 18) restart_system;;
|
1856
|
|
- 19) break;;
|
|
1929
|
+ 2) view_or_change_passwords;;
|
|
1930
|
+ 3) menu_backup_restore;;
|
|
1931
|
+ 4) show_firewall;;
|
|
1932
|
+ 5) reset_tripwire;;
|
|
1933
|
+ 6) menu_app_settings;;
|
|
1934
|
+ 7) ${PROJECT_NAME}-addremove;;
|
|
1935
|
+ 8) logging_on_off;;
|
|
1936
|
+ 9) ping_enable_disable;;
|
|
1937
|
+ 10) menu_users;;
|
|
1938
|
+ 11) menu_email;;
|
|
1939
|
+ 12) security_settings;;
|
|
1940
|
+ 13) set_main_repo;;
|
|
1941
|
+ 14) change_system_name;;
|
|
1942
|
+ 15) set_static_IP;;
|
|
1943
|
+ 16) menu_wifi;;
|
|
1944
|
+ 17) check_for_updates;;
|
|
1945
|
+ 18) shut_down_system;;
|
|
1946
|
+ 19) restart_system;;
|
|
1947
|
+ 20) break;;
|
1857
|
1948
|
esac
|
1858
|
1949
|
done
|
1859
|
1950
|
}
|