Skip to content

Commit

Permalink
Merge pull request #29 from redBorder/development
Browse files Browse the repository at this point in the history
Release 0.2.2
  • Loading branch information
manegron authored Jun 5, 2024
2 parents a2d72ef + 00d0d6d commit 6590987
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 36 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,55 @@ jobs:
echo "TAG=$TAG" >> $GITHUB_ENV
shell: bash

- name: Check if Tag Exists
id: check_tag
run: |
if git rev-parse "refs/tags/${{ env.TAG }}" >/dev/null 2>&1; then
echo "Tag ${{ env.TAG }} already exists, exiting."
exit 1
fi
shell: bash

- name: Set Version
if: success()
run: echo "VERSION=${{ env.TAG }}" >> $GITHUB_ENV

- name: Run Docker Container
if: success()
run: docker run --privileged -d --name builder --network host rockylinux:9 /bin/sleep infinity

- name: Install build tools RPM
if: success()
run: |
docker cp ./ builder:/build
docker exec builder bash -c "yum install -y epel-release && yum install -y make git mock"
docker exec builder bash -c "rm -rf /etc/mock/default.cfg"
- name: Setup SDK
if: success()
run: |
docker exec builder bash -c "curl https://raw.githubusercontent.com/redBorder/repoinit/master/sdk9.cfg > /build/sdk9.cfg"
docker exec builder bash -c "echo \"config_opts['use_host_resolv'] = True\" >> /build/sdk9.cfg"
docker exec builder bash -c "ln -s /build/sdk9.cfg /etc/mock/default.cfg"
- name: Build RPM using mock
if: success()
run: |
docker exec builder bash -c "git config --global --add safe.directory /build"
docker exec builder bash -c "cd /build/ && VERSION=${{ env.TAG }} make rpm"
- name: Copy RPMS
if: success()
run: |
docker cp builder:/build/packaging/rpm/pkgs/. ./rpms
- name: Delete non-.rpm files
if: success()
run: |
find ./rpms -type f -not -name '*.rpm' -exec rm {} \;
- name: Release
if: success()
uses: softprops/action-gh-release@v1
with:
files: ./rpms/*
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
cookbook-rb-proxy CHANGELOG
===============

## 0.2.2

- David Vanhoucke
- [28ae7e2] add temporary variables in node.run_state
- Miguel Negrón
- [3e930e8] Update README.md
- [c7e880b] Update rpm.yml

## 0.2.1

- Miguel Negrón
Expand Down
33 changes: 14 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
# proxy Cookbook
# cookbook-rb-proxy
[![Build Status][build-shield]][build-url]
[![Linters][linters-shield]][linters-url]
[![License][license-shield]][license-url]

<!-- Badges -->
[build-shield]: https://github.com/redBorder/cookbook-rb-proxy/actions/workflows/rpm.yml/badge.svg?branch=master
[build-url]: https://github.com/redBorder/cookbook-rb-proxy/actions/workflows/rpm.yml?query=branch%3Amaster
[linters-shield]: https://github.com/redBorder/cookbook-rb-proxy/actions/workflows/lint.yml/badge.svg?event=push
[linters-url]: https://github.com/redBorder/cookbook-rb-proxy/actions/workflows/lint.yml
[license-shield]: https://img.shields.io/badge/license-AGPLv3-blue.svg
[license-url]: https://github.com/cookbook-rb-proxy/blob/HEAD/LICENSE

Cookbook to configure a redborder proxy

## Requirements

depends 'kafka', '0.0.1'
depends 'zookeeper', '0.0.1'

### Platforms

- Rocky Linux 9

### Chef

- Chef 12.0 or later

# BUILDING

- Build rpm package for redborder platform:
* git clone https://github.com/redborder/cookbook-rb-proxy.git
* cd cookbook-rb-proxy
* make
* RPM packages is under packaging/rpm/pkgs/
- Chef 15.7.0 or later

## Contributing

Expand All @@ -33,8 +31,5 @@ depends 'zookeeper', '0.0.1'
6. Submit a Pull Request using Github

## License
GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007

## Authors
Miguel Negrón <manegron@redborder.com>
David Vanhoucke <dvanhoucke@redborder.com>
GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
2 changes: 1 addition & 1 deletion resources/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
maintainer_email 'git@redborder.com'
license 'AGPL-3.0'
description 'Installs/Configures redborder proxy'
version '0.2.1'
version '0.2.2'

depends 'rb-common'
depends 'rb-selinux'
Expand Down
26 changes: 13 additions & 13 deletions resources/recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,45 +55,45 @@
end

rbscanner_config "Configure redborder-scanner" do
scanner_nodes node["redborder"]["sensors_info_all"]["scanner-sensor"]
scanner_nodes node.run_state["sensors_info_all"]["scanner-sensor"]
action (proxy_services["redborder-scanner"] ? [:add] : [:remove])
end

f2k_config "Configure f2k" do
sensors node["redborder"]["sensors_info"]["flow-sensor"]
sensors node.run_state["sensors_info"]["flow-sensor"]
action (proxy_services["f2k"] ? [:add] : [:remove])
end

pmacct_config "Configure pmacct" do
sensors node["redborder"]["sensors_info"]["flow-sensor"]
sensors node.run_state["sensors_info"]["flow-sensor"]
action (proxy_services["pmacct"] ? [:add] : [:remove])
end

logstash_config "Configure logstash" do
cdomain node["redborder"]["cdomain"]
flow_nodes node["redborder"]["sensors_info_all"]["flow-sensor"]
namespaces node["redborder"]["namespaces"]
vault_nodes node["redborder"]["sensors_info_all"]["vault-sensor"]
device_nodes node["redborder"]["sensors_info_all"]["device-sensor"]
flow_nodes node.run_state["sensors_info_all"]["flow-sensor"]
namespaces node.run_state["namespaces"]
vault_nodes node.run_state["sensors_info_all"]["vault-sensor"]
device_nodes node.run_state["sensors_info_all"]["device-sensor"]
action (proxy_services["logstash"] ? [:add] : [:remove])
end

rsyslog_config "Configure rsyslog" do
vault_nodes node["redborder"]["sensors_info_all"]["vault-sensor"]
vault_nodes node.run_state["sensors_info_all"]["vault-sensor"]
action (proxy_services["rsyslog"] ? [:add] : [:remove])
end

rbnmsp_config "Configure redborder-nmsp" do
memory node["redborder"]["memory_services"]["redborder-nmsp"]["memory"]
flow_nodes node["redborder"]["sensors_info_all"]["flow-sensor"]
flow_nodes node.run_state["sensors_info_all"]["flow-sensor"]
hosts node["redborder"]["zookeeper"]["zk_hosts"]
mode "proxy"
action (proxy_services["redborder-nmsp"] ? [:add, :configure_keys] : [:remove])
end

n2klocd_config "Configure n2klocd" do
mse_nodes node["redborder"]["sensors_info_all"]["mse-sensor"]
meraki_nodes node["redborder"]["sensors_info_all"]["meraki-sensor"]
mse_nodes node.run_state["sensors_info_all"]["mse-sensor"]
meraki_nodes node.run_state["sensors_info_all"]["meraki-sensor"]
n2klocd_managers [node.name]
memory node["redborder"]["memory_services"]["n2klocd"]["memory"]
action (proxy_services["n2klocd"] ? [:add] : [:remove])
Expand All @@ -105,7 +105,7 @@

# TODO: replace node["redborder"]["services"] in action with "proxy_services"..
rbale_config "Configure redborder-ale" do
ale_nodes node["redborder"]["sensors_info_all"]["ale-sensor"]
ale_nodes node.run_state["sensors_info_all"]["ale-sensor"]
action (node["redborder"]["services"]["redborder-ale"] ? [:add] : [:remove])
end

Expand All @@ -132,7 +132,7 @@

## TODO: replace node["redborder"]["services"] in action with "proxy_services"..
#freeradius_config "Configure radiusd" do
# flow_nodes node["redborder"]["sensors_info_all"]["flow-sensor"]
# flow_nodes node.run_state["sensors_info_all"]["flow-sensor"]
# mode "proxy"
# action (node["redborder"]["services"]["radiusd"] ? [:config_common] : [:remove])
#end
Expand Down
6 changes: 3 additions & 3 deletions resources/recipes/prepare_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@
node.default["redborder"]["cdomain"] = cdomain

#get sensors info
node.default["redborder"]["sensors_info"] = get_sensors_info()
node.run_state["sensors_info"] = get_sensors_info()

#get sensors info full info
node.default["redborder"]["sensors_info_all"] = get_sensors_all_info()
node.run_state["sensors_info_all"] = get_sensors_all_info()

#get namespaces
node.default["redborder"]["namespaces"] = get_namespaces
node.run_state["namespaces"] = get_namespaces

#get string with all zookeeper hosts and port separated by commas, its needed for multiples services
zk_port = node["redborder"]["zookeeper"]["port"]
Expand Down

0 comments on commit 6590987

Please sign in to comment.