Skip to content

Commit

Permalink
chore: pre-commit (#1240)
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Rys authored Aug 20, 2021
1 parent 2ba3bd3 commit 157e50c
Show file tree
Hide file tree
Showing 72 changed files with 1,412 additions and 659 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* @rfaircloth-splunk
package/etc/ @rfaircloth @nandinivij
.pre-commit-config.yaml @arys-splunk
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright 2021 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-merge-conflict
- repo: https://github.com/psf/black
rev: 21.7b0
hooks:
- id: black
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ Get involved, try it out, ask questions, contribute filters, and make new friend

We welcome feedback and contributions from the community! Please see our [contribution guidelines](/docs/CONTRIBUTING.md) for more information on how to get involved. PR contributions require acceptance of both the code of conduct and the contributor license agreement.

This repository uses `pre-commit`. After installing dependencies, please do
```bash
pre-commit install
```

## License

* Configuration and documentation licensed subject to [CC0](LICENSE-CC0)
Expand Down
10 changes: 3 additions & 7 deletions package/etc/conf.d/sc4slib/dest_hec/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,11 @@

workers = os.getenv(f"SC4S_DEST_SPLUNK_HEC_{ group }_WORKERS", 10)
headers = []
user_headers = os.getenv(
f"SC4S_DEST_SPLUNK_HEC_{ group }_HEADERS", ""
)
if user_headers!="":
user_headers = os.getenv(f"SC4S_DEST_SPLUNK_HEC_{ group }_HEADERS", "")
if user_headers != "":
headers += user_headers.split(",")

token=os.getenv(f"SC4S_DEST_SPLUNK_HEC_{ group }_TOKEN")
token = os.getenv(f"SC4S_DEST_SPLUNK_HEC_{ group }_TOKEN")
headers.append(f"Authorization: Splunk {token}")

if os.getenv(f"SC4S_DEST_SPLUNK_HEC_{ group }_CONNECTION_CLOSE", "yes").lower() in [
Expand All @@ -75,7 +73,6 @@
else:
headers.append(f"Connection: keep-alive")


msg = tm.render(
group=group,
altname=altname,
Expand Down Expand Up @@ -108,7 +105,6 @@
peer_verify=os.getenv(f"SC4S_DEST_SPLUNK_HEC_{ group }_TLS_VERIFY", "yes"),
cipher_suite=os.getenv(f"SC4S_DEST_SPLUNK_HEC_{ group }_CIPHER_SUITE"),
ssl_version=os.getenv(f"SC4S_DEST_SPLUNK_HEC_{ group }_SSL_VERSION"),

)

print(msg)
2 changes: 0 additions & 2 deletions package/etc/conf.d/sc4slib/lp_dest_alts_global/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@
for d in os.getenv("SC4S_DEST_GLOBAL_ALTERNATES").split(","):
msg = tm.render(destination=d)
print(msg)


52 changes: 33 additions & 19 deletions package/etc/conf.d/sc4slib/source_syslog/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
use_tls = False

if os.getenv(f"SC4S_RUNTIME_ENV", "unknown").lower() == "k8s":
cert_file="tls.crt"
key_file="tls.key"
cert_file = "tls.crt"
key_file = "tls.key"
else:
cert_file="server.pem"
key_file="server.key"
cert_file = "server.pem"
key_file = "server.key"


for port_id in ports.split(","):
Expand All @@ -76,42 +76,56 @@
port_udp=os.getenv(f"SC4S_LISTEN_{ port_id }_UDP_PORT", "disabled").split(","),
port_udp_sockets=int(os.getenv(f"SC4S_SOURCE_LISTEN_UDP_SOCKETS", 4)),
port_udp_sorecvbuff=os.getenv(f"SC4S_SOURCE_UDP_SO_RCVBUFF", 17039360),

port_tcp=os.getenv(f"SC4S_LISTEN_{ port_id }_TCP_PORT", "disabled").split(","),
port_tcp_sockets=int(os.getenv(f"SC4S_SOURCE_LISTEN_TCP_SOCKETS", 1)),
port_tcp_max_connections=os.getenv(f"SC4S_SOURCE_TCP_MAX_CONNECTIONS", "2000"),
port_tcp_log_iw_size=os.getenv(f"SC4S_SOURCE_TCP_IW_SIZE", "20000000"),
port_tcp_log_fetch_limit=os.getenv(f"SC4S_SOURCE_TCP_FETCH_LIMIT", "2000"),
port_tcp_so_recvbuff=os.getenv(f"SC4S_SOURCE_TCP_SO_RCVBUFF", "17039360"),

port_tls=os.getenv(f"SC4S_LISTEN_{ port_id }_TLS_PORT", "disabled").split(","),
port_tls_sockets=int(os.getenv(f"SC4S_SOURCE_LISTEN_TLS_SOCKETS", 1)),
port_tls_max_connections=os.getenv(f"SC4S_SOURCE_TLS_MAX_CONNECTIONS", "2000"),
port_tls_log_iw_size=os.getenv(f"SC4S_SOURCE_TCP_IW_SIZE", "20000000"),
port_tls_log_fetch_limit=os.getenv(f"SC4S_SOURCE_TCP_FETCH_LIMIT", "2000"),
port_tls_so_recvbuff=os.getenv(f"SC4S_SOURCE_TLS_SO_RCVBUFF", "17039360"),
port_tls_tls_options=os.getenv(f"SC4S_SOURCE_TLS_OPTIONS", "no-sslv2, no-sslv3, no-tlsv1"),
port_tls_cipher_suit=os.getenv(f"SC4S_SOURCE_TLS_CIPHER_SUITE", "HIGH:!aNULL:!eNULL:!kECDH:!aDH:!RC4:!3DES:!CAMELLIA:!MD5:!PSK:!SRP:!KRB5:@STRENGTH"),

port_5426=os.getenv(f"SC4S_LISTEN_{ port_id }_RFC5426_PORT", "disabled").split(","),
port_tls_tls_options=os.getenv(
f"SC4S_SOURCE_TLS_OPTIONS", "no-sslv2, no-sslv3, no-tlsv1"
),
port_tls_cipher_suit=os.getenv(
f"SC4S_SOURCE_TLS_CIPHER_SUITE",
"HIGH:!aNULL:!eNULL:!kECDH:!aDH:!RC4:!3DES:!CAMELLIA:!MD5:!PSK:!SRP:!KRB5:@STRENGTH",
),
port_5426=os.getenv(f"SC4S_LISTEN_{ port_id }_RFC5426_PORT", "disabled").split(
","
),
port_5426_sockets=int(os.getenv(f"SC4S_SOURCE_LISTEN_RFC5426_SOCKETS", 1)),
port_5426_sorecvbuff=os.getenv(f"SC4S_SOURCE_RFC5426_SO_RCVBUFF", 17039360),

port_6587=os.getenv(f"SC4S_LISTEN_{ port_id }_RFC6587_PORT", "disabled").split(","),
port_6587=os.getenv(f"SC4S_LISTEN_{ port_id }_RFC6587_PORT", "disabled").split(
","
),
port_6587_sockets=os.getenv(f"SC4S_SOURCE_LISTEN_RFC6587_SOCKETS", 1),
port_6587_max_connections=os.getenv(f"SC4S_SOURCE_RFC6587_MAX_CONNECTIONS", "2000"),
port_6587_max_connections=os.getenv(
f"SC4S_SOURCE_RFC6587_MAX_CONNECTIONS", "2000"
),
port_6587_log_iw_size=os.getenv(f"SC4S_SOURCE_RFC6587_IW_SIZE", "20000000"),
port_6587_log_fetch_limit=os.getenv(f"SC4S_SOURCE_RFC6587_FETCH_LIMIT", "2000"),
port_6587_so_recvbuff=os.getenv(f"SC4S_SOURCE_RFC6587_SO_RCVBUFF", "17039360"),

port_5425=os.getenv(f"SC4S_LISTEN_{ port_id }_RFC5425_PORT", "disabled").split(","),
port_5425=os.getenv(f"SC4S_LISTEN_{ port_id }_RFC5425_PORT", "disabled").split(
","
),
port_5425_sockets=int(os.getenv(f"SC4S_SOURCE_LISTEN_RFC5425_SOCKETS", 1)),
port_5425_max_connections=os.getenv(f"SC4S_SOURCE_RFC5425_MAX_CONNECTIONS", "2000"),
port_5425_max_connections=os.getenv(
f"SC4S_SOURCE_RFC5425_MAX_CONNECTIONS", "2000"
),
port_5425_log_iw_size=os.getenv(f"SC4S_SOURCE_RFC5425_IW_SIZE", "20000000"),
port_5425_log_fetch_limit=os.getenv(f"SC4S_SOURCE_RFC5425_FETCH_LIMIT", "2000"),
port_5425_so_recvbuff=os.getenv(f"SC4S_SOURCE_RFC5425_SO_RCVBUFF", "17039360"),
port_5425_tls_options=os.getenv(f"SC4S_SOURCE_RFC5425_OPTIONS", "no-sslv2, no-sslv3, no-tlsv1"),
port_5425_cipher_suit=os.getenv(f"SC4S_SOURCE_RFC5425_CIPHER_SUITE", "HIGH:!aNULL:!eNULL:!kECDH:!aDH:!RC4:!3DES:!CAMELLIA:!MD5:!PSK:!SRP:!KRB5:@STRENGTH"),

port_5425_tls_options=os.getenv(
f"SC4S_SOURCE_RFC5425_OPTIONS", "no-sslv2, no-sslv3, no-tlsv1"
),
port_5425_cipher_suit=os.getenv(
f"SC4S_SOURCE_RFC5425_CIPHER_SUITE",
"HIGH:!aNULL:!eNULL:!kECDH:!aDH:!RC4:!3DES:!CAMELLIA:!MD5:!PSK:!SRP:!KRB5:@STRENGTH",
),
)
print(outputText)
Loading

0 comments on commit 157e50c

Please sign in to comment.