Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

183
Views
¿Cómo configurar un archivo Apache server/crontab/bash para permitir el acceso en ciertos momentos del día y/o desde IP específicas?

Estoy intentando un ejercicio dado por mi instructor. Tuvimos la tarea de configurar un VirtualHost al que se pudiera acceder de lunes a viernes del 1 al 5. Además de eso, debemos permitir el acceso al sitio desde la IP "XX.XX.XX.XXX" en cualquier momento.

Crontab actual:

 * 13 * * 1-5 root apachectl start * 17 * * 1-5 root apachectl stop * * * * * root ./bash

Archivo bash:

 currIP=$(hostname -I) case "$currIP" in *XX.XX.XX.XXX*) ??????? ;; esac

¿Alguien puede explicarme cómo voy a servir este sitio a la IP sin servirlo a todos a la vez?

¡Gracias!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Digamos que este es su archivo de configuración.

 /etc/apache2/httpd.conf

Ejecute estos comandos:

 sudo cp /etc/apache2/httpd.conf all.conf sudo cp /etc/apache2/httpd.conf restricted.conf

Ahora cree este script en algún lugar de su sistema:

 #!/bin/bash [[ "$1" = "all" ]] && { ln -s --force /etc/apache2/all.conf /etc/apache2/httpd.conf ;} [[ "$1" = "restricted" ]] && { ln -s --force /etc/apache2/restricted.conf /etc/apache2/httpd.conf ;} sudo systemctl restart httpd

Y agregue permisos de ejecución:

 sudo chmod +x /path/to/your/script.sh

Ahora modifique /etc/apache2/restricted.conf para filtrar solicitudes por IP. Puede encontrar información al respecto aquí: https://httpd.apache.org/docs/2.4/es/mod/mod_authz_core.html#require

Ahora configure el cron raíz como:

 sudo crontab -e

Y ahí agrega esto:

 * 13 * * 1-5 /path/to/your/script.sh "all" * 17 * * 1-5 /path/to/your/script.sh "restricted"

¡Y se feliz!

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!