diff options
-rw-r--r-- | services/Makefile | 22 | ||||
-rw-r--r-- | services/authorized_keys | 1 |
2 files changed, 22 insertions, 1 deletions
diff --git a/services/Makefile b/services/Makefile index a68f095d..901769b8 100644 --- a/services/Makefile +++ b/services/Makefile @@ -1,9 +1,29 @@ help:;@cat Makefile - export authorized_keys_file := authorized_keys export services_file := services.txt export host_key_file := test.key +export services_home := /opt/services + +.PHONY: authorized_keys +$(services_home)/.ssh: + mkdir $@ + chown services:services $@ + +$(services_home)/.ssh/authorized_keys: $(services_home)/.ssh $(authorized_keys_file) + cp $(authorized_keys_file) $(services_home)/.ssh/authorized_keys + @echo "restricting authorized_keys..." + @sed -i 's#^#command="/bin/cat $(services_home)/services.txt",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty #' $(services_home)/.ssh/authorized_keys + +$(services_home)/services.txt: + @echo 'make sure to configure the services correctly in $(services_home)/services.txt' + cp $(services_file) $(services_home)/services.txt + +service-user: $(services_home)/services.txt $(services_home)/.ssh/authorized_keys + @echo 'also make sure that the user is created: make create-service-user' +create-service-user: + useradd -m -r -l -f -1 -d /opt/services services + test-client: ssh localhost -p 1337 2>/dev/null diff --git a/services/authorized_keys b/services/authorized_keys index dcb8bfeb..a7368693 100644 --- a/services/authorized_keys +++ b/services/authorized_keys @@ -1 +1,2 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7YrLdnXDRU2XEdZDu1BmgiT0Vaxplf3bfvSm+5o3g4AcR2yCv7h2D633c9uA0gq52EJ3V5m8B1ZcxqA0zqDptKwx+ZTMUGDls7StH5xpJyk9j5gf8DzyDLQPQG2IYszCH+8esKjo3BOFxfey8NaX+k6gvQsG3lyV0PjLvvIy4gDuMn6dPZfVAlwNYFOUNgwpku3W3A0d+UFyVjt3/sgZxM+8C3y6QE1gwT5/NfBbHM5vaEqjHcVq1ui+7a4iOXFGKkZDcd7EX6cQZSbCzZL7sZ0OmB1WpAsDCvIXfzX1YfNA0sso7ldSF6ZUGNgwEk1LootnQlCK/dfbM+i62SZ+1 tv@iiso +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCv9TTt4FkzT3jlQ0VS2tX/GpQO9Ef0wIQ+g96foe4qSniBwR667T1gIhURrod/p7N9oQcWRrNohjgmSBZRYA0kW6ZyqYJkLvRv54nXv6j/8Xq2nG/KVfDqL0kp8if+JGeFlQElpWJiAbGifYkopFy69QiLYU2ndR7aPbx+5qm/dcwPJ7K+n6dyePynCZadtcabm3PuBFUxGLdT9ImDXMOPfXxPMlN/3eb78byuEuHnhCIvIGLMBGx+8QTXvu7kHpZObvkbsF1xjVs9fDpwVLjh7GWdwf3BZ/agFlI24ffyqCPFnuaxUVyfUZeqf4twRsIZkTTB47lHDhYiVkyGe8gd root@pigstarter.de |