Ankündigung

Einklappen
Keine Ankündigung bisher.

Amazon Alexa Plugin

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • mskoric
    antwortet
    AWS kann die domain xyz.myfritz.net nicht auflösen. da müsstest nochmal schauen ob da alles richtig konfiguriert ist in der fritzbox.

    zu Bad Gateway
    schau nochmal ob das alexa plugin auch auf port 9000 lauscht.

    PHP-Code:
      pi@pi_hq:~ $ sudo netstat -tupl grep 9000 tcp        0      0 *:9000                  *:*                     LISTEN      16232/python3 

    Einen Kommentar schreiben:


  • schorge
    antwortet
    lamda index.js geänder auf /alexa

    Nach aufruf von https://myfritz../alexa bekomm ich die Passwortabfrage vom NGINX und dann ein

    502 BAD GATEWAY

    Meine aws lamda index.js kommt mit diesem Fehler nach Änderung auf /alexa:

    Code:
    Response:
    {
      "errorMessage": "getaddrinfo ENOTFOUND https://xyz.myfritz.net https://xyz.myfritz.net:443",
      "errorType": "Error",
      "stackTrace": [
        "errnoException (dns.js:26:10)",
        "GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)"
      ]
    }
    
    Request ID:
    "c4c61a06-f83d-11e7-b3fc-03fb1dd09bee"
    
    Function Logs:
    START RequestId: c4c61a06-f83d-11e7-b3fc-03fb1dd09bee Version: $LATEST
    2018-01-13T08:43:03.713Z    c4c61a06-f83d-11e7-b3fc-03fb1dd09bee    requesting {"header":{"payloadVersion":"2","namespace":"Alexa.ConnectedHome.Discovery","name":"DiscoverAppliancesRequest","messageId":"F8752B11-69BB-4246-B124-3BFB27C06C7D"},"payload":{}}
    2018-01-13T08:43:03.793Z    c4c61a06-f83d-11e7-b3fc-03fb1dd09bee    request failed { [Error: getaddrinfo ENOTFOUND https://xyz.myfritz.net https://xyz.myfritz.net:443]
      code: 'ENOTFOUND',
      errno: 'ENOTFOUND',
      syscall: 'getaddrinfo',
      hostname: 'https://xyz.myfritz.net',
      host: 'https://xyz.myfritz.net',
      port: '443' }
    2018-01-13T08:43:03.812Z    c4c61a06-f83d-11e7-b3fc-03fb1dd09bee    {"errorMessage":"getaddrinfo ENOTFOUND https://xyz.myfritz.net https://hczx6l3zhygbdk21.myfritz.net:443","errorType":"Error","stackTrace":["errnoException (dns.js:26:10)","GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)"]}
    END RequestId: c4c61a06-f83d-11e7-b3fc-03fb1dd09bee
    REPORT RequestId: c4c61a06-f83d-11e7-b3fc-03fb1dd09bee    Duration: 159.55 ms    Billed Duration: 200 ms     Memory Size: 128 MB    Max Memory Used: 25 MB
    smarthomeNG alexa Plugin läuft soweit:

    plugin.yaml und Konsole:
    Code:
    alexa:
        class_name: Alexa
        class_path: plugins.alexa
        service_host: 127.0.0.1
        service_port: 9000
    
    2018-01-13 09:41:37 DEBUG    plugin       Main         Starting alexa Plugin -- plugin.py:start:104
    2018-01-13 09:41:37 DEBUG    __init__     alexa        Alexa: validating device esszimmer-lampe -- __init__.py:validate_devices:153
    2018-01-13 09:41:37 DEBUG    __init__     Main         KNX[default]: 1.1.8 set 4/3/28 to 19.8 -- __init__.py:parse_telegram:348
    2018-01-13 09:41:37 INFO     __init__     alexa        Alexa: providing 1 devices -- __init__.py:create_alias_devices:164
    2018-01-13 09:41:37 INFO     _cplogging   BackendServer [13/Jan/2018:09:41:37] ENGINE Serving on http://192.168.178.125:8383 -- _cplogging.py:error:219
    2018-01-13 09:41:37 DEBUG    __init__     Main         KNX[default]: write request from 1.1.8 to 4/3/28 with '07bc' and DPT 9 -- __init__.py:parse_telegram:360
    2018-01-13 09:41:37 INFO     service      alexa        Alexa: service starting -- service.py:start:27
    2018-01-13 09:41:37 DEBUG    __init__     BackendServer BackendServer: engine started -- __init__.py:run:157
    PHP läuft aber immer noch nicht- die Seite wird immer als Download angezeigt, die Default Apache Index Page wird aber angezeigt.

    Einen Kommentar schreiben:


  • mskoric
    antwortet
    Also wenn ich das richtig sehe hast du in der lambda function als path / angegeben. im nginx /alexa. das müsstest du einmal ändern.
    also teste mal https://myfritz..../alexa

    da müsste dann ne Fehlermeldung von smarthomeng alexa plugin kommen.

    Einen Kommentar schreiben:


  • schorge
    antwortet
    Code:
    ll /etc/apache2/mods-enabled/php5.*
    -bash: ll: Kommando nicht gefunden.
     [root@SmartHomeNG ~]# sudo apt-get install libapache2-mod-php5
    Paketlisten werden gelesen... Fertig
    Abhängigkeitsbaum wird aufgebaut.
    Statusinformationen werden eingelesen.... Fertig
    Paket libapache2-mod-php5 ist nicht verfügbar, wird aber von einem anderen Paket
    referenziert. Das kann heißen, dass das Paket fehlt, dass es abgelöst
    wurde oder nur aus einer anderen Quelle verfügbar ist.
    
    E: Für Paket »libapache2-mod-php5« existiert kein Installationskandidat.
    xyz.myfrit.net.conf :

    Code:
    server {
        server_tokens off;
    
        ## Blocken, wenn Zugriff aus einem nicht erlaubten Land erfolgt ##
        if ($allowed_country = no) {
            return 403;
        }    
    
        # https://www.cyberciti.biz/tips/linux-unix-bsd-nginx-webserver-security.html
        ## Block download agents ##
        if ($http_user_agent ~* LWP::Simple|BBBike|wget) {
            return 403;
        }
    
        ## Block some robots ##
        if ($http_user_agent ~* msnbot|scrapbot) {
            return 403;
        }
    
        ## Deny certain Referers ##
    
        if ( $http_referer ~* (babes|forsale|girl|jewelry|love|nudit|organic|poker|porn|sex|teen) )
        {
            return 403;
        }
        ## MEIN SERVER WIRD HIER EINGETRAGEN DYNDNS ODER FRITZBOX  XYZ.myfritz.net##
        listen 443 ssl default_server;
        server_name XYZ.myfritz.net;
    
        ##
        # SSL
        ##
    
        ## Activate SSL, setze SERVER Zertifikat Informationen ## 
        # Generiert via Let's Encrypt! 
        ssl on;
        ssl_certificate /etc/letsencrypt/live/XYZ.myfritz.net/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/XYZ.myfritz.net/privkey.pem;
        ssl_session_cache builtin:1000 shared:SSL:10m;
        ssl_prefer_server_ciphers on;
        # unsichere SSL Ciphers deaktivieren!
        ssl_ciphers    HIGH:!aNULL:!eNULL:!LOW:!3DES:!MD5:!RC4;
    
        ##
        # HSTS
        ##
    
        add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    
        ##
        # global
        ##
    
        root /var/www/XYZ.myfritz.net;
        index index.php index.htm index.html;
    
        # Weiterleitung zu SmartHomeNG (Websocket Schnittstelle) mit Basic Auth
        location / {
            auth_basic "Restricted Area: smartVISU";
            auth_basic_user_file /etc/nginx/.smartvisu;
    
            # Zugreifendes Land erlaubt?
            if ($allowed_country = no) {
                    return 403;
            }
    
            # Nur Websocket Verbindungen gegen "/" durchlassen!
            if ($http_upgrade = websocket) {
                    proxy_pass http://192.168.178.125:80;
            }
            if ($http_upgrade != websocket) {
                    return 403;
            }
        }
    
        # Zugriff auf die SmartVISU mit Basic Auth
        location /smartVISU {      
            auth_basic "Restricted Area: smartVISU";
            auth_basic_user_file /etc/nginx/.smartvisu;
    
            # Zugreifendes Land erlaubt? 
            if ($allowed_country = no)  {
                    return 403;
            }
    
            proxy_pass http://192.168.178.125/smartVISU;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }
    
        # Alexa Plugin Weiterleitung
        location /alexa {
            auth_basic "Restricted Area: Alexa";
            auth_basic_user_file /etc/nginx/.alexa;
    
            # Zugreifendes Land erlaubt?
            if ($allowed_country = no) {
                    return 403;
            }
    
            proxy_pass http://192.168.178.125:9000/;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }
    
        # Network Plugin Weiterleitung
        location /shng {
            auth_basic "Restricted Area: SmartHomeNG";
            auth_basic_user_file /etc/nginx/.shng;
    
            if ($allowed_country = no) {
                    return 403;
                    break;
            }
            proxy_pass http://192.168.178.125:8090/;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }
    }

    /etc/nginx/sites-available/default

    Code:
    ##
    # You should look at the following URL's in order to grasp a solid understanding
    # of Nginx configuration files in order to fully unleash the power of Nginx.
    # https://www.nginx.com/resources/wiki/start/
    # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
    # https://wiki.debian.org/Nginx/DirectoryStructure
    #
    # In most cases, administrators will remove this file from sites-enabled/ and
    # leave it as reference inside of sites-available where it will continue to be
    # updated by the nginx packaging team.
    #
    # This file will automatically load configuration files provided by other
    # applications, such as Drupal or Wordpress. These applications will be made
    # available underneath a path with that package name, such as /drupal8.
    #
    # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
    ##
    
    # Default server configuration
    #
    server {
        listen 80 default_server;
        listen [::]:80 default_server;
        include /etc/nginx/snippets/letsencrypt.conf;
    
        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;
    
        root /var/www/html;
    
        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html index.php;
    
        server_name _;
    
        location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ =404;
        }
    
        # pass PHP scripts to FastCGI server
        #
        #location ~ \.php$ {
        #    include snippets/fastcgi-php.conf;
        #
        #    # With php-fpm (or other unix sockets):
        #    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        #    # With php-cgi (or other tcp sockets):
        #    fastcgi_pass 127.0.0.1:9000;
        #}
    
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny all;
        #}
    }
    
    
    # Virtual Host configuration for example.com
    #
    # You can move that to a different file under sites-available/ and symlink that
    # to sites-enabled/ to enable it.
    #
    #server {
    #    listen 80;
    #    listen [::]:80;
    #
    #    server_name example.com;
    #
    #    root /var/www/example.com;
    #    index index.html;
    #
    #    location / {
    #        try_files $uri $uri/ =404;
    #    }
    #}

    Einen Kommentar schreiben:


  • mskoric
    antwortet
    sorry. gerade etwas verwirrt. in dem Image ist nen apache schon mit drinne. d.h. der nginx ist ja nur ReverseProxy. So wie das aussieht fehlt dem apache2 das apache-php modul.

    schau mal ob das modul enabled ist.

    PHP-Code:
    root@pi_hq:/home/pi# ll /etc/apache2/mods-enabled/php5.*
    lrwxrwxrwx 1 root root 27 Dec 19 20:21 /etc/apache2/mods-enabled/php5.conf -> ../mods-available/php5.conf
    lrwxrwxrwx 1 root root 27 Dec 19 20
    :21 /etc/apache2/mods-enabled/php5.load -> ../mods-available/php5.load 
    Ansonsten mal nen
    PHP-Code:
    sudo apt-get install libapache2-mod-php5 

    Was auch sein kann, du lieferst die dateien direkt über den nginx aus.
    Zeig mal deine nginx configs.
    Zuletzt geändert von mskoric; 12.01.2018, 16:51.

    Einen Kommentar schreiben:


  • schorge
    antwortet
    Ich benutze das fertige Image hier aus dem Forum:

    https://sourceforge.net/p/smarthomen...age/wiki/Home/

    Code:
    [B]Base:[/B]
    [URL="https://downloads.raspberrypi.org/raspbian_lite_latest"]Raspbian "stretch lite"[/URL] from November, 29th 2017. 
    Kernel 4.9.70-v7+

    Einen Kommentar schreiben:


  • mskoric
    antwortet
    welches os? kann auch php-fpm heißen

    Einen Kommentar schreiben:


  • schorge
    antwortet
    Code:
    SmartHomeNG ~]# apt-get install php5-fpm
    Paketlisten werden gelesen... Fertig
    Abhängigkeitsbaum wird aufgebaut.... 50%
    Abhängigkeitsbaum wird aufgebaut.
    Statusinformationen werden eingelesen.... Fertig
    Paket php5-fpm ist nicht verfügbar, wird aber von einem anderen Paket
    referenziert. Das kann heißen, dass das Paket fehlt, dass es abgelöst
    wurde oder nur aus einer anderen Quelle verfügbar ist.
    Komme nicht mehr auf meine Visu

    Einen Kommentar schreiben:


  • mskoric
    antwortet
    php5-fpm haste noch nicht installiert.

    hier ist ne gute anleitung: https://www.howtoforge.de/anleitung/...-ubuntu-11-10/

    Einen Kommentar schreiben:


  • schorge
    antwortet
    Ich haue dann mal NGINX auch auf den Rpi drauf.
    Dafür muss der Port 80 von dem Apache auf 8000 oder Port nach
    Wahl in etc/apache2/ports.conf geändert werden, sonst lässt sich
    NGINX nicht installieren.

    Hier die Ergebnisse:

    Code:
    /*
     [root@SmartHomeNG ~]# sudo ps fax | grep nginx
     6558 pts/1    S+     0:00  |       \_ grep nginx
     5005 ?        Ss     0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
     5953 ?        S      0:00  \_ nginx: worker process
     5954 ?        S      0:00  \_ nginx: worker process
     5956 ?        S      0:00  \_ nginx: worker process
     5958 ?        S      0:00  \_ nginx: worker process
     [root@SmartHomeNG ~]# sudo netstat -tupl | grep ngin
    tcp        0      0 0.0.0.0:http            0.0.0.0:*               LISTEN      5005/nginx: master
    tcp        0      0 0.0.0.0:https           0.0.0.0:*               LISTEN      5005/nginx: master
    tcp6       0      0 [::]:http               [::]:*                  LISTEN      5005/nginx: master
     [root@SmartHomeNG ~]#
    Ich komme bei Eingabe https://masodfmoaisdf.myfritz.net/smartVisu
    oder https//IPRAPI/smartVisu dann zur PW Abfrage,
    gebe das PW ein, bekomme ich die index.php als Download vom Browser,
    woran liegt das?
    Zuletzt geändert von schorge; 12.01.2018, 12:16.

    Einen Kommentar schreiben:


  • mskoric
    antwortet
    Ich hab die 3 alle auf einem System. Natürlich wäre man noch sicherer wenn die Systeme physikalisch auf mehrere Maschinen verteilt sind, aber denke wenn man den nginx bzw. rpi regelmäßig updatet, (und das sollte man eh machen), sollte man nichts befürchten müssen.

    Einen Kommentar schreiben:


  • schorge
    antwortet
    Ausgabe:
    Code:
     [root@SmartHomeNG ~]# ps fax | grep nginx
    13393 pts/0    S+     0:00  |       \_ grep nginx
    Also ich habe das NGINX nicht installiert, da ich bei der Anleitung:
    http://smarthomeng.de/user/visualisi...rse_proxy.html
    Unter dem Punkt:
    • NGINX wird auf einem frisch aufgesetzten RaspberryPi mit "Raspbian Stretch Lite" installiert.
    • Der RaspberryPi dient ausschliesslich der Funktion als ReverseProxy
    • SmartHomeNG und SmartVISU sind auf einem separaten Rechner im gleichen LAN installiert.
    bedenken habe, da ich ja NGINX auf dem Raspberry mit SmartVisu und SmarhomeNG installieren muss
    wo leider bei dem Image von onkelandy NGINX nicht inbegriffen ist.
    Kann ich das bedenkenlos nach der Anleitung auf smarthomeng.de ausführen?

    Einen Kommentar schreiben:


  • mskoric
    antwortet
    Prüf mal bitte die Weiterleitung in deiner Fritzbox, ob die IP vom RPI richtig ist.
    Und prüf mal bitte, ob der nginx process auf dem rpi da ist
    sowas müsste da rauskommen:


    PHP-Code:
    pi@pi_hq:~ $ sudo ps fax grep nginx
    17238 pts
    /0    S+     0:00              \_ grep --color=auto nginx
      735 
    ?        Ss     0:00 nginxmaster process /usr/sbin/nginx -g daemon onmaster_process on;
      
    736 ?        S      0:12  \_ nginxworker process
      737 
    ?        S      0:09  \_ nginxworker process
      738 
    ?        S      0:07  \_ nginxworker process
      739 
    ?        S      0:12  \_ nginxworker process
    pi
    @pi_hq:~ $ sudo netstat -tupl grep ngin
    tcp        0      0 
    *:http                  *:*                     LISTEN      735/nginx -g daemon
    tcp        0      0 
    *:https                 *:*                     LISTEN      735/nginx -g daemon 
    im lokalen netz solltest du auch zugriff darauf haben. im browser mal https://rasperryip probieren

    sonst post mal deine configs
    Zuletzt geändert von mskoric; 10.01.2018, 15:39.

    Einen Kommentar schreiben:


  • schorge
    antwortet
    Also hier schon mal mein LOG der AWS:

    Code:
     START RequestId: f789d133-f5fb-11e7-ab50-bfdfe01a49a1 Version: $LATEST
    2018-01-10T11:46:59.997Z    f789d133-f5fb-11e7-ab50-bfdfe01a49a1    [DEBUG] Discovery Request: {"header":{"payloadVersion":"2","namespace":"Alexa.ConnectedHome.Discovery","name":"DiscoverAppliancesRequest","messageId":"F8752B11-69BB-4246-B124-3BFB27C06C7D"},"payload":{}}
    2018-01-10T11:47:00.036Z    f789d133-f5fb-11e7-ab50-bfdfe01a49a1    TypeError: Cannot read property 'trim' of undefined
        at handleDiscovery (/var/task/index.js:203:56)
        at exports.handler (/var/task/index.js:377:13)
    END RequestId: f789d133-f5fb-11e7-ab50-bfdfe01a49a1
    REPORT RequestId: f789d133-f5fb-11e7-ab50-bfdfe01a49a1    Duration: 128.68 ms    Billed Duration: 200 ms     Memory Size: 128 MB    Max Memory Used: 20 MB    
    RequestId: f789d133-f5fb-11e7-ab50-bfdfe01a49a1 Process exited before completing request

    Nach der Verbindung mit NGIX muss ich nochmal schauen, das habe ich nicht verstanden

    Mittel Ausführen>CMD ping https://isdijifniv92394.myfritz.net:443 habe ich Zugriff auf meine IP, Port 443 ist
    auf meinen RPI weitergeleitet. Nach Eingabe im Browser kommt nur
    ERR_CONNECTION_REFUSED

    Einen Kommentar schreiben:


  • mskoric
    antwortet
    [QUOTE=schorge;n1174494]

    Sorry nochmal, ich versuche aber immernoch verzweifelt das Alexa-Plugin zu nutzen, hier nochmal eine kleine Übersicht
    vielleicht stehe ich in irgendeiner Sache auf dem Schlauch:

    Alexa-Skill ist aktiviert, jedoch verstehe ich die SSL- Reverse Proxy Sache nicht ganz, ist es unsicher mit der Fritz!Box 7490 den SSL-Port
    freizugeben? Von ausserhalb will ich nur selber mit VPN im Notfall steuern und mit das mit der Anleitung (danke an @psilo) vorerst sparen.


    Erstmal würde ich schauen ob der nginx korrekt läuft und eingerichtet ist mit ssl etc.

    1. Einmal Handy nehmen ( ohne wlan, damit du von extern kommst)
    2. dyndnns adr. eingerichtet? falls ja, einfach mal https://meinedyndns.com/ aufrufen. Falls nicht einmal machen. Ansonsten ip adr vom hausanschluss rausfinden.
    ipschwein.de oder wieistmeineip.de dann https://meineip

    3. dann müsstest du eine http Auth Abfrage sehen, wenn du es nach der Anleitung gemacht hast. Wenn die kommt die credentials eingeben. Dann müsstest du folgende Fehlermeldung bekommen:
    Error response

    Error code: 501
    Message: Unsupported method ('GET').
    Error code explanation: 501 - Server does not support this operation.


    falls du die Fehlermeldung nicht siehst ist bei der nginx conf etwas falsch. Dann poste mal deine nginx conf hier, dann schauen wir weiter.

    4. Du kannst auch noch nen Test in der lamba function anlegen. Bei AWS auf der functions seite oben rechts nen test anlegen mit folgenden inhalt.

    {
    "header": {
    "payloadVersion": "2",
    "namespace": "Alexa.ConnectedHome.Discovery",
    "name": "DiscoverAppliancesRequest",
    "messageId": "F8752B11-69BB-4246-B124-3BFB27C06C7D"
    },
    "payload": {
    }
    }


    Der müsste nach dem speichern und ausführen dir zeigen welche Geräte du in smarthomng eingerichtet hast. Falls da auch nichts kommt, poste mal den output.

    Gruß Majk

    Einen Kommentar schreiben:

Lädt...
X