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

sciond socket file mode. #3099

Merged
merged 3 commits into from
Sep 5, 2019
Merged

Conversation

juagargi
Copy link
Contributor

@juagargi juagargi commented Sep 5, 2019

sciond sets the file mode for both its Reliable and Unix socket files.
The file mode comes from the configuration value SocketFileMode,
specified in octal as a string.


This change is Reviewable

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 6 of 6 files at r1.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @juagargi)


go/sciond/internal/config/sample.go, line 28 at r1 (raw file):

Unix = "/run/shm/sciond/default-unix.sock"

# File permissions of both the Reliable and Unix socket files, in octal.

Add (default 0770) at the end.


go/sciond/internal/config/sample.go, line 29 at r1 (raw file):

# File permissions of both the Reliable and Unix socket files, in octal.
SocketFileMode = "0755"

This should contain the default value, so that the test checks that the default and the sample match.


go/sciond/internal/servers/server.go, line 106 at r1 (raw file):

func (srv *Server) listen() (net.Listener, error) {
	var listener net.Listener
	var error error

errors are always named err please also name it like that.


go/sciond/internal/servers/server.go, line 119 at r1 (raw file):

		return nil, common.NewBasicError("unknown network", nil, "net", srv.network)
	}
	if error == nil {

usually we check the other way around:

if err != nil {
      return nil, err
}
if err := os.Chmod(....); err != nil {
....
}
return listener, nil

Copy link
Contributor Author

@juagargi juagargi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @lukedirtwalker)


go/sciond/internal/config/sample.go, line 28 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

Add (default 0770) at the end.

Done.


go/sciond/internal/config/sample.go, line 29 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

This should contain the default value, so that the test checks that the default and the sample match.

Done.


go/sciond/internal/servers/server.go, line 106 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

errors are always named err please also name it like that.

Done.


go/sciond/internal/servers/server.go, line 119 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

usually we check the other way around:

if err != nil {
      return nil, err
}
if err := os.Chmod(....); err != nil {
....
}
return listener, nil

Done.

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

sciond sets the file mode for both its Reliable and Unix socket files.
The file mode comes from the configuration value SocketFileMode,
specified in octal as a string.
Use default value in config test. Refactor and comments.
Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r3.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@lukedirtwalker lukedirtwalker merged commit 9c78899 into scionproto:master Sep 5, 2019
@juagargi juagargi deleted the sciond_filemode branch September 5, 2019 14:29
juagargi added a commit to juagargi/scion that referenced this pull request Sep 6, 2019
Move the FileMode type to util. Refactor.
Use FileMode also in the dispatcher.
Relates to scionproto#3099.
lukedirtwalker pushed a commit that referenced this pull request Sep 9, 2019
Makes the file mode of the socket file configurable. (default 0770)

Abstracts the sciond FileMode type into util package and uses it in both configs.

Relates to #3099
juagargi added a commit to netsec-ethz/scion that referenced this pull request Sep 9, 2019
sciond sets the file mode for both its Reliable and Unix socket files.
The file mode comes from the configuration value SocketFileMode,
specified in octal as a string.

The default is 0770
juagargi added a commit to netsec-ethz/scion that referenced this pull request Sep 9, 2019
Makes the file mode of the socket file configurable. (default 0770)

Abstracts the sciond FileMode type into util package and uses it in both configs.

Relates to scionproto#3099
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants