{"id":15466180,"url":"https://github.com/mozamimy/nymphia","last_synced_at":"2025-04-22T10:37:45.014Z","repository":{"id":56886006,"uuid":"73542282","full_name":"mozamimy/nymphia","owner":"mozamimy","description":"Create your SSH config with Ruby, and without any pain.","archived":false,"fork":false,"pushed_at":"2018-02-03T09:30:08.000Z","size":45,"stargazers_count":19,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-22T10:37:34.680Z","etag":null,"topics":["dsl","ruby","ssh-config"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/mozamimy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-12T08:57:47.000Z","updated_at":"2022-03-22T04:10:20.000Z","dependencies_parsed_at":"2022-08-21T00:20:50.754Z","dependency_job_id":null,"html_url":"https://github.com/mozamimy/nymphia","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozamimy%2Fnymphia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozamimy%2Fnymphia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozamimy%2Fnymphia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozamimy%2Fnymphia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mozamimy","download_url":"https://codeload.github.com/mozamimy/nymphia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250221948,"owners_count":21394791,"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":["dsl","ruby","ssh-config"],"created_at":"2024-10-02T01:05:18.958Z","updated_at":"2025-04-22T10:37:44.963Z","avatar_url":"https://github.com/mozamimy.png","language":"Ruby","readme":"# Nymphia\n\n[![Build Status](https://travis-ci.org/mozamimy/nymphia.svg?branch=master)](https://travis-ci.org/mozamimy/nymphia)\n\nNymphia is a DSL to generate a ssh config file more structurally.  \nYou can use full Ruby syntax and useful methods provided by Nymphia.\n\nThere is a Vim syntax ([nymphia.vim](https://github.com/mozamimy/nymphia.vim)) if you want to edit colorfully in Vim.\n\n## Installation\n\nJust type gem command,\n\n```\n$ gem install nymphia\n```\n\n## CLI interface\n\n```\n$ nymphia --help\nnymphia\n    -f, --file=FILE                  Your DSL code file\n    -o, --output=FILE                Output file (default: stdout)\n```\n\n## Getting started\n\n### Basis\n\nFollowing code is a small example.\n\n```ruby\nidentity_file :private, '~/.ssh/id_rsa.1'\n\nmy_server_port = 4321\n\nhost('alice', 'my server on VPS') {\n  hostname 'alice.example.com'\n  user 'alice'\n  port my_server_port\n  use_identify_file :private\n}\n```\n\nFollowing ssh config file is generated after the code is compiled.\n\n```\n#\n# This config is generated by Nymphia 0.1.2\n# @ 2017-12-08T16:34:15+09:00\n#\n\n# my server on VPS\nHost alice\n  Hostname alice.example.com\n  User alice\n  Port 4321\n  IdentityFile ~/.ssh/id_rsa.1\n```\n\nMethod `identity_file` register your identity file with a name. You can use registered identity file by `use_identify_file` in `host` block.\n\nMethod `host` generate `Host` directive. First argument is name of host, Second argument is description of the host. Description is optional.\n\n### Splitting files\n\nYou can use `include_file` method to include other Nymphia file like following example. Absolute path and relative path are acceptable as the file path.\n\nWe could use `load` in previous version, but `load` is obsoleted now.\n\n```ruby\nidentity_file :private, '~/.ssh/id_rsa.1'\n\nhost('alice', 'my server on VPS') {\n  hostname 'alice.example.com'\n  user 'alice'\n  port 4321\n  use_identify_file :private\n}\n\ninclude_file 'other_nymphia_file.rb'\n```\n\n### Proxy method\n\nMethod `proxy` is almost same to `host`, but `local_forward` method can be used in `proxy`. Following code is  small example of `proxy`.\n\n```ruby\nidentity_file :company_gateway, '~/.ssh/id_rsa.company.gw'\n\nproxy('awsproxy.company.apne1') {\n  hostname 'gw.apne1.example.com'\n  user 'alice'\n  port 19822\n  use_identify_file :company_gateway\n\n  # SOCKS proxy\n  dynamic_forward 23921\n\n  # ssh tunnels\n  local_forward 'mysql-server', {\n    'localhost' =\u003e 13306,\n    'mysql.apne.aws.example.com' =\u003e 3306,\n  }\n\n  local_forward 'ldap', {\n    'localhost' =\u003e 10389,\n    'ldap.apne.aws.example.com' =\u003e 398,\n  }\n}\n```\n\nFollowing ssh config file is generated after the code is compiled.\n\n```\n#\n# This config is generated by Nymphia 0.1.2\n# @ 2017-12-08T16:34:15+09:00\n#\n\nHost awsproxy.company.apne1\n  Hostname gw.apne1.example.com\n  User alice\n  Port 19822\n  IdentityFile ~/.ssh/id_rsa.company.gw\n  DynamicForward 23921\n  LocalForward localhost:13306 mysql.apne.aws.example.com:3306\n  LocalForward localhost:10389 ldap.apne.aws.example.com:398\n```\n\n### Advanced: Grouping and use_gateway, default_params\n\nNymphia has `group` and `gateway` method to make ssh config more structurally. Following code is small example of grouping.\n\n```ruby\nidentity_file :company, '~/.ssh/id_rsa.company'\nidentity_file :company_gateway, '~/.ssh/id_rsa.company.gw'\n\ngateway('company.gateway') {\n  hostname 'gw.example.com'\n  user 'alice'\n  port 19822\n}\n\ngroup('company.ap-northeast-1') {\n  use_gateway 'company.gateway'\n\n  default_params {\n    check_host_ip 'no'\n    strict_host_key_checking 'no'\n    user 'alice'\n    port 9822\n    use_identify_file :company, :company_gateway\n  }\n\n  host('*.apne.aws.example.com')\n\n  host('alice.apne.aws.example.com') {\n    hostname '10.16.16.16'\n    user 'white_rabbit'\n    port 7777\n  }\n}\n```\n\nFollowing ssh config file is generated after the code is compiled.\n\n```\n\n#\n# This config is generated by Nymphia 0.1.2\n# @ 2017-12-08T16:34:15+09:00\n#\n\nHost company.gateway\n  Hostname gw.example.com\n  User alice\n  Port 19822\n\nHost *.apne.aws.example.com\n  CheckHostIp no\n  StrictHostKeyChecking no\n  User alice\n  Port 9822\n  IdentityFile ~/.ssh/id_rsa.company\n  IdentityFile ~/.ssh/id_rsa.company.gw\n  ProxyCommand ssh company.gateway -q -W %h:%p\n\nHost alice.apne.aws.example.com\n  CheckHostIp no\n  StrictHostKeyChecking no\n  IdentityFile ~/.ssh/id_rsa.company\n  IdentityFile ~/.ssh/id_rsa.company.gw\n  ProxyCommand ssh company.gateway -q -W %h:%p\n  Hostname 10.16.16.16\n  User white_rabbit\n  Port 7777\n```\n\nMethod `gateway` is almost same to `host`, but it can be used in a group by `use_gateway` method. When write `use_gateway` in a group, `ProxyCommand ssh #{gateway name} -q -W %h:%p` directive is added automatically to hosts in the group.\n\nMethod `default_params` defines default parameters of hosts in the group including `default_params`. In this example, `host '*.apne.aws.example.com'` has no parameters, but `Host *.apne.aws.example.com` in result is filled by default parameters. The default parameters can be overide like `host 'alice.apne.aws.example.com'`.\n\n## Vim syntax\n\nhttps://github.com/mozamimy/nymphia.vim\n\n## Todo\n\n- [x] vim syntax\n- [ ] Test code\n- [x] CI\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/mozamimy/nymphia.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozamimy%2Fnymphia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmozamimy%2Fnymphia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozamimy%2Fnymphia/lists"}