Skip to content

Commit b73b7e8

Browse files
authored
Merge pull request CactuseSecurity#2766 from tpurschke/cactus-develop
Cactus develop add packages for puppeteer
2 parents 40c69e5 + 8c93938 commit b73b7e8

File tree

70 files changed

+321
-274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+321
-274
lines changed

.github/workflows/test-install.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
runs-on: ubuntu-latest
4646
steps:
4747
- uses: actions/checkout@v3
48+
4849
- name: do test install in case of merged pull request
4950
run: cd /home/runner/work/firewall-orchestrator/firewall-orchestrator && ansible-playbook -e force_install=true site.yml -K
5051

documentation/developer-docs/csharp/wkhtmltopdf.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

documentation/installer/install-advanced.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ Note that the following domains must be reachable through the proxy:
7575
postgresql.org
7676
microsoft.com
7777
nuget.org
78+
googlechromelabs.github.io
79+
storage.googleapis.com
7880

7981
Only for the initial setup of python venv
8082

documentation/installer/install-for-testing.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,27 @@ Set dotnet installation mode to "debug" as follows (default = Release)
3939
```console
4040
ansible-playbook/ site.yml -e "dotnet_mode=Debug" -K
4141
```
42-
## Running integration tests after installation/upgrade
4342

44-
To only run tests (for an existing installation) use tags as follows:
43+
## Running unit tests after installation/upgrade
44+
45+
To only run unit tests (for an existing installation only to be used in comination with installation_mode=upgrade) use tags as follows:
4546

4647
```console
47-
ansible-playbook site.yml --tags test -K
48+
ansible-playbook site.yml --tags unittests -K
4849
```
4950

50-
## Running unit tests only
51+
## Running integration tests after installation/upgrade
52+
53+
To only run integration tests (for an existing installation only to be used in comination with installation_mode=upgrade) use tags as follows:
54+
55+
```console
56+
ansible-playbook site.yml --tags integrationtests -K
57+
```
5158

52-
To only run tests (for an existing installation, can only be combined with installation_mode=upgrade) use tags as follows:
59+
## Running installation without any tests
5360

5461
```console
55-
ansible-playbook site.yml --tags unittest -e "installation_mode=upgrade" -K
62+
ansible-playbook site.yml -K --skip-tags unittests,integrationtests
5663
```
5764

5865
## Parameter "api_no_metadata" to prevent meta data import

inventory/group_vars/all.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ wsgi_package_name: libapache2-mod-wsgi
138138

139139
############# wkhtmltopdf #########################
140140

141-
wkhtmltopdf_version: "0.12.6.1-3"
141+
# wkhtmltopdf_version: "0.12.6.1-3"
142142

143143

144144
################# testing #########################

roles/database/files/upgrade/8.6.1.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ $$ LANGUAGE plpgsql;
7070
-- EXECUTE PROCEDURE owner_network_change_triggered ();
7171

7272
DROP FUNCTION IF EXISTS recert_refresh_per_owner(INTEGER);
73+
DROP FUNCTION IF EXISTS refresh_view_rule_with_owner();
7374
DROP TRIGGER IF EXISTS owner_network_change ON owner_network CASCADE;
7475
DROP FUNCTION IF EXISTS owner_network_change_triggered ();
7576
DROP TRIGGER IF EXISTS owner_change ON owner CASCADE;

roles/lib/files/FWO.Report/ReportBase.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
using FWO.Report.Filter;
55
using FWO.Config.Api;
66
using System.Text;
7-
using PuppeteerSharp.Media;
8-
using PuppeteerSharp;
97
using System.Reflection;
10-
using System.IO;
8+
using PuppeteerSharp;
9+
using PuppeteerSharp.Media;
1110
using PuppeteerSharp.BrowserData;
1211

1312
namespace FWO.Report
@@ -240,11 +239,14 @@ public static string ToUtcString(string? timestring)
240239

241240
InstalledBrowser? brw = await browserFetcher.DownloadAsync(BrowserTag.Stable);
242241

242+
var isGitHubActions = Environment.GetEnvironmentVariable("GITHUB_ACTIONS") == "true";
243243
using IBrowser? browser = await Puppeteer.LaunchAsync(new LaunchOptions
244244
{
245-
ExecutablePath = brw.GetExecutablePath(),
245+
ExecutablePath = isGitHubActions? "/usr/bin/chromium-browser" : brw.GetExecutablePath(),
246246
Headless = true,
247-
Args = ["--no-sandbox"]
247+
Args = isGitHubActions?
248+
new[] { "--no-sandbox", "--database=/tmp", "--disable-setuid-sandbox" }
249+
: new string[0] // No additional arguments locally
248250
});
249251

250252
try

