HTTP Deploy Basic CGI Application Flashcards

1
Q

Deploy Basic CGI Application

A

cd /var/www/cgi-bin/

vim mytime.sh
#!/bin/bash
echo "Content-type: text"
echo
echo
echo "This is the current time on the system `date`"

chmod +c mytime.sh

getsebool -a | grep httpd_enable_cgi

setsebool -P httpd_enable_cgi 1

elinks http://web.home.com/cgi-bin/mytime.sh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Deploy a non-default CGI Script

A
mkdir /var/webscripts
vim /var/webscripts/ourtime.sh
#!/bin/bash
echo "Content-type: text"
echo
echo
echo "This is the current time on the system `date`"

semanage fcontext -a -t httpd_sys_script_exec_t “/var/webscripts(/.*)?”
[root@we3kb2 webscripts]# restorecon -Rv /var/webscripts/

vim /etc/httpd/conf/http.conf
Search ScriptAlias

  ScriptAlias /cgi-bin/ "/var/webscripts/"
    {Directory /var/webscripts}
        AllowOverride None
        Options None
        Require all granted
    {/Directory}

systemctl restart httpd

elinks http://web.home.com/cgi-bin/ourtime.sh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly