summaryrefslogtreecommitdiff
path: root/python/vyos/util.py
AgeCommit message (Collapse)Author
2022-06-29openvpn: T4485: Accept multiple `tls ca-certificate` valuessarthurdev
2022-05-31pki: T3642: Update conf scripts using changed PKI objectssarthurdev
2022-04-07ipv6: T4346: delete (migrate) CLI command to disable IPv6 address familyChristian Poessinger
2022-04-01wwan: T4324: is_wwan_connected() must verify if ModemManager is runningChristian Poessinger
2022-03-30vyos.util: T4319: add is_ipv6_enabled() helper functionChristian Poessinger
2022-03-25vyos.util: T4319: rename sysctl() -> sysctl_write()Christian Poessinger
2022-03-25vyos.util: T4319: provide generic sysctl_read() helperChristian Poessinger
2022-02-21smoketest: vxlan: T4120: verify support for multiple remote addressesChristian Poessinger
2022-02-13vyos.util: T4191: add new sysctl() helper functionChristian Poessinger
2022-01-26pki: T4212: Catch `install_into_config` errors and output for manual command ↵sarthurdev
entry
2021-12-08vyos.util: T4061: add function to check for completion of boot configJohn Estabrook
2021-12-06Merge pull request #1077 from sever-sever/T3829Christian Poessinger
netns: T3829: Ability to configure network namespaces
2021-11-26netns: T3829: Ability to configure network namespacesViacheslav
2021-11-24T3356: Rewrite remote.pyerkin
2021-11-18wwan: T3795: make connect and disconnect op-mode commands aware to WWAN ↵Christian Poessinger
interfaces (cherry picked from commit a032d73f1d405f3bae269791e9064026faa491d9)
2021-11-09pki: T3970: Allow op-mode PKI commands in a config session to install directlysarthurdev
2021-10-24T3937: rewrite the "show system memory" script in PythonDaniil Baturin
2021-09-08openvpn: T3805: use vyos.util.write_file() to store certificatesChristian Poessinger
2021-09-06vyos.util: add function to search a key recursively in a dictionaryChristian Poessinger
data = { 'interfaces': {'dummy': {'dum0': {'address': ['192.0.2.17/29']}}, 'ethernet': {'eth0': {'address': ['2001:db8::1/64', '192.0.2.1/29'], 'description': 'Test123', 'duplex': 'auto', 'hw_id': '00:00:00:00:00:01', 'speed': 'auto'}, 'eth1': {'address': ['192.0.2.9/29'], 'description': 'Test456', 'duplex': 'auto', 'hw_id': '00:00:00:00:00:02', 'speed': 'auto'}}} } dict_search_recursive(data, 'hw_id') will yield both '00:00:00:00:00:01' and '00:00:00:00:00:02' as generator object.
2021-09-06vyos.util: T2755: rename dict_search() function args to match other ↵Christian Poessinger
implementations
2021-08-26vyos.util: T3763: Optimized the check_port_availability functionzsdc
`print` was removed or replaced to `ValueError`, where possible.
2021-08-26wireguard: T3763: Added check for listening port availabilityzsdc
Each wireguard interface requires a unique port for in and out connections. This commit adds the new `vyos.util` function - `check_port_availability`, and uses it to be sure that a port that is planned to be used for wireguard interface is truly available and not used by any other services (not only other wireguard interfaces).
2021-08-14vyos.util: T1503: use build in methods to determine current user for ↵Christian Poessinger
commit_in_progress()
2021-08-13vyos.util: "harden" is_systemd_service_running() functionChristian Poessinger
Inspired by the comments of https://unix.stackexchange.com/a/435317 use a more robust approach. A service can be "active" but not "running" (e.g. restarting with a configuration error). We can now test if a systemd unit is "activated" and if it is "running" at all. >>> from vyos.util import is_systemd_service_active >>> from vyos.util import is_systemd_service_running >>> is_systemd_service_active('ssh') True >>> is_systemd_service_running('sshd') False >>> is_systemd_service_running('ssh') True
2021-07-30vyos.util: add is_systemd_service_running() helper functionChristian Poessinger
Test is a specified systemd service is actually running. Returns True if service is running, false otherwise.
2021-07-13T3663: add a small sleep between polling for a new inotify event.Daniil Baturin
2021-07-08T3663: add pre_hook argument to util.wait_for_inotifyDaniil Baturin
When waiting for processes that don't take long, we need add an inotify watcher _before_ starting that process. The pre-hook arguments allows the user to pass a () -> () anonymous function to be called before adding a watch.
2021-07-08T3663: fix the call to time.time() to match the new import scheme.Daniil Baturin
2021-07-06ipsec: T2816: Migrate ipsec-settings.xml.in and charon.conf to vpn_ipsec.pysarthurdev
Also adds check for the charon socket instead of an arbitrary sleep()
2021-07-05pki: ipsec: T3642: Fix issue with '.' being present in tag nodes, adds new ↵sarthurdev
vyos.util method `dict_search_args` to allow for dot characters in keys.
2021-07-04vyos.util: T3663: move inotify-based imports to function levelChristian Poessinger
Keep the vyos.util function clean and not pull in the rest of the world when importing it.
2021-07-04T3663: prerequisites for inotify-based watching implementations.Daniil Baturin
2021-07-02ipsec: T3656: T3659: Fix pass-through with ipv6. Fix op-mode ipsec commands. ↵sarthurdev
Remove python3-crypto dependency.
2021-07-01vyos.util: remove no longer needed copy_file helper methodChristian Poessinger
The IPSec ceritifcate handling is now done by storing the CA key inside the running configuration.
2021-07-01Merge branch 'pki_ipsec' of https://github.com/sarthurdev/vyos-1x into pki-cliChristian Poessinger
* 'pki_ipsec' of https://github.com/sarthurdev/vyos-1x: pki: ipsec: T3642: Update migration script to account for file permission issues pki: ipsec: T3642: Migrate IPSec to use PKI configuration pki: T3642: New PKI config and management
2021-07-01vyos.util: fix IsADirectoryError and SameFileError for copy_fileChristian Poessinger
Commit 5303ec39 ("vyos.util: add new helper copy_file()") added a new helper function to copy a file from A -> B and create the destination directory if required. It did also throw an excpetion if the destination file already existed and consisted of the same file - this is now ignored and we always copy the source to the destination.
2021-06-29pki: T3642: New PKI config and managementsarthurdev
2021-06-26vyos.util: add new helper copy_file()Christian Poessinger
Copy a file from A -> B but also support adjusting Bs file permissions and creation of Bs base directory if required.
2021-06-09remote, util: Move general helper routines from `remote.py` to `util.py`erkin
2021-05-28ipsec: T2816: IPSec python rework, includes DMVPN and VTI supportSimon
2021-05-18revert: "util: T2467: add autosudo as an option to command"Christian Poessinger
Implementing a wrapper which will - based on the command - add a sudo prefix to the execution string seemed to be a nice idea but unfortunately it did not only not get momentum but also the codebase somethis added an implicit "sudo" call a second time. This resulted in a call: "sudo sudo systemctl" The entire functionality was removed again and if an op-mode script requires root priviledges it must be explicitly called with them - no black magic.
2021-04-16config: T3481: add switch to prevent mangling of tag node valuesJohn Estabrook
2021-03-23vyos.util: dict_search() should not throw exception when inputs are NoneChristian Poessinger
2021-03-14vyos.util: rename get_json_iface_options() -> get_interface_config()Christian Poessinger
2021-03-14vyos.util: add helper get_all_vrfs()Christian Poessinger
The helper will return a dict in form: {'red': {'table': 1000}, 'blue': {'table': 2000}}
2021-02-28vyos.util: provide single implementation for get_json_iface_options()Christian Poessinger
There had been four implementations of "ip -d -j link show interface" scattered accross the codebase. Those implementations have now been combined into a new helper: vyos.util.get_json_iface_options()
2021-01-31vyos: T3274: Handle EOF in ask_yes_no()erkin
2021-01-07login: radius: T3192: migrate to get_config_dict()Christian Poessinger
2020-12-28webproxy: T563: squidguard: support default rulesetChristian Poessinger
2020-10-28vyos.util: T2995: rename vyos_dict_search() -> dict_search()Christian Poessinger
Renamed using snippet below: ---------------------------- for file in $(find . -name "*.py") do sed -i "s/vyos_dict_search/dict_search/" $file done