[fix] default parameter run records parameters in session for replay[fix] remove default parameters for several cubes
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# ssh-authorize
|
||||
|
||||
**Authorize SSH public key for a user**
|
||||
|
||||
## Purpose
|
||||
|
||||
This cube adds a specific SSH public key to a user's `authorized_keys` file on the remote server, allowing them to log in via SSH using the corresponding private key.
|
||||
|
||||
## Configuration
|
||||
|
||||
### Parameters
|
||||
|
||||
- **USER** (string, default: `'vagrant'`)
|
||||
- The username on the remote server to authorize.
|
||||
- If the user does not exist, `pyinfra` will attempt to create it (though a full user creation with shell/groups is better handled by `user-add`).
|
||||
|
||||
- **PUBKEY** (string, required)
|
||||
- The actual content of the public key (e.g., `ssh-ed25519 AAAA...`).
|
||||
|
||||
## Use Cases
|
||||
|
||||
Grant access to a developer:
|
||||
```javascript
|
||||
exec('ssh-authorize', {
|
||||
USER: 'developer',
|
||||
PUBKEY: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA...'
|
||||
})
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
None.
|
||||
@@ -0,0 +1,13 @@
|
||||
from pyinfra import host
|
||||
from pyinfra.operations import server
|
||||
|
||||
USER = host.data.USER
|
||||
PUBKEY = host.data.PUBKEY
|
||||
|
||||
server.user(
|
||||
name=f"Authorize public key for {USER}",
|
||||
user=USER,
|
||||
public_keys=[PUBKEY],
|
||||
present=True,
|
||||
_sudo=True
|
||||
)
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Manifest } from '@bitsquare/nopy-cube';
|
||||
import { z } from 'zod';
|
||||
|
||||
export default Manifest({
|
||||
id: 'ssh:authorize',
|
||||
name: 'Authorize SSH public key for a user',
|
||||
dependencies: () => [],
|
||||
schema: z.object({
|
||||
USER: z.string().describe('Username to authorize').default('vagrant'),
|
||||
PUBKEY: z.string().describe('SSH public key string').default(''),
|
||||
}),
|
||||
});
|
||||
Reference in New Issue
Block a user