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

nixos/printing: Add openFirewall option #176539

Merged
merged 1 commit into from
Nov 5, 2023
Merged

Conversation

onny
Copy link
Contributor

@onny onny commented Jun 6, 2022

Description of changes

Add

services.printing.openFirewall = true;

option to open TCP ports specified in printing.listenAdddresses required for network printer sharing.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@Ma27
Copy link
Member

Ma27 commented Jun 9, 2022

The problem I see here is that when changing listenAddress to use another port, openFirewall opens up the wrong network port, correct?

@onny onny marked this pull request as draft September 5, 2022 05:34
@onny onny force-pushed the cups-firewall branch 2 times, most recently from d3c0245 to bb39788 Compare October 19, 2023 13:14
@onny
Copy link
Contributor Author

onny commented Oct 19, 2023

@Ma27 @klemensn Updated the pull request. It now parses the ports in cfg.listenAddresses and puts them into networking.firewall.allowedTCPPorts.

Tested it with nixos-shell and

{ pkgs, ... }: {
  services.printing = {
    enable = true;
    listenAddresses = [
      "*:631"
      "127.0.0.1:632"
    ];
    openFirewall = true;
  };

  networking.firewall.enable = true;
  environment.systemPackages = [ pkgs.nftables ];
}

@onny onny marked this pull request as ready for review October 19, 2023 13:18
@klemensn
Copy link
Contributor

I no longer use this code, so can't test.

@onny onny changed the title nixos/printing: Add openFirewall rule nixos/printing: Add openFirewall option Oct 20, 2023
@onny onny requested a review from happysalada October 20, 2023 08:47
Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

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

LGTM

@drupol drupol merged commit 35128eb into NixOS:master Nov 5, 2023
20 checks passed
@cafkafk cafkafk mentioned this pull request Nov 9, 2023
13 tasks
nyabinary pushed a commit to nyabinary/nixpkgs that referenced this pull request Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants