{"id":17081359,"url":"https://github.com/eugenmayer/opnsense-cli","last_synced_at":"2025-03-22T18:32:47.834Z","repository":{"id":57561850,"uuid":"118166309","full_name":"EugenMayer/opnsense-cli","owner":"EugenMayer","description":"Client interface for OPNsense written in go. Can be used as cli or golang lib ","archived":false,"fork":false,"pushed_at":"2024-03-24T06:15:45.000Z","size":23113,"stargazers_count":30,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-15T12:51:33.486Z","etag":null,"topics":["cli","golang","library","openvpn","opnsense","rest-api","unbound"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EugenMayer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-19T19:04:51.000Z","updated_at":"2024-10-10T19:25:35.000Z","dependencies_parsed_at":"2024-06-20T09:41:02.157Z","dependency_job_id":null,"html_url":"https://github.com/EugenMayer/opnsense-cli","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EugenMayer%2Fopnsense-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EugenMayer%2Fopnsense-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EugenMayer%2Fopnsense-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EugenMayer%2Fopnsense-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EugenMayer","download_url":"https://codeload.github.com/EugenMayer/opnsense-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221832190,"owners_count":16888188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","golang","library","openvpn","opnsense","rest-api","unbound"],"created_at":"2024-10-14T12:51:45.694Z","updated_at":"2024-10-28T13:31:15.097Z","avatar_url":"https://github.com/EugenMayer.png","language":"Go","readme":"[![build](https://github.com/EugenMayer/opnsense-cli/actions/workflows/build.yml/badge.svg)](https://github.com/EugenMayer/opnsense-cli/actions/workflows/build.yml)\n\n## WAT\n\nImplementation of the OPNsense WebAPI to be used on the CLI or as a library - written in Golang\n\nCompatible with OPNsense 22.1 and higher.\n\n## Installation\n\nIts precompiled and has no dependencies, so just download the binary, and you are good to go\n\n    Pick a release from https://github.com/EugenMayer/opnsense-cli/releases\n    chmod +x opn-*\n\nYou need to create a .env (dotenv) for the secrets, or expose them into your ENV using `export`\n\n    OPN_URL=https://localhost:10443\n    OPN_APIKEY=5GWbPwKfXVLzgJnewKuu1IPw2HS7s510jKHmTM+rLA1y9VfEFE57yj/kJiWbXREB0EgpBK48u4gnyign\n    OPN_APISECRET=EtpPVbiCBdtvG5VDlYJQfLu7Qck2hRffoLi2vb73arn5bKzxEbGdti8+iZetgc9eHABJy6XYG6/UsW/1`\n    # if we should not verify SSL while talking to opn, enable that\n    #OPN_NOSSLVERIFY=1\n\n## Commands included\n\nJust run \n\n    opn \n\nto see a full list. Currently implemented\n\n- managing host overrides for unbound (CRUD + list)\n\n\n## Usage: cli\n\n    opn --help\n\n    # unbound host DNS entries\n    opn unbound hostoverride create --host foo --domain bar.tld --ip 10.10.10.1\n    opn unbound hostoverride update --host foo --domain bar.tld --ip 10.10.10.2\n    opn unbound hostoverride show --host foo --domain bar.tld\n    opn unbound hostoverride rm --host foo --domain bar.tld\n    opn unbound hostoverride list\n\n    # unbound service\n    opn unbound service restart\n    opn unbound service reconfigure\n    opn unbound service status\n\n**HINT**: Right now, as of 22.7, you have to run `reconfigure` everytime you change a hostentry on `unbound`, so e.g.\n\n    # this will yet not show up when you run a DNS query\n    opn unbound hostoverride create --host foo --domain bar.tld --ip 10.10.10.1\n    # after that, it will\n    opn unbound service reconfigure\n\nThis might change in later releases.\n\n## Usage: GoLang library\n\n    import (\n      opn_unbound \"github.com/eugenmayer/opnsense-cli/opnsense/api/unbound\"\n      opn_api \"github.com/eugenmayer/opnsense-cli/opnsense/api\"\n    )\n     \n    func create_host_entry() error {\n        var opnUnboundConnection opn_unbound.UnboundApi\n\n        if opnConnection, opnErr := opn_api.ConfiugreFromEnv(); opnErr != nil {\n            return errors.New(fmt.Sprintf(\"Error getting OPNsense connection: %s\", opnErr))\n        } else {\n            opnUnboundConnection = opn_unbound.UnboundApi{opnConnection}\n        }\n    \n        var dnsHostEntry = opn_unbound.HostOverride{\n            Host:   \"test,\n            Domain: \"foo.tld,\n            Ip:     \"10.10.10.1\",\n        }\n        \n        _, _ := opnUnboundConnection.HostOverrideCreateOrUpdate(dnsHostEntry)\n    }\n\n## Development\n\n    # building\n    make build\n\n## Contributions\n\nIf you like to add a new command implementing OPNsense API reference https://docs.opnsense.org/development/api.html#introduction - open a PR and iam happy to add it. Be bold. \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feugenmayer%2Fopnsense-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feugenmayer%2Fopnsense-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feugenmayer%2Fopnsense-cli/lists"}