Function name is an array

This commit is contained in:
Bob Mottram 2018-02-25 12:50:46 +00:00
parent ad8d266452
commit 443d7a7913
45 changed files with 233 additions and 231 deletions

View File

@ -53,7 +53,7 @@ function install_interactive_batman {
}
function configure_firewall_for_batman {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $ENABLE_BATMAN != "yes" ]]; then
@ -62,7 +62,7 @@ function configure_firewall_for_batman {
function_check save_firewall_settings
save_firewall_settings
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function reconfigure_batman {

View File

@ -84,7 +84,7 @@ function upgrade_dlna {
}
function configure_firewall_for_dlna {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
@ -111,7 +111,7 @@ function configure_firewall_for_dlna {
systemctl restart avahi-daemon
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function backup_local_dlna {
@ -253,7 +253,7 @@ function install_dlna_main {
}
function script_for_attaching_usb_drive {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
echo '#!/bin/bash' > /usr/bin/attach-music
@ -289,7 +289,7 @@ function script_for_attaching_usb_drive {
echo 'exit 0' >> /usr/bin/remove-music
chmod +x /usr/bin/remove-music
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function install_dlna {

View File

@ -205,7 +205,7 @@ function remove_ipfs {
}
function configure_firewall_for_ipfs {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $ONION_ONLY != "no" ]]; then
@ -213,11 +213,11 @@ function configure_firewall_for_ipfs {
fi
firewall_add IPFS $IPFS_PORT tcp
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function mesh_install_ipfs_js {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -287,7 +287,7 @@ EOF
chroot ${rootdir} systemctl enable ${IPFS_DAEMON_NAME}
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function install_ipfs_js {

View File

@ -481,7 +481,7 @@ function configure_firewall_for_irc {
if [ ! -d /etc/ngircd ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ ${INSTALLED_WITHIN_DOCKER} == "yes" ]]; then

View File

@ -102,7 +102,7 @@ function configure_firewall_for_keyserver {
firewall_add keyserver 11370 tcp
firewall_add keyserver 11371 tcp
firewall_add keyserver 11372 tcp
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function keyserver_reset_database {

View File

@ -225,14 +225,14 @@ function remove_mumble {
}
function configure_firewall_for_mumble {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $ONION_ONLY != "no" ]]; then
return
fi
firewall_add Mumble ${MUMBLE_PORT}
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function install_mumble {

View File

@ -604,7 +604,7 @@ function install_rss_gnusocial {
set_repo_commit $RSS_READER_GNUSOCIAL_PATH "rss reader gnusocial commit" "$RSS_READER_GNUSOCIAL_COMMIT" $RSS_READER_GNUSOCIAL_REPO
chown -R www-data:www-data $RSS_READER_GNUSOCIAL_PATH
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -648,7 +648,7 @@ function install_rss_mobile_reader {
fi
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi

View File

@ -512,12 +512,12 @@ function remove_syncthing {
}
function configure_firewall_for_syncthing {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
firewall_add Syncthing ${SYNCTHING_PORT}
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function install_syncthing_repo {

View File

@ -318,7 +318,7 @@ function remove_tox {
function configure_firewall_for_tox {
if [ ! $INSTALLING_MESH ]; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
fi
@ -341,11 +341,11 @@ function configure_firewall_for_tox {
fi
firewall_add Tox ${TOX_PORT}
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function tox_avahi {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -387,7 +387,7 @@ function tox_avahi {
systemctl restart avahi-daemon
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function install_tox_node {

View File

@ -573,7 +573,7 @@ function configure_firewall_for_xmpp {
if [ ! -d /etc/prosody ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
@ -588,7 +588,7 @@ function configure_firewall_for_xmpp {
firewall_add XMPP 5269 tcp
firewall_add XMPP 5280 tcp
firewall_add XMPP 5281 tcp
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function remove_xmpp {

View File

@ -140,13 +140,13 @@ function remove_zeronet {
}
function configure_firewall_for_zeronet {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
firewall_add ZeroNet ${ZERONET_PORT}
firewall_add Tracker ${TRACKER_PORT}
firewall_add Tracker 1900 udp
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function install_zeronet_blog {

View File

@ -120,7 +120,7 @@ function email_create_template {
}
function configure_email_onion {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $SYSTEM_TYPE == "mesh"* ]]; then
@ -150,7 +150,7 @@ function configure_email_onion {
set_completion_param "email onion domain" "${onion_address}"
add_email_hostname "$onion_address"
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function check_email_address_exists {
@ -207,7 +207,7 @@ function encrypt_incoming_email {
function_check set_repo_commit
set_repo_commit $INSTALL_DIR/gpgit "gpgit commit" "$GPGIT_COMMIT" $GPGIT_REPO
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -237,7 +237,7 @@ function encrypt_incoming_email {
echo -n '| /usr/bin/gpgit.pl --encrypt-mode prefer-inline --inline-flatten $USER@' >> /etc/skel/.procmailrc
echo "$DEFAULT_DOMAIN_NAME" >> /etc/skel/.procmailrc
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function encrypt_outgoing_email {
@ -247,7 +247,7 @@ function encrypt_outgoing_email {
if [ ! -d /etc/exim4 ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $GPG_ENCRYPT_STORED_EMAIL != "yes" ]]; then
@ -287,7 +287,7 @@ function encrypt_outgoing_email {
sed -i "s|set pgp_encrypt_sign_command.*|set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --trust-model always --encrypt-to $MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$MY_USERNAME/.muttrc
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function encrypt_all_email {
@ -320,7 +320,7 @@ function encrypt_all_email {
fi
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -343,14 +343,14 @@ function encrypt_all_email {
chmod 600 /home/$MY_USERNAME/README
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function email_client {
if [ ! -d /etc/exim4 ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
apt-get -yq install lynx abook urlview mutt
@ -475,7 +475,7 @@ function email_client {
chown ${GENERIC_IMAGE_USERNAME}:${GENERIC_IMAGE_USERNAME} /home/${GENERIC_IMAGE_USERNAME}/.mutt-alias
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function email_archiving {
@ -519,7 +519,7 @@ function email_archiving {
function_check set_repo_commit
set_repo_commit $INSTALL_DIR/cleanup-maildir "cleanup-maildir commit" "$CLEANUP_MAILDIR_COMMIT" $CLEANUP_MAILDIR_REPO
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -543,12 +543,12 @@ function email_archiving {
fi
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# Ensure that the from field is correct when sending email from Mutt
function email_from_address {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -561,14 +561,14 @@ function email_from_address {
echo "set from='$MY_NAME <$MY_EMAIL_ADDRESS>'" >> /home/$MY_USERNAME/.muttrc
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function create_public_mailing_list {
if [ ! -d /etc/exim4 ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [ ! $PUBLIC_MAILING_LIST ]; then
@ -658,14 +658,14 @@ function create_public_mailing_list {
${PROJECT_NAME}-addlist -u $MY_USERNAME -l "$PUBLIC_MAILING_LIST" -s "$PUBLIC_MAILING_LIST"
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function create_private_mailing_list {
if [ ! -d /etc/exim4 ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [ ! $PRIVATE_MAILING_LIST ]; then
@ -720,7 +720,7 @@ function create_private_mailing_list {
chmod 0000 /etc/shadow
chmod 0000 /etc/gshadow
#exim -d -bt $PRIVATE_MAILING_LIST@$DEFAULT_DOMAIN_NAME
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function split_gpg_key_into_fragments {
@ -753,7 +753,7 @@ function import_email {
Now on your internet router forward ports
25, 587, 465, 993 and 2222 to the ${PROJECT_NAME}
"
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
if [[ $SYSTEM_TYPE == "mail"* ]]; then
function_check backup_to_friends_servers
backup_to_friends_servers
@ -776,7 +776,7 @@ function import_email {
fi
return
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
if [[ $SYSTEM_TYPE == "mail"* ]]; then
function_check backup_to_friends_servers
backup_to_friends_servers
@ -886,7 +886,7 @@ function create_procmail {
if [ ! -d /etc/exim4 ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [ ! -f /home/$MY_USERNAME/.procmailrc ]; then
@ -924,7 +924,7 @@ function create_procmail {
chmod 6755 /usr/bin/procmail
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function handle_admin_emails {
@ -940,7 +940,7 @@ function spam_filtering {
if [ ! -d /etc/exim4 ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
apt-get -yq install exim4-daemon-heavy
@ -1109,14 +1109,14 @@ function spam_filtering {
function_check cron_add_mins
cron_add_mins 10 "$script_name 2> /dev/null"
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function configure_imap {
if [ ! -d /etc/exim4 ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -1213,14 +1213,14 @@ function configure_imap {
fi
systemctl restart dovecot
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function configure_imap_client_certs {
if [ ! -d /etc/exim4 ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
# http://strange.systems/certificate-based-auth-with-dovecot-sendmail/
@ -1295,7 +1295,7 @@ function configure_imap_client_certs {
echo 0001 > /etc/ssl/sslserial
#${PROJECT_NAME}-clientcert -u $MY_USERNAME
systemctl restart dovecot
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function create_gpg_subkey {
@ -1303,7 +1303,7 @@ function create_gpg_subkey {
if [ ! -d /etc/exim4 ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
apt-get -yq install gnupg
@ -1336,7 +1336,7 @@ function create_gpg_subkey {
MY_GPG_SUBKEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_EMAIL_ADDRESS")
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function gpg_key_exists {
@ -1362,7 +1362,7 @@ function configure_gpg {
if [ ! -d /etc/exim4 ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
apt-get -yq install gnupg dirmngr
@ -1395,7 +1395,7 @@ function configure_gpg {
if [ -d /home/$MY_USERNAME/.gnupg/crls.d ]; then
chmod +x /home/$MY_USERNAME/.gnupg/crls.d
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
return
fi
fi
@ -1481,7 +1481,7 @@ function configure_gpg {
fi
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function refresh_gpg_keys {
@ -1525,7 +1525,7 @@ function install_email {
if [[ $SYSTEM_TYPE == "mesh"* ]]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -1533,7 +1533,7 @@ function install_email {
install_email_basic
configure_email_onion
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately no exit 0

View File

@ -49,7 +49,7 @@ function remove_tripwire {
}
function install_tripwire {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -146,7 +146,7 @@ function install_tripwire {
' | twadmin --create-polfile -S /etc/tripwire/${HOSTNAME}-site.key /etc/tripwire/twpol.txt
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately no exit 0

View File

@ -40,18 +40,20 @@ function create_avahi_service {
exit 52925
fi
echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /etc/avahi/services/${service_name}.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /etc/avahi/services/${service_name}.service
echo '<service-group>' >> /etc/avahi/services/${service_name}.service
echo " <name replace-wildcards=\"yes\">%h ${service_type}</name>" >> /etc/avahi/services/${service_name}.service
echo ' <service>' >> /etc/avahi/services/${service_name}.service
echo " <type>_${service_type}._${service_protocol}</type>" >> /etc/avahi/services/${service_name}.service
echo " <port>${service_port}</port>" >> /etc/avahi/services/${service_name}.service
{ echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->';
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">';
echo '<service-group>';
echo " <name replace-wildcards=\"yes\">%h ${service_type}</name>";
echo ' <service>';
echo " <type>_${service_type}._${service_protocol}</type>";
echo " <port>${service_port}</port>"; } > "/etc/avahi/services/${service_name}.service"
if [ "$service_description" ]; then
echo " <txt-record>$service_description</txt-record>" >> /etc/avahi/services/${service_name}.service
echo " <txt-record>$service_description</txt-record>" >> "/etc/avahi/services/${service_name}.service"
fi
echo ' </service>' >> /etc/avahi/services/${service_name}.service
echo '</service-group>' >> /etc/avahi/services/${service_name}.service
{ echo ' </service>';
echo '</service-group>'; } >> "/etc/avahi/services/${service_name}.service"
}
function mesh_avahi {
@ -59,64 +61,64 @@ function mesh_avahi {
decarray=( 1 2 3 4 5 6 7 8 9 0 )
PEER_ID=${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}
sed -i "s|#host-name=.*|host-name=P$PEER_ID|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|use-ipv4=.*|use-ipv4=no|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|use-ipv6=.*|use-ipv6=yes|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|#allow-interfaces=.*|allow-interfaces=wlan0, wlan1, wlan2, wlan3, wlan4, wlan5|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|allow-interfaces=.*|allow-interfaces=wlan0, wlan1, wlan2, wlan3, wlan4, wlan5|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|#deny-interfaces=.*|deny-interfaces=eth0, eth1, eth2, eth3, eth4, eth5|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|deny-interfaces=.*|deny-interfaces=eth0, eth1, eth2, eth3, eth4, eth5|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|disallow-other-stacks=.*|disallow-other-stacks=yes|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|#publish_addresses=.*|publish_addresses=yes|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|publish_addresses=.*|publish_addresses=yes|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|#publish-hinfo=.*|publish-hinfo=no|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|publish-hinfo=.*|publish-hinfo=no|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|#publish-workstation=.*|publish-workstation=no|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|publish-workstation=.*|publish-workstation=no|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|#publish-domain=.*|publish-domain=yes|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|publish-domain=.*|publish-domain=yes|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|#publish-a-on-ipv6=.*|publish-a-on-ipv6=yes|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|publish-a-on-ipv6=.*|publish-a-on-ipv6=yes|g" $rootdir/etc/avahi/avahi-daemon.conf
sed -i "s|#host-name=.*|host-name=P$PEER_ID|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|use-ipv4=.*|use-ipv4=no|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|use-ipv6=.*|use-ipv6=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|#allow-interfaces=.*|allow-interfaces=wlan0, wlan1, wlan2, wlan3, wlan4, wlan5|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|allow-interfaces=.*|allow-interfaces=wlan0, wlan1, wlan2, wlan3, wlan4, wlan5|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|#deny-interfaces=.*|deny-interfaces=eth0, eth1, eth2, eth3, eth4, eth5|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|deny-interfaces=.*|deny-interfaces=eth0, eth1, eth2, eth3, eth4, eth5|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|disallow-other-stacks=.*|disallow-other-stacks=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|#publish_addresses=.*|publish_addresses=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|publish_addresses=.*|publish_addresses=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|#publish-hinfo=.*|publish-hinfo=no|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|publish-hinfo=.*|publish-hinfo=no|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|#publish-workstation=.*|publish-workstation=no|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|publish-workstation=.*|publish-workstation=no|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|#publish-domain=.*|publish-domain=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|publish-domain=.*|publish-domain=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|#publish-a-on-ipv6=.*|publish-a-on-ipv6=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf"
sed -i "s|publish-a-on-ipv6=.*|publish-a-on-ipv6=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf"
if [ ! -d $rootdir/etc/avahi/services ]; then
mkdir -p $rootdir/etc/avahi/services
if [ ! -d "$rootdir/etc/avahi/services" ]; then
mkdir -p "$rootdir/etc/avahi/services"
fi
# remove an avahi service which isn't used
if [ -f $rootdir/etc/avahi/services/udisks.service ]; then
rm $rootdir/etc/avahi/services/udisks.service
if [ -f "$rootdir/etc/avahi/services/udisks.service" ]; then
rm "$rootdir/etc/avahi/services/udisks.service"
fi
# Add a mesh routing protocol service
echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > $rootdir/etc/avahi/services/routing.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> $rootdir/etc/avahi/services/routing.service
echo '<service-group>' >> $rootdir/etc/avahi/services/routing.service
echo ' <name replace-wildcards="yes">%h routing</name>' >> $rootdir/etc/avahi/services/routing.service
echo ' <service>' >> $rootdir/etc/avahi/services/routing.service
echo ' <type>_bmx6._tcp</type>' >> $rootdir/etc/avahi/services/routing.service
echo ' </service>' >> $rootdir/etc/avahi/services/routing.service
echo '</service-group>' >> $rootdir/etc/avahi/services/routing.service
{ echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->';
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">';
echo '<service-group>';
echo ' <name replace-wildcards="yes">%h routing</name>';
echo ' <service>';
echo ' <type>_bmx6._tcp</type>';
echo ' </service>';
echo '</service-group>'; } > "$rootdir/etc/avahi/services/routing.service"
# keep the daemon running
WATCHDOG_SCRIPT_NAME="keepon"
echo '' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
echo '# keep avahi daemon running' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
echo 'AVAHI_RUNNING=$(pgrep avahi-daemon > /dev/null && echo Running)' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
echo 'if [ ! $AVAHI_RUNNING ]; then' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
echo ' systemctl start avahi-daemon' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
echo ' echo -n $CURRENT_DATE >> $LOGFILE' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
echo ' echo " Avahi daemon restarted" >> $LOGFILE' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
echo 'fi' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
chmod +x $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
{ echo '';
echo '# keep avahi daemon running';
echo "AVAHI_RUNNING=\$(pgrep avahi-daemon > /dev/null && echo Running)";
echo "if [ ! \$AVAHI_RUNNING ]; then";
echo ' systemctl start avahi-daemon';
echo " echo -n \$CURRENT_DATE >> \$LOGFILE";
echo " echo \" Avahi daemon restarted\" >> \$LOGFILE";
echo 'fi'; } >> "$rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME"
chmod +x "$rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME"
}
function install_avahi {
if [ $INSTALLING_MESH ]; then
if [ "$INSTALLING_MESH" ]; then
mesh_avahi
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
# only enable avahi if we're doing mesh networking
@ -140,11 +142,11 @@ function install_avahi {
sed -i "s|host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function configure_firewall_for_avahi {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
iptables -A INPUT -p tcp --dport 548 -j ACCEPT
@ -155,7 +157,7 @@ function configure_firewall_for_avahi {
iptables -A INPUT -p udp --dport 5354 -j ACCEPT
function_check save_firewall_settings
save_firewall_settings
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately there is no "exit 0"

View File

@ -67,7 +67,7 @@ function restart_site {
}
function configure_backup_key {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
apt-get -yq install gnupg dirmngr
@ -132,7 +132,7 @@ function configure_backup_key {
shred -zu ${MY_BACKUP_KEY}_public.asc
shred -zu ${MY_BACKUP_KEY}_private.asc
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function backup_to_friends_servers {

View File

@ -83,7 +83,7 @@ function install_cmake {
fi
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -111,7 +111,7 @@ function install_cmake {
fi
make install
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately there is no "exit 0"

View File

@ -43,7 +43,7 @@ function randomize_cron {
# The predictable default timing of Debian cron jobs might
# be exploitable knowledge. Avoid too much predictability
# by randomizing the times when cron jobs run
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -74,7 +74,7 @@ function randomize_cron {
systemctl restart cron
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function schedule_stig_tests {

View File

@ -76,7 +76,7 @@ function install_cryptopp {
fi
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -98,7 +98,7 @@ function install_cryptopp {
fi
make install
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately there is no "exit 0"

View File

@ -191,7 +191,7 @@ function mariadb_create_root_user {
}
function install_mariadb {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
apt-get -yq install software-properties-common debconf-utils
@ -237,7 +237,7 @@ function install_mariadb {
mariadb_create_root_user
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function backup_databases_script_header {
@ -285,7 +285,7 @@ function repair_databases_script {
sed -i "s|/usr/bin/repairdatabase|${PROJECT_NAME}-repair-database|g" /etc/cron.hourly/repair
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -299,7 +299,7 @@ function repair_databases_script {
chmod 600 /etc/cron.hourly/repair
chmod +x /etc/cron.hourly/repair
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function remove_database {

View File

@ -102,7 +102,7 @@ function create_freedns_updater {
fi
# currently inadyn doesn't work as expected with freeDNS, so this is a workaround
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $DDNS_PROVIDER != *"freedns"* ]]; then
@ -127,7 +127,7 @@ function create_freedns_updater {
systemctl restart cron
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function add_ddns_domain {
@ -192,7 +192,7 @@ function remove_ddns_domain {
}
function configure_dns {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -215,7 +215,7 @@ function configure_dns {
# prevent resolv.conf from changing
resolvconf -u
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function set_hostname {
@ -233,18 +233,18 @@ function set_hostname {
}
function set_your_domain_name {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
function_check set_hostname
set_hostname $DEFAULT_DOMAIN_NAME
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function configure_firewall_for_dns {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
@ -254,7 +254,7 @@ function configure_firewall_for_dns {
iptables -A INPUT -p udp -m udp --dport 1024:65535 --sport 53 -j ACCEPT
function_check save_firewall_settings
save_firewall_settings
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately no exit 0

View File

@ -70,7 +70,7 @@ function install_tomb {
set_repo_commit $INSTALL_DIR/tomb "tomb commit" "$TOMB_COMMIT" $TOMB_REPO
if [ -f $COMPLETION_FILE ]; then
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
fi
@ -100,7 +100,7 @@ function install_tomb {
exit 93462
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function defrag_filesystem {

View File

@ -29,7 +29,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
function install_final {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
# unmount any attached usb drive
@ -41,7 +41,7 @@ function install_final {
split_gpg_key_into_fragments
lockdown_permissions
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
clear
echo ''

View File

@ -50,7 +50,7 @@ function firewall_block_bad_ip_ranges {
if [ $INSTALLING_MESH ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -86,7 +86,7 @@ function firewall_block_bad_ip_ranges {
iptables -A INPUT -s 215.0.0.0/8 -j DROP
iptables -A OUTPUT -s 215.0.0.0/8 -j DROP
save_firewall_settings
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function global_rate_limit {
@ -143,7 +143,7 @@ function configure_firewall {
# recreate the firewall to remove RELATED
sed -i "/firewall/d" $COMPLETION_FILE
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
@ -200,11 +200,11 @@ function configure_firewall {
# Incoming malformed NULL packets:
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function firewall_drop_telnet {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
# telnet isn't enabled as an input and we can also
@ -213,11 +213,11 @@ function firewall_drop_telnet {
iptables -A OUTPUT -p udp --dport telnet -j REJECT
function_check save_firewall_settings
save_firewall_settings
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function configure_firewall_ping {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
# Only allow ping for mesh installs
@ -228,11 +228,11 @@ function configure_firewall_ping {
iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT
function_check save_firewall_settings
save_firewall_settings
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function configure_internet_protocol {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $SYSTEM_TYPE == "mesh"* ]]; then
@ -331,7 +331,7 @@ function configure_internet_protocol {
sed -i 's|net.ipv4.tcp_timestamps.*|net.ipv4.tcp_timestamps=0|g' /etc/sysctl.conf
fi
/sbin/sysctl -p
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function mesh_firewall {
@ -615,7 +615,7 @@ function firewall_unblock_domain {
}
function firewall_drop_spoofed_packets {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
iptables -t mangle -A PREROUTING -s 224.0.0.0/3 -j DROP
@ -627,11 +627,11 @@ function firewall_drop_spoofed_packets {
iptables -t mangle -A PREROUTING -s 127.0.0.0/8 ! -i lo -j DROP
function_check save_firewall_settings
save_firewall_settings
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function firewall_rate_limits {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -652,7 +652,7 @@ function firewall_rate_limits {
function_check save_firewall_settings
save_firewall_settings
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately no exit 0

View File

@ -134,7 +134,7 @@ function set_repo_commit {
}
function configure_firewall_for_git {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
@ -146,7 +146,7 @@ function configure_firewall_for_git {
fi
firewall_add Git 9418 tcp
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately no exit 0

View File

@ -227,7 +227,7 @@ function upgrade_golang {
systemctl restart gogs
fi
set_completion_param "$FUNCNAME" "$GO_VERSION"
set_completion_param "${FUNCNAME[0]}" "$GO_VERSION"
}
# NOTE: deliberately there is no "exit 0"

View File

@ -29,7 +29,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
function locale_setup {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -49,7 +49,7 @@ function locale_setup {
update-locale LC_ALL=${DEFAULT_LANGUAGE}
update-locale LC_CTYPE=${DEFAULT_LANGUAGE}
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately no exit 0

View File

@ -29,7 +29,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
function change_login_message {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -46,7 +46,7 @@ function change_login_message {
echo "' ' --' --' -' - -' ' ' -' -' -' ' - --'" >> /etc/motd
echo $' Freedom in the Cloud' >> /etc/motd
echo '' >> /etc/motd
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately no exit 0

View File

@ -57,7 +57,7 @@ function install_mongodb {
exit 7356272
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -90,7 +90,7 @@ function install_mongodb {
fi
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function remove_mongodb {

View File

@ -29,7 +29,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
function install_monkeysphere {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
apt-get -yq install monkeysphere msva-perl
@ -60,7 +60,7 @@ function install_monkeysphere {
fpr=$(gpg --with-colons --fingerprint $MY_GPG_PUBLIC_KEY_ID | grep fpr | head -n 1 | awk -F ':' '{print $10}')
monkeysphere-authentication add-identity-certifier $fpr
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately no exit 0

View File

@ -48,7 +48,7 @@ ROUTER_IP_ADDRESS="192.168.1.254"
MESH_INSTALL_DIR=/var/lib
function install_static_network {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $INSTALLING_ON_BBB == "yes" ]]; then
@ -68,7 +68,7 @@ function install_static_network {
echo ' netmask 255.255.255.0' >> /etc/network/interfaces.d/static
echo " gateway $ROUTER_IP_ADDRESS" >> /etc/network/interfaces.d/static
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function get_external_ipv4_address {

View File

@ -222,7 +222,7 @@ function install_nodejs {
mesh_install_nodejs
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
upgrade_nodejs
return
fi
@ -256,7 +256,7 @@ function install_nodejs {
fi
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately there is no "exit 0"

View File

@ -221,7 +221,7 @@ function enable_ssh_via_onion {
if [[ $SYSTEM_TYPE == "mesh"* ]]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
apt-get -yq install tor connect-proxy
@ -248,11 +248,11 @@ function enable_ssh_via_onion {
echo 'Host *.onion' >> /etc/skel/.ssh/config
echo 'ProxyCommand connect -R remote -5 -S 127.0.0.1:9050 %h %p' >> /etc/skel/.ssh/config
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function configure_ssh_onion {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $SYSTEM_TYPE == "mesh"* ]]; then
@ -268,14 +268,14 @@ function configure_ssh_onion {
set_completion_param "ssh onion domain" "${SSH_ONION_HOSTNAME}"
add_email_hostname "${SSH_ONION_HOSTNAME}"
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function install_tor {
if [[ $SYSTEM_TYPE == "mesh*" ]]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -296,14 +296,14 @@ function install_tor {
sed -i "s|#AccountingMax.*|AccountingMax $TOR_MAX_TRAFFIC_PER_MONTH_GB GBytes|g" /etc/tor/torrc
sed -i "s|AccountingMax.*|AccountingMax $TOR_MAX_TRAFFIC_PER_MONTH_GB GBytes|g" /etc/tor/torrc
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function resolve_dns_via_tor {
if [[ $SYSTEM_TYPE == "mesh"* ]]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [ ! -f /etc/tor/torrc ]; then
@ -327,13 +327,13 @@ function resolve_dns_via_tor {
echo 'nameserver 127.0.0.1:53' > $resolvconf
resolvconf -u
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# see https://trac.torproject.org/projects/tor/wiki/doc/TransparentProxy
# Local Redirection and Anonymizing Middlebox
function route_outgoing_traffic_through_tor {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $ROUTE_THROUGH_TOR != "yes" ]]; then
@ -428,7 +428,7 @@ function route_outgoing_traffic_through_tor {
echo "DNSListenAddress $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/tor/torrc
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function get_app_onion_address {

View File

@ -41,13 +41,13 @@ DEFAULT_PASSWORD_LENGTH=20
function enforce_good_passwords {
# because humans are generally bad at choosing passwords
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
apt-get -yq install libpam-cracklib
sed -i 's/password.*requisite.*pam_cracklib.so.*/password required pam_cracklib.so retry=2 dcredit=-4 ucredit=-1 ocredit=-1 lcredit=0 minlen=10 reject_username/g' /etc/pam.d/common-password
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function create_password {

View File

@ -69,7 +69,7 @@ function install_postgresql {
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -101,7 +101,7 @@ function install_postgresql {
exit 835290
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function add_postgresql_user {

View File

@ -32,7 +32,7 @@
DEBIAN_REPO="ftp.us.debian.org"
function create_repo_sources {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
rm -rf /var/lib/apt/lists/*
@ -53,12 +53,12 @@ function create_repo_sources {
apt-get update
apt-get -yq install apt-transport-https
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# A command to create a git repository for a project
function create_git_project {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
apt-get -yq install git
@ -86,7 +86,7 @@ function create_git_project {
echo 'exit 0' >> /usr/bin/$CREATE_GIT_PROJECT_COMMAND
chmod +x /usr/bin/$CREATE_GIT_PROJECT_COMMAND
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately no exit 0

View File

@ -59,7 +59,7 @@ function check_hwrng {
}
function check_onerng_verification {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $HWRNG_TYPE != "onerng" ]]; then
@ -78,7 +78,7 @@ function check_onerng_verification {
echo $'OneRNG firmware verification passed'
# if haveged was previously installed then remove it
apt-get -yq remove haveged
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function install_onerng {
@ -131,7 +131,7 @@ function install_onerng {
}
function random_number_generator {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
@ -165,7 +165,7 @@ function random_number_generator {
;;
esac
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately no exit 0

View File

@ -252,7 +252,7 @@ function turn_off_rsys_logging {
}
function initial_setup {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -283,7 +283,7 @@ function initial_setup {
mkdir -p $INSTALL_DIR
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function turn_off_magic_sysrq {
@ -316,7 +316,7 @@ function admin_user_sudo {
function search_for_attached_usb_drive {
# If a USB drive is attached then search for email,
# gpg, ssh keys and emacs configuration
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
detect_usb_drive
@ -404,7 +404,7 @@ function search_for_attached_usb_drive {
fi
echo $'No USB drive attached'
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function mark_admin_user_account {
@ -681,14 +681,14 @@ function create_usb_canary {
if [[ $SYSTEM_TYPE == "mesh"* ]]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
echo "ACTION==\"add\", KERNEL==\"sd*[!0-9]\", RUN+=\"/usr/local/bin/${PROJECT_NAME}-usb-canary\"" > /etc/udev/rules.d/00-usb-canary.rules
udevadm control --reload-rules
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function setup_firewall {

View File

@ -37,7 +37,7 @@ SSH_KEX="curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffi
SSH_HOST_KEY_ALGORITHMS="ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-ed25519,ssh-rsa"
function configure_ssh {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -125,7 +125,7 @@ function configure_ssh {
function_check configure_firewall_for_ssh
configure_firewall_for_ssh
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# see https://stribika.github.io/2015/01/04/secure-secure-shell.html
@ -135,7 +135,7 @@ function ssh_remove_small_moduli {
}
function configure_ssh_client {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
#sed -i 's/# PasswordAuthentication.*/ PasswordAuthentication no/g' /etc/ssh/ssh_config
@ -165,11 +165,11 @@ function configure_ssh_client {
function_check ssh_remove_small_moduli
ssh_remove_small_moduli
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function regenerate_ssh_keys {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
rm -f /etc/ssh/ssh_host_*
@ -179,11 +179,11 @@ function regenerate_ssh_keys {
ssh_remove_small_moduli
systemctl restart ssh
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function configure_firewall_for_ssh {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
@ -192,7 +192,7 @@ function configure_firewall_for_ssh {
fi
firewall_add SSH ${SSH_PORT} tcp
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function get_ssh_server_key {

View File

@ -65,7 +65,7 @@ function install_tracker {
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -97,7 +97,7 @@ function install_tracker {
systemctl enable tracker.service
systemctl start tracker.service
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately no exit 0

View File

@ -43,20 +43,20 @@ function create_upgrade_script {
fi
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
apt-get -yq install unattended-upgrades
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function upgrade_installation_from_previous_versions {
if [ ! -f $COMPLETION_FILE ]; then
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -87,7 +87,7 @@ function upgrade_installation_from_previous_versions {
rm /usr/local/bin/zeronetavahi
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately no exit 0

View File

@ -34,7 +34,7 @@
WATCHDOG_SCRIPT_NAME="keepon"
function install_watchdog_script {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
echo '#!/bin/bash' > /usr/bin/$WATCHDOG_SCRIPT_NAME
@ -46,7 +46,7 @@ function install_watchdog_script {
function_check cron_add_mins
cron_add_mins 1 "/usr/bin/$WATCHDOG_SCRIPT_NAME"
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function daemon_is_running {

View File

@ -437,7 +437,7 @@ function install_dynamicdns {
function_check set_repo_commit
set_repo_commit $INSTALL_DIR/inadyn "inadyn commit" "$INADYN_COMMIT" $INADYN_REPO
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -512,7 +512,7 @@ function install_dynamicdns {
systemctl start inadyn
systemctl daemon-reload
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function update_default_search_engine {
@ -539,13 +539,13 @@ function update_default_search_engine {
}
function install_command_line_browser {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
apt-get -yq install elinks
update_default_search_engine
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function mesh_web_server {
@ -572,7 +572,7 @@ function install_web_server {
function_check set_repo_commit
set_repo_commit $INSTALL_DIR/nginx_ensite "nginx-ensite commit" "$NGINX_ENSITE_COMMIT" $NGINX_ENSITE_REPO
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
# remove apache
@ -714,7 +714,7 @@ function install_web_server {
function_check configure_firewall_for_web_access
configure_firewall_for_web_access
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function remove_certs {
@ -742,7 +742,7 @@ function remove_certs {
}
function configure_firewall_for_web_access {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [[ $INSTALLED_WITHIN_DOCKER == "yes" ]]; then
@ -754,7 +754,7 @@ function configure_firewall_for_web_access {
fi
firewall_add HTTP 80 tcp
firewall_add HTTPS 443 tcp
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function update_default_domain {

View File

@ -120,7 +120,7 @@ function setup_wifi {
return
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -131,7 +131,7 @@ function setup_wifi {
if [ -f $WIFI_NETWORKS_FILE ]; then
${PROJECT_NAME}-wifi --networks $WIFI_NETWORKS_FILE
mark_completed $FUNCNAME
mark_complete "${FUNCNAME[0]}"
return
fi
@ -148,12 +148,12 @@ function setup_wifi {
else
${PROJECT_NAME}-wifi -s $WIFI_SSID -t $WIFI_TYPE --hotspot $HOTSPOT --networks $WIFI_NETWORKS_FILE
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# ath9k_htc driver
function install_atheros_wifi {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
if [ $INSTALLING_ON_BBB != "yes" ]; then
@ -198,7 +198,7 @@ function install_atheros_wifi {
if [ ! "$?" = "0" ]; then
exit 74681
fi
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
function update_wifi_adaptors {

View File

@ -29,7 +29,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
function enable_zram {
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
return
fi
@ -40,7 +40,7 @@ function enable_zram {
${PROJECT_NAME}-zram on
mark_completed $FUNCNAME
mark_completed "${FUNCNAME[0]}"
}
# NOTE: deliberately no exit 0

View File

@ -48,7 +48,7 @@ function zram_daemon {
echo "ExecStart=${PROJECT_NAME}-zram on";
echo '';
echo '[Install]';
echo 'WantedBy=multi-user.target'; } >> $DAEMON_FILENAME
echo 'WantedBy=multi-user.target'; } > $DAEMON_FILENAME
}
function zram_on {