Web Services Flashcards

LPIC-2 Web services, including Apache, Nginx and Squid

1
Q

What do HTTP and HTTPS stand for?

A

HyperText transfer protocol and Secure HTTP

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

What does HTML stand for?

A

HyperText Markup Language

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

HTTP status codes have the format 1xx, 2xx, 3xx, 4xx, 5xx - what types of messages do these number represent?

A
1xx - Informational messages
2xx - Success
3xx - Redirection
4xx - Client Error
5xx - Server Error
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does SSL stand for?

A

Secure Sockets Layer

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

What does TLS stand for and what is it?

A

TLS is Transport Layer security, it is the security layer applied to web traffic, the successor to SSL.

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

Which port numbers do these services usually run on:
Web server (HTTP)
Secure Web server (HTTPS)
Squid Proxy Server

A

HTTP - 80
HTTPS - 443
Squid - 138

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

There are a number of web service options available, which 3 web services does LPIC-2 focus on? Which is the most popular in Linux today?

A

Apache - Web Server (most popular)
Nginx - Web Server
Squid - Web Proxy Server

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

Name some of the core features of the Apache web server

A
Loadable dynamic modules (that can be activated/deactivated on the fly)
Scalable Multi-Session Support
Limiting concurrent connections
Bandwidth Throttling
Web Caching (web proxy)
Load Balancing (reverse Proxy)
Common Gateway Interface (CGI) support
Virtual Hosting
User-Based Web Page Hosting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

In Web Hosting, what does CGI stand for? What does it do?

A

Common Gateway Interface. It allows programs to be run that can generate dynamic web content.

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

What are the two main functions of the squid proxy server?

A

Web filtering and web caching

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

What is nginx?

A

Nginx is a web server that is gaining popularity. It can act as either a web server or as a reverse proxy server that performs load balancing

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

Where are Apache web documents generally stored?

A

/var/www/html/

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

Which Apache utility allows you to control (stop, start, restart, status) the Apache service?

A

apachectl

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

Unfortunately the configuration file location for Apache are not standard across distros. Which 2 places would you check on Debian based distros, which 2 places on Redhat based distros.

A
Debian:
/etc/apache2.conf
/etc/apache2/apache2.conf
Redhat:
/etc/httpd/httpd.conf
/etc/httpd/httpd2.conf
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Name the Apache directive that allows you to specify a port number to listen on and an optional IP address.

A

Listen

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

Name the Apache directive that specifies the user account which should be used to start the service

A

User

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

Name the Apache directive that allows you to specify a group for the Apache daemon service

A

Group

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

Name the Apache directive that allows you to specify an email address for the Apache server administrator

A

ServerAdmin

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

Name the Apache directive that allows you to specify a name for the Web server

A

ServerName

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

Name the Apache directive that allows you to specify the base directory for the configuration files

A

ServerRoot

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

Name the Apache directive that allows you to specify the base directory for the data files

A

DocumentRoot

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

Name the Apache directive that allows you to specify a default file served when a client requests an index of a directory

A

DirectoryIndex

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

Name the Apache directive that allows you to specify a file to serve when an error occurs

A

ErrorDocument

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

Name the Apache directive that allows you to specify the log file location

A

ErrorLog

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

Name the Apache directive that allows you to specify a file that lists restrictions on files in a folder

A

AccessFileName

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

Name the Apache directive that allows you to specify another file to include in the configuration

A

Include

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

Name the Apache directive that allows you to specify the number of servers to start to handle concurrent requests

A

StartServers

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

Name the Apache directive that allows you to specify the maximum number of servers to handle concurrent requests

A

MaxClients

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

Name the Apache directive that allows you to specify the minimum number of spare servers to have running

A

MinSpareServers

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

Name the Apache directive that allows you to specify the maximum number of spare servers to have running

A

MaxSpareServers

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

Name the Apache directive that allows you to load and enable special feature modules on the server

A

LoadModule

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

What does an Apache conditional BLOCK directive look like?

A

directives

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

What does an Apache conditional MODULE directive look like?

A

directives

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

What does an Apache conditional DIRECTORY directive look like?

A

directives

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

What are the two types of Apache logs?

A

Access logs and Error Logs

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

The location of the Apache Error logs can be different on Debian based distros to that on Redhat based distros. What are the likely locations and files names on each?

A

Debian:
/var/log/apache2/error.log
Redhat:
/var/log/httpd/error_log

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

