Zhang Huangbin avatar Zhang Huangbin committed d1a4180

FreeBSD: Allow access to MySQL server from Jail.

Comments (0)

Files changed (2)


     elif [ X"${DISTRO}" == X'FREEBSD' ]; then
         ECHO_DEBUG "Configure Apache."
         # With Apache2.2 it now wants to load an Accept Filter.
-        echo 'accf_http_load="YES"' >> /boot/loader.conf
+        echo 'accf_http_load="YES"' >> /boot/loader.conf &>/dev/null
         # Change 'Deny from all' to 'Allow from all'.
         sed -i '.iredmailtmp' '/Each directory to/,/Note that from/s#Deny\ from\ all#Allow\ from\ all#' ${HTTPD_CONF}


     ECHO_DEBUG "Sleep 5 seconds for MySQL daemon initialize ..."
     sleep 5
-    echo '' > ${MYSQL_INIT_SQL}
+    ECHO_DEBUG "Grant access privilege from ${LOCAL_ADDRESS} ..."
+    if [ X"${LOCAL_ADDRESS}" == X'' ]; then
+        mysql -u${MYSQL_ROOT_USER} <<EOF
+    fi
     ECHO_DEBUG "Setting password for MySQL admin (${MYSQL_ROOT_USER})."
     mysqladmin --user=root password "${MYSQL_ROOT_PASSWD}"
+    echo '' > ${MYSQL_INIT_SQL}
     cat >> ${MYSQL_INIT_SQL} <<EOF
-/* Delete anonymouse user. */
+-- Delete anonymouse user.
 USE mysql;
 DELETE FROM user WHERE User='';
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.