specinfra 2.80.0 → 2.81.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 111c7d5597fd8dd3b5e7cd5d579116f0d737a8a7
|
4
|
+
data.tar.gz: deb4176282e0c2cf3ebbeeaa4762d8dcb6ddba91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4c1a4b94b2d292c1ea6377df2663a378061b9e4fb81d99f330f20fab0f857191d8008d8ccf86ed361f81227d50b1c3811cc51ff011f9db08d0fb351b32bfa27
|
7
|
+
data.tar.gz: b450a2fe01de72c1c3df2ee0bd944253e95bb042c25f36e9def21e5fa391ec1e68c0f848b92506cda6fa9bcee83449c274a8123d42532dff96c7483d9349e60f
|
@@ -8,6 +8,14 @@ class Specinfra::Command::Base::Group < Specinfra::Command::Base
|
|
8
8
|
"getent group #{escape(group)} | cut -f 3 -d ':' | grep -w -- #{escape(gid)}"
|
9
9
|
end
|
10
10
|
|
11
|
+
def check_is_system_group(group)
|
12
|
+
exists = "getent group #{escape(group)} > /dev/null 2>&1"
|
13
|
+
gid = "getent group #{escape(group)} | cut -f 3 -d ':'"
|
14
|
+
sys_gid_min = "awk 'BEGIN{sys_gid_min=101} {if($1~/^SYS_GID_MIN/){sys_gid_min=$2}} END{print sys_gid_min}' /etc/login.defs"
|
15
|
+
sys_gid_max = "awk 'BEGIN{sys_gid_max=0;gid_min=1000} {if($1~/^SYS_GID_MAX/){sys_gid_max=$2}if($1~/^GID_MIN/){gid_min=$2}} END{if(sys_gid_max!=0){print sys_gid_max}else{print gid_min-1}}' /etc/login.defs"
|
16
|
+
%Q|#{exists} && test "$(#{gid})" -ge "$(#{sys_gid_min})" && test "$(#{gid})" -le "$(#{sys_gid_max})"|
|
17
|
+
end
|
18
|
+
|
11
19
|
def get_gid(group)
|
12
20
|
"getent group #{escape(group)} | cut -f 3 -d ':'"
|
13
21
|
end
|
@@ -12,6 +12,14 @@ class Specinfra::Command::Base::User < Specinfra::Command::Base
|
|
12
12
|
"id -gn #{escape(user)}| grep ^#{escape(group)}$"
|
13
13
|
end
|
14
14
|
|
15
|
+
def check_is_system_user(user)
|
16
|
+
exists = "getent passwd #{escape(user)} > /dev/null 2>&1"
|
17
|
+
uid = "getent passwd #{escape(user)} | cut -f 3 -d ':'"
|
18
|
+
sys_uid_min = "awk 'BEGIN{sys_uid_min=101} {if($1~/^SYS_UID_MIN/){sys_uid_min=$2}} END{print sys_uid_min}' /etc/login.defs"
|
19
|
+
sys_uid_max = "awk 'BEGIN{sys_uid_max=0;uid_min=1000} {if($1~/^SYS_UID_MAX/){sys_uid_max=$2}if($1~/^UID_MIN/){uid_min=$2}} END{if(sys_uid_max!=0){print sys_uid_max}else{print uid_min-1}}' /etc/login.defs"
|
20
|
+
%Q|#{exists} && test "$(#{uid})" -ge "$(#{sys_uid_min})" && test "$(#{uid})" -le "$(#{sys_uid_max})"|
|
21
|
+
end
|
22
|
+
|
15
23
|
def check_has_uid(user, uid)
|
16
24
|
regexp = "^uid=#{uid}("
|
17
25
|
"id #{escape(user)} | grep -- #{escape(regexp)}"
|
data/lib/specinfra/version.rb
CHANGED
@@ -17,3 +17,7 @@ end
|
|
17
17
|
describe get_command(:add_group, 'foo', :system_group => true) do
|
18
18
|
it { should eq 'groupadd -r foo' }
|
19
19
|
end
|
20
|
+
|
21
|
+
describe get_command(:check_group_is_system_group, 'foo') do
|
22
|
+
it { should eq "getent group foo > /dev/null 2>&1 && test \"$(getent group foo | cut -f 3 -d ':')\" -ge \"$(awk 'BEGIN{sys_gid_min=101} {if($1~/^SYS_GID_MIN/){sys_gid_min=$2}} END{print sys_gid_min}' /etc/login.defs)\" && test \"$(getent group foo | cut -f 3 -d ':')\" -le \"$(awk 'BEGIN{sys_gid_max=0;gid_min=1000} {if($1~/^SYS_GID_MAX/){sys_gid_max=$2}if($1~/^GID_MIN/){gid_min=$2}} END{if(sys_gid_max!=0){print sys_gid_max}else{print gid_min-1}}' /etc/login.defs)\"" }
|
23
|
+
end
|
@@ -57,3 +57,7 @@ end
|
|
57
57
|
describe get_command(:update_user_login_shell, 'foo', '/bin/bash') do
|
58
58
|
it { should eq 'usermod -s /bin/bash foo' }
|
59
59
|
end
|
60
|
+
|
61
|
+
describe get_command(:check_user_is_system_user, 'foo') do
|
62
|
+
it { should eq "getent passwd foo > /dev/null 2>&1 && test \"$(getent passwd foo | cut -f 3 -d ':')\" -ge \"$(awk 'BEGIN{sys_uid_min=101} {if($1~/^SYS_UID_MIN/){sys_uid_min=$2}} END{print sys_uid_min}' /etc/login.defs)\" && test \"$(getent passwd foo | cut -f 3 -d ':')\" -le \"$(awk 'BEGIN{sys_uid_max=0;uid_min=1000} {if($1~/^SYS_UID_MAX/){sys_uid_max=$2}if($1~/^UID_MIN/){uid_min=$2}} END{if(sys_uid_max!=0){print sys_uid_max}else{print uid_min-1}}' /etc/login.defs)\"" }
|
63
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specinfra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.81.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-scp
|