# adfullssl **Repository Path**: mirrors_linkedin/adfullssl ## Basic Information - **Project Name**: adfullssl - **Description**: AdFullSsl is a tool that can automatically detect SSL non-compliant ads and fix them - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-09 - **Last Updated**: 2026-03-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # AdFullSsl AdFullSsl is a tool that can automatically detect SSL non-compliant ads and fix them. ## Background Web browsers connect HTTPS pages using encrypted connection with SSL/TLS, but no encryption is made on regular HTTP connections. If the HTTPS page includes contents retrieved through HTTP (insecure) connections, the user is subject to a risk of main-in-the-middle attack, in which an attacker can steal user's sensitive information on unencrypted connection. As a practical countermeasure, insecure contents are blocked by default on HTTPS pages on recent versions of web browsers after Firefox 23, Chrome 21 and Internet Explorer 10. However, it will break page layout and some functionalities. Internet Explorer displays an annoying warning message each time insecure content is detected. To prevent such poor user experience, all contents should be served over HTTPS on HTTPS pages. Ads are not exceptions. Many web pages contain ads and these ads often use external resources, such as iframes, flash files, images, and stylesheets. ## Overview The goal of AdFullSsl is to detect SSL non-compliant ads and fix them. To this end, it mainly performs the following steps: 1. Modify ads by replacing http: with https: or relative protocol in which URLs does not have protocol 2. Locate ads on HTTPS server and browse them with headless browsers to capture all the traffic 3. Analyze the traffic to detect insecure requests 4. Upload the modified ads if any modification was made on step 1 and became secure AdFullSsl supports creatives served by Google’s DoubleClick for Publishers (DFP). A creative is an actual ad displayed in web pages. ## Installation This software was tested on Python 2.6.6 on x86_64 Linux 2.6 Red Hat Enterprise 6.1. 1. Check out a package of AdFullSsl:
$ git clone https://github.com/linkedin/adfullssl.git2. Install the installation tools for python. Please use the package manager installed on your environment:
$ yum install python-pip3. Install python packages:
$ pip install -r requirements.txt4. Install a Flash-supported version of PhantomJS from [r3b/phantomjs]. Please make sure that the flash support works fine with the example script on [ryanbridges.org]. 5. To configure authentication for DFP API, check out [googleads-python-legacy-lib] and run `adspygoogle/scripts/adspygoogle/dfp/config.py`. Two credential files `dfp_api_auth.pkl` and `dfp_api_config.pkl` will be created under your home directory. 6. Create your private key to use for SSL and public x509 certificate, and move them to `scanner/baseline/keys`. The name of private key should be `privatekey.pem` and that of public x509 certificate should be `certificate.pem`. This is an example command to create these keys.
$ openssl genrsa -out privatekey.pem 1024
$ openssl req -new -key privatekey.pem -out certificate.csr
$ openssl x509 -req -in certificate.csr -signkey privatekey.pem -out certificate.pem
$ mv privatekey.pem certificate.pem conf/keys/
[r3b/phantomjs]: https://github.com/r3b/phantomjs
[ryanbridges.org]: http://www.ryanbridges.org/2013/05/21/putting-the-flash-back-in-phantomjs/
[googleads-python-legacy-lib]: https://github.com/googleads/googleads-python-legacy-lib
## Usage
1. Edit configuration file. Specify the path to your `phantomjs` command in the "phantomjs" parameter in the "Browser" section. Also, please set `False` to the items in the "Steps" section if you do not need to run them.
$ vi conf/config.ini2. Run the scanner:
$ python src/adscan/run.py### Set cookies Cookies stored in files under the `conf/cookies` directory are used while browsing ads. The file name should be the domain name the cookies belong to. The cookies can be defined as the file content and each cookie are delimited by a semi-colon. For example, cookies in `scanner/baseline/cookies/www.example.com.txt` file belong to `www.example.com` and its content is like this:
xxx="abc=0000000000000000000000"; yyy="version=1111111111111111111"; SESSIONID="00000000000000000000";## How it works ### Overall steps The scanner executes the following steps: Step | Summary -----------------------|------------------------------------------------------------------------ Download creative ids | Download ids of recently-served creatives via ReportService of DFP API Donwload creatives | Download creative via CreativeService of DFP API Modify creatives | See the next section for the detail about how to modify creatives Browse ads over HTTPS | Host creatives on HTTPS server and browse them with headless browsers Browse ads over HTTP | Host creatives on HTTP server and browse them with headless browsers Check SSL compliance | Detect HTTP requests and compare the number of requests over HTTPS and HTTP Upload creatives | Upload creatives if they become compliant after modification via CreativeService of DFP API Compress log file | Compress the log directory at the end of the scanning process ### Browsing steps The steps for browsing ads include the following steps: Step | Summary ------------------------------------|---------------------------------------------------------------------- Load cookies | Load customized cookies to the headless browser. Browse ads and capture all requests | Browse ads with the headless browser. The browser ignores all SSL certificate errors and captures all the request the ads make. Check HTTPS availability | Send a request to each requested URL captured in the previous step. The browser can recognize SSL certificate errors as well as other types of errors such as 4xx client-side errors and 5xx server-side errors, so that to identify the HTTPS availability on the servers.