Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VyOS file upload, management and templating #284

Open
thinkl33t opened this issue Dec 1, 2022 · 0 comments
Open

VyOS file upload, management and templating #284

thinkl33t opened this issue Dec 1, 2022 · 0 comments
Labels
feature This issue/PR relates to a feature request.

Comments

@thinkl33t
Copy link

SUMMARY

We have occasional need to upload files, create directories, and template files onto our vyos servers. Currently we're using an unholy mixture of net_put, templating on the local machine, and vyos_command of linux commandlines to do this.

There are issues with this however - when a file (in our case an openssh vpn certificate) is net_put into place it ends up only owned by the user who created it, and once the VPN is restarted the openvpn process itself takes ownership. This means that this file can't be managed or changed by other administrators. The only way we've come up with to work around this is via net_put into /tmp/ then use vyos_command to copy the file into place. Obviously this isn't idempotent.

We also use a similar process to template a file (in this case openvpn LDAP configuration), initially templating it to /tmp on the user's machine, then uploading it. This has the same issue as the previous paragraph, in that permissions of net_put files are set to the uploading user, with no option to change that.

tl;dr: We'd like to have idempotent, vyos-compatible versions of the following modules, which can use sudo to write to files that require it. We can't use these modules directly as they don't work over network_cli connection method, and end up running on the local host instead.

  • template
  • file
  • copy
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

vyos.vyos.template, vyos.vyos.copy, vyos.vyos.file

ADDITIONAL INFORMATION
vyos.vyos.file:
  name: "/config/auth/{{ single_network.key }}/"
  owner: openvpn
  group: openvpn
  mode: 0600
become: true
vyos.vyos.template:
  src: ldap_auth.config.j2
  dest: "/config/auth/{{ single_network.key }}/ldap-auth.config"
  owner: openvpn
  group: openvpn
  mode: 0664
become: true
vyos.vyos.copy:
  src: "{{ inventory_hostname }}.pem"
  dest: "/config/auth/{{ single_network.key }}/{{ inventory_hostname.pem }}"
  owner: openvpn
  group: openvpn
  mode: 0600
become: true
@NilashishC NilashishC added the feature This issue/PR relates to a feature request. label Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request.
Development

No branches or pull requests

2 participants