Comments (9)
@psanford That code only applies if you use the -o
option. If you redirect the output of age-keygen
to a file, the shell creates the file and you can see the warning.
% umask
002
% ./age-keygen >test.keys
Warning: writing to a world-readable file.
Consider setting the umask to 066 and trying again.
Public key: age1efnk2yn5zj0zffkthqsmzz7gv5e7gffkpqlmsg76qlger0satasscpg3zj
% ls -l test.keys
-rw-rw-r--. 1 foo bar 189 Jan 2 11:25 test.keys
from age.
umask is an inverse mask of the permission bits
That's a very good point; the error message does say "umask", not "mode". That is terribly unusable; I know of no way to directly set a umask in the CLI, whereas I expect every user will turn to chmod
and stick that value in (as I did), because it looks so close to a common mode.
Perhaps the error should instead give an example command for the user to run? Either one that uses the umask, or a chmod 600 FILENAME
.
from age.
I know of no way to directly set a umask in the CLI
$ umask 066
should work in any POSIX shell.
from age.
Perhaps an better solution is to suggest that users use the -o
option to specify the output file, in which case age-keygen
creates the file, not the shell, and can set the correct permissions.
from age.
It looks right to me as is. umask is an inverse mask of the permission bits, so a umask of 066 should clear the read and write bits of any new files for the group and other users but not the owner.
from age.
I believe the reason the warning suggests umask
instead of chmod
is so that the file will never exist with too-broad permissions. If you chmod it after the fact, another user on the machine could read the contents between when the key is generated and when the permissions are changed.
from age.
I think the warning is indeed confusing but for different reason: umask should be 077
.
066
will leave execution rights which doesn't make sense.
from age.
$ umask 066
should work in any POSIX shell.
Oh cool, this is something I'd never come across! Which exactly makes my point: the error message shouldn't assume that users are familiar with obscure Unix-specific functionality.
from age.
@str4d did you actually trigger the error message here? The code is already creating the file with limited permissions:
f, err := os.OpenFile(name, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600)
Its then doing a sanity check on the permissions after creation.
Given the 0600
FileMode It doesn't seem like it would be possible to actually hit this error case on a normal unix filesystem. (If you did somehow hit this error I don't see how the problem would actually be related to the process' umask).
from age.
Related Issues (20)
- c2sp.org/age-plugin returns 404 Not Found HOT 1
- Age terminates too soon on MacOS HOT 5
- Can this method be used to encrypt movie files? HOT 1
- report unexpected HOT 1
- age: error: failed to wrap key for recipient #0: test plugin: write |1: broken pipe HOT 16
- Plugin receives only one identity or recipient when there are multiple HOT 1
- failed to decrypt and authenticate payload chunk HOT 1
- Documentation bug in /README.md #encrypting-to-a-github-user HOT 2
- Support `sk-ssh` keys HOT 2
- brew install: not a tagged release HOT 1
- Specified SSH key is not eligible for claiming. Only RSA and Ed25519 keys are supported for proof generation. HOT 9
- Couldn't decrypt with that SSH key, please choose another one. HOT 1
- Couldn't decrypt with that SSH key, please choose another one. HOT 1
- Unable to claim the reward of 5000 token FLT HOT 1
- Unsupported SSH key type: ecdsa-sha2-nistp256 HOT 2
- Decryption does not create a file when data is empty HOT 1
- ssh connection to Github HOT 1
- I am the winner of the airdrop HOT 2
- unable to decrypt a proof with ssh key HOT 1
- Choco and scoop were unable to install age in windows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from age.