I would like to get help to configure Trafficserver and HTTPS.
My goal is to achieve Transparent Proxying to perform caching of http
and https (mainly of videos for youtube/googlevideo and facebook/akamai
images).
I've been reading this week
mail-archives.apache.org/mod_mbox/trafficserver-users and
docs.trafficserver.apache.org but could not achieve my objective.
Questions:
. Do I have to install an SSL server certificate?
. Do I have to make a remap rule?
. Did I make something good?
Thanks and Regards. Mauro.
##########################################################33
--------------
| General data |
--------------
ATS Version
# traffic_server -V
[TrafficServer] using root directory '/opt/ats'
Apache Traffic Server - traffic_server - 5.0.1 - (build # 63016 on Jul
30 2014 at 16:46:34)
ATS OS: debian 7.6
ATS interfaces: eth0
---------------
| Configuration |
---------------
Routing
-------
/-----\
| ATS |
\-----/
/\
|
|
|
\/
/----------\ /--------\ /---------\
| Internet | <--> | router | <--> | clients |
\----------/ \--------/ \---------/
router redirect traffic from clients with dst-port 80 and 443 to ATS
In ATS I've got the following rules and routes:
net/ipv4/ip_forward=1
iptables -t mangle -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j
TPROXY --on-ip 0.0.0.0 --on-port 8080 --tproxy-mark 1/1
iptables -t mangle -A PREROUTING -i eth0 -p tcp -m tcp --sport 80 -j
MARK --set-mark 1/1
iptables -t mangle -A PREROUTING -i eth0 -p tcp -m tcp --dport 443 -j
TPROXY --on-ip 0.0.0.0 --on-port 443 --tproxy-mark 2/2
iptables -t mangle -A PREROUTING -i eth0 -p tcp -m tcp --sport 443 -j
MARK --set-mark 2/2
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE (due to works as a
transparent proxy)
ip rule add fwmark 1/1 table 1
ip rule add fwmark 2/2 table 1
ip route add local 0.0.0.0/0 dev eth0 table 1
ssl_multicert.config
--------------------
dest_ip=* ssl_cert_name=cert.pem ssl_key_name=key.pem
I created an X.509 Certificate Signing Request (CSR) and RSA key as
follow in etc/trafficserver/ssl:
openssl req -x509 -newkey rsa:2048 -keyout keypriv.pem -out cert.pem
-days 365
openssl rsa -in keypriv.pem -out key.pem
records.config
--------------
##############################################################################
# Thread configurations. Docs:
##############################################################################
CONFIG proxy.config.exec_thread.autoconfig INT 1
CONFIG proxy.config.exec_thread.autoconfig.scale FLOAT 1.500000
CONFIG proxy.config.exec_thread.limit INT 2
CONFIG proxy.config.ssl.number.threads INT 1
CONFIG proxy.config.accept_threads INT 1
CONFIG proxy.config.task_threads INT 2
CONFIG proxy.config.cache.threads_per_disk INT 8
CONFIG proxy.config.exec_thread.affinity INT 0
##############################################################################
# Specify server addresses and ports to bind for HTTP and HTTPS. Docs:
##############################################################################
CONFIG proxy.config.http.server_ports STRING 8080:tr-full, 443:ssl:tr-full
CONFIG proxy.config.http.server_port_attr STRING =
CONFIG proxy.config.reverse_proxy.enabled INT 1
##############################################################################
# Via: headers. Docs:
##############################################################################
CONFIG proxy.config.http.insert_request_via_str INT 0
CONFIG proxy.config.http.insert_response_via_str INT 0
##############################################################################
# Parent proxy configuration, in addition to these settings also see
parent.config. Docs:
##############################################################################
CONFIG proxy.config.http.parent_proxy_routing_enable INT 0
CONFIG proxy.config.http.parent_proxy.retry_time INT 300
CONFIG proxy.config.http.parent_proxy.connect_attempts_timeout INT 30
CONFIG proxy.config.http.forward.proxy_auth_to_parent INT 0
##############################################################################
# HTTP connection timeouts (secs). Docs:
##############################################################################
CONFIG proxy.config.http.keep_alive_no_activity_timeout_in INT 600
CONFIG proxy.config.http.keep_alive_no_activity_timeout_out INT 600
CONFIG proxy.config.http.transaction_no_activity_timeout_in INT 30
CONFIG proxy.config.http.transaction_no_activity_timeout_out INT 30
CONFIG proxy.config.http.transaction_active_timeout_in INT 43200
CONFIG proxy.config.http.transaction_active_timeout_out INT 43200
CONFIG proxy.config.http.accept_no_activity_timeout INT 30
CONFIG proxy.config.net.default_inactivity_timeout INT 30
##############################################################################
# Origin server connect attempts. Docs:
##############################################################################
CONFIG proxy.config.http.connect_attempts_max_retries INT 6
CONFIG proxy.config.http.connect_attempts_max_retries_dead_server INT 3
CONFIG proxy.config.http.connect_attempts_rr_retries INT 3
CONFIG proxy.config.http.connect_attempts_timeout INT 30
CONFIG proxy.config.http.post_connect_attempts_timeout INT 1800
CONFIG proxy.config.http.down_server.cache_time INT 300
CONFIG proxy.config.http.down_server.abort_threshold INT 10
##############################################################################
# Negative response caching, for redirects and errors. Docs:
##############################################################################
CONFIG proxy.config.http.negative_caching_enabled INT 0
CONFIG proxy.config.http.negative_caching_lifetime INT 1800
##############################################################################
# Proxy users variables. Docs:
##############################################################################
CONFIG proxy.config.http.anonymize_insert_client_ip INT 0
CONFIG proxy.config.http.insert_squid_x_forwarded_for INT 0
##############################################################################
# Security. Docs:
##############################################################################
CONFIG proxy.config.http.push_method_enabled INT 0
##############################################################################
# Cache control. Docs:
##############################################################################
CONFIG proxy.config.http.cache.ignore_client_cc_max_age INT 1
CONFIG proxy.config.http.normalize_ae_gzip INT 1
CONFIG proxy.config.http.cache.cache_responses_to_cookies INT 1
CONFIG proxy.config.http.cache.cache_urls_that_look_dynamic INT 1
CONFIG proxy.config.http.cache.when_to_revalidate INT 0
CONFIG proxy.config.http.cache.required_headers INT 2
#improvements from trafficserver wiki added by Emiliano
CONFIG proxy.config.http.chunking.size INT 131072
CONFIG proxy.config.http.server_session_sharing.match STRING host
CONFIG proxy.config.http.cache.ignore_server_no_cache INT 1
##############################################################################
# Heuristic cache expiration. Docs:
##############################################################################
CONFIG proxy.config.http.cache.heuristic_min_lifetime INT 3600
CONFIG proxy.config.http.cache.heuristic_max_lifetime INT 86400
CONFIG proxy.config.http.cache.heuristic_lm_factor FLOAT 0.100000
##############################################################################
# Network. Docs:
##############################################################################
CONFIG proxy.config.net.connections_throttle INT 30000
##############################################################################
# RAM and disk cache configurations. Docs:
##############################################################################
CONFIG proxy.config.cache.ram_cache.size INT 6
CONFIG proxy.config.cache.ram_cache_cutoff INT 4194304
CONFIG proxy.config.cache.limits.http.max_alts INT 5
CONFIG proxy.config.cache.max_doc_size INT 0
CONFIG proxy.config.cache.min_average_object_size INT 8000
##############################################################################
# Logging Config. Docs:
##############################################################################
CONFIG proxy.config.log.logging_enabled INT 3
CONFIG proxy.config.log.max_space_mb_for_logs INT 25000
CONFIG proxy.config.log.max_space_mb_headroom INT 1000
CONFIG proxy.config.log.squid_log_enabled INT 1
CONFIG proxy.config.log.squid_log_is_ascii INT 1
CONFIG proxy.config.log.rolling_enabled INT 1
CONFIG proxy.config.log.rolling_interval_sec INT 86400
CONFIG proxy.config.log.rolling_size_mb INT 10
CONFIG proxy.config.log.auto_delete_rolled_files INT 1
##############################################################################
# These settings control remapping, and if the proxy allows (open)
forward proxy or not. Docs:
##############################################################################
CONFIG proxy.config.url_remap.remap_required INT 0
CONFIG proxy.config.url_remap.pristine_host_hdr INT 0
##############################################################################
# SSL Termination. Docs:
##############################################################################
CONFIG proxy.config.ssl.client.verify.server INT 0
CONFIG proxy.config.ssl.client.CA.cert.filename STRING NULL
CONFIG proxy.config.ssl.server.cipher_suite STRING
ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:RC4-MD5:AES128-SHA:AES256-SHA:DES-CBC3-SHA!SRP:!DSS:!PSK:!aNULL:!eNULL:!SSLv2
CONFIG proxy.config.ssl.enabled INT 1
CONFIG proxy.config.ssl.server.honor_cipher_order INT 0
CONFIG proxy.config.ssl.TLSv1 INT 1
CONFIG proxy.config.ssl.compression INT 1
CONFIG proxy.config.ssl.server.cert.filename STRING cert.pem
CONFIG proxy.config.ssl.server.private_key.filename STRING key.pem
CONFIG proxy.config.ssl.server.cert.path STRING etc/trafficserver/ssl
CONFIG proxy.config.ssl.server.private_key.path STRING etc/trafficserver/ssl
CONFIG proxy.config.ssl.CA.cert.path STRING etc/trafficserver/ssl
CONFIG proxy.config.ssl.client.cert.path STRING etc/trafficserver/ssl
CONFIG proxy.config.ssl.client.private_key.path STRING etc/trafficserver/ssl
CONFIG proxy.config.ssl.client.CA.cert.path STRING etc/trafficserver/ssl
CONFIG proxy.config.ssl.server.multicert.filename STRING
ssl/ssl_multicert.config
##############################################################################
# ICP Configuration. Docs:
##############################################################################
CONFIG proxy.config.icp.enabled INT 0
##############################################################################
# Debugging. Docs:
##############################################################################
CONFIG proxy.config.diags.debug.enabled INT 1
CONFIG proxy.config.diags.debug.tags STRING cache_control|middlecast|ssl
# ToDo: Undocumented
CONFIG proxy.config.dump_mem_info_frequency INT 0
CONFIG proxy.config.http.slow.log.threshold INT 0
##############################################################################
# These are necessary (for now) to keep traffic_manager/_cop happy.
##############################################################################
CONFIG proxy.config.proxy_name STRING host160-253
CONFIG proxy.config.admin.user_id STRING nobody
CONFIG proxy.config.log.logfile_dir STRING var/log/trafficserver
CONFIG proxy.config.output.logfile STRING traffic.out
##############################################################################
# Cluster Subsystem. Docs:
##############################################################################
LOCAL proxy.local.cluster.type INT 3
CONFIG proxy.config.cluster.ethernet_interface STRING lo
CONFIG proxy.config.cluster.cluster_port INT 8086
CONFIG proxy.config.cluster.rsport INT 8088
CONFIG proxy.config.cluster.mcport INT 8089
CONFIG proxy.config.cluster.mc_group_addr STRING 224.0.1.37
CONFIG proxy.config.http.response_server_enabled INT 0
CONFIG proxy.config.http.insert_age_in_response INT 0
CONFIG proxy.config.cluster.cluster_configuration STRING cluster.config
CONFIG proxy.config.body_factory.template_sets_dir STRING
etc/trafficserver/body_factory
CONFIG proxy.config.cache.control.filename STRING cache.config
CONFIG proxy.config.cache.permit.pinning INT 1
CONFIG proxy.config.cache.enable_read_while_writer INT 0
CONFIG proxy.config.http.background_fill_active_timeout INT 1
CONFIG proxy.config.http.background_fill_completed_threshold FLOAT 0.500000