Classes | |
| struct | SecureInput |
Functions | |
| std::optional< uid_t > | parse_uid (const char *value) |
| uid_t | original_caller_uid () |
| bool | allowed_input_path (const std::string &path) |
| std::optional< SecureInput > | open_input_securely (const std::string &path, uid_t caller_uid) |
| std::string | trim (std::string value) |
| bool | is_valid_ip (const std::string &value) |
| std::vector< std::string > | load_and_validate_ips (int fd) |
| std::optional< std::string > | find_program (std::initializer_list< const char * > candidates) |
| bool | run_program (const std::string &executable, const std::vector< std::string > &arguments, bool silence_stderr=false) |
| bool | apply_ufw (const std::vector< std::string > &ips) |
| bool | apply_firewalld (const std::vector< std::string > &ips) |
| void | clear_firewall () |
Variables | |
| constexpr std::string_view | kInputPrefix = "/tmp/bastionguard-firewall-ips-" |
| constexpr off_t | kMaxInputBytes = 16 * 1024 * 1024 |
| constexpr std::size_t | kMaxEntries = 250000 |
| constexpr std::size_t | kMaxLineLength = 128 |
| bool anonymous_namespace{bastionguard-firewall.cpp}::allowed_input_path | ( | const std::string & | path | ) |
Definition at line 98 of file bastionguard-firewall.cpp.
References allowed_input_path(), and kInputPrefix.
Referenced by allowed_input_path(), and open_input_securely().
| bool anonymous_namespace{bastionguard-firewall.cpp}::apply_firewalld | ( | const std::vector< std::string > & | ips | ) |
Definition at line 286 of file bastionguard-firewall.cpp.
References apply_firewalld(), find_program(), and run_program().
Referenced by apply_firewalld(), and main().
| bool anonymous_namespace{bastionguard-firewall.cpp}::apply_ufw | ( | const std::vector< std::string > & | ips | ) |
Definition at line 273 of file bastionguard-firewall.cpp.
References apply_ufw(), find_program(), and run_program().
Referenced by apply_ufw(), and main().
| void anonymous_namespace{bastionguard-firewall.cpp}::clear_firewall | ( | ) |
Definition at line 319 of file bastionguard-firewall.cpp.
References clear_firewall(), find_program(), and run_program().
Referenced by clear_firewall(), and main().
| std::optional< std::string > anonymous_namespace{bastionguard-firewall.cpp}::find_program | ( | std::initializer_list< const char * > | candidates | ) |
Definition at line 227 of file bastionguard-firewall.cpp.
References find_program().
Referenced by apply_firewalld(), apply_ufw(), clear_firewall(), and find_program().
| bool anonymous_namespace{bastionguard-firewall.cpp}::is_valid_ip | ( | const std::string & | value | ) |
Definition at line 162 of file bastionguard-firewall.cpp.
References AF_INET, AF_INET6, is_valid_ip(), and kMaxLineLength.
Referenced by is_valid_ip(), and load_and_validate_ips().
| std::vector< std::string > anonymous_namespace{bastionguard-firewall.cpp}::load_and_validate_ips | ( | int | fd | ) |
Definition at line 172 of file bastionguard-firewall.cpp.
References _, is_valid_ip(), kMaxEntries, kMaxInputBytes, load_and_validate_ips(), and trim().
Referenced by load_and_validate_ips(), and main().
| std::optional< SecureInput > anonymous_namespace{bastionguard-firewall.cpp}::open_input_securely | ( | const std::string & | path, |
| uid_t | caller_uid ) |
Definition at line 106 of file bastionguard-firewall.cpp.
References _, allowed_input_path(), kMaxInputBytes, open_input_securely(), S_IWGRP, S_IWOTH, and anonymous_namespace{bastionguard-firewall.cpp}::SecureInput::SecureInput().
Referenced by main(), and open_input_securely().
| uid_t anonymous_namespace{bastionguard-firewall.cpp}::original_caller_uid | ( | ) |
Definition at line 91 of file bastionguard-firewall.cpp.
References original_caller_uid(), and parse_uid().
Referenced by main(), and original_caller_uid().
| std::optional< uid_t > anonymous_namespace{bastionguard-firewall.cpp}::parse_uid | ( | const char * | value | ) |
Definition at line 78 of file bastionguard-firewall.cpp.
References parse_uid().
Referenced by original_caller_uid(), and parse_uid().
| bool anonymous_namespace{bastionguard-firewall.cpp}::run_program | ( | const std::string & | executable, |
| const std::vector< std::string > & | arguments, | ||
| bool | silence_stderr = false ) |
Definition at line 235 of file bastionguard-firewall.cpp.
References run_program().
Referenced by apply_firewalld(), apply_ufw(), clear_firewall(), and run_program().
| std::string anonymous_namespace{bastionguard-firewall.cpp}::trim | ( | std::string | value | ) |
Definition at line 155 of file bastionguard-firewall.cpp.
References trim().
Referenced by load_and_validate_ips(), and trim().
|
constexpr |
Definition at line 42 of file bastionguard-firewall.cpp.
Referenced by allowed_input_path().
|
constexpr |
Definition at line 44 of file bastionguard-firewall.cpp.
Referenced by load_and_validate_ips().
|
constexpr |
Definition at line 43 of file bastionguard-firewall.cpp.
Referenced by load_and_validate_ips(), and open_input_securely().
|
constexpr |
Definition at line 45 of file bastionguard-firewall.cpp.
Referenced by is_valid_ip().