devops:mock:hoverfly
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
devops:mock:hoverfly [2022/04/29 10:39] – created skipidar | devops:mock:hoverfly [2023/11/01 07:15] (current) – ↷ Page moved from camunda:devops:mock:hoverfly to devops:mock:hoverfly skipidar | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Hoverfly ===== | + | ====== HoverFly ===== |
+ | |||
+ | === CA LISA === | ||
+ | ServiceVirtualization tool. | ||
+ | Like CA LISA: http:// | ||
+ | |||
+ | Microservices and " | ||
+ | https:// | ||
+ | |||
+ | === Hoverfly === | ||
+ | |||
+ | Download | ||
+ | http:// | ||
+ | |||
+ | |||
+ | {{https:// | ||
+ | |||
+ | |||
+ | Documentation: | ||
+ | |||
+ | Repository: https:// | ||
+ | Releases: https:// | ||
+ | |||
+ | Tutorials: http:// | ||
+ | |||
+ | |||
+ | === Starting hoverfly === | ||
+ | |||
+ | <sxh js> | ||
+ | |||
+ | # start | ||
+ | hoverfly \ | ||
+ | -ap 8006 \ | ||
+ | -pp 8005 \ | ||
+ | -username " | ||
+ | -password " | ||
+ | -listen-on-host 0.0.0.0 \ | ||
+ | -logs-file "/ | ||
+ | |||
+ | # start on windows | ||
+ | .\hoverfly ` | ||
+ | -ap 8888 ` | ||
+ | -pp 8005 ` | ||
+ | -username " | ||
+ | -password " | ||
+ | -listen-on-host 0.0.0.0 ` | ||
+ | -logs-file "/ | ||
+ | </ | ||
+ | |||
+ | === Enable proxy === | ||
+ | |||
+ | To enable the proxy - you can proxy everything. | ||
+ | You will just have to allow the traffic to the hoverfly running on port 8888, | ||
+ | and to the frontend running on port 8500 or 4200. | ||
+ | |||
+ | Depending on the way, you started it- via a jar or via a "ng start" | ||
+ | |||
+ | {{https:// | ||
+ | |||
+ | |||
+ | === Recording the traffic === | ||
+ | |||
+ | Set the hoverfly into the " | ||
+ | |||
+ | {{https:// | ||
+ | |||
+ | And record the traffic, e.g. by navigating the REST api URLs manually. | ||
+ | |||
+ | Then export the strategy.json | ||
+ | |||
+ | < | ||
+ | hoverctl export simulation.json | ||
+ | </ | ||
+ | |||
+ | Congratulation! You are now independent from the backend and may test the frontend - independently from backend. | ||
+ | |||
+ | |||
+ | By just importing the recorded actions | ||
+ | < | ||
+ | hoverctl import simulation.json | ||
+ | </ | ||
+ | |||
+ | You can see the captured datasets under the GUI | ||
+ | {{https:// | ||
+ | |||
+ | |||
+ | === how do I configure Ubuntu OS, to route all HTTP and HTTPS traffic via a HTTP proxy as a gateway? | ||
+ | |||
+ | Ideally one would not want to configure the application under test. | ||
+ | |||
+ | So we search for a proxification method, allowing to redirect HTTP, HTTPS traffic via a proxy transparently to the application. | ||
+ | |||
+ | Here https:// | ||
+ | the tool *proxychains* is recommended. | ||
+ | |||
+ | |||
+ | @Deprecated | ||
+ | https:// | ||
+ | |||
+ | Replacement | ||
+ | https:// | ||
+ | |||
+ | |||
+ | == Install proxychains == | ||
+ | |||
+ | <sxh shell> | ||
+ | sudo apt update | ||
+ | sudo apt install proxychains4 | ||
+ | </ | ||
+ | |||
+ | |||
+ | == Configure the proxychain == | ||
+ | |||
+ | **sudo vim / | ||
+ | |||
+ | <sxh shell> | ||
+ | # proxychains.conf | ||
+ | # | ||
+ | # HTTP, SOCKS4, SOCKS5 tunneling proxifier with DNS. | ||
+ | # | ||
+ | |||
+ | # The option below identifies how the ProxyList is treated. | ||
+ | # only one option should be uncommented at time, | ||
+ | # otherwise the last appearing option will be accepted | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # Dynamic - Each connection will be done via chained proxies | ||
+ | # all proxies chained in the order as they appear in the list | ||
+ | # at least one proxy must be online to play in chain | ||
+ | # (dead proxies are skipped) | ||
+ | # otherwise EINTR is returned to the app | ||
+ | # | ||
+ | strict_chain | ||
+ | # | ||
+ | # Strict - Each connection will be done via chained proxies | ||
+ | # all proxies chained in the order as they appear in the list | ||
+ | # all proxies must be online to play in chain | ||
+ | # otherwise EINTR is returned to the app | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # Random - Each connection will be done via random proxy | ||
+ | # (or proxy chain, see chain_len) from the list. | ||
+ | # this option is good to test your IDS :) | ||
+ | |||
+ | # Make sense only if random_chain | ||
+ | #chain_len = 2 | ||
+ | |||
+ | # Quiet mode (no output from library) | ||
+ | # | ||
+ | |||
+ | # Proxy DNS requests - no leak for DNS data | ||
+ | proxy_dns | ||
+ | |||
+ | # Some timeouts in milliseconds | ||
+ | tcp_read_time_out 15000 | ||
+ | tcp_connect_time_out 8000 | ||
+ | |||
+ | # ProxyList format | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # Examples: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # proxy types: http, socks4, socks5 | ||
+ | # ( auth types supported: " | ||
+ | # | ||
+ | [ProxyList] | ||
+ | # add proxy here ... | ||
+ | # meanwile | ||
+ | # defaults set to " | ||
+ | http 127.0.0.1 | ||
+ | </ | ||
+ | |||
+ | |||
+ | *note* : | ||
+ | |||
+ | " | ||
+ | |||
+ | |||
+ | == Make the OS trust the hoverfly CA certificate == | ||
+ | |||
+ | Add it to the trusted certificates https:// | ||
+ | |||
+ | <sxh shell> | ||
+ | # get the hoverfly cert | ||
+ | wget https:// | ||
+ | |||
+ | sudo apt-get install -y ca-certificates | ||
+ | sudo cp / | ||
+ | sudo update-ca-certificates | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | == Call some URL with proxy in the middle == | ||
+ | |||
+ | Now you can make " | ||
+ | |||
+ | |||
+ | <sxh shell> | ||
+ | proxychains curl -iv https:// | ||
+ | |||
+ | |||
+ | [proxychains] config file found: / | ||
+ | [proxychains] preloading / | ||
+ | [proxychains] DLL init: proxychains-ng 4.14 | ||
+ | * | ||
+ | * TCP_NODELAY set | ||
+ | [proxychains] Strict chain ... 127.0.0.1: | ||
+ | * Connected to google.com (127.0.0.1) port 443 (#0) | ||
+ | * ALPN, offering h2 | ||
+ | * ALPN, offering http/1.1 | ||
+ | * successfully set certificate verify locations: | ||
+ | * | ||
+ | CApath: / | ||
+ | * TLSv1.3 (OUT), TLS handshake, Client hello (1): | ||
+ | * TLSv1.3 (IN), TLS handshake, Server hello (2): | ||
+ | * TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): | ||
+ | * TLSv1.3 (IN), TLS handshake, Certificate (11): | ||
+ | * TLSv1.3 (IN), TLS handshake, CERT verify (15): | ||
+ | * TLSv1.3 (IN), TLS handshake, Finished (20): | ||
+ | * TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1): | ||
+ | * TLSv1.3 (OUT), TLS handshake, Finished (20): | ||
+ | * SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256 | ||
+ | * ALPN, server did not agree to a protocol | ||
+ | * Server certificate: | ||
+ | * subject: O=GoProxy untrusted MITM proxy Inc; CN=google.com | ||
+ | * start date: Jan 1 00:00:00 1970 GMT | ||
+ | * expire date: Dec 31 00:00:00 2049 GMT | ||
+ | * subjectAltName: | ||
+ | * issuer: O=Hoverfly Authority; CN=hoverfly.proxy | ||
+ | * SSL certificate verify ok. | ||
+ | > GET / HTTP/1.1 | ||
+ | > Host: google.com | ||
+ | > User-Agent: curl/ | ||
+ | > Accept: */* | ||
+ | > | ||
+ | * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): | ||
+ | * Mark bundle as not supporting multiuse | ||
+ | < HTTP/1.1 301 Moved Permanently | ||
+ | HTTP/1.1 301 Moved Permanently | ||
+ | < Alt-Svc: h3=": | ||
+ | Alt-Svc: h3=": | ||
+ | < Cache-Control: | ||
+ | Cache-Control: | ||
+ | < Connection: close | ||
+ | Connection: close | ||
+ | < Content-Security-Policy-Report-Only: | ||
+ | Content-Security-Policy-Report-Only: | ||
+ | < Content-Type: | ||
+ | Content-Type: | ||
+ | < Date: Fri, 23 Jun 2023 06:30:08 GMT | ||
+ | Date: Fri, 23 Jun 2023 06:30:08 GMT | ||
+ | < Expires: Fri, 23 Jun 2023 06:30:08 GMT | ||
+ | Expires: Fri, 23 Jun 2023 06:30:08 GMT | ||
+ | < Hoverfly: Was-Here | ||
+ | Hoverfly: Was-Here | ||
+ | < Location: https:// | ||
+ | Location: https:// | ||
+ | < P3p: CP=" | ||
+ | P3p: CP=" | ||
+ | < Server: gws | ||
+ | Server: gws | ||
+ | < Set-Cookie: CONSENT=PENDING+692; | ||
+ | Set-Cookie: CONSENT=PENDING+692; | ||
+ | < Transfer-Encoding: | ||
+ | Transfer-Encoding: | ||
+ | < X-Frame-Options: | ||
+ | X-Frame-Options: | ||
+ | < X-Xss-Protection: | ||
+ | X-Xss-Protection: | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | The document has moved | ||
+ | <A HREF=" | ||
+ | </ | ||
+ | * Closing connection 0 | ||
+ | * TLSv1.3 (OUT), TLS alert, close notify (256): | ||
+ | </ | ||
+ |
devops/mock/hoverfly.1651228748.txt.gz · Last modified: by skipidar