roles/lib/handlers/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@
2424
- "Try to upgrade {{ product_name }} later or contact the support [email protected]"
2525
listen: "lib handler"
2626
when: lib_handler_guard == "start"
27+
28+
- name: Reload and Restart AppArmor
29+
service:
30+
name: apparmor
31+
state: restarted
32+
become: true
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
- block:
2+
# install libs needed for nuget package PuppeteerSharp
3+
- name: Define core packages
4+
set_fact:
5+
core_packages:
6+
- ca-certificates
7+
- fonts-liberation
8+
- libappindicator3-1
9+
- libatk-bridge2.0-0
10+
- libatk1.0-0
11+
- libcups2
12+
- libdbus-1-3
13+
- libdrm2
14+
- libgbm1
15+
- libnspr4
16+
- libnss3
17+
- libx11-xcb1
18+
- libxcomposite1
19+
- libxdamage1
20+
- libxrandr2
21+
- xdg-utils
22+
23+
- name: Define default platform-specific library names
24+
set_fact:
25+
glib_library: libglib2.0-0
26+
sound_library: libasound2
27+
28+
- name: Define new library names based on newer OS versions
29+
set_fact:
30+
glib_library: libglib2.0-0t64
31+
sound_library: libasound2t64
32+
when: >
33+
ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_version'] | float >= 24.04
34+
or ansible_facts['distribution'] == "Debian" and ansible_facts['distribution_version'] | float >= 13
35+
or ansible_facts['distribution'] == "Debian" and ansible_lsb.codename == "trixie"
36+
37+
- block: # only use apparmor for ubuntu 24.04ff
38+
- name: Ensure the /etc/apparmor.d directory exists
39+
file:
40+
path: /etc/apparmor.d
41+
state: directory
42+
mode: '0755'
43+
44+
- name: Create /etc/apparmor.d/chrome-dev-builds for Chrome
45+
copy:
46+
dest: /etc/apparmor.d/chrome-dev-builds
47+
content: |
48+
abi <abi/{{ abi_version }}>,
49+
include <tunables/global>
50+
51+
profile /usr/local/bin/**/chrome flags=(unconfined) {
52+
userns,
53+
54+
# Site-specific additions and overrides. See local/README for details.
55+
# Include the local overrides only if the file exists.
56+
# This is a common best practice to avoid parser errors.
57+
include if exists <local/chrome>
58+
}
59+
mode: '0644'
60+
notify:
61+
- Reload and Restart AppArmor
62+
63+
when: ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_version'] | float >= 24.04
64+
65+
- name: Install additional libraries for old Debian 11
66+
apt:
67+
name:
68+
- libpangocairo-1.0-0
69+
- libpangoft2-1.0-0
70+
state: present
71+
update_cache: yes
72+
when: ansible_facts['distribution'] == "Debian" and ansible_facts['distribution_version'] == "11"
73+
74+
- name: Combine all packages
75+
set_fact:
76+
platform_packages: "{{ core_packages + [sound_library, glib_library] }}"
77+
78+
- name: Install all combined dependencies
79+
apt:
80+
name: "{{ platform_packages }}"
81+
state: present
82+
update_cache: yes
83+
84+
become: true
85+
environment: "{{ proxy_env }}"
86+
87+
# get google chrome for pdf generation
88+
- name: get last known good versions of chrome to download
89+
uri:
90+
url: https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json
91+
register: chrome_versions
92+
93+
- name: parse latest stable versions for chrome and headless shell
94+
set_fact:
95+
stable_chrome_versions: "{{ chrome_versions['json']['channels']['Stable']['downloads'] }}"
96+
chrome_dest: "/usr/local/bin/Chrome/Linux-{{ chrome_versions['json']['channels']['Stable']['version'] }}"
97+
headless_shell_dest: "/usr/local/bin/ChromeHeadlessShell/Linux-{{ chrome_versions['json']['channels']['Stable']['version'] }}"
98+
99+
- block:
100+
- name: install unzip
101+
package:
102+
name: unzip
103+
state: present
104+
105+
- name: create chrome install path
106+
file:
107+
path: "{{ chrome_dest }}"
108+
state: directory
109+
mode: '0755'
110+
111+
- name: create chrome headless shell install path
112+
file:
113+
path: "{{ headless_shell_dest }}"
114+
state: directory
115+
mode: '0755'
116+
117+
- name: download google chrome and unpack
118+
unarchive:
119+
src: "{{ stable_chrome_versions['chrome'] | selectattr('platform', 'match', 'linux64') | map(attribute='url') | first }}"
120+
dest: "{{ chrome_dest }}"
121+
remote_src: yes
122+
123+
- name: download google chrome headless shell and unpack
124+
unarchive:
125+
src: "{{ stable_chrome_versions['chrome-headless-shell'] | selectattr('platform', 'match', 'linux64') | map(attribute='url') | first }}"
126+
dest: "{{ headless_shell_dest }}"
127+
remote_src: yes
128+
129+
become: true
130+
environment: "{{ proxy_env }}"

roles/lib/tasks/install_wkhtml_pdf.yml

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)