The location of the Apache Access logs can be different on Debian based distros to that on Redhat based distros. What are the likely locations and files names on each?

A

Debian:
/var/log/apache2/access.log
Redhat:
/var/log/httpd/access_log

38
Q

Name the Apache directive that allows users to host their own files on a system

A

USERDIR
e.g
USERDIR public_html
http://localhost/~username/test.html

39
Q

What is named based virtual web hosting?

A

Where multiple hostnames point to a single IP address

40
Q

What does an Apache name based virtual hosting definition look like?

A

NameVirtualHost 192.168.10.1

ServerName www.example1.com
DocumentRoot /var/www/html/example1

Servername www.example2.com
DocumentRoot /var/www/html/example2
41
Q

What does an Apache IP based virtual hosting definition look like?

A

Listen 192.168.10.1
Listen 192.168.10.2

Servername www.example1.com
DocumentRoot /var/www/html/example1

Servername www.example2.com
DocumentRoot /var/www/html/example2
42
Q

There are a number of Apache access restriction modules, which is the most common

A

mod_auth

also known as mod_authn_file

43
Q

Name the Apache directive that allows you to specify a name for a mod_auth access restricted location

A

AuthName

44
Q

Name the Apache directive that allows you to specify an authentication type for a mod_auth access restricted location

A

AuthType

45
Q

Name the Apache directive that allows you to specify a file name for a mod_auth access restricted location

A

AuthUserFile

file can be created with the htpasswd utility

46
Q

What does a mod_auth restricted access configuration directive look like?

A
AuthName "Secure pages, restricted access"
    AuthType Basic
    AuthUserFile /etc/apache/passwords
    Require valid-user
    DocumentRoot /var/www/html/secure
47
Q

Which utility allows you to create a password file for a restricted access setup? How would you use it?

A

htpassed

#to create a new file
htpasswd -c /etc/apache/password jdoe
48
Q

What are the three methods of restricting access to content on an Apache server?

A

Using an authentication module, using .htaccess files or IP address based restrictions

49
Q

Name the Apache directive that allows users to specify configuration directives in a .htaccess file

A

AllowOverRide

50
Q

What does an IP based restriction configuration directive look like?

A

Order Deny,Allow
Deny from all
Allow from 192.168.10.0/255.255.255.0
DocumentRoot /var/www/html/secure

51
Q

Which two Apache directives do you need for any CGI configuration?

A

ScriptAlias
e.g. ScriptAlias /cgi-bin/ /var/www/cgi-bin/
AddHandler
e.g. AddHandler cgi-script .cgi .pl

52
Q

What are mod_perl, mod_php, mod_python, mod_ruby?

A

Commonly used installable Apache modules that can be with CGI to create dynamic web content.

53
Q

What are the 6 steps to setting up https on Apache?

A

1 Install Apache SSL module
2 Create server public/private key pair
3 Create a CSR
4 Have the CSR Signed
5 Copy Certificate and Keys into your Apache Setup
6 Configure Apache to use the certificate

54
Q

Using openssl, how would you create a public/private certificate key pair for your server

A

openssl genrsa -des3 -out server.key 2048

55
Q

Using openssl, how would you create a certificate signing request for your server key “server.key”

A

openssl req -new -key server.key -out newreq.pem

56
Q

There is a perl script that is part of the openssl-perl package that allows you to setup a certificate authority and self sign your CSR’s. What is the name and location of the perl script

A

/var/lib/ssl/misc/CA.pl

CA.pl -newca
CA.pl -signreq

57
Q

What is SNI

A

Server Name Indication - this is an extension of the TLS protocol in which the hostname is indicated during the handshake. This allows multiple signed hosts to run on a single web server.

58
Q

Name the Apache directive that turns on SSL capability

A

SSLEngine

e.g. SSLEngine on

59
Q

Name the Apache directive that defines an SSL certificate to use

A

SSLCertificateFile

e.g. SSLCertificateFile /etc/apache/certs/server.pem

60
Q

Name the Apache directive that defines an SSL certificate key

A

SSLCertificateKeyFile

e.g. SSLCertificateKeyFile /etc/apache/certs/server.key

61
Q

Name the Apache directive that defines the certificate authorities key file

A

SSLCACertificateFile

62
Q

Name the Apache directive that defines the certificate authorities key file path

A

SSLCACertificatePth

63
Q

Name the Apache directive that defines the a file that contains multiple concatenated certificate files for validating client files

A

SSLCertificateChainFile

64
Q

Name the Apache directive that allows the specification of versions of the TLS and SSL protocols

A

SSLProtocol

65
Q

Name the Apache directive that defines the supports SSL/TLS ciphers

A

SSLCipherSuite

66
Q

Where is the squid config file in
Redhat based distros?
Debian based distros?

A

Redhat
/etc/squid/squid.conf
Debian
/etc/squid3/squid.conf

67
Q

Only two directives are required for a basic Squid web caching setup, what are they?

A

http_port
Cache_dir

Example:
http_port 3128
cache_dir ufs /var/spool/squid3 100 16 256

100MB
16 top level cache folders
256 2nd level cache folders

More folders should equal better caching performance

68
Q

Name the Squid directive that defines an access control list

A

acl

69
Q

Name the Squid directive that specifies a program to authenticate users

A

auth_param

70
Q

Name the Squid directive that specifies a folder to cache web requests

A

cache_dir

71
Q

Name the Squid directive that specifies a rule for allowing or denying access for an ACL group

A

http_access

72
Q

Name the Squid directive that specifies the port on which the Squid service will listen on

A

http_port

73
Q

Name the Squid directive that specifies an external program where all web requests can be redirected to

A

redirect_program

74
Q

What does a squid acl directive look like?

A

acl ourhosts src 192.168.30.0/255.255.255.0

75
Q

What is the squid acl src directive?

A

allows you to specify source IP addresses

76
Q

What is the squid acl dst directive?

A

allows you to specify destination IP addresses

77
Q

What is the squid acl port directive?

A

allows you to specify a list of TCP ports

78
Q

What is the squid acl srcdomain directive?

A

allows you to specify a list of source domain names

79
Q

What is the squid acl dstdomain directive?

A

allow you to specify a list of destination domain names

80
Q

What is the squid acl time directive?

A

allows you to specify a list of days or time of day

81
Q

What is the squid acl proto directive?

A

allows you to specify a list of protocols

82
Q

What is the squid acl browser directive?

A

allows you to specify a list of browsers

83
Q

What is this squid configuration doing?

acl socialmedia dstdomain www.facebook.com www.twitter.com
acl lunch MTWHF 12:00-13:00
http_access allow socialmedia lunch
http_access deny socialmedia

A

The first acl defines a list of destination domains
The second acl defines an hour, monday - Friday called lunch
The first http_access directive allows access to the domains during lunch
The second http_access directive denies access to the domains (at any other time)

84
Q

Client authentication in squid uses which configuration directive?

A

auth_param

The same parameter is used in the config file to defines multiple settings, for example to use pam

auth_param basic /usr/lib/squid/pam_auth
auth_param basic children 5 startup=5 idle=1
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours

acl ourhosts proxy_auth REQUIRED

85
Q

What is the benefits of Nginx over Apache?

A

Nginx doesn’t spawn a new program thread for each client request like Apache. It spawns client threads within the main application program. This has the benefit of using less memory and can therefore be useful in large scale websites.

The second benefit is the ability to use Nginx as a reverse proxy which can serve as a load balancer for backend applications

86
Q

Where is the nginx config file usually found and what is it called?

A

/etc/nginx/

nginx.conf

87
Q

Name the nginx config directive that specifies the port nginx should listen on

A

listen

e.g.
listen 80 default_server;

88
Q

Name the nginx config directive that specifies the location of the web content. What is the equivalent directive in Apache?

A

root

e.g.
root /var/www/html;

equivalent directive in Apache is DocumentRoot

89
Q

Name the nginx config directive that defines the default file to load. What is the equivalent directive in Apache?

A

index

e.g.
index index.htm index.html;

equivalent directive in Apache is DirectoryIndex

90
Q

Name the nginx config directive that specifies the web server name. What is the equivalent directive in Apache?

A

server_name

e.g.
server_name localhost;

equivalent directive in Apache is ServerName

91
Q

Name the nginx config directive that specifies the settings for specific locations on the server

A

location

e.g.
location / {
try_files $uri $uri/ =404;
}

92
Q

Which nginx directives are used to create a reverse proxy? What does a simple example look like?

A

The location directive with proxy_pass

location / {
proxy_pass http://www.someotherplace.com;
}

or using IP and port

location / {
proxy_pass 192.168.30.30:5100;
}