From 8504fd84bcc5bd72ecb7f6e914cf820d22579b4e Mon Sep 17 00:00:00 2001 From: "Justin M. Wray" Date: Mon, 28 Aug 2017 00:08:42 -0400 Subject: [PATCH 01/14] Remove NodeJS-Legacy (Fixes: #550) (#551) * Remove NodeJS-Legacy (Fixes: #550) * Updated version of node.js installed to fix critical provisioning errors. By default, Ubuntu 14.04 uses a legacy version of node.js. This code removes the legacy version and updates to a newer version. * Source: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions * This PR fixes the provision/build issue from #550 --- extra/provision.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extra/provision.sh b/extra/provision.sh index 108a64dd..cf5d44a0 100755 --- a/extra/provision.sh +++ b/extra/provision.sh @@ -311,7 +311,14 @@ fi log "Updating npm" sudo npm install -g npm@lts - package nodejs-legacy + log "Removing node.js legacy version" + sudo DEBIAN_FRONTEND=noninteractive apt-get remove --purge nodejs -y + + log "Downloading updated node.js version" + curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - + + log "Installing node.js" + package nodejs log "Installing all required npm node_modules" sudo npm install --prefix "$CTF_PATH" From 93387b35921511063374a3519dc0634ee4fb91bc Mon Sep 17 00:00:00 2001 From: "Justin M. Wray" Date: Thu, 31 Aug 2017 00:28:32 -0400 Subject: [PATCH 02/14] Downgraded DropkickJS and Streamlined Provision for NodeJS/Downloads (Fixes: #554) (#555) * Downgraded Dropkick.js to version 2.1.10. The project originally was built using 2.1.10 and specified a near version in the 2.x.x release family. On August 27th 2017 Dropkick.js released version 2.2.0 which is incompatible with ES6 specs. The incompatibility with the new release of Dropkick.js caused the provisioning of the platform to fail. * Moved the installation process for Node.js to a function within `lib.sh`. This change streamlines the provision script. * Removed the installation of `wget` from provisioning. `wget` is no longer used within the project and is therefore unneeded. * Updated the `dl()` download function within the provision script to use `curl` exclusively, with retry options. The retry options are set to 5 retries with a 15-second delay between retries. The addition of the retry option ensures the provision can continue if there is a temporary issue with a remote connection or availability of a remote resource. * Added the `dl_pipe()` download function to the provision script. This download function provided the data from the remote resource via standard output to be piped into another command. As piping downloads within the provisioning process have become more common, this function streamlines the process. * Fixes #554 * Updates fixes for #550 --- extra/lib.sh | 25 ++++++++++++++++++------- extra/provision.sh | 13 +------------ package.json | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/extra/lib.sh b/extra/lib.sh index 3e862a15..6f397e08 100755 --- a/extra/lib.sh +++ b/extra/lib.sh @@ -29,12 +29,12 @@ function ok_log() { function dl() { local __url=$1 local __dest=$2 + sudo curl --retry 5 --retry-delay 15 -sSL "$__url" -o "$__dest" +} - if [ -n "$(which wget)" ]; then - sudo wget -q "$__url" -O "$__dest" - else - sudo curl -s "$__url" -o "$__dest" - fi +function dl_pipe() { + local __url=$1 + curl --retry 5 --retry-delay 15 -sSL "$__url" } function package_repo_update() { @@ -53,7 +53,7 @@ function package() { function install_unison() { cd / - curl -sL https://www.archlinux.org/packages/extra/x86_64/unison/download/ | sudo tar Jx + dl_pipe "https://www.archlinux.org/packages/extra/x86_64/unison/download/" | sudo tar Jx } function repo_osquery() { @@ -280,12 +280,23 @@ function install_composer() { local __path=$1 cd $__path - curl -sS https://getcomposer.org/installer | php + dl_pipe "https://getcomposer.org/installer" | php hhvm composer.phar install sudo mv composer.phar /usr/bin sudo chmod +x /usr/bin/composer.phar } +function install_nodejs() { + log "Removing node.js legacy version" + sudo DEBIAN_FRONTEND=noninteractive apt-get remove --purge nodejs -y + + log "Downloading and setting node.js version 6.x repo information" + dl_pipe "https://deb.nodesource.com/setup_6.x" | sudo -E bash - + + log "Installing node.js" + package nodejs +} + function import_empty_db() { local __u="ctf" local __p="ctf" diff --git a/extra/provision.sh b/extra/provision.sh index cf5d44a0..4ea22b98 100755 --- a/extra/provision.sh +++ b/extra/provision.sh @@ -214,7 +214,6 @@ package_repo_update package git package curl -package wget package rsync # Check for available memory, should be over 1GB @@ -307,18 +306,8 @@ fi fi package ca-certificates - package npm - log "Updating npm" - sudo npm install -g npm@lts - log "Removing node.js legacy version" - sudo DEBIAN_FRONTEND=noninteractive apt-get remove --purge nodejs -y - - log "Downloading updated node.js version" - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - - - log "Installing node.js" - package nodejs + install_nodejs log "Installing all required npm node_modules" sudo npm install --prefix "$CTF_PATH" diff --git a/package.json b/package.json index 1391ddde..5d9be93e 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "d3": "^3.5.16", - "dropkickjs": "^2.1.10", + "dropkickjs": "2.1.10", "hoverintent-jqplugin": "^0.2.1", "jquery": "^2.2.3", "keycode": "^2.1.1", From 88827c231d480fdb7c327876b9e5447b984c3fcb Mon Sep 17 00:00:00 2001 From: "Justin M. Wray" Date: Thu, 31 Aug 2017 00:29:08 -0400 Subject: [PATCH 03/14] Added Quick Setup Guide to README (#556) * Updated links and information related to the installation process. * Included a link to Quick Setup Guide. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cd5112e5..8eef011a 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,11 @@ For more information, see the [Admin Guide](https://github.com/facebook/fbctf/wi # Installation -The FBCTF platform was designed with flexibility in mind, allowing for different types of installations depending on the needs of the end user. The FBCTF platform can be installed either in Development Mode, or Production Mode. Development is for development, and Production is intended for live events utilizing the FBCTF platform. +The FBCTF platform was designed with flexibility in mind, allowing for different types of installations depending on the needs of the end user. The FBCTF platform can be installed either in Development Mode, or Production Mode. -[Development Installation Guide](https://github.com/facebook/fbctf/wiki/Installation-Guide,-Development) +[Quick Setup Guide](https://github.com/facebook/fbctf/wiki/Quick-Setup-Guide) (_Recommended Installation_) -[Production Installation Guide](https://github.com/facebook/fbctf/wiki/Installation-Guide,-Production) +The [Quick Setup Guide](https://github.com/facebook/fbctf/wiki/Quick-Setup-Guide) details the quick setup mode which provides a streamlined and consistent build of the platform but offers less flexibility when compared to a custom installation. If you would prefer to perform a custom installation, please see the [Development Installation Guide](https://github.com/facebook/fbctf/wiki/Installation-Guide,-Development) or [Production Installation Guide](https://github.com/facebook/fbctf/wiki/Installation-Guide,-Production). ## Reporting an Issue From ccc3ae76f043890a1109b5d4f221be33a4b5d55e Mon Sep 17 00:00:00 2001 From: "Justin M. Wray" Date: Thu, 31 Aug 2017 00:29:37 -0400 Subject: [PATCH 04/14] Update CONTRIBUTING (#557) * Included message indicating that Pull Requests need to be submitted against `dev`. * Updated commands to branch from `dev`. --- CONTRIBUTING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8a601541..a05ec714 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,12 +7,14 @@ Complete your CLA here: ## Submitting a PR +**All Pull Requests should be made against `dev` (even _bug fixes_).** + Before submitting a large PR for a new feature or improvement, please create an issue first. This will allow us to discuss the feature before much development effort is put into it. After we've agreed that the feature would fit in the scope of the project, or if the change is small enough to not require an issue, follow these steps to create a PR: - Make a new branch ``` -git checkout -b my-fix master +git checkout -b my-fix dev ``` - Make your changes, including test cases if applicable. Make sure to follow the coding guidelines described below. From 5e28529118d456b5434824b9f76a93acefaabe03 Mon Sep 17 00:00:00 2001 From: Claudson Martins Date: Mon, 11 Sep 2017 17:43:04 -0300 Subject: [PATCH 05/14] Brazilian Portuguese Filename Fix (#562) * Fixed Brazilian Portuguese Filename: Changed to `lang_pt-br.php` --- src/language/{lang_bp.php => lang_pt-br.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/language/{lang_bp.php => lang_pt-br.php} (100%) diff --git a/src/language/lang_bp.php b/src/language/lang_pt-br.php similarity index 100% rename from src/language/lang_bp.php rename to src/language/lang_pt-br.php From da4d8d100c4461b48342177f7a8a9a2466488c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=C3=ADez?= Date: Mon, 11 Sep 2017 22:47:35 +0200 Subject: [PATCH 06/14] Spanish translations added (#566) * Spanish translations added * In Spanish language the first letter of each word is not in capital letters (except if you start a sentence). --- src/controllers/AdminController.php | 6 +- src/language/lang_en.php | 12 ++ src/language/lang_es.php | 222 +++++++++++++++------------- 3 files changed, 133 insertions(+), 107 deletions(-) diff --git a/src/controllers/AdminController.php b/src/controllers/AdminController.php index a7eb52e8..b46b4313 100644 --- a/src/controllers/AdminController.php +++ b/src/controllers/AdminController.php @@ -2973,11 +2973,11 @@ class="not_configuration" if ($country->getEnabled()) { $highlighted_action = 'disable_country'; $highlighted_color = 'highlighted--red country-enabled'; - $current_status = 'DISABLED'; + $current_status = 'Disabled'; } else { $highlighted_action = 'enable_country'; $highlighted_color = 'highlighted--green country-disabled'; - $current_status = 'ENABLED'; + $current_status = 'Enabled'; } if (!$using_country) { @@ -2986,7 +2986,7 @@ class="not_configuration" class={$highlighted_color} href="#" data-action={str_replace('_', '-', $highlighted_action)}> - {$current_status} + {tr($current_status)} ; } else { $status_action = ; diff --git a/src/language/lang_en.php b/src/language/lang_en.php index 77563863..e5644cef 100644 --- a/src/language/lang_en.php +++ b/src/language/lang_en.php @@ -209,6 +209,8 @@ 'Registration Type', 'Strong Passwords' => 'Strong Passwords', + 'Password Types' => + 'Password Types', 'Team Selection' => 'Team Selection', 'Game' => @@ -225,6 +227,16 @@ 'Bases Cycle (s)', 'Default Bonus Dec' => 'Default Bonus Dec', + 'Game Schedule' => + 'Game Schedule', + 'Game Start Year' => + 'Game Start Year', + 'Game End Year' => + 'Game End Year', + 'Day' => + 'Day', + 'Minute' => + 'Minute', 'Timer' => 'Timer', 'Server Time' => diff --git a/src/language/lang_es.php b/src/language/lang_es.php index a552080a..1d8ef561 100644 --- a/src/language/lang_es.php +++ b/src/language/lang_es.php @@ -18,15 +18,15 @@ 'Gameboard' => 'Panel de juego', 'Register Team' => - 'Registrar Equipo', + 'Registrar equipo', 'Get ready for the CTF to start and register your team now!' => '¡Prepárate para competir y registrar tu equipo!', 'Login' => - 'Inciar Sesión', + 'Inciar sesión', 'Soon' => 'Próximamente', 'Upcoming Game' => - 'Próximo Juego', + 'Próximo juego', '_days' => '_días', '_hours' => @@ -74,17 +74,17 @@ 'Name' => 'Nombre', 'Email' => - 'Correo Electrónico', + 'Correo electrónico', 'Token' => 'Token', 'Team Registration' => - 'Registro de Equipo', + 'Registro de equipo', 'Team Name' => - 'Nombre de Equipo', + 'Nombre de equipo', 'Password' => - 'Password', + 'Contraseña', 'Choose an Emblem' => - 'Elige un Emblema', + 'Elige un emblema', 'or upload your own' => 'o sube tus propios', 'Clear your custom emblem to use a default emblem.' => @@ -96,7 +96,7 @@ 'Register to play Capture The Flag here. Once you have registered, you will be logged in.' => 'Regístrate aquí para jugar Capture The Flag. Una vez registrado, accederás al sitio.', 'Not Available' => - 'No Disponible', + 'No disponible', 'Team Registration will be open soon, stay tuned!' => '¡El registro de equipos se habilitará pronto, mantente al tanto!', 'Try Again' => @@ -104,7 +104,7 @@ 'Select' => 'Seleccionar', 'Team Login' => - 'Acceso de Equipo', + 'Acceso de equipo', 'Please login here. If you have not registered, you may do so by clicking "Sign Up" below. ' => 'Por favor inicia sesión aquí. Si no lo hiciste, puedes hacerlo haciendo clic en "Registro" más abajo. ', 'Team Login will be open soon, stay tuned!' => @@ -120,7 +120,7 @@ 'Thank you.' => 'Gracias.', 'Logout' => - 'Cerrar Sesión', + 'Cerrar sesión', 'Registration' => 'Registro', 'Play CTF' => @@ -135,7 +135,7 @@ 'Navigation' => 'Navegación', 'View Mode' => - 'Modo Visualización', + 'Modo visualización', 'View mode' => 'Modo visualización', 'Tutorial' => @@ -149,7 +149,7 @@ 'All' => 'Todos', 'Leaderboard' => - 'Tabla de Posiciones', + 'Ranking', 'Announcements' => 'Anuncios', 'Teams' => @@ -159,12 +159,12 @@ 'Activity' => 'Actividad', 'Game Clock' => - 'Reloj del Juego', + 'Reloj de juego', //Translations for AdminController 'Auto' => 'Auto', 'All Categories' => - 'Todas las Categorías', + 'Todas las categorías', 'Open' => 'Abrir', 'Tokenized' => @@ -180,11 +180,11 @@ 'Available' => 'Disponible', 'Registration Tokens' => - 'Tokens de Registro', + 'Tokens de registro', 'Create More' => - 'Crear Más', + 'Crear más', 'Export Available' => - 'Exportar Disponibles', + 'Exportar disponibles', 'Not started yet' => 'No inició aún', 'Configuration' => @@ -192,7 +192,7 @@ 'Tokens' => 'Tokens', 'Game Configuration' => - 'Configuración del Juego', + 'Configuración del juego', 'OK' => 'OK', 'status_' => @@ -202,39 +202,53 @@ 'Off' => 'Off', 'Player Names' => - 'Nombre de los Jugadores', + 'Nombre de los jugadores', 'Players Per Team' => - 'Jugadores Por Equipo', + 'Jugadores por equipo', 'Registration Type' => - 'Tipo de Registro', + 'Tipo de registro', 'Strong Passwords' => - 'Contraseñas Seguras', + 'Contraseñas Sseguras', 'Team Selection' => - 'Selección de Equipo', + 'Selección de equipo', + 'Password Types' => + 'Politica de contraseñas', 'Game' => 'Juego', 'Scoring' => 'Puntuación', 'Progressive Cycle (s)' => - 'Ciclos Progresivos', + 'Ciclos progresivos', 'Refresh Gameboard' => - 'Refrescar Panel de Juego', + 'Refrescar panel de juego', 'Default Bonus' => 'Bonus por defecto', 'Bases Cycle (s)' => 'Ciclos Base', 'Default Bonus Dec' => 'Bonus Dec por defecto', + 'Game Schedule' => + 'Calendario', + 'Game Start Year' => + 'Año de inicio', + 'Game End Year' => + 'Año de fin', + 'Day' => + 'Día', + 'Month' => + 'Mes', + 'Minute' => + 'Minuto', 'Timer' => 'Temporizador', 'Server Time' => - 'Tiempo de Servidor', + 'Tiempo del servidor', 'Game Duration' => - 'Duración del Juego', + 'Duración del juego', 'Begin Time' => - 'Tiempo de Inicio', + 'Tiempo de inicio', 'Expected End Time' => - 'Tiempo de Finalización Esperada', + 'Tiempo de finalización esperado', 'Internationalization' => 'Internacionalización', 'Language' => @@ -242,27 +256,27 @@ 'Branding' => 'Marca', 'Custom Logo' => - 'Logotipo Personalizado', + 'Logotipo personalizado', 'Logo' => 'Logo', 'Custom Text' => - 'Texto Personalizado', + 'Texto personalizado', 'DELETE' => 'BORRAR', 'Delete' => 'Borrar', 'No Announcements' => - 'No hay Anuncios', + 'No hay anuncios', 'Game Controls' => - 'Controles del Juego', + 'Controles del juego', 'Write New Announcement here' => - 'Escribir Nuevo Anuncio aquí', + 'Escribir nuevo anuncio aquí', 'Create' => 'Crear', 'General' => 'General', 'Back Up Database' => - 'Hacer Copia de Seguridad de la Base de Datos', + 'Hacer copia de seguridad de la base de datos', 'Export Full Game' => 'Juego completo de exportación', 'Import Full Game' => @@ -270,11 +284,11 @@ 'Import Teams' => 'Equipos de importación', 'Export Teams' => - 'Exportar Equipos', + 'Exportar equipos', 'Import Logos' => - 'Importar Logos', + 'Importar logos', 'Export Logos' => - 'Exportar Logos', + 'Exportar logos', 'Import Levels' => 'Niveles de importación', 'Export Levels' => @@ -286,13 +300,13 @@ 'Levels' => 'Niveles', 'New Quiz Level' => - 'Nuevo Nivel Acertijo', + 'Nuevo nivel acertijo', 'Title' => 'Título', 'Question' => 'Pregunta', 'Level title' => - 'Título del Nivel', + 'Título del nivel', 'Quiz question' => 'Acertijo', 'Country' => @@ -304,23 +318,23 @@ 'Hint' => 'Pista', 'Hint Penalty' => - 'Penalidad de la Pista', + 'Penalización de la pista', 'EDIT' => 'EDITAR', 'All Quiz Levels' => - 'Todos los Niveles Acertijo', + 'Todos los niveles acertijo', 'Filter By:' => 'Filtrar por:', 'All Status' => - 'Todos los Estados', + 'Todos los estados', 'Enabled' => 'Habilitado', 'Disabled' => 'Deshabilitado', 'Quiz Level' => - 'Nivel Acertijo', + 'Nivel acertijo', 'Show Answer' => - 'Mostrar Respuesta', + 'Mostrar respuesta', 'Bonus' => 'Bonus', '-Dec' => @@ -328,15 +342,15 @@ 'Save' => 'Guardar', 'Quiz Management' => - 'Administración de Acertijos', + 'Administración de acertijos', 'Add Quiz Level' => - 'Añadir nuevo nivel de Acertijo', + 'Añadir nuevo nivel de acertijo', 'New Flag Level' => - 'Nuevo Nivel Bandera', + 'Nuevo nivel bandera', 'Description' => 'Descripción', 'Level description' => - 'Descripción del Nivel', + 'Descripción del divel', 'Category' => 'Categoría', 'Flag' => @@ -344,9 +358,9 @@ 'flag' => 'bandera', 'All Flag Levels' => - 'Todos los Niveles Bandera', + 'Todos los niveles bandera', 'New Attachment:' => - 'Nuevo Adjunto:', + 'Nuevo adjunto:', 'Attachment' => 'Adjunto', 'Link' => @@ -354,7 +368,7 @@ 'New Link:' => 'Nuevo Link:', 'Flag Level' => - 'Nivel Bandera', + 'Nivel bandera', 'Categories' => 'Categorias', '+ Attachment' => @@ -362,39 +376,39 @@ '+ Link' => '+ Link', 'Flags Management' => - 'Administrar Banderas', + 'Administrar banderas', 'Add Flag Level' => - 'Añadir Nivel Bandera', + 'Añadir nivel bandera', 'New Base Level' => - 'Nuevo Nivel Base', + 'Nuevo nivel base', 'Keep Points' => - 'Mantener Puntos', + 'Mantener puntos', 'Capture points' => 'Capturar puntos', 'All Base Levels' => - 'Todos los Niveles Base', + 'Todos los niveles base', 'Base Level' => - 'Nivel Base', + 'Nivel base', 'Bases Management' => - 'Administrar Bases', + 'Administrar bases', 'Add Base Level' => 'Añadir Nivel Base', 'New Category' => - 'Nueva Categoría', + 'Nueva categoría', 'Category: ' => 'Categoría: ', 'Categories Management' => - 'Administrar Categorías', + 'Administrar categorías', 'Add Category' => 'Añadir Categoría', 'All Countries' => - 'Todos lo Países', + 'Todos lo países', 'In Use' => - 'En Uso', + 'En uso', 'In use' => 'En uso', 'Not Used' => - 'Sin Usar', + 'Sin usar', 'Yes' => 'Si', 'No' => @@ -402,9 +416,9 @@ 'ISO Code' => 'Código ISO', 'Countries Management' => - 'Adminsitrar Países', + 'Adminsitrar países', 'No Team Names' => - 'No hay Nombre de Equipos', + 'No hay nombre de equipos', 'time' => 'tiempo', 'type' => @@ -420,7 +434,7 @@ 'Attempt' => 'Intento', 'No Failures' => - 'Sin Fallas', + 'Sin fallas', 'Team' => 'Equipo', 'team' => @@ -432,45 +446,45 @@ 'Failures' => 'Fallas', 'New Team' => - 'Nuevo Equipo', + 'Nuevo equipo', 'Team Logo' => - 'Logo de Equipo', + 'Logo de equipo', 'Selected Logo:' => - 'Logo Seleccionado:', + 'Logo seleccionado:', 'Select Logo' => - 'Seleccionar Logo', + 'Seleccionar logo', 'All Teams' => - 'Todos los Equipos', + 'Todos los equipos', 'Protected' => 'Protegido', 'Score' => 'Puntuación', 'Change Password' => - 'Cambiar Password', + 'Cambiar contraseña', 'Admin Level' => - 'Administrar Nivel', + 'Administrar nivel', 'Visibility' => 'Visibilidad', 'Team Management' => - 'Administrar Equipo', + 'Administrar equipo', 'Add Team' => - 'Añadir Equipo', + 'Añadir equipo', 'None' => 'Ningúno', 'Logo Name' => - 'Nombre de Logo', + 'Nombre de logo', 'Logo Management' => - 'Administración de Logo', + 'Administración de logo', 'Session' => 'Sesión', 'Cookie' => 'Cookie', 'Creation Time' => - 'Tiempo de Creación', + 'Tiempo de creación', 'Last Access' => - 'Último Acceso', + 'Último acceso', 'Last Page Access' => - 'Última Página de Acceso', + 'Última página de acceso', 'Data' => 'Datos', 'Sessions' => @@ -478,17 +492,17 @@ 'entry' => 'entrada', 'No Entries' => - 'Sin Entrada', + 'Sin entrada', 'Game Logs' => - 'Logs del Juego', + 'Logs del juego', 'Game Logs Timeline' => - 'Logs del Juego en Linea de Tiempo', + 'Logs del juego en linea de tiempo', 'End Game' => - 'Finalizar Juego', + 'Finalizar juego', 'Begin Game' => - 'Iniciar Juego', + 'Iniciar juego', 'Game Admin' => - 'Administración del Juego', + 'Administración del juego', 'Controls' => 'Controles', 'Quiz' => @@ -519,13 +533,13 @@ 'pts' => 'pts', //points 'Your Rank' => - 'Tu Posición', + 'Tu posición', 'Your Score' => - 'Tu Puntaje', + 'Tu puntuación', 'Everyone' => 'Todos', 'Your Team' => - 'Tu Equipo', + 'Tu equipo', 'Captured' => 'Capturado', 'Initiating' => @@ -577,7 +591,7 @@ 'cancel_' => 'cancelar_', 'Are you sure you want to cancel? You have unsaved changes that will be reverted.' => - 'Está seguro que desea cancelar? Los cambios sin guardar se perderán.', + '¿Está seguro que desea cancelar? Los cambios sin guardar se perderán.', 'choose_logo' => 'elegir_logo', 'captured_' => @@ -595,7 +609,7 @@ 'Insert your answer' => 'Introduce tu respuesta', 'Request Hint' => - 'Solicitar Pista', + 'Solicitar pista', 'Submit' => 'Enviar', 'hint_' => @@ -637,29 +651,29 @@ 'Tool_Bars' => 'Tool_Bars', 'Tap the "Game Clock" to keep track of time during gameplay. Don’t let time get the best of you.' => - 'Pulsa el "Reloj del Juego" para hacer seguimiento del tiempo. No dejes que el tiempo te gane.', + 'Pulsa el "Reloj del juego" para hacer seguimiento del tiempo. No dejes que el tiempo te gane.', 'Game_Clock' => - 'Game_Clock', + 'Reloj de juego', 'Countries marked with an ' => 'Países marcados con una ', 'are captured by you.' => - 'son capturados por vos.', + 'son capturados por tí.', ' are owned by others.' => ' le pertenecen a otros.', 'Captures' => 'Capturas', 'Tap Plus[+] to Zoom In. Tap Minus[-] to Zoom Out.' => - 'Pulsa Más[+] para Acercarte. Pulsa Menos[-] para Alejarte.', + 'Pulsa más[+] para acercarte. Pulsa menos[-] para alejarte.', 'Click and Drag to move left, right, up and down.' => - 'Presiona y Arrastra para moverte por la izquierda, derecha, arriba o abajo', + 'Presiona y rrastra para moverte por la izquierda, derecha, arriba o abajo', 'Zoom' => 'Zoom', 'Tap Forward Slash [/] to activate computer commands. A list of commands can be found under "Rules".' => - 'Presiona Slash [/] para activar los comandos del juego. La lista completa de comandos puede ser encontrada en "Reglas".', + 'Presiona contrabarra [/] para activar los comandos del juego. La lista completa de comandos puede ser encontrada en "Reglas".', 'Command_Line' => 'Command_Line', 'Click "Nav" to access main navigation links like Rules of Play, Registration, Blog, Jobs & more.' => - 'Presiona "Nav" para acceder a los links principales como Reglas del Juego, Registro, Blog, Trabajo y más.', + 'Presiona "Navegación" para acceder a los links principales como "Reglas del juego", "Cerrar sesión" y otros.', 'Track your competition by clicking "scoreboard" to access real-time game statistics and graphs.' => 'Haz un seguimiento del juego haciendo clic en "scoreboard" para acceder a estadísticas y gráficas en tiempo real.', 'Have fun, be the best and conquer the world.' => @@ -675,11 +689,11 @@ 'Powered By Facebook' => 'Powered By Facebook', 'Active Directory / LDAP' => - 'Active Directory / LDAP', + 'Directorio Activo / LDAP', 'LDAP Server' => - 'LDAP Server', + 'LDAP Servidor', 'LDAP Port' => - 'LDAP Port', + 'LDAP Puerto', 'LDAP Domain' => - 'LDAP Domain', + 'LDAP Dominio', ); From 1a8286bef5d124e85e48bb281a00cfd5477152f2 Mon Sep 17 00:00:00 2001 From: Diego Giuliani Date: Mon, 11 Sep 2017 17:48:49 -0300 Subject: [PATCH 07/14] Update index.js (#568) There was an typo in the verifyTeamName function, it was using teamname as the name of the input, and should be team_name --- src/static/js/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/static/js/index.js b/src/static/js/index.js index 7a6f4263..142894d1 100644 --- a/src/static/js/index.js +++ b/src/static/js/index.js @@ -2,7 +2,7 @@ var $ = require('jquery'); function teamNameFormError() { $('.el--text')[0].classList.add('form-error'); - $('.fb-form input[name="teamname"]').on('change', function() { + $('.fb-form input[name="team_name"]').on('change', function() { $('.el--text')[0].classList.remove('form-error'); }); } @@ -43,7 +43,7 @@ function teamLogoFormError() { function verifyTeamName(context) { if (context === 'register') { - var teamName = String($('.fb-form input[name="teamname"]')[0].value); + var teamName = String($('.fb-form input[name="team_name"]')[0].value); if (teamName.length === 0) { teamNameFormError(); return false; From b9822ff3e9c81f8d5415d1c99fb5ff78d65d814a Mon Sep 17 00:00:00 2001 From: "Justin M. Wray" Date: Tue, 19 Sep 2017 14:27:16 -0400 Subject: [PATCH 08/14] Travis-CI to use Docker (#569) * Travis-CI now builds a docker image and uses the docker image for build testing. * Split docker build, docker run, and the docker execution of `run_tests.sh` into separate steps. * Added a service status check to `run_tests.sh` to ensure services are running or wait until they are. The service test process will not directly return any error status; instead, the process will wait (up to 10 times, 10 seconds each) for the services to come online before finally failing with an error or continuing if everything is ready. * This change removes our dependency on Travis-provided images and allows us to move away from Ubuntu 14.04 when ready. --- .travis.yml | 16 +++++++++------- extra/run_tests.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index cc8b03a5..23616c75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,13 @@ -# We use language generic because that's the only thing that's supported for the -# trusty distro -language: generic +# We are now using Docker to test builds with Travis - this removes our dependency on Ubuntu 14.04 sudo: required -dist: trusty +language: generic -group: deprecated-2017Q2 +services: + - docker -install: ./extra/provision.sh -m dev -s $TRAVIS_BUILD_DIR -d $TRAVIS_BUILD_DIR +install: + - docker build --build-arg MODE=dev -t="fbctf_in_travis" . -script: ./extra/run_tests.sh $TRAVIS_BUILD_DIR +script: + - docker run -d -p 80:80 -p 443:443 --name="fbctf_in_travis" fbctf_in_travis + - docker exec fbctf_in_travis /var/www/fbctf/extra/run_tests.sh /var/www/fbctf/ diff --git a/extra/run_tests.sh b/extra/run_tests.sh index 862fbe4f..e0763a86 100755 --- a/extra/run_tests.sh +++ b/extra/run_tests.sh @@ -12,6 +12,34 @@ CODE_PATH=${1:-/vagrant} DB_USER=${2:-root} DB_PWD=${3:-root} +echo "[+] Verifying service status" +READY=0 +for i in {1..10}; do + HHVM_STATUS=$(service hhvm status | grep -P "start|running|Uptime" | wc -l) + NGINX_STATUS=$(service nginx status | grep -P "start|running|Uptime" | wc -l) + MYSQL_STATUS=$(service mysql status | grep -P "start|running|Uptime" | wc -l) + MC_STATUS=$(service memcached status | grep -P "start|running|Uptime" | wc -l) + if [ $HHVM_STATUS == 0 ] || [ $NGINX_STATUS == 0 ] || [ $MYSQL_STATUS == 0 ] || [ $MC_STATUS == 0 ]; then + echo "[+] Services not ready, waiting 10 seconds..." + sleep 10 + continue + else + READY=1 + break + fi +done + +if [ $READY = 0 ]; then + echo "[!] Services are not running, tests cannot be completed." + exit 1 +else + echo "[+] Services are running" +fi + + +echo "[+] Changing directory to $CODE_PATH" +cd "$CODE_PATH" + echo "[+] Starting tests setup in $CODE_PATH" mysql -u "$DB_USER" --password="$DB_PWD" -e "CREATE DATABASE $DB;" From 37c43e7803321dc4e036397b9040456884650079 Mon Sep 17 00:00:00 2001 From: Juan Rossi Date: Wed, 27 Sep 2017 18:07:27 -0300 Subject: [PATCH 09/14] Make sure that requests are not being generated if an error was generated (#565) * If a request was sent, don't create another one until the first one has finished. * If a request fails, wait one extra "round" before sending new ones. --- src/static/js/fb-ctf.js | 103 ++++++++++++++++++++++++++++------------ 1 file changed, 72 insertions(+), 31 deletions(-) diff --git a/src/static/js/fb-ctf.js b/src/static/js/fb-ctf.js index fce831ac..c69aea6f 100644 --- a/src/static/js/fb-ctf.js +++ b/src/static/js/fb-ctf.js @@ -274,7 +274,9 @@ function setupInputListeners() { $listview, $mapSvg, $map, - $countryHover; + $countryHover, + reload = true, + reload_team = true; /** @@ -516,44 +518,72 @@ function setupInputListeners() { }, FB_CTF.data.CONF.refreshConf); // Countries and other modules + var count = 0; setInterval(function() { - if (FB_CTF.data.CONF.gameboard === '1') { - // Map - getCountryData(); - refreshMapData(); - // Announcements - if (Widget.getWidgetStatus('Announcements') === 'open') { - loadAnnouncementsModule(); - } - // Filter - if (Widget.getWidgetStatus('Filter') === 'open') { - loadSavedFilterModule(); - } - // Activity - if (Widget.getWidgetStatus('Activity') === 'open') { - loadActivityModule(); + if (reload == true || count > 1){ + reload = false; + if (FB_CTF.data.CONF.gameboard === '1') { + // Map + getCountryData(); + refreshMapData(); + // Announcements + if (Widget.getWidgetStatus('Announcements') === 'open') { + loadAnnouncementsModule(); + } + // Filter + if (Widget.getWidgetStatus('Filter') === 'open') { + loadSavedFilterModule(); + } + // Activity + if (Widget.getWidgetStatus('Activity') === 'open') { + loadActivityModule(); + } + } else { + clearMapData(); + clearAnnouncements(); + clearActivity(); } - } else { - clearMapData(); - clearAnnouncements(); - clearActivity(); + } + + if (reload == false){ + count += 1; + } + + // reset counter + if (count > 1){ + count = 0; + reload = true; } }, FB_CTF.data.CONF.refreshMap); // Teams + var teams_count = 0; setInterval(function() { - if (FB_CTF.data.CONF.gameboard === '1') { - // Teams - loadTeamData(); - if (Widget.getWidgetStatus('Teams') === 'open') { - loadTeamsModule(); - } - if (Widget.getWidgetStatus('Leaderboard') === 'open') { - loadLeaderboardModule(); + if (reload_team == true || teams_count > 1){ + reload_team = false; + if (FB_CTF.data.CONF.gameboard === '1') { + // Teams + loadTeamData(); + if (Widget.getWidgetStatus('Teams') === 'open') { + loadTeamsModule(); + } + if (Widget.getWidgetStatus('Leaderboard') === 'open') { + loadLeaderboardModule(); + } + } else { + clearTeams(); + clearLeaderboard(); } - } else { - clearTeams(); - clearLeaderboard(); + } + + if (reload_team == false){ + teams_count += 1; + } + + // reset team counter + if (teams_count > 1){ + teams_count = 0; + reload_team = true; } }, FB_CTF.data.CONF.refreshMap); @@ -1433,6 +1463,7 @@ function setupInputListeners() { return $.get(loadPath, function(data) { FB_CTF.data.TEAMS = data; var df = $.Deferred(); + reload_team = true; return df.resolve(FB_CTF.data.TEAMS); }, 'json').error(function(jqhxr, status, error) { console.error("There was a problem retrieving the team data."); @@ -1440,6 +1471,8 @@ function setupInputListeners() { console.log(status); console.log(error); console.error("/error"); + console.error("Team data request failed"); + reload_team = false; }); } @@ -1498,6 +1531,7 @@ function setupInputListeners() { return $.get(loadPath, function(data) { FB_CTF.data.CONF = data; var df = $.Deferred(); + reload = true; return df.resolve(FB_CTF.data.CONF); }, 'json').error(function(jqhxr, status, error) { console.error("There was a problem retrieving the conf data."); @@ -1505,6 +1539,7 @@ function setupInputListeners() { console.log(status); console.log(error); console.error("/error"); + reload = false; }); } @@ -1546,12 +1581,14 @@ function setupInputListeners() { $('#' + key)[0].parentNode.setAttribute('data-captured', value.datacaptured); } }); + reload = true; }, 'json').error(function(jqhxr, status, error) { console.error("There was a problem retrieving the map data."); console.log(loadPath); console.log(status); console.log(error); console.error("/error"); + reload = false; }); } @@ -1568,12 +1605,14 @@ function setupInputListeners() { $('#' + key)[0].parentNode.children[1].classList.remove("captured--you"); $('#' + key)[0].parentNode.children[1].classList.remove("captured--opponent"); }); + reload = true; }, 'json').error(function(jqhxr, status, error) { console.error("There was a problem retrieving the map data."); console.log(loadPath); console.log(status); console.log(error); console.error("/error"); + reload = false; }); } @@ -1591,6 +1630,7 @@ function setupInputListeners() { return $.get(loadPath, function(data) { FB_CTF.data.COUNTRIES = data; var df = $.Deferred(); + reload = true; return df.resolve(FB_CTF.data.COUNTRIES); }, 'json').error(function(jqxhr, status, error) { console.error("There was a problem retrieving the game data."); @@ -1598,6 +1638,7 @@ function setupInputListeners() { console.log(status); console.log(error); console.error("/error"); + reload = false; }); } From 80da1454005197686b6959824745ee1b53704715 Mon Sep 17 00:00:00 2001 From: Redsadic Date: Mon, 23 Oct 2017 18:33:29 +0200 Subject: [PATCH 10/14] Ensure /root/tmp exists before writing there (#587) Resolved a directory not found error during the let's encrypt process when using docker-compose. --- extra/lib.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/lib.sh b/extra/lib.sh index 6f397e08..cb9edb2d 100755 --- a/extra/lib.sh +++ b/extra/lib.sh @@ -128,6 +128,7 @@ function letsencrypt_cert() { fi if [[ "$__docker" = true ]]; then + mkdir -p /root/tmp cat <<- EOF > /root/tmp/certbot.sh #!/bin/bash if [[ ! ( -d /etc/letsencrypt && "\$(ls -A /etc/letsencrypt)" ) ]]; then From 780071b7652b119d6d761defff10450ae8da3489 Mon Sep 17 00:00:00 2001 From: "Justin M. Wray" Date: Thu, 26 Oct 2017 13:16:16 -0400 Subject: [PATCH 11/14] Attachment Security Update (#590) * Attachment Security Update * Attachments have been moved out of a web accessible direcotry (`/var/www/fbctf/src/data/`) and now reside in `/var/www/fbctf/attachments`. * Attachment downloads are now handled by an endpoint in `/data`: `attachment.php`. * All links to attachments now refer to the correct `attachment.php` endpoint location. * The `tar` command within the Attachment Import function now sets the mode to 600 at time of extraction. * The Attachment Import functionality will no longer change or attempt to change permissions on the current or parent directories. * The Attachment Import functionality will no longer change permissions on any directories, though subdirectories are not supported. * Attachment filenames will no longer be altered, excluding the inclusion of the file hash. * The provision script has been updated to support the new Attachment directory location. * Attachment specific directives are no longer set in the Mult-Server Nginx configuration. * Attachment location information has been updated in the `.gitignore` configuration. * Fixed an issue with the deletion path. --- .gitignore | 8 ++-- extra/nginx/nginx.conf | 6 --- extra/provision.sh | 8 ++-- src/controllers/AdminController.php | 22 ++++----- src/data/attachment.php | 41 ++++++++++++++++ src/data/attachments/deleted/index.php | 3 -- src/data/attachments/index.php | 3 -- src/data/country-data.php | 5 +- src/models/Attachment.php | 66 +++++++++++++++++--------- src/models/Control.php | 11 +++-- src/static/js/fb-ctf.js | 6 ++- 11 files changed, 119 insertions(+), 60 deletions(-) create mode 100644 src/data/attachment.php delete mode 100644 src/data/attachments/deleted/index.php delete mode 100644 src/data/attachments/index.php diff --git a/.gitignore b/.gitignore index f9ba930a..6fbd82bb 100644 --- a/.gitignore +++ b/.gitignore @@ -31,10 +31,10 @@ www.pid *.swo # Attachments directory -src/data/attachments/* -!src/data/attachments/index.php -src/data/attachments/deleted/* -!src/data/attachments/deleted/index.php +attachments/* +!attachments/index.php +attachments/deleted/* +!attachments/deleted/index.php # Custom logos directory src/data/customlogos/* diff --git a/extra/nginx/nginx.conf b/extra/nginx/nginx.conf index 350ba270..61a8da02 100644 --- a/extra/nginx/nginx.conf +++ b/extra/nginx/nginx.conf @@ -38,12 +38,6 @@ server { root CTFPATH; index index.php; - location /data/attachments/ { - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - fastcgi_pass HHVMSERVER:9000; - } - location /data/customlogos/ { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; diff --git a/extra/provision.sh b/extra/provision.sh index 4ea22b98..8dea1edd 100755 --- a/extra/provision.sh +++ b/extra/provision.sh @@ -326,10 +326,10 @@ fi fi log "Creating attachments folder, and setting ownership to www-data" - sudo sudo mkdir -p "$CTF_PATH/src/data/attachments" - sudo sudo mkdir -p "$CTF_PATH/src/data/attachments/deleted" - sudo chown -R www-data:www-data "$CTF_PATH/src/data/attachments" - sudo chown -R www-data:www-data "$CTF_PATH/src/data/attachments/deleted" + sudo sudo mkdir -p "$CTF_PATH/attachments" + sudo sudo mkdir -p "$CTF_PATH/attachments/deleted" + sudo chown -R www-data:www-data "$CTF_PATH/attachments" + sudo chown -R www-data:www-data "$CTF_PATH/attachments/deleted" log "Creating custom logos folder, and setting ownership to www-data" sudo mkdir -p "$CTF_PATH/src/data/customlogos" diff --git a/src/controllers/AdminController.php b/src/controllers/AdminController.php index b46b4313..55cf8d4c 100644 --- a/src/controllers/AdminController.php +++ b/src/controllers/AdminController.php @@ -4,7 +4,7 @@ class AdminController extends Controller { <<__Override>> protected function getTitle(): string { $custom_org = \HH\Asio\join(Configuration::gen('custom_org')); - return tr($custom_org->getValue()). ' '. tr('CTF'). ' | '. tr('Admin'); + return tr($custom_org->getValue()).' '.tr('CTF').' | '.tr('Admin'); } <<__Override>> @@ -157,8 +157,8 @@ class="fb--conf--registration_type" $select = ; foreach ($types as $type) { $select->appendChild